Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions cdp/trade.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,16 @@ def to_amount(self) -> Decimal:
"""
return Decimal(self._model.to_amount) / Decimal(10) ** self._model.to_asset.decimals

@property
def status(self) -> str:
"""Get the status.

Returns:
str: The status.

"""
return self.transaction.status

@property
def transaction(self) -> Transaction:
"""Get the trade transaction."""
Expand Down
4 changes: 2 additions & 2 deletions tests/test_trade.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def test_broadcast_trade(mock_api_clients, trade_factory):
broadcast_trade_request=ANY,
)
assert isinstance(response, Trade)
assert response.transaction.status.value == "broadcast"
assert response.status.value == "broadcast"
broadcast_trade_request = mock_broadcast.call_args[1]["broadcast_trade_request"]
assert broadcast_trade_request.signed_payload == trade.transaction.signature
assert (
Expand Down Expand Up @@ -224,7 +224,7 @@ def test_wait_for_trade(mock_time, mock_sleep, mock_api_clients, trade_factory):

result = pending_trade.wait(interval_seconds=0.2, timeout_seconds=1)

assert result.transaction.status.value == "complete"
assert result.status.value == "complete"
mock_get_trade.assert_called_with(
wallet_id=pending_trade.wallet_id,
address_id=pending_trade.address_id,
Expand Down
Loading