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

Problems with case insensitive deserialization [BinanceTradeOrderData] #136

Closed
ha07z7xe opened this issue Mar 14, 2019 · 5 comments
Closed

Comments

@ha07z7xe
Copy link

Issue Overview

There are errors in the deserialization of BinanceTradeOrderData from the user data feed, due to case insensitive deserialization from Json.Net JamesNK/Newtonsoft.Json#815

For example, the following message is deserialized as follows. Errors highlighted in purple.

{
    "e": "executionReport",
    "E": 1552602237245,
    "s": "BNBBTC",
    "c": "pc_12cbcdd2ebbe4893a5d5de4ef27b3954",
    "S": "SELL",
    "o": "LIMIT",
    "f": "GTC",
    "q": "0.62000000",
    "p": "0.00487400",
    "P": "0.00000000",
    "F": "0.00000000",
    "g": -1,
    "C": "pc_31471433322c4166a05c58152650c96a",
    "x": "CANCELED",
    "X": "CANCELED",
    "r": "NONE",
    "i": 124465346,
    "l": "0.00000000",
    "z": "0.00000000",
    "L": "0.00000000",
    "n": "0",
    "N": null,
    "T": 1552602237240,
    "t": -1,
    "I": 286808464,
    "w": false,
    "m": false,
    "M": false,
    "O": 1552601178372,
    "Z": "0.00000000",
    "Y": "0.00000000"
}

image
https://github.com/binance-exchange/binance-official-api-docs/blob/master/user-data-stream.md

I tried fixing this, but it looks like a deeper problem with the JSON.Net deserializer that has yet to be fixed.

I haven't investigated other socket messages but I expect they may have similar problems.

Any suggestions @glitch100 ? I was unable to think of an easy way to fix.

@glitch100
Copy link
Owner

In the actual JSON payload which fields do they correspond too? We can put an attribute to correctly identify what they should deserialize as . Further if the type is wrong we can build a custom converter. We have done this for other types

@ha07z7xe
Copy link
Author

OrderId corresponds to i but is binding to I.
Order type corresponds to o but is binding to O.
I had a brief look at converters, but it seemed to me this was a deeper problem with JSON.Net.

@glitch100
Copy link
Owner

This has a workaround in 4.9.0 👍
#137

@rasmuseeg
Copy link

Does this mean that there is now support for case-sensitive deserialization?

@glitch100
Copy link
Owner

@rasmuseeg yes if it follows the pattern we used here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants