Skip to content

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
@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
3 participants