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

fix: buy order results bug in OKEx #829

Merged
merged 1 commit into from
Feb 8, 2024
Merged

Conversation

O-Mutt
Copy link
Contributor

@O-Mutt O-Mutt commented Feb 7, 2024

image

Comment on lines +854 to +865
var avgPrice = decimal.TryParse(token["avgPx"].Value<string>(), out var tempAvgPx) ? tempAvgPx : default;
var price = decimal.TryParse(token["px"].Value<string>(), out var tempPx) ? tempPx : default;
if (avgPrice == default && price != default)
{
avgPrice = price;
}
else if (price == default && avgPrice != default)
{
price = avgPrice;
}
newResult.Price = price;
newResult.AveragePrice = avgPrice;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Seems there was an expectation that the inverse was true previously. I made it a bit safer parsing and use the other value if there is missing data one way or the other.

i.e. if we don't have avgPx use px, if we don't have px use avgPx, if we have both, Great!

@vslee vslee merged commit 9486d77 into DigitalRuby:main Feb 8, 2024
1 of 3 checks passed
@O-Mutt O-Mutt deleted the okexBugFix branch February 12, 2024 16:27
@vslee vslee changed the title fix: bug fix on buy order results fix: buy order results bug in OKEx Apr 6, 2024
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.

3 participants