dutu / poloLender

Free, open source, high performance bot for lending funds on Poloniex exchange
https://github.com/dutu/poloLender
Other
160 stars 47 forks source link

Poloniex API rate limiting #119

Closed ghost closed 6 years ago

ghost commented 7 years ago

Pretty consistently with the latest version, it seems that the API limits of Poloniex are getting hit. 2017-09-18 15:25:12 - notice: returnActiveLoans: Poloniex error 429: Too Many Requests. Please do not make more than 8 API calls per second.

2017-09-18 15:25:13 - notice: returnActiveLoans: Poloniex error 429: Too Many Requests. Please do not make more than 8 API calls per second. 2017-09-18 15:25:14 - notice: returnActiveLoans: Poloniex error 429: Too Many Requests. Please do not make more than 8 API calls per second. 2017-09-18 15:25:14 - notice: returnActiveLoans: Poloniex error 429: Too Many Requests. Please do not make more than 8 API calls per second. 2017-09-18 15:25:15 - notice: returnActiveLoans: Poloniex error 429: Too Many Requests. Please do not make more than 8 API calls per second. 2017-09-18 15:25:16 - notice: returnActiveLoans: Poloniex error 429: Too Many Requests. Please do not make more than 8 API calls per second. 2017-09-18 15:25:16 - notice: returnActiveLoans: Poloniex error 429: Too Many Requests. Please do not make more than 8 API calls per second. 2017-09-18 15:25:17 - notice: returnActiveLoans: Poloniex error 429: Too Many Requests. Please do not make more than 8 API calls per second. 2017-09-18 15:25:17 - notice: returnActiveLoans: Poloniex error 429: Too Many Requests. Please do not make more than 8 API calls per second. 2017-09-18 15:25:18 - notice: returnActiveLoans: Poloniex error 429: Too Many Requests. Please do not make more than 8 API calls per second.

May need to limit the API calls down to prevent this behavior.

dutu commented 7 years ago

It looks like Poloniex is fiddling with API call throttling. We've seen this before and things returned to normal after a while. Nevertheless, here are steps you can follow when this specific error is seen:

ghost commented 7 years ago

So I still have the same issue even when dropping down the API Calls to 4:

 "maxApiCallsPerDuration": 4,
    "apiCallsDurationMS": 1500,
    "advancedSettings": {
      "parallelApiExecution": false,
      "nonceDelay": 500,
      "muteNonceErrors": false
    },

It starts off fine, but after the initial loan offer/ taken/canceled section on startup, it starts to send API limit errors.

I also am seeing consistent crashes every day or so while running the code on an AWS node:

Killed
npm ERR! code ELIFECYCLE
npm ERR! errno 137
npm ERR! poloLenderPro@1.3.3 start: `node -r babel-register app.js`
npm ERR! Exit status 137
npm ERR!
npm ERR! Failed at the poloLenderPro@1.3.3 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /../../../_logs/2017-10-02T21_12_30_011Z-debug.log
dutu commented 7 years ago

Will look into adding some debug info to display the api call numbers.

The crashes seem to happen due to out of memory. When browser is open, output lines are being added to the logtrail and eventually the system runs out of memory. I will implement discarding older logtrail messages in the next revision; in the meantime, as a workaround, keep your browser closed when not needed for longer periods or time.

ghost commented 7 years ago

Both good revisions. I actually am running the deployment mostly headless on an ec2, and it is sending telegram messages via api, which might be the cause. I only have used the browser for initial setup on the newer version.

dutu commented 7 years ago

Please use v1.3.4 and set the environment variable DEBUG=pololender to get the API call debug log. It indicates the time and number of API calls per second, which can help in troubleshooting and/or reporting the issue to Poloniex.