from pykrakenapi import KrakenAPI import krakenex class Fake: def __init__(self): self.krakenAPI = krakenex.API() self.krakenAPI.load_key("kraken.key") self.krakenWrapper = KrakenAPI(self.krakenAPI) self.balances = {'XXBT': self.krakenWrapper.get_ticker_information(pair="XXBTZUSD")["c"][0][0] * 100, 'ZUSD': 0.0} def buyOrder(self, amount, pair): self.balances[0:3] += float(self.krakenWrapper.get_ticker_information(pair="XXBTZUSD")["c"][0][0]) * amount self.balances[4:7] -= amount def sellOrder(self, amount, pair): self.balances[0:3] -= 1/float(self.krakenWrapper.get_ticker_information(pair="XXBTZUSD")["c"][0][0]) * amount self.balances[4:7] += amount