This project simulates binance futures trading in realtime using binance market data web socket. you can use this in order to test your strategies before trading with real money.
- Realtime price stream
- Trade in any market (e.g. btcusdt)
- Set your desired balance and fee rate
- Live processing orders with real time prices
- Set leverage on your position
- Submit market and limit orders
- Cancel orders
- Close your position at market or limit price
- Pnl and margin calculations
- Liquidation check for position
- Json file database
install requirements
pip install -r requirements.txt
run server.py and specify symbol, balance and fee rate.
python server.py --symbol btcusdt --balance 10000 --fee 0.0004
interact with server using client.py
from client import Client
c = Client()c.get_price()c.get_account()c.set_leverage(100)c.submit_order(side='buy', quantity=2)c.submit_order(side='sell', quantity=1, price=16100.0)c.get_orders()c.cancel_order(id=1)c.get_position()c.close_position()c.close_position(price=18000.0)