Skip to content
This repository has been archived by the owner on Feb 16, 2020. It is now read-only.

Price precision for XDG-XBT on kraken #2537

Closed
H256 opened this issue Sep 17, 2018 · 6 comments
Closed

Price precision for XDG-XBT on kraken #2537

H256 opened this issue Sep 17, 2018 · 6 comments

Comments

@H256
Copy link
Contributor

H256 commented Sep 17, 2018

I'm submitting a ...
[ x] bug report
[ ] question about the decisions made in the repository

Action taken (what you did)
Started live trader on kraken, BTC-DOGE (XBT-XDG).

Expected result (what you hoped would happen)
It trades.

Actual result (unexpected outcome)
It does not trade. Internally it receives an Invalid Price error: related to #2535 , #2536

Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, etc)

I've added some logs to the kraken-api module to see what actually gets send to the exchange.
Further I've added a log to the Buy-Call on the exchange-wrapper to see, what price is listed here.

Logs (first line is the trace from within gekko-exchange-wrapper)

@askmike, this is on the latest develop:
I'm still getting the error - but it's hidden -> I've traced the kraken-api-module to find out, what it actually sends to the exchange - seems to be that it doesnt send the correct number format:

GEKKO-Order: buy 6776.5710204 XDG @ 9.7e-7 XBT
{ headers: 
   { 'API-Key': '12345678900000000000000000000000',
     'API-Sign': 'XYZXYZXYZ',
     'User-Agent': 'Kraken Javascript API Client' },
  timeout: 60000,
  method: 'POST',
  body: 'pair=XXDGXXBT&type=buy&ordertype=limit&price=9.7e-7&volume=6776.5710204&nonce=1537166879451000' }
2018-09-17T06:47:59.749Z 'Order:Invalid price:Invalid price argument.'
2018-09-17T06:47:59.752Z '[sticky order] FATAL ERROR' 'Order:Invalid price:Invalid price argument.'
2018-09-17T06:47:59.753Z Error: Order:Invalid price:Invalid price argument.
    at rawRequest (/home/pi/gekko/exchange/node_modules/kraken-api/kraken.js:56:9)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:182:7)
{ headers: { 'User-Agent': 'Kraken Javascript API Client' },
  timeout: 60000,
  method: 'POST',
  body: 'pair=XXDGXXBT' }

Seems to be the 9.7e-7 notation of the price - gekko should convert this number before sending? Maybe it doesn't take the precision into account on that pair?

@askmike
Copy link
Owner

askmike commented Sep 17, 2018

Thanks for opening a new one, and apologies for not fixing it the first time!

Can you try running the branch found here? #2538

That should force Gekko to pass the price in decimal over scientific notation.

@H256
Copy link
Contributor Author

H256 commented Sep 17, 2018

Pulled the branch, I still get this message :(

2018-09-17T09:57:10.112Z 'sticky create' 'buy'
2018-09-17T09:57:10.489Z 'Order:Invalid price:Invalid price argument.'
2018-09-17T09:57:10.490Z '[sticky order] FATAL ERROR' 'Order:Invalid price:Invalid price argument.'
2018-09-17T09:57:10.491Z Error: Order:Invalid price:Invalid price argument.
    at rawRequest (/home/pi/gekko_kraken_test/exchange/node_modules/kraken-api/kraken.js:54:9)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:182:7)

@H256
Copy link
Contributor Author

H256 commented Sep 17, 2018

@askmike Seems like you missed one rounding in kraken.js, line 282 in the PR:

If I use the new function here, it seems to work - at least it does not throw an error
price = this.roundPrice(price); // only round price, not amount

On Kraken, it also shows the orders - they are cancelled, but they are there with the correct price. (0.00000095 in this case)

@askmike
Copy link
Owner

askmike commented Sep 17, 2018 via email

@H256
Copy link
Contributor Author

H256 commented Sep 17, 2018

Kraken seems to very tricky to work with as an API :(
Thanks for the help! :)
But anyhow... I will close this issue for now.

@askmike
Copy link
Owner

askmike commented Sep 19, 2018

I merged that new PR (#2538), so if you run in a new issue please comment here since I'm assuming this is now fixed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants