binanceapi
A rest and websocket api for binance exchange. See https://www.binance.com/restapipub.html for more informations about paramaters required.
Actually you can :
-
Getting latest price of a symbol
-
Getting depth of a symbol or maintain a depth cache locally
-
Placing a LIMIT order
-
Placing a MARKET order
-
Checking an order’s status
-
Cancelling an order
-
Getting list of open orders
-
Getting list of current position
More features soon
Installation
npm install -s binanceapi
Sample
const api = const Binance = api // rest api const BinanceWS = api // websocket api const conf = api: "apiKey here" secret: "secretKey here" const client = conf client client const clientWS = clientWS
## Available rest method
client // get price of all money params = symbol: "GASBTC" // required client // depth of a money params = symbol: "GASBTC" // required side: "BUY OR SELL" // required type: "LIMIT OR MARKET" // required timeInForce: "GTC OR IOC" // required quantity: 4 // required price: 2 // required client // create a new order params = symbol: "GASBTC" // required client // Get all open orders on a symbol params = symbol: "GASBTC" // required client // Get all open and closed orders on a symbol params = symbol: "GASBTC" // required client // Get all account orders; active, canceled, or filled params = symbol: "GASBTC" // required newClientOrderId: "a string" // optional client // Cancel an active order client // Get current account information params = symbol: "GASBTC" // required client // Get trades for a specific account and symbol client // Start a new user data stream, get a listen key params = listenKey: "listenKey" // required client // PING a user data stream to prevent a time out params = listenKey: "listenKey" // required client // Close out a user data stream
## Available WebSocket method
clientWS // get depth of a symbol clientWS // kline endpoint, see kline section for more details // Get compressed, aggregate trades.// Trades that fill at the time, from the same order,//with the same price will have the quantity aggregatedclientWS binanceRestInstance = api: "apiKey" secret: "secretKey"clientWS // get all account event
## Expected values
Symbol type: SPOT
Order status: NEW PARTIALLY_FILLED FILLED CANCELED PENDING_CANCEL REJECTED EXPIRED
Order types: LIMIT MARKET
Order side: BUY SELL
Time in force: GTC IOC
Kline intervals:
m -> minutes; h -> hours; d -> days; w -> weeks; M -> months
1m
3m
5m
15m
30m
1h
2h
4h
6h
8h
12h
1d
3d
1w
1M