Skip to content

Commit

Permalink
Fixed order_response
Browse files Browse the repository at this point in the history
  • Loading branch information
rhettre committed Sep 6, 2024
1 parent 0eb7a86 commit 1dbbaed
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions coinbase_advanced_trader/legacy_tests/test_coinbase_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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')

Expand Down
6 changes: 3 additions & 3 deletions coinbase_advanced_trader/services/order_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 1dbbaed

Please sign in to comment.