Giter Site home page Giter Site logo

iilunin / crypto-bot Goto Github PK

View Code? Open in Web Editor NEW
246.0 18.0 51.0 2.96 MB

Binance crypto bot which supports smart entry, trailing stop-losses and take profits, multiple exit targets, One-Cancels-the-Other functionality, UI Interface

License: Apache License 2.0

Python 57.95% Smarty 0.31% Dockerfile 0.77% JavaScript 0.70% TypeScript 27.54% HTML 10.13% CSS 2.60%
trade bot binance-trades container ui trailing-profit trailing-stoploss

crypto-bot's People

Contributors

dependabot[bot] avatar iilunin avatar spiderpug avatar venticello avatar

Stargazers

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

Watchers

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

crypto-bot's Issues

Balance insufficient founds when creating order

Hello Why i cant place order...
Here is the logs

2019-02-12 10:09:13,219[INFO][BinanceWebsocket|Binance WebSocket Thread]: Websocket Connected to "wss://stream.binance.com:9443/stream?streams=xrpbtc@ticker"
2019-02-12 10:09:13,665[INFO][TradeHandler|Binance WebSocket Thread]: WebSocket message received
2019-02-12 10:09:13,666[WARNING][PlaceOrderStrategy(XRPBTC)|Binance WebSocket Thread]: Insufficient balance to place order. Bal: 0.0173229, Order: 197.0
2019-02-12 10:09:14,668[WARNING][PlaceOrderStrategy(XRPBTC)|Binance WebSocket Thread]: Insufficient balance to place order. Bal: 0.0173229, Order: 197.0
2019-02-12 10:09:16,667[WARNING][PlaceOrderStrategy(XRPBTC)|Binance WebSocket Thread]: Insufficient balance to place order. Bal: 0.0173229, Order: 197.0
2019-02-12 10:09:20,675[WARNING][PlaceOrderStrategy(XRPBTC)|Binance WebSocket Thread]: Insufficient balance to place order. Bal: 0.0173229, Order: 197.0

the sell limit order is not excuted

Hello,
I created sell limit order but it doesn't executed. There is nothing happened in my account although the price is reached and I enable trading mode in api Binance. So, what is problem ? Thank you !

I have 15k CMT in balance

{
  "trade": {
    "id": "A8964745-4C4F-CCF6-05E4-03B9F0FE86D2",
    "asset": "CMT",
    "symbol": "CMTBTC",
    "side": "SELL",
    "status": "ACTIVE",
    "exit": {
      "smart": false,
      "threshold": "0.40%",
      "targets": [
        {
          "price": "0.00000655",
          "vol": "2.00000000",
          "sl": "0.00000623"
        }
      ]
    }
  }
}

Threshold default value 0,4% (es_ES locale)

Trade is not created if I use default value for threshold in Exit Targets -> Default Settings.

Default value 0.4% in spanish locale is converted to 0,4% and it is not valid.

"{"status": 100, "msg": "could not convert string to float: '0,4'"}"

Thank you.

Telegram Signals Reader

Hi there,

Thank you very much for creating this tool for us to use.

I was wondering if there is anyway you can create (if not already done) a way for the bot to scan telegram channels for signals and open trades in Binance ?

this is not a request, just asking if it exist or is possible to make.

Thanks.

examples

Any examples for how to set trailing stop loss/take profit? Thank you for your work! Very excited to try this out.

Stoploss not triggered

Hello,

Today I had a trade with TRUUSDT, with a stop loss at 0.29800000, and when the price price fallen closer to this stop-loss value nothing happenned. Nothing more when the price price hited this stop-loss value (18h03 UTC+2).
I don't see any action or error in the logs
Did I miss something or this is an issue ?

"stoploss": {
  "type": "TRAILING",
  "threshold": "10%",
  "initial_target": {
    "price": "0.29800000",
    "vol": "100%"
  }
}

TRUUSDT_291860A3-B9CA-F6C2-94D3-2163A49E4EAF.txt
TRUUSDT.txt

ui don't create the order

hi i installed the bot
then i run with all double checked parametre :-D sorrry for eng
i can log in all work if i want to create an order i set all but when i click create nothing appear i refresh and the order isn't create

Margin account?

Hi does this support margin on binance? The api is based on supposedly supports it, but I cannot find it in the code? Thanks!

No volume left to process order

Hello,

I have an issue with trade submitted via Web UI. There is the Exit strategy defined in the trade, as well as the Stoploss strategy. But I see these warning messages in the docker log that there's no volume left to process the order.

user@server:~$ sudo docker logs -f cryptobot
...
Orders to be posted: []
2021-04-30 01:42:23,244[WARNING][PlaceOrderStrategy(ZECUSDT)|Binance WebSocket Thread]: No volume left to process order @ price 259
2021-04-30 01:42:23,245[WARNING][PlaceOrderStrategy(ZECUSDT)|Binance WebSocket Thread]: No volume left to process order @ price 284
2021-04-30 01:42:23,247[INFO][PlaceOrderStrategy(ZECUSDT)|Binance WebSocket Thread]: Orders to be posted: []
2021-04-30 01:42:24,243[WARNING][PlaceOrderStrategy(ZECUSDT)|Binance WebSocket Thread]: No volume left to process order @ price 259
2021-04-30 01:42:24,244[WARNING][PlaceOrderStrategy(ZECUSDT)|Binance WebSocket Thread]: No volume left to process order @ price 284
...

But the volume is there, even the Web UI shows me the volume: https://imgur.com/h6RAFEj

This is the trade in the Web UI: https://imgur.com/NmwliUE

This is how the trade file looks like when I searched for it: https://imgur.com/M5UPk2V

The other strange thing to me is why the trade file (ZECUSDT_1920EF65-16B3-99DA-0C60-456CB412F2B5.json) is in the location /var/lib/docker/volumes/92454e26cf378dd2916f6c42ce922e856720c7606a8b2e6148452e9a2d300fa3/_data/, when I launched the docker container with the following command:
docker run -d --rm -p xxx.xxx.xxx.xxx:3000:3000 --name cryptobot
-e "TZ=Europe/Prague"
-e "KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
-e "SECRET=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
-e "API_USER=xxxxxxxxxxxx"
-e "API_PASS=xxxxxxxxxxxxxxxxxxx"
-v $(pwd)/Active:/usr/src/crypto-bot/trades_active
-v $(pwd)/Completed:/usr/src/crypto-bot/trades_completed
-v $(pwd)/Config:/usr/src/crypto-bot/config:ro
iilunin/crypto-bot:stable

Do you have any idea what can be wrong there?

Thank you very much.

Trade is not created in the Web UI

Hello,
I was able to submit one trade but the other one I cannot submit. Or in other words, I can enter all the needed fields and hit "Create" but nothing happens, the trade is not created and I receive no message in the Web UI.

This is the trade I am trying to create: https://imgur.com/a/XZfqDeT

In the docker log I see only those two rows when hitting the Create button:
2021-04-30 02:01:43,703[INFO][werkzeug|Thread-5725]: 82.99.141.xxx - - [30/Apr/2021 02:01:43] "POST /api/v1/trade/0 HTTP/1.1" 500 -
2021-04-30 02:01:43,736[INFO][werkzeug|Thread-5726]: 82.99.141.xxx - - [30/Apr/2021 02:01:43] "GET /api/v1/trades HTTP/1.1" 200 -

But as I wrote, I don't see the trade in the list of trades and I don't receive any error message in the Web UI. Sincerely I don't know what is wrong with it.

The only difference between the trade that was created and the one that wasn't created, is that the one that was created was without decimal point, there I used only integers. But the one that wasn't created, I needed to enter 7 or 8 decimal positions, but I suppose this shouldn't be an issue, right?

Thanks in advance for your support.

ImportError: cannot import name 'json' from 'itsdangerous'

Hi Igor

Thanks for your nice job , unfortunately when I try to run your docker image both on an Ubuntu or a Mac I consistently get the following error message ... I am not a docker expert, any thought ?

Thanks in advance.

Traceback (most recent call last):

File "main.py", line 9, in

from API.APIServer import APIServer

File "/usr/src/app/API/APIServer.py", line 4, in

from flask import Flask, app, render_template

File "/usr/local/lib/python3.7/site-packages/flask/init.py", line 19, in

from . import json

File "/usr/local/lib/python3.7/site-packages/flask/json/init.py", line 15, in

from itsdangerous import json as _json

ImportError: cannot import name 'json' from 'itsdangerous' (/usr/local/lib/python3.7/site-packages/itsdangerous/init.py)

If the price drops below the stop-loss order, the market order is not sent

Hello,
Thank you for this fantastic job, and for the very detailed documentation :-)

I had a problem with an missed stop loss.
I think the price went down too quickly, so the stop loss order was above the price, so maybe that explains this error:
2021-05-19 06:19:38,685[ERROR][StopLossStrategy(FIOUSDT)|Binance WebSocket Thread]: APIError(code=-2010): Stop price would trigger immediately.

But after that I expected a market order, but instead I get an order with a target price.

2021-05-19 06:19:37,118[INFO][StopLossStrategy(FIOUSDT)|Binance WebSocket Thread]: canceling all orders...
2021-05-19 06:19:38,009[INFO][StopLossStrategy(FIOUSDT)|Binance WebSocket Thread]: Order 35968633 canceled
2021-05-19 06:19:38,234[INFO][StopLossStrategy(FIOUSDT)|Binance WebSocket Thread]: Order 35968636 canceled
2021-05-19 06:19:38,685[ERROR][StopLossStrategy(FIOUSDT)|Binance WebSocket Thread]: APIError(code=-2010): Stop price would trigger immediately.
2021-05-19 06:19:38,686[INFO][PlaceOrderStrategy(FIOUSDT)|Binance WebSocket Thread]: Orders to be posted: [{'price': 0.3253, 'volume': 50.84, 'side': 'SELL', 'target': <Bot.Target.ExitTarget object at 0x7f1179084dd0>}, {'price': 0.349, 'volume': 38.13, 'side': 'SELL', 'target': <Bot.Target.ExitTarget object at 0x7f1179242f90>}]
2021-05-19 06:19:39,135[INFO][ConsoleLauncher|Binance WebSocket Thread]: File "/usr/src/trades/FIOUSDT_2CA16E6D-F0DC-0F8F-E523-10CB195480EF.json" updated by trade handler. Its mod time: 1621397979.132154
2021-05-19 06:19:39,135[INFO][PlaceOrderStrategy(FIOUSDT)|Binance WebSocket Thread]: All Orders are Placed
2021-05-19 06:19:39,668[INFO][StopLossStrategy(FIOUSDT)|Binance WebSocket Thread]: canceling all orders...
2021-05-19 06:19:42,571[ERROR][StopLossStrategy(FIOUSDT)|Binance WebSocket Thread]: APIError(code=-2011): Unknown order sent.
2021-05-19 06:19:56,340[INFO][StopLossStrategy(FIOUSDT)|Binance WebSocket Thread]: canceling all orders...
2021-05-19 06:20:02,947[INFO][StopLossStrategy(FIOUSDT)|Binance WebSocket Thread]: Order 36072113 canceled
2021-05-19 06:20:05,042[INFO][StopLossStrategy(FIOUSDT)|Binance WebSocket Thread]: Order 36072114 canceled
2021-05-19 06:20:10,007[ERROR][StopLossStrategy(FIOUSDT)|Binance WebSocket Thread]: APIError(code=-2010): Stop price would trigger immediately.

