This commit is contained in:
Logan G 2021-02-01 21:37:04 -07:00
parent 75f42e7353
commit 8c3299f9d5
Signed by: logan
GPG key ID: E328528C921E7A7A

View file

@ -31,13 +31,13 @@ class Kraken:
self.shortEMA = self.prices.ewm(span=3).mean() self.shortEMA = self.prices.ewm(span=3).mean()
def buyOrder(self, currency_pair, currency_buy, currency_sell, amount, _type="market"): def buyOrder(self, currency_pair, currency_buy, currency_sell, amount, ordertype="market"):
self.krakenWrapper.add_standard_order(currency_pair, "sell", _type, volume=amount, validate=True) self.krakenWrapper.add_standard_order(currency_pair, "buy", ordertype, volume=amount, validate=True)
self.balances["vol"][currency_buy] += amount self.balances["vol"][currency_buy] += amount
self.balances["vol"][currency_sell] -= amount * self.prices.tail(1)[0] self.balances["vol"][currency_sell] -= amount * self.prices.tail(1)[0]
def sellOrder(self, currency_pair, currency_buy, currency_sell, amount, _type="market"): def sellOrder(self, currency_pair, currency_buy, currency_sell, amount, ordertype="market"):
self.krakenWrapper.add_standard_order(currency_pair, "buy", _type, volume=amount, validate=True) self.krakenWrapper.add_standard_order(currency_pair, "sell", ordertype, volume=amount, validate=True)
self.balances["vol"][currency_buy] -= amount self.balances["vol"][currency_buy] -= amount
self.balances["vol"][currency_sell] += amount * self.prices.tail(1)[0] self.balances["vol"][currency_sell] += amount * self.prices.tail(1)[0]