def get_currency_pairs_info(self): # https://api.kraken.com/0/public/AssetPairs k = KRAKEN_RAW_API.API(key=self.account.api_key, secret=self.account.secret_key) result = k.query_public('AssetPairs') result = universal.CurrencyPairInfos(self.MARKET, result) return result
def cancel_order(self, currency_pair, order_id): k = KRAKEN_RAW_API.API(key=self.account.api_key, secret=self.account.secret_key) result = k.query_private('CancelOrder', {'txid': order_id}) result = universal.CancelOrderResult(self.MARKET, currency_pair, result, order_id) return result
def submit_order(self, type, currency_pair, price, amount): k = KRAKEN_RAW_API.API(key=self.account.api_key, secret=self.account.secret_key) pair_name='X'+Kraken.COINNAMEMAPPING.get(currency_pair.base, currency_pair.base) + 'Z' + Kraken.COINNAMEMAPPING.get( currency_pair.reference, currency_pair.reference) action='buy' if type>=1 or type=='1' or type=='buy' else 'sell' result = k.query_private('AddOrder', {'pair': pair_name, 'type': action, 'ordertype': 'limit', 'price': str(price), 'volume': str(amount) }) result = universal.OrderInfo(self.MARKET, currency_pair, result, {'price':price,'amount':amount,'type':type}) return result
def trades_volume(self): # https: // api.kraken.com / 0 / private / TradeVolume k = KRAKEN_RAW_API.API(key=self.account.api_key, secret=self.account.secret_key) result = k.query_private('TradeVolume') return float(result['result']['volume'])
def balances(self): k = KRAKEN_RAW_API.API(key=self.account.api_key, secret=self.account.secret_key) result = k.query_private('Balance') return universal.BalanceInfo(self.MARKET, result)