Coder Social home page Coder Social logo

binance-futures-hedging's Introduction

Binance Futures hedging bot

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.

Parameters

  • MARKET: Specifies the market, can be COINM or USDM
  • SYMBOL: Specifies the trading symbol (e.g. BTCUSDT)
  • SIDE: Can be SHORT or LONG
  • QUANTITY: Contract size to trade
  • RESET_ALL: Whether to reset all, closing previous positions in this symbol
  • ENTRY_PRICE: If set, is the entry price for the first limit order. Can be None and a market order is executed in this case
  • STOP_LOSS: Maximum tolerable losses considering trading losses and fees
  • TAKE_PROFIT: Price to exit the trade and close all orders
  • HEDGE_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.g 0.001)
  • INITIAL_LOSSES: Initial losses to consider for total running losses (default 0)
  • MAX_TIME: Time to fix the Binance Client timestamp to get in sync with the API (default 86400)
  • TOLERANCE: Percent tolerance for the Binance Tool helper that creates the orders (default 0.0005)

Features

  • 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_LOSS parameter or when the price of SYMBOL reaches TAKE_PROFIT the bot automatically stops.
  • Binance API key and Secrey key must be added to environment variables BINANCE_API_KEY and BINANCE_SECRET_KEY

Disclaimer

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.

binance-futures-hedging's People

Contributors

andresrzch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.