Exemplo n.º 1
0
 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
Exemplo n.º 2
0
    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
Exemplo n.º 3
0
 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
Exemplo n.º 4
0
 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'])
Exemplo n.º 5
0
 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)