abanchev / binance-proxy

62 stars 18 forks source link

Error in FreqTrade #7

Open Lambda-Epsilon opened 2 years ago

Lambda-Epsilon commented 2 years ago

Im getting this error when starting the docker container with FreqTrade configured to use this:

freqtrade | 2021-09-08 01:47:29,807 - freqtrade.exchange.common - WARNING - Giving up retrying: _async_get_candle_history()

freqtrade | 2021-09-08 01:47:29,808 - freqtrade.exchange.common - WARNING - _async_get_candle_history() returned exception: "Could not fetch historical candle (OHLCV) data for pair XRP/USDT due to ExchangeNotAvailable. Message: binance GET http://127.0.0.1:8080/api/v3/exchangeInfo 404 Not Found {"detail":"Not Found"}"

This error repeats for all the pairs in my volume list.

abanchev commented 2 years ago

Freqtrade does not see the proxy port, probably a networking configuration issue, check that they are both on the same network, for docker you may need host mode networking for both FT and the proxy.

MunkeyBalls commented 2 years ago

@abanchev, this error will pop up for me too sporadically without having changed anything, I just ignore them for now but I'm guessing it probably means missed trades. The error message disappear by themselves. I don't run the docker in host mode, but considering it's an intermittent issue I don't think not running host network is the cause.

2021-09-11 05:58:02,940 - freqtrade.worker - INFO - Bot heartbeat. PID=1, version='docker-93c1dff7', state='RUNNING'
2021-09-11 05:59:02,963 - freqtrade.worker - INFO - Bot heartbeat. PID=1, version='docker-93c1dff7', state='RUNNING'
2021-09-11 06:00:05,819 - freqtrade.worker - INFO - Bot heartbeat. PID=1, version='docker-93c1dff7', state='RUNNING'
2021-09-11 06:00:05,832 - freqtrade.exchange.common - WARNING - _async_get_candle_history() returned exception: "Could not fetch historical candle (OHLCV) data for pair DYDX/BUSD due to ExchangeNotAvailable. Message: binance GET http://172.31.0.100:8080/api/v3/klines?symbol=DYDXBUSD&interval=1d&limit=1000&startTime=1630972800000&endTime=1631340005830"

2021-09-11 06:00:05,832 - freqtrade.exchange.common - WARNING - retrying _async_get_candle_history() still for 4 times

2021-09-11 06:00:05,834 - freqtrade.exchange.common - WARNING - _async_get_candle_history() returned exception: "Could not fetch historical candle (OHLCV) data for pair USDP/BUSD due to ExchangeNotAvailable. Message: binance GET http://172.31.0.100:8080/api/v3/klines?symbol=USDPBUSD&interval=1d&limit=1000&startTime=1630972800000&endTime=1631340005829"

2021-09-11 06:00:05,834 - freqtrade.exchange.common - WARNING - retrying _async_get_candle_history() still for 4 times

2021-09-11 06:01:52,197 - freqtrade.worker - INFO - Bot heartbeat. PID=1, version='docker-93c1dff7', state='RUNNING'

2021-09-11 06:02:01,826 - freqtrade.exchange.common - WARNING - _async_get_candle_history() returned exception: "Could not fetch historical candle (OHLCV) data for pair DYDX/BUSD due to ExchangeNotAvailable. Message: binance GET http://172.31.0.100:8080/api/v3/klines?symbol=DYDXBUSD&interval=1d&limit=1000&startTime=1630972800000&endTime=1631340121824"

2021-09-11 06:02:01,827 - freqtrade.exchange.common - WARNING - retrying _async_get_candle_history() still for 4 times

2021-09-11 06:02:01,828 - freqtrade.exchange.common - WARNING - _async_get_candle_history() returned exception: "Could not fetch historical candle (OHLCV) data for pair USDP/BUSD due to ExchangeNotAvailable. Message: binance GET http://172.31.0.100:8080/api/v3/klines?symbol=USDPBUSD&interval=1d&limit=1000&startTime=1630972800000&endTime=1631340121823"

