Skip to content

Commit

Permalink
finish poloniex tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
PandaXcentric committed Oct 9, 2018
1 parent 9045282 commit b4771ad
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 5 deletions.
4 changes: 2 additions & 2 deletions cryptofeed/rest/poloniex.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,11 +196,11 @@ def withdraw(self, payload):
"""
return self._post("withdraw", payload)

def available_account_balances(self, payload):
def available_account_balances(self, payload={}):
"""
"account" (optional)
"""
return self._post("returnAvailableAccountBalances")
return self._post("returnAvailableAccountBalances", payload)

def tradable_balances(self):
return self._post("returnTradableBalances")
Expand Down
32 changes: 29 additions & 3 deletions tests/unit/rest_apis/test_poloniex.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,35 @@ def test_deposit_addresses(self):

def test_deposit_withdrawals(self):
poloniex = Rest('config.yaml').Poloniex
deposit_withdrawals = poloniex.deposit_withdrawals({"start": 1410158341, "end": 1410499372})

assert 'deposits' in deposit_withdrawals
assert 'withdrawals' in deposit_withdrawals

def test_open_orders(self):
poloniex = Rest('config.yaml').Poloniex
open_orders = poloniex.open_orders()

assert 'BTC_AMP' in open_orders

def test_trade_history(self):
poloniex = Rest('config.yaml').Poloniex
trade_history = poloniex.trade_history()

assert len(trade_history) >= 0

def test_available_account_balances(self):
poloniex = Rest('config.yaml').Poloniex
available_account_balances = poloniex.available_account_balances()

assert len(available_account_balances) >= 0

def test_tradable_balances(self):
poloniex = Rest('config.yaml').Poloniex
tradable_balances = poloniex.tradable_balances()

assert 'BTC_BTS' in tradable_balances
assert float(tradable_balances['BTC_BTS']['BTC']) == 0.0

if __name__ == '__main__':
unittest.main()

poloniex = Rest('config.yaml').Poloniex
poloniex.balances()

0 comments on commit b4771ad

Please sign in to comment.