CryptoBot/api/fake.py
2021-01-31 14:17:25 -07:00

24 lines
751 B
Python

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 = {'XXDG': self.krakenWrapper.get_ticker_information(pair="XDGUSD")["c"][0][0] * 100, 'ZUSD': 0.0}
def buyOrder(self, amount, pair):
self.balances[0:3] += float(self.krakenWrapper.get_ticker_information(pair=pair)["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=pair)["c"][0][0]) * amount
self.balances[4:7] += amount