示例#1
0
#!/bin/env python3

from kraken import Kraken

import sys

k = Kraken()

# load keys
k.load_key('keys/albus.key')

arg = {'txid': ' '.join(sys.argv[1:])}

t = k.query_private('CancelOrder', arg)

print(t)
示例#2
0
import json

import time

from kraken import Kraken

# init krakenex API
k = Kraken(tier=3)

# load keys
k.load_key('keys/albus-test.key')

while (True):
    try:
        new_bal = k.query_private('Balance')['result']
    except:
        print("Cannot get balance")
        time.sleep(30)

    try:
        with open('data/balance.json', 'r') as fp:
            old_bal = json.load(fp)
    except:
        print("First run, a balance file will be created")
        old_bal = dict()

    if (old_bal != new_bal):
        print("Balance has changed")

        for key, value in sorted(new_bal.items()):
示例#3
0
#!/bin/env python3

import sys

from tabulate import tabulate

from kraken import Kraken

k = Kraken()

# load keys
k.load_key('keys/albus-test.key')

orders = k.query_private('OpenOrders')

orders = orders['result']['open']

t = [{'pair':orders[key]['descr']['pair'],\
      'type':orders[key]['descr']['type'],\
      'price':orders[key]['descr']['price'],\
      'vol':orders[key]['vol'],\
      'key':key,\
      'status':orders[key]['status']} for key in orders.keys()]

print(tabulate(t, floatfmt="7.9f"))