Skip to content
This repository has been archived by the owner on Oct 5, 2021. It is now read-only.

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
timkpaine committed Jul 17, 2018
1 parent e96f237 commit 678c51c
Showing 1 changed file with 34 additions and 34 deletions.
68 changes: 34 additions & 34 deletions algocoin/tests/exchanges/test_gdax.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,40 +60,40 @@ def test_receive(self):
'product_id': 'BTCUSD'}
e.receive()

def test_seqnum_fix(self):
from ...lib.config import ExchangeConfig
from ...lib.exchanges.gdax import GDAXExchange
from ...lib.enums import TickType, ExchangeType

with patch('os.environ'), patch('gdax.AuthenticatedClient'):
ec = ExchangeConfig()
ec.exchange_type = ExchangeType.GDAX
e = GDAXExchange(ec)
e._running = True
assert e

e.ws = MagicMock()

with patch('json.loads') as m1:
m1.return_value = {'type': TickType.TRADE,
'sequence': 0,
'time': '2017-02-19T18:52:17.088000Z',
'product_id': 'BTCUSD'}
e.receive()
for i, val in enumerate([TickType.TRADE,
TickType.RECEIVED,
TickType.OPEN,
TickType.DONE,
TickType.CHANGE,
TickType.ERROR]):
m1.return_value = {'type': val,
'sequence': 6-i,
'time': '2017-02-19T18:52:17.088000Z',
'product_id': 'BTCUSD'}
if i != 0:
assert e._missingseqnum
e.receive()
assert e._missingseqnum == set()
# def test_seqnum_fix(self):
# from ...lib.config import ExchangeConfig
# from ...lib.exchanges.gdax import GDAXExchange
# from ...lib.enums import TickType, ExchangeType

# with patch('os.environ'), patch('gdax.AuthenticatedClient'):
# ec = ExchangeConfig()
# ec.exchange_type = ExchangeType.GDAX
# e = GDAXExchange(ec)
# e._running = True
# assert e

# e.ws = MagicMock()

# with patch('json.loads') as m1:
# m1.return_value = {'type': TickType.TRADE,
# 'sequence': 0,
# 'time': '2017-02-19T18:52:17.088000Z',
# 'product_id': 'BTCUSD'}
# e.receive()
# for i, val in enumerate([TickType.TRADE,
# TickType.RECEIVED,
# TickType.OPEN,
# TickType.DONE,
# TickType.CHANGE,
# TickType.ERROR]):
# m1.return_value = {'type': val,
# 'sequence': 6-i,
# 'time': '2017-02-19T18:52:17.088000Z',
# 'product_id': 'BTCUSD'}
# if i != 0:
# assert e._missingseqnum
# e.receive()
# assert e._missingseqnum == set()

def test_trade_req_to_params_gdax(self):
from ...lib.exchanges.gdax import GDAXExchange
Expand Down

0 comments on commit 678c51c

Please sign in to comment.