Exemplo n.º 1
0
 def test_spread(self):
     client = pykrakenrequests.Client(API_KEY,
                                      PRIVATE_KEY,
                                      requests_kwargs=PROXY)
     t = client.kpublic_spread(pair=['XETHXXBT'])
     print(t)
     self.assertTrue('XETHXXBT' in t.keys())
Exemplo n.º 2
0
 def test_assetpairs(self):
     client = pykrakenrequests.Client(API_KEY,
                                      PRIVATE_KEY,
                                      requests_kwargs=PROXY)
     t = client.kpublic_assetpairs()
     # TODO: find a better test
     self.assertTrue('XXBTZUSD' in t.keys())
Exemplo n.º 3
0
 def test_server_time(self):
     client = pykrakenrequests.Client(API_KEY,
                                      PRIVATE_KEY,
                                      requests_kwargs=PROXY)
     utcnow = time.time()
     t = client.kpublic_time()
     # t_compare = datetime.strptime(t[1], '%a, %d %b %y %H:%M:%S +0000')
     t_compare = t[0]
     print("t_compare: {} utcnow: {}".format(t_compare, utcnow))
     delta = t_compare - utcnow
     self.assertLessEqual(abs(delta), 6)
Exemplo n.º 4
0
from pprint import pprint

import pykrakenrequests
from examples.config import PROXY, API_KEY, PRIVATE_KEY

client = pykrakenrequests.Client(API_KEY, PRIVATE_KEY, requests_kwargs=PROXY)
t = client.kpublic_time()

txids = client.kprivate_tradesHistory()
# pprint(txids['trades'])

txid = txids['trades'].keys()[0]

onequery = client.kprivate_queryTrades(txid=[txid])
pprint(onequery)
Exemplo n.º 5
0
 def test_no_api_key(self):
     with self.assertRaises(Exception):
         client = pykrakenrequests.Client()
Exemplo n.º 6
0
 def test_assets_aclass_parameter(self):
     with self.assertRaises(pykrakenrequests.exceptions.BadParamterError):
         client = pykrakenrequests.Client(API_KEY,
                                          PRIVATE_KEY,
                                          requests_kwargs=PROXY)
         t = client.kpublic_assets(aclass='mouahahah bad parameter')
Exemplo n.º 7
0
 def test_assets_asset_parameter(self):
     client = pykrakenrequests.Client(API_KEY,
                                      PRIVATE_KEY,
                                      requests_kwargs=PROXY)
     t = client.kpublic_assets(asset=['XETH'])
     self.assertTrue(u'XETH' in t.keys())