From 1dbbaede779ad01628e0020b51b1778264461bbe Mon Sep 17 00:00:00 2001 From: Rhett Reisman Date: Fri, 6 Sep 2024 00:01:21 -0500 Subject: [PATCH 1/2] Fixed order_response --- .../legacy_tests/test_coinbase_client.py | 4 ++-- coinbase_advanced_trader/services/order_service.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/coinbase_advanced_trader/legacy_tests/test_coinbase_client.py b/coinbase_advanced_trader/legacy_tests/test_coinbase_client.py index e83abf5..ad78d37 100644 --- a/coinbase_advanced_trader/legacy_tests/test_coinbase_client.py +++ b/coinbase_advanced_trader/legacy_tests/test_coinbase_client.py @@ -189,7 +189,7 @@ def test_cancel_orders(self, mock_cb_auth): self.assertTrue(results['success']) self.assertEqual(results['failure_reason'], "UNKNOWN_CANCEL_FAILURE_REASON") - self.assertEqual(results['order_id'], "0000-00000") + self.assertEqual(results['success_response']['order_id'], "0000-00000") @patch('coinbase_advanced_trader.coinbase_client.cb_auth') def test_list_orders(self, mock_cb_auth): @@ -341,7 +341,7 @@ def test_get_order(self, mock_cb_auth): self.assertIsNotNone(result) self.assertIsInstance(result, dict) self.assertIn('order', result) - self.assertEqual(result['order']['order_id'], order_id) + self.assertEqual(result['order']['success_response']['order_id'], order_id) self.assertEqual(result['order']['product_id'], 'BTC-USD') self.assertEqual(result['order']['status'], 'OPEN') diff --git a/coinbase_advanced_trader/services/order_service.py b/coinbase_advanced_trader/services/order_service.py index c01d54d..74ade6c 100644 --- a/coinbase_advanced_trader/services/order_service.py +++ b/coinbase_advanced_trader/services/order_service.py @@ -62,7 +62,7 @@ def fiat_market_buy(self, product_id: str, fiat_amount: str) -> Order: raise Exception(error_log) order = Order( - id=order_response['order_id'], + id=order_response['success_response']['order_id'], product_id=product_id, side=OrderSide.BUY, type=OrderType.MARKET, @@ -113,7 +113,7 @@ def fiat_market_sell(self, product_id: str, fiat_amount: str) -> Order: raise Exception(error_log) order = Order( - id=order_response['order_id'], + id=order_response['success_response']['order_id'], product_id=product_id, side=OrderSide.SELL, type=OrderType.MARKET, @@ -198,7 +198,7 @@ def _place_limit_order(self, product_id: str, fiat_amount: str, limit_price: Opt ) order = Order( - id=order_response['order_id'], + id=order_response['success_response']['order_id'], product_id=product_id, side=side, type=OrderType.LIMIT, From 3856c4028d48333e8ba2e425e9688de7081982f0 Mon Sep 17 00:00:00 2001 From: Rhett Reisman Date: Fri, 6 Sep 2024 00:01:43 -0500 Subject: [PATCH 2/2] Update setup.py --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index e53f329..d38551a 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ setup( name='coinbase-advancedtrade-python', - version='0.2.4', + version='0.2.5', description='The unofficial Python client for the Coinbase Advanced Trade API', long_description=long_description, long_description_content_type="text/markdown",