FIOUSDT_2CA16E6D-F0DC-0F8F-E523-10CB195480EF.txt
FIOUSDT.txt

APIError(code=-1013): Filter failure: MIN_NOTIONAL

Got new issue. It seems like this one #5 , but I don’t know how to solve it. Tried to edit active json file to exact number of decimals, but didn’t work. Is there any workaround? Thanks

File "/usr/src/app/Bot/Strategy/EntryStrategy.py", line 83, in execute
self.handle_smart_target(trigger_order_price, price)
File "/usr/src/app/Bot/Strategy/EntryStrategy.py", line 105, in handle_smart_target
self.handle_stoploss_order(trigger_order_price, current_price)
File "/usr/src/app/Bot/Strategy/EntryStrategy.py", line 183, in handle_stoploss_order
volume=self.exchange_info.adjust_quanity(vol)
File "/usr/src/app/Bot/FXConnector.py", line 151, in create_stop_order
price=FXConnector.format_number(price))
File "/usr/local/lib/python3.7/site-packages/binance/client.py", line 1149, in create_order
return self._post('order', True, data=params)
File "/usr/local/lib/python3.7/site-packages/binance/client.py", line 210, in _post
return self._request_api('post', path, signed, version, **kwargs)
File "/usr/local/lib/python3.7/site-packages/binance/client.py", line 181, in _request_api
return self._request(method, uri, signed, **kwargs)
File "/usr/local/lib/python3.7/site-packages/binance/client.py", line 176, in _request
return self._handle_response(response)
File "/usr/local/lib/python3.7/site-packages/binance/client.py", line 200, in _handle_response
raise BinanceAPIException(response)
binance.exceptions.BinanceAPIException: APIError(code=-1013): Filter failure: MIN_NOTIONAL

Error

2018-12-30 13:54:53,298[INFO][ExitStrategy(ONTBTC)|Binance WebSocket Thread]: Setting StopLoss-SELL for 0.00015935 - 2% of current Price: 0.00016020
2018-12-30 13:54:53,588[ERROR][ExitStrategy(ONTBTC)|Binance WebSocket Thread]: Traceback (most recent call last):
File "/usr/src/app/Bot/Strategy/EntryStrategy.py", line 83, in execute
self.handle_smart_target(trigger_order_price, price)
File "/usr/src/app/Bot/Strategy/EntryStrategy.py", line 105, in handle_smart_target
self.handle_stoploss_order(trigger_order_price, current_price)
File "/usr/src/app/Bot/Strategy/EntryStrategy.py", line 183, in handle_stoploss_order
volume=self.exchange_info.adjust_quanity(vol)
File "/usr/src/app/Bot/FXConnector.py", line 151, in create_stop_order
price=FXConnector.format_number(price))
File "/usr/local/lib/python3.6/site-packages/binance/client.py", line 1133, in create_order
return self._post('order', True, data=params)
File "/usr/local/lib/python3.6/site-packages/binance/client.py", line 209, in _post
return self._request_api('post', path, signed, version, **kwargs)
File "/usr/local/lib/python3.6/site-packages/binance/client.py", line 180, in _request_api
return self._request(method, uri, signed, **kwargs)
File "/usr/local/lib/python3.6/site-packages/binance/client.py", line 175, in _request
return self._handle_response(response)
File "/usr/local/lib/python3.6/site-packages/binance/client.py", line 199, in _handle_response
raise BinanceAPIException(response)
binance.exceptions.BinanceAPIException: APIError(code=-1013): Invalid price.

Error -1013
https://www.reddit.com/r/binance/comments/7ej5cn/api_error_code1013_filter_falinure_price_filter/ seems to be something to do with wrong amount. Selling "10.153" ONT wont work while "10.15" will.

Enable HTTPS?

Is there a way to access it over HTTPS? Thank you

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.