2021-09-11 06:02:01,828 - freqtrade.exchange.common - WARNING - retrying _async_get_candle_history() still for 4 times

2021-09-11 06:02:23,073 - AgeFilter - INFO - Removed USDP/BUSD from whitelist, because age 1 is less than 3 days

2021-09-11 06:02:52,997 - freqtrade.worker - INFO - Bot heartbeat. PID=1, version='docker-93c1dff7', state='RUNNING'
2021-09-11 06:03:53,019 - freqtrade.worker - INFO - Bot heartbeat. PID=1, version='docker-93c1dff7', state='RUNNING'
2021-09-11 06:04:53,042 - freqtrade.worker - INFO - Bot heartbeat. PID=1, version='docker-93c1dff7', state='RUNNING'

In the binance proxy these are some of the errors I see

(node:1) UnhandledPromiseRejectionWarning: FetchError: invalid json response body at https://api.binance.com/api/v3/klines?symbol=BADGERUSDT&interval=1h reason: Unexpected token < in JSON at position 0,
    at /usr/src/app/node_modules/node-fetch/lib/index.js:272:32,
    at runMicrotasks (<anonymous>),
    at processTicksAndRejections (internal/process/task_queues.js:95:5),
(node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 4520),
(node:1) UnhandledPromiseRejectionWarning: FetchError: invalid json response body at https://api.binance.com/api/v3/klines?symbol=QNTUSDT&interval=5m reason: Unexpected token < in JSON at position 0,
    at /usr/src/app/node_modules/node-fetch/lib/index.js:272:32,
    at runMicrotasks (<anonymous>),
    at processTicksAndRejections (internal/process/task_queues.js:95:5),
(node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 4522),
(node:1) UnhandledPromiseRejectionWarning: FetchError: invalid json response body at https://api.binance.com/api/v3/klines?symbol=CAKEUSDT&interval=1h reason: Unexpected token < in JSON at position 0,
    at /usr/src/app/node_modules/node-fetch/lib/index.js:272:32,
    at runMicrotasks (<anonymous>),
(node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 5),
    at processTicksAndRejections (internal/process/task_queues.js:82:21),
    at emitErrorCloseNT (internal/streams/destroy.js:74:3),
    at emitErrorNT (internal/streams/destroy.js:106:8),
    at TLSSocket.socketErrorListener (_http_client.js:475:9),
    at TLSSocket.emit (events.js:400:28),
    at ClientRequest.emit (events.js:400:28),
    at ClientRequest.<anonymous> (/usr/src/app/node_modules/node-fetch/lib/index.js:1461:11),
(node:1) UnhandledPromiseRejectionWarning: FetchError: request to https://api.binance.com/api/v3/klines?symbol=OMGUSDT&interval=5m failed, reason: getaddrinfo EAI_AGAIN api.binance.com,
(node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 4),
[HPM] Error occurred while proxying request 172.31.0.100:8080/api/v3/ticker/24hr?symbol=WINGBUSD to https://api.binance.com/ [EAI_AGAIN] (https://nodejs.org/api/errors.html#errors_common_system_errors),
(node:1) UnhandledPromiseRejectionWarning: FetchError: request to https://api.binance.com/api/v3/klines?symbol=UNIUSDT&interval=5m failed, reason: getaddrinfo EAI_AGAIN api.binance.com
2021-08-31T12:31:57.635186601Z [ 'WebSocket closed: c98usdt@kline_1d (1006)' ],
2021-08-31T12:31:57.635234802Z [ 'WebSocket reconnecting: c98usdt@kline_1d...' ],
2021-08-31T12:31:57.948816418Z [ 'WebSocket closed: badgerusdt@kline_1h (1006)' ],
2021-08-31T12:31:57.948881319Z [ 'WebSocket reconnecting: badgerusdt@kline_1h...' ],
jegb commented 2 years ago

