Skip to content

Commit

Permalink
example
Browse files Browse the repository at this point in the history
  • Loading branch information
lee101 committed Feb 17, 2018
1 parent eee35e0 commit fb4c6cb
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ Extended to be asynchronous using requests futures

Extended to include margin trading API


See test for [example usage](tests/test_poloniex_wrapper.py)
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
import urllib.request
from collections import defaultdict

from config import logger
import logging

logger = logging.getLogger(__name__)


def createTimeStamp(datestr, format="%Y-%m-%d %H:%M:%S"):
Expand Down
12 changes: 11 additions & 1 deletion tests/test_poloniex_wrapper.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import unittest

from config import poloniex
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):
Expand Down Expand Up @@ -28,10 +36,12 @@ def test_balance(self):
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()
Expand Down

0 comments on commit fb4c6cb

Please sign in to comment.