askmike / gekko

A bitcoin trading bot written in node - https://gekko.wizb.it/
MIT License
10.08k stars 3.94k forks source link

UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot read property 'date' of undefined with Kraken #1557

Closed acidos closed 6 years ago

acidos commented 6 years ago

Note: for support questions, please join our Discord server

First I cloned default git branch. Then I've seen number of issues fixed recently for Kraken, such as retry mechanism and cloned develop branch, but still got the error.

greenbigfrog commented 6 years ago

What you shared, is most likely not the full error. Mind sharing the full error?

acidos commented 6 years ago

This is what I see in terminal when running gekko in --ui mode. Before that I see only few GET/POST lines. Log folder is empty. In baseConfig.js debug is true. I would appreciate for hint on how to collect logs.

acidos commented 6 years ago

I was running it on Windows Bash. Today I tried to run develop branch on OS X and the error is much verbose here indeed:

Import 25675033919433377 started
  --> POST /api/import 200 6ms 149b
(node:4789) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'date' of undefined
    at handleFetch (/Users/aaa/gekko/importers/exchanges/kraken.js:38:42)
    at Trader.processResults (/Users/aaa/gekko/exchanges/kraken.js:145:21)
    at bound (/Users/aaa/gekko/node_modules/lodash/dist/lodash.js:729:21)
    at /Users/aaa/gekko/core/util.js:28:7
    at /Users/aaa/gekko/exchanges/kraken.js:137:12
    at response.then.catch.error (/Users/aaa/gekko/node_modules/kraken-api-es5/index.js:132:70)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:160:7)
(node:4789) 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(). (rejection id: 1)
(node:4789) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

So I just imported some data from kraken, this time much less, for just around 3 weeks.

cmroche commented 6 years ago

@acidos The changes in the develop branch do not cause the importer to be fully robust against Kraken's service problems, PR #1549 has some additional fixes which

1) Correct the retry delays on error (currently they fire too fast) 2) If retries fail for too long report a proper error and end the import instead of crashing it.

cmroche commented 6 years ago

@acidos Please try downloading or fetching this branch https://github.com/cmroche/gekko/tree/bitfinex_retry

Even though the branch name is bitfinex_retry, it has some kraken fixes in there. Please try with that branch directly. If you still have problems paste the entirety of your debug log from the console.

I suggest an npm update after syncing too, just in case.

Thank you.

acidos commented 6 years ago

@cmroche The new branch imported perfectly fine from Kraken, without single crash, though extremely slow. But this is due to errors on their service I guess. I hope your changes will be pulled and merged...

cmroche commented 6 years ago

@acidos It is partly because of the errors, partly because importing is just slow. In the last few months most exchanges have seen their volume explode by an order of magnitude at least, this slows the import process. Kraken is still one of the fastest importers available in Gekko.

stale[bot] commented 6 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. If you feel this is very a important issue please reach out the maintainer of this project directly via e-mail: gekko at mvr dot me.