This bot operates in Binance Futures automatically opening and closing hedge positions against a main position that is always open. Different parameters can be set in order to configure the bot.
MARKET: Specifies the market, can beCOINMorUSDMSYMBOL: Specifies the trading symbol (e.g.BTCUSDT)SIDE: Can beSHORTorLONGQUANTITY: Contract size to tradeRESET_ALL: Whether to reset all, closing previous positions in this symbolENTRY_PRICE: If set, is the entry price for the first limit order. Can beNoneand a market order is executed in this caseSTOP_LOSS: Maximum tolerable losses considering trading losses and feesTAKE_PROFIT: Price to exit the trade and close all ordersHEDGE_OPEN_PCT: Percent change (in opposite direction) to open the hedge position (e.g.0.001)HEDGE_CLOSE_PCT: Percent change (in main direction) to close the hedge position (e.g0.001)INITIAL_LOSSES: Initial losses to consider for total running losses (default0)MAX_TIME: Time to fix the Binance Client timestamp to get in sync with the API (default86400)TOLERANCE: Percent tolerance for the Binance Tool helper that creates the orders (default0.0005)
- It requires Binance Tools library for helper functions, Binance API Wrapper and Unicorn Binance Websocket API to handle the streams.
- The bot opens a Websocket instance streaming all the filled orders. Then it creates the hedge side order using Binance API
- When the sum of fees paid and closed positions losses are greater than the
STOP_LOSSparameter or when the price ofSYMBOLreachesTAKE_PROFITthe bot automatically stops. - Binance API key and Secrey key must be added to environment variables
BINANCE_API_KEYandBINANCE_SECRET_KEY
There are no warranties expressed or implied in this repository. I am not responsible for anything done with this program. You assume all responsibility and liability. Use it at your own risk.