-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_poloniex_wrapper.py
54 lines (41 loc) · 1.55 KB
/
test_poloniex_wrapper.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import unittest
poloniex_key = "KEY_HERE"
poloniex_secret = "KEY_HERE"
from poloniex.poloniex_wrapper import poloniex
from requests_futures.sessions import FuturesSession
session = FuturesSession(max_workers=10)
poloniex = poloniex(poloniex_key, poloniex_secret, session)
class TestPoloniexWrapper(unittest.TestCase):
@unittest.skip
def test_cancell_all(self):
poloniex.cancellAllOrders()
def test_margin_tradable_balance(self):
balances = poloniex.returnMarginTradableBalances()
json = balances.result().json()
print(json)
self.assertIn('BTC', json['BTC_ETH'])
self.assertIn('ETH', json['BTC_ETH'])
def test_available_tradable_balance(self):
balances = poloniex.returnAvailableAccountBalances()
json = balances.result().json()
print(json)
self.assertIn('XMR', json['exchange'])
self.assertIn('ETH', json['exchange'])
def test_balance(self):
balances = poloniex.returnBalances()
json = balances.result().json()
print(json)
self.assertIn('BTC', json)
self.assertIn('ETH', json)
def test_complete_tradable_balance(self):
balances = poloniex.returnAllCompleteBalances()
json = balances.result().json()
print(json)
def test_getMarginPosition(self):
balances = poloniex.getMarginPosition()
json = balances.result().json()
print(json)
self.assertIn('pl', json['BTC_ETH'])
self.assertIn('basePrice', json['BTC_ETH'])
if __name__ == '__main__':
unittest.main()