Skip to content

binance futures simulator for testing your strategies in realtime

License

Notifications You must be signed in to change notification settings

Daemshad/binance-futures-simulator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Binance Futures Simulator

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.

Features

  • 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

Usage

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

import Client and create an instance

from client import  Client
    
c  =  Client()

get last price

c.get_price()

get account info

c.get_account()

set leverage

c.set_leverage(100)

submit market order

c.submit_order(side='buy',  quantity=2)

submit limit order

c.submit_order(side='sell',  quantity=1,  price=16100.0)

get orders list

c.get_orders()

cancel order

c.cancel_order(id=1)

get position info

c.get_position()

close your position with market price

c.close_position()

close your position at limit price

c.close_position(price=18000.0)

About

binance futures simulator for testing your strategies in realtime

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages