Binance is a Shanghai founded digital currency exchange that supports all major crypto currencies and crypto futures. The Binance Futures plugin is for trading cryptocurrency futures. For trading plain coins (spot market), use the Binance plugin.
If you already have a Binance account for the spot market, you can extend it to futures. You will need a new API key and secret for trading futures. This key will then also work for logging in to the spot market. Make sure that your account is in one-way mode (no hedging), since the plugin assumes single-side positions.
There are two Binance Futures plugins. One was developed by a Zorro user and is available on Github. The other one is included in the Zorro setup and described here. It requires Zorro S and an account list. It uses the Websocket API for streaming market data and the REST API for all other fuctions. Real mode uses the Binance production server, demo mode the test server. 4 different endpoints are available that can be set in the Server field of the account list:
USDT futures production endpoint: wss://fstream.binance.com
COIN futures production endpoint: wss://dstream.binance.com
USDT futures test endpoint: wss://stream.binancefuture.com
COIN futures test endpoint: wss://dstream.binancefuture.com
Zorro login fields for Binance Futures:
User | API Key |
Password | API Secret |
Accounts.csv example entries:
Name | Server | Account | User | Pass | Assets | CCY | Real | NFA | Plugin |
BinFut-USDT | wss://fstream.binance.com | USDT | (Key) | (Secret) | AssetsBF | USDT | 1 | 14 | BinanceFutures |
BinFut-Coin | wss://dstream.binance.com | BBTC | (Key) | (Secret) | AssetsBF | BTC.8 | 1 | 14 | BinanceFutures |
BinFut-Demo | wss://dstream.binancefuture.com | BTC | (Key) | (Secret) | AssetsBF | BTC.8 | 0 | 14 | BinanceFutures |
Binance Fututures has inconsistent symbols across all endpoints, but the
plugin takes care of this. It uses the below symbology:
Perpetual
Futures: AAABBB, e.g. "BTCUSDT"
Futures: AAABBB-FUT-YYYYMMDD, e.g.
"BTCUSDT-FUT-20210326"
Alternatively, use the
contract functions for futures, using the currency
pair "BTCUSDT" as the underlying.
The plugin supports the brokerCommand f function with the following commands:
There are 2 plugin specific commands:
2002: Returns number of milliseconds
since the plugin received any message from the websocket server.
Name,Price,Spread,RollLong,RollShort,PIP,PIPCost,MarginCost,Leverage,LotAmount,Commission,Symbol BTCUSDT,57125,3.5,0,0,0.01,0.00001000,-1,0,0.001,-0.25,BTCUSDT BTCUSDT-210326,57125,3.5,0,0,0.01,0.00001000,-1,0,0.001,-0.25,BTCUSDT-FUT-20210326 ETHUSDT,1991,0.05,0,0,0.01,0.00001000,-1,0,0.001,-0.25,ETHUSDT ETHUSDT-210626,1991,0.05,0,0,0.01,0.00001000,-1,0,0.001,-0.25,ETHUSDT-FUT-20210326Example COIN asset list entries:
Name,Price,Spread,RollLong,RollShort,PIP,PIPCost,MarginCost,Leverage,LotAmount,Commission,Symbol BTCUSD,57125,3.5,0,0,0.1,0.00017505,-1,0,1,-0.25,BTCUSD BTCUSD-210326,57125,3.5,0,0,0.1,0.00017505,-1,0,1,-0.25,BTCUSD-FUT-20210326 ETHUSD,1991,0.05,0,0,0.01,0.00005023,-1,0,1,-0.25,ETHUSD ETHUSD-210326,1991,0.05,0,0,0.01,0.00005023,-1,0,1,-0.25,ETHUSD-FUT-20210326In the above examples, the Name column uses a shortened version of the futures contract name. The Symbol column must follow the above nomenclature.