Crypto-toolbox / bitex

Crypto-currency Exchange API Framework
MIT License
484 stars 136 forks source link

Fix KrakenFormattedResponse.ticker() #174

Closed alexanderkoumis closed 6 years ago

alexanderkoumis commented 6 years ago

self.method_args[0] refers to a bitex.interface.kraken.Kraken object, self.method_args[1] refers to the pair symbol. Update index for accessing pair from 0 to 1.

Without this fix, running the following code:

import bitex
kraken = bitex.Kraken()
ticker_kraken = kraken.ticker(bitex.ETHUSD).ticker()

will result in the following exception:

Traceback (most recent call last):
  File "test.py", line 3, in <module>
    ticker_kraken = kraken.ticker(bitex.ETHUSD).ticker()
  File "/usr/local/lib/python3.6/site-packages/bitex/formatters/kraken.py", line 20, in ticker
    data = self.json(parse_int=str, parse_float=str)['result'][pair]
KeyError: <bitex.interface.kraken.Kraken object at 0x108d7c4a8>