Ejemplo n.º 1
0
 def test_get_my_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' \
             + '?accountOwner=' + client.public_address \
             + '&accountNumber=' + str(client.account_number) \
             + '&market=' + ','.join(MARKETS)
         rm.get(uri, json=json_obj)
         result = client.get_my_trades(market=MARKETS, )
         assert result == json_obj
Ejemplo n.º 2
0
 def test_get_my_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" +
                "?makerAccountOwner=" + client.public_address +
                "&makerAccountNumber=" + str(client.account_number) +
                "&pairs=" + ",".join(PAIRS))
         rm.get(uri, json=json_obj)
         result = client.get_my_trades(pairs=PAIRS)
         assert result == json_obj
Ejemplo n.º 3
0
 def test_get_my_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" +
                "?makerAccountOwner=" + client.public_address +
                "&makerAccountNumber=" + str(client.account_number) +
                "&pairs=" + ",".join(PAIRS) + "&limit=" + str(limit) +
                "&startingBefore=" + startingBefore)
         rm.get(uri, json=json_obj)
         result = client.get_my_trades(pairs=PAIRS,
                                       limit=limit,
                                       startingBefore=startingBefore)
         assert result == json_obj
Ejemplo n.º 4
0
 def test_get_my_trades_specified_success(self):
     client = Client(PRIVATE_KEY_1)
     limit = 99
     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' \
             + '?accountOwner=' + client.public_address \
             + '&accountNumber=' + str(client.account_number) \
             + '&market=' + ','.join(MARKETS) \
             + '&limit=' + str(limit) \
             + '&startingBefore=' + startingBefore
         rm.get(uri, json=json_obj)
         result = client.get_my_trades(market=MARKETS,
                                       limit=limit,
                                       startingBefore=startingBefore)
         assert result == json_obj
Ejemplo n.º 5
0
 def test_get_my_trades_no_pairs_error(self):
     client = Client(PRIVATE_KEY_1)
     with pytest.raises(TypeError) as error:
         client.get_my_trades()
     assert 'required positional argument: \'market\'' in str(error.value)