- Notifications
You must be signed in to change notification settings - Fork294
Binance_grid_trader is a grid strategy bot trading with Binance Spot and Binance Futures Exchange. you can use it to trade any pair in Binance Exchange. Binance_grid_trader是一个币安网格策略软件, 目前支持币安现货,USDT合约和币币合约。
License
51bitquant/binance_grid_trader
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Binance_grid_trader is a grid strategy bot trading with Binance Spot andBinance Future Exchange. you can use it to trade any pair in BinanceExchange.
First, download the codes. Then create a python virtual env, you can usethe anaconda to create the env.
conda create -n trader python==3.7
then you have an env(trader), to use this env, you can use the followingcommand to activate the env.
conda activate trader
Second, you need to use the pip to install the libraries.
pip install -r requirements.txt
the requirements.txt is in the project. It lists the libraries theproject rely on.
After install the libraries, you can run the main.py, if you use thepycharm, you may need to configure your project's interpreter.
python main.py
Note: if you run the main.py, you will see the Window UI, if you want torun without ui, you can run the main_futures_script.py ormain_spot_script.py, they are for the binance futures or spot exchange.
Click the top-left Config Binance Api button, near the python button andselect Connect Futures.
key: past your api key from binance exchange Api management here.
secret: past your api secret from binance exchange Api management, and remember to edit your api restrictions to allow trade futures.
futures_types: if you want to trade contracts settled in USDT or BUSD like BTCUSDT, BTCBUSD symbol, set it to USDT else set it to COIN.
proxy_host and proxy_port, if you can connect to binance exchange, then leave it blank. If you can't connect directly to Binance exchange, you may need to config the proxy_host or proxy_port.If you have run vpn software, then set the proxy_host to 127.0.0.1 else you need to set the proxy_host to a remote server ip.
All your config api data will save in project directorygridtrader/connect_futures.json file.
NOTE: Remember every time you run the grid strategy, you need to connectthe api your api First.To connect the binance api, Click the confirmbutton.
Click the top-left Config Binance Api button, near the python button andselect Connect Spot.
key: past your api key from binance exchange Api management here.
secret: past your api secret from binance exchange Api management, and remember to edit your api restrictions to allow trade futures.
proxy_host and proxy_port, if you can connect to binance exchange,then leave it blank. If you can't connect directly to Binanceexchange, you may need to config the proxy_host or proxy_port. If youhave run vpn software, then set the proxy_host to 127.0.0.1 else youneed to set the proxy_host to a remote server ip.
All your config api data will save in project directorygridtrader/connect_spot.json file.
NOTE: Remember every time you run the grid strategy, you need to connectthe api your api First.To connect the binance api, Click the confirmbutton.
If you want to run the grid strategy in Futures Market, you can add the FutureGridStrategy. The following is the parameters description for the strategy:strategy_name: set a name for the strategy.
vt_symbol: the symbol you want to trade, like BTCUSDT, ETHBUSD ect.for Future, remember to use the uppercase. if you use the lower case,you will run in the Spot market.
upper_price: the grid highest price, if you set the upper_price to40000, that means if the market price is over 40000, the strategywon't place any order.
bottom_price: the lowest price fo the strategy. If you set thebottom_price to 30000, if the price is under 30000, the strategywon't place any order.
grid_number, the grid number for the strategy, if the upper_price is40000, the bottom_price is 30000, if the grid_number is 100, the gridstep(or the order price step) is (40000- 30000)/100 = 100
order_volume: your order volume/quantity
max_open_orders: the max open order in buy/sell side.
The strategy settings data will save ingridtrader/grid_strategy_setting.json, you can checkout and modify it.
And the gridtrader/grid_strategy_data.json file will save some variablesin the strategy when runnning.
If you want to run the grid strategy in Spot Market, you can add theSpotGridStrategy. The following is the parameters description for thestrategy:
strategy_name: set a name for the strategy.
vt_symbol: the symbol you want to trade, like btcusdt, ethbusd ect.for spot market, remember to use the lowercase. if you use thelower case, you will run in the Spot market.
upper_price: the grid highest price, if you set the upper_price to40000, that means if the market price is over 40000, the strategywon't place any order.
bottom_price: the lowest price fo the strategy. If you set thebottom_price to 30000, if the price is under 30000, the strategywon't place any order.
grid_number, the grid number for the strategy, if the upper_price is40000, the bottom_price is 30000, if the grid_number is 100, the gridstep(or the order price step) is (40000- 30000)/100 = 100
order_volume: your order volume/quantity
invest_coin: if you want to trade btcusdt, then set to USDT, if youwant to trade btcbusd, then set to BUSD, if you want to trade ethbtc,then set to btc.
max_open_orders: the max open order in buy/sell side.
The strategy settings data will save ingridtrader/grid_strategy_setting.json, you can checkout and modify it.
And the gridtrader/grid_strategy_data.json file will save some variablesin the strategy when runnning.
If you want to start the grid strategy, you need to:
Init your strategy: Click the Init Button
Start your strategy: Click the Start Button.
If you want to stop the strategy, click the Stop button, or even clickedit button to edit the strategy's parameters.
If you have a lot of strategies to start in batch, you can click InitAll Strategies and Start All Strategies.
If want to run the code in Linux system or just don't want to use theUI, you can use the script. If you want to trade in spot market,checkout the main_spot_script.py. If you want to trade in the futuremarket, checkout the main_futures_script.py
But before run the script, you need to edit thegridtrader/grid_strategy_setting.json file, then config your strategysetting.
wechat: bitquant51
discord: 51bitquant#8078
IF you have any question, please feel free to contact me in discord. Ifyou don't have a binance account, I'm happy you can use the followinglink to register the account:Binance referral LINK,and you will get 20% commission rebate.
I don't guarantee that this bot can make profit from market, use it atyour risk. Don't put your real money into the market before you read thecodes. Use at your own risk.
About
Binance_grid_trader is a grid strategy bot trading with Binance Spot and Binance Futures Exchange. you can use it to trade any pair in Binance Exchange. Binance_grid_trader是一个币安网格策略软件, 目前支持币安现货,USDT合约和币币合约。
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors3
Uh oh!
There was an error while loading.Please reload this page.