having same issue, could you elaborate how to setup the networking in more detail? I have added --network host to both FT and proxy and gives the same error.

gyaja commented 2 years ago

Same issue here, also with the same network (freqtrade own network).

jegb commented 2 years ago

could you share an example of that combined docker-compose file? have to be both repos cloned on the same directory?

On Mon, Sep 27, 2021 at 4:05 PM wardwouts @.***> wrote:

By default docker-compose creates a separate bridge network for its containers. Could that be the case here?

Ignore if docker-compose is not used for either.

If docker-compose is used, --network host (well, the docker-compose equivalent) for both FT and proxy should work. But so should putting both FT and proxy in the same docker-compose file.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/abanchev/binance-proxy/issues/7#issuecomment-927628759, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKUXGJDUQ2P43FWWJSAJJ3UEAQVLANCNFSM5DTS5GHA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

gyaja commented 2 years ago

I made a custom docker-compose file with 2 service together with freqtrade, the logs still the same. Here you are my docker-compose file, I don't think I made any mistake regarding to the connections. docker-compose.txt

wardwouts commented 2 years ago

I made a custom docker-compose file with 2 service together with freqtrade, the logs still the same. Here you are my docker-compose file, I don't think I made any mistake regarding to the connections. docker-compose.txt

That is very similar to mine. To me this rules out docker networking as the issue. The communication between the containers works. Seems like binance temporarily not responding. Maybe too many connections on the non-cached channel?

frysee commented 2 years ago

+1, same behavior here.

wardwouts commented 2 years ago

I just disabled the proxy and re-enabled rate limiting in the hope of getting rid of these messages. However, now I see even more of them:

...
2021-09-29 07:36:34,495 - freqtrade.exchange.common - WARNING - _async_get_candle_history() returned exception: "Could not fetch historical candle (OHLCV) data for pair TRX/USDT due to ExchangeNotAvailable. Message: binance {"code":-1001,"msg":"Internal error; unable to process your request. Please try again."}"
2021-09-29 07:36:34,495 - freqtrade.exchange.common - WARNING - retrying _async_get_candle_history() still for 2 times
2021-09-29 07:36:34,556 - freqtrade.exchange.common - WARNING - _async_get_candle_history() returned exception: "Could not fetch historical candle (OHLCV) data for pair XLM/USDT due to ExchangeNotAvailable. Message: binance {"code":-1001,"msg":"Internal error; unable to process your request. Please try again."}"
2021-09-29 07:36:34,557 - freqtrade.exchange.common - WARNING - retrying _async_get_candle_history() still for 2 times
2021-09-29 07:36:34,685 - freqtrade.exchange.common - WARNING - _async_get_candle_history() returned exception: "Could not fetch historical candle (OHLCV) data for pair ONE/USDT due to ExchangeNotAvailable. Message: binance {"code":-1001,"msg":"Internal error; unable to process your request. Please try again."}"
2021-09-29 07:36:34,685 - freqtrade.exchange.common - WARNING - retrying _async_get_candle_history() still for 3 times
...

To me this shows this is not a proxy issue at all.

frysee commented 2 years ago

To me this shows this is not a proxy issue at all.

Two scenarios:

jegb commented 2 years ago

certainly based on the last communications by binance, they are under maintenance, and is very likely they started this before they announced it publicly. Lets monitor if this is persistent in few days.

On Wed, Sep 29, 2021 at 3:54 PM frysee @.***> wrote:

To me this shows this is not a proxy issue at all.

Two scenarios:

  • If this is from 20 minutes ago, Binance is performing maintenance right now.
  • Otherwise this sounds like you exceeded rate limit while using the proxy and spun up freqtrade right after. You would still be blacklisted, which is why you are getting the exact same message. Wait a few minutes and see if the messages persist.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/abanchev/binance-proxy/issues/7#issuecomment-929930478, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKUXGIBZVDEDHRAF7NABVTUELA4NANCNFSM5DTS5GHA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

wardwouts commented 2 years ago

Without the proxy that message is no longer showing.