GithubHelp home page GithubHelp logo

mxjoly / binance-futures-trading-bot Goto Github PK

View Code? Open in Web Editor NEW
13.0 5.0 13.0 29.63 MB

A Binance trading bot using node.js

License: MIT License

TypeScript 94.12% JavaScript 5.88%
cryptocurrency trading-bot bitcoin binance trading algorithmic-trading bot telegram trading-platform trading-strategies

binance-futures-trading-bot's Introduction

GitHub package.json version styled with prettier GitHub

๐Ÿค– Binance trading bot

Features

  • ๐Ÿ”จ Build your own strategy
  • โœ… Can use multiple strategies at same time with different coins
  • โš™๏ธ Configure the conditions to open / close a position
  • ๐ŸŽ› Multiple indicators to use for your strategies (moving averages, bollinger bands, rsi, macd, adx, ...)
  • ๐Ÿ•ฐ Trading sessions
  • โฑ Limit the duration of the trades
  • โœ… Multiple time frames can be used in a single strategy
  • โœ… Money management
  • ๐Ÿฉบ Backtesting with complete report (html file)
  • ๐Ÿ’Š Hyper parameters optimization
  • โœ… Telegram channel notifications

Setup the environment

Install npm and dependecies

Linux

sudo rm -rf node_modules package-lock.json && npm install

Windows

remove directory node_modules and remove file package-lock.json

npm install

If crazy error, try: Note: remove directory node_modules and remove file package-lock.json

npm install @tensorflow/tfjs-node --ignore-scripts unit-tests --save
npm install nodemon -g
npm install -g win-node-env

Development

Set your api keys to the environment variables for testnet in .env with BINANCE_FUTURES_TESTNET_PUBLIC_KEY and BINANCE_FUTURES_TESTNET_PRIVATE_KEY. Go to https://testnet.binancefuture.com/en/futures/BTCUSDT and https://testnet.binance.vision/ to get your keys. Then run the commands:

npm run build:dev
npm run dev

Production

Get your api keys from your Binance account and set them to the environment variables BINANCE_PUBLIC_KEY and BINANCE_PRIVATE_KEY in the file .env. Then, run the commands:

npm run build:prod
npm run prod

Create your strategy

You can create your own strategy for your bot. The file must be placed in src/configs. There are some examples to help you to create the best strategy. Check the declaration file global.d.ts to have an overview of the possibilities you can add to your strategy. And don't forget to backtest your strategy before running it in production !

Backtest your strategy

You can backtest your strategy by running the backtest mode. To do that, you need to:

  1. Configure the properties for your backtest in config.json.
  2. Tap the commands npm build:test and npm run test to run the backtest.
  3. When the backtest ends, it generates a log file in the folder logs and an html report in reports. You can consulting these to evaluate the performance and profitability of your strategy (note that the results in real will be a little different cause of the funding rates).

Configure the Telegram Channel

See https://core.telegram.org/bots to configure the channel. Then, set up your bot api key to the environment variable TELEGRAM_TOKEN and the id of the chat with TELEGRAM_CHAT_ID.

Machine Learning

In progress...

Todo

  • Add custom Telegram channel with the notifications of the robot when an action is executed
  • Trade managements

Documentation

License

MIT.

binance-futures-trading-bot's People

Contributors

mxjoly avatar ricardospinoza avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

binance-futures-trading-bot's Issues

Error try run project

Fail try execute this command:

npm run build:dev
npm run dev

return:

src/backtest/bot.ts:377:13 - error TS2345: Argument of type 'ExchangeInfo<FuturesOrderType_LT>' is not assignable to parameter of type 'ExchangeInfo<OrderType_LT>'.

377             exchangeInfo
                ~~~~~~~~~~~~

src/backtest/bot.ts:387:15 - error TS2345: Argument of type 'ExchangeInfo<FuturesOrderType_LT>' is not assignable to parameter of type 'ExchangeInfo<OrderType_LT>'.

387               exchangeInfo
                  ~~~~~~~~~~~~

src/bot.ts:93:5 - error TS2322: Type 'ExchangeInfo<FuturesOrderType_LT>' is not assignable to type 'ExchangeInfo<OrderType_LT>'.
  Type 'FuturesOrderType_LT' is not assignable to type 'OrderType_LT'.
    Type '"TAKE_PROFIT"' is not assignable to type 'OrderType_LT'.

93     this.exchangeInfo = await binanceClient.futuresExchangeInfo();
       ~~~~~~~~~~~~~~~~~

src/bot.ts:365:19 - error TS2322: Type 'number' is not assignable to type 'string'.

365                   price,
                      ~~~~~

src/bot.ts:384:19 - error TS2322: Type 'number' is not assignable to type 'string'.

384                   stopPrice: stopLoss,
                      ~~~~~~~~~

src/bot.ts:394:19 - error TS2322: Type 'number' is not assignable to type 'string'.

394                   stopPrice: stopLoss,
                      ~~~~~~~~~

src/bot.ts:395:19 - error TS2322: Type 'number' is not assignable to type 'string'.

395                   price: stopLoss,
                      ~~~~~

src/bot.ts:484:19 - error TS2322: Type 'number' is not assignable to type 'string'.

484                   price: price,
                      ~~~~~

src/bot.ts:503:19 - error TS2322: Type 'number' is not assignable to type 'string'.

503                   stopPrice: stopLoss,
                      ~~~~~~~~~

src/bot.ts:513:19 - error TS2322: Type 'number' is not assignable to type 'string'.

513                   stopPrice: stopLoss,
                      ~~~~~~~~~

src/bot.ts:514:19 - error TS2322: Type 'number' is not assignable to type 'string'.

514                   price: stopLoss,
                      ~~~~~

src/utils/__tests__/currencyInfo.test.ts:16:5 - error TS2322: Type 'ExchangeInfo<FuturesOrderType_LT>' is not assignable to type 'ExchangeInfo<OrderType_LT>'.

16     exchangeInfo = await binanceClient.futuresExchangeInfo();
       ~~~~~~~~~~~~


Found 12 errors in 3 files.

Errors  Files
     2  src/backtest/bot.ts:377
     9  src/bot.ts:93
     1  src/utils/__tests__/currencyInfo.test.ts:16
Note: This command was run via npm module 'win-node-env'

Help me!!! Plz

Thank you.

There is no issue. I want to thank you for creating this repo and open source it. ๐Ÿ™

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.