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

Kraken exchange broken on XXBT-ZUSD #2632

Closed
zaventh opened this issue Feb 5, 2021 · 5 comments · Fixed by #2641
Closed

Kraken exchange broken on XXBT-ZUSD #2632

zaventh opened this issue Feb 5, 2021 · 5 comments · Fixed by #2641
Labels
bug exchange Relating to an exchange

Comments

@zaventh
Copy link
Contributor

zaventh commented Feb 5, 2021

System information

  • Have I written custom code (as opposed to using zenbot vanilla): No
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Linux Mint 20
  • Zenbot version (commit ref, or version): HEAD (a0b2073)
  • Zenbot branch: unstable
  • NodeJS version: v14.15.4
  • Python version (when using a python script):
  • Exact command to reproduce (include everything): e.g. node zenbot balance kraken.XXBT-ZUSD
  • Did I make any changes to conf-sample.js?: Yes

Describe the problem

All commands on selector kraken.XXBT-ZUSD fail with various errors.

Source code / Error logs

$ node zenbot balance kraken.XXBT-ZUSD
...
getQuote error:
TypeError: Cannot read property 'b' of undefined
    at [redacted]/zenbot/extensions/exchanges/kraken/exchange.js:224:34
    at [redacted]/zenbot/node_modules/kraken-api/kraken.js:125:23
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:30445) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'b' of undefined
    at [redacted]/zenbot/extensions/exchanges/kraken/exchange.js:226:34
    at [redacted]/zenbot/node_modules/kraken-api/kraken.js:125:23
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:30445) 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: 1)
(node:30445) [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.
^C

This is because

var pair = joinProductFormatted(opts.product_id)

Is returning XBTUSD after commit 574da60. However, Kraken API is returning:

{
  "XXBTZUSD": {
    "a": [
      "37844.70000",
      "1",
      "1.000"
    ],
    "b": [
      "37844.60000",
      "11",
      "11.000"
    ],
    "c": [
      "37844.70000",
      "0.00065207"
    ],
    "v": [
      "4593.65887495",
      "4807.10838099"
    ],
    "p": [
      "37647.70122",
      "37623.15773"
    ],
    "t": [
      39405,
      41211
    ],
    "l": [
      "36582.90000",
      "36582.90000"
    ],
    "h": [
      "38340.00000",
      "38340.00000"
    ],
    "o": "36975.80000"
  }
}

I'm not sure of the motivation behind #2629 but it appears the solution is more nuanced than remapping the symbols in every case. The unmodified concatenation XXBTZUSD is expected here.

@xazes
Copy link

xazes commented Feb 6, 2021

As dirty workarround you can edit exchange.js from kraken and edit this part here:
var fixMap = { 'XETH': 'ETH', 'XXBT': 'XBT', 'XLTC': 'LTC', 'XXDG': 'XDG', 'XETC': 'ETC', 'XMLN': 'MLN', 'XREP': 'REP', 'XXRP': 'XRP', 'XXLM': 'XLM', 'XXMR': 'XMR', 'XZEC': 'ZEC', 'ZAUD': 'AUD', 'ZEUR': 'EUR', 'ZGBP': 'GBP', 'ZUSD': 'USD', 'ZJPY': 'JPY', 'ZCAD': 'CAD',

change in your case 'XXBT': 'XBT' and 'ZUSD': 'USD', TO 'XXBT': 'XXBT' and 'ZUSD': 'ZUSD' until an update appears

@ChairmenMeow100
Copy link

hey zaventh, the initial Problem is a inconsistency in the naming of the products on the kraken side this was the last solution d5d1f91 it reformatted the "small coins". The list on line 47 was incomplete so i figured out it needs to change into "var assetsToFix = ['AAVE', 'ADA', 'ALGO', 'ANT', 'ATOM', 'BAL', 'BAT', 'BCH', 'COMP', 'CRV', 'DAI', 'DOT', 'DASH', 'EOS', 'FIL', 'GNO', 'GRT', 'ICX', 'KAVA', 'KEEP', 'KNC', 'KSM', 'LINK', 'LSK', 'MANA', 'NANO', 'OMG', 'OXT', 'PAXG', 'QTUM', 'REPV2', 'SC', 'SNX', 'STORJ', 'TBTC', 'TRX', 'UNI', 'USDT', 'USDC', 'WAVES', 'XTZ', 'YFI']" to support all of this coins.
I am completely new to al of this, so i made my pull request in the wrong directory - so it does not get a match. In the meantime the webpack components were updated and we saw a new approach to this problem.
Now the "big coins" are reformatted, the small ones work great but the other coins no more. It seems to me this approach has not erase Problem, it just turns it upside down.
I have no programming skills to fix this on my own and can´t merge my solution because the whole chunk was changed - as i mentioned i am new to this so i don´t know what to do.

best regards

@ChairmenMeow100
Copy link

hey @zaventh , i have undone the last changes on the file ~/zenbot/extensions/exchanges/kraken/exchange.js and now XXBT works on my machine again - i will test it a bit and try to do a pull request tomorrow.

@DeviaVir DeviaVir added bug exchange Relating to an exchange labels Feb 8, 2021
@zaventh
Copy link
Contributor Author

zaventh commented Feb 8, 2021

@ChairmenMeow100 No worries. Can you describe what you were trying to fix initially? It looks like a problem with the DOT-XETH pair? If I get a chance I may be able to look at it sometime this week.

@ChairmenMeow100
Copy link

hey @zaventh , thanks for the response. As far as i know all kraken names for currency starts with Z and asset start with X. The names consists of four letter, but at some point kraken has stopped to do so. Now we have products with three letters and products with four letters and i don´t know why but this causes trouble. So the solution is apparently to reformat one group, the earlier version was to change all of them into four letters (i guess) and it worked so i just added e few newer coins to get a fully support. The latest change just cut all products down to three letters but now you search for the "wrong product" at kraken and get an error cause they don´t have "ETH" they named it "XETH"
examples:
litecoin = XLTC
polkadot = DOT
unfortunately i can´t do a proper pull request - so please do it yourself. I had another problem with the changes in zenbot/extensions/exchanges/kraken/update-products.sh (the price had to much digits, they support only four decimals - so it gets rejected) ... I just downgraded my whole version a bit to undo all the latest kraken specific changes - now it seems to run.

zaventh added a commit to zaventh/zenbot that referenced this issue Feb 12, 2021
Removes the need for manual mapping due to Kraken's inconsistent naming
conventions for asset pairs.

Resolves DeviaVir#2632
DeviaVir pushed a commit that referenced this issue Feb 13, 2021
Removes the need for manual mapping due to Kraken's inconsistent naming
conventions for asset pairs.

Resolves #2632
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug exchange Relating to an exchange
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants