Example #1
0
 def test_get_trades_default_success(self):
     client = Client(PRIVATE_KEY_1)
     with requests_mock.mock() as rm:
         json_obj = tests.test_json.mock_get_trades_json
         uri = 'https://api.dydx.exchange/v2/trades' \
             + '?market=' + ','.join(MARKETS)
         rm.get(uri, json=json_obj)
         result = client.get_trades(market=MARKETS, )
         assert result == json_obj
Example #2
0
 def test_get_trades_default_success(self):
     client = Client(PRIVATE_KEY_1)
     with requests_mock.mock() as rm:
         json_obj = tests.test_json.mock_get_trades_json
         uri = ("https://api.dydx.exchange/v1/dex/trades" + "?pairs=" +
                ",".join(PAIRS))
         rm.get(uri, json=json_obj)
         result = client.get_trades(pairs=PAIRS)
         assert result == json_obj
Example #3
0
 def test_get_trades_specified_success(self):
     client = Client(PRIVATE_KEY_1)
     limit = 1234
     startingBefore = datetime.datetime.utcnow().isoformat()
     with requests_mock.mock() as rm:
         json_obj = tests.test_json.mock_get_trades_json
         uri = ("https://api.dydx.exchange/v1/dex/trades" + "?pairs=" +
                ",".join(PAIRS) + "&limit=" + str(limit) +
                "&startingBefore=" + startingBefore)
         rm.get(uri, json=json_obj)
         result = client.get_trades(pairs=PAIRS,
                                    limit=limit,
                                    startingBefore=startingBefore)
         assert result == json_obj
Example #4
0
 def test_get_trades_specified_success(self):
     client = Client(PRIVATE_KEY_1)
     limit = 1234
     startingBefore = datetime.datetime.utcnow().isoformat()
     with requests_mock.mock() as rm:
         json_obj = tests.test_json.mock_get_trades_json
         uri = 'https://api.dydx.exchange/v2/trades' \
             + '?market=' + ','.join(MARKETS) \
             + '&limit=' + str(limit) \
             + '&startingBefore=' + startingBefore
         rm.get(uri, json=json_obj)
         result = client.get_trades(market=MARKETS,
                                    limit=limit,
                                    startingBefore=startingBefore)
         assert result == json_obj
Example #5
0
 def test_get_trades_no_pairs_error(self):
     client = Client(PRIVATE_KEY_1)
     with pytest.raises(TypeError) as error:
         client.get_trades()
     assert 'required positional argument: \'pairs\'' in str(error.value)