Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Adding better errors for coinbase order errors #826

Merged
merged 3 commits into from
Jan 23, 2024

Conversation

O-Mutt
Copy link
Contributor

@O-Mutt O-Mutt commented Jan 23, 2024

No description provided.

Comment on lines 461 to 472
return new ExchangeOrderResult(){
Result = ExchangeAPIOrderResult.Rejected,
IsBuy = payload["side"].ToStringInvariant().Equals(BUY),
MarketSymbol = payload["product_id"].ToStringInvariant(),
ClientOrderId = order.ClientOrderId,
ResultCode = $"{token["error_response"]["error"].ToStringInvariant()} - {token["error_response"]["preview_failure_reason"].ToStringInvariant()}",
AmountFilled = 0,
Amount = order.Amount,
AveragePrice = 0,
Fees = 0,
FeesCurrency = "USDT"
};
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

include order details since the error handler uses .ToString() on the ExchangeOrderResults and without details it is useless. Also token["error_response"]["error"] seems insufficient in many cases so including token["error_response"]["preview_failure_reason"] as well

@@ -396,24 +396,25 @@ protected override async Task<ExchangeOrderResult> OnPlaceOrderAsync(ExchangeOrd
payload["side"] = order.IsBuy ? BUY : "SELL";

Dictionary<string, object> orderConfig = new Dictionary<string, object>();
var amount = order.ShouldRoundAmount ? order.RoundAmount().ToStringInvariant() : order.Amount.ToStringInvariant();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We check the ShouldRound and then RoundAmount if needed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check happens already in order.RoundAmount so i moved back to using the method instead of this variable check

@vslee vslee merged commit 6a21325 into DigitalRuby:main Jan 23, 2024
1 of 3 checks passed
@O-Mutt O-Mutt deleted the CoinbaseError branch January 24, 2024 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants