burakoner / OKEx.Net

Open source .Net API wrapper for the @OKEx V5 Rest API and V5 Websocket API
MIT License
86 stars 49 forks source link

It's better to add "instId" in class OkexOrderBook for subscription identity. #40

Closed Tendx closed 2 years ago

Tendx commented 2 years ago

In the docs, after u subscribe the "books" channel success, it will push:

{
    "arg": {
        "channel": "books",
        "instId": "BTC-USDT"
    },
    "action": "snapshot",
    "data": [{
        "asks": [
            ["8476.98", "415", "0", "13"],
            ["8477", "7", "0", "2"],
            ["8477.34", "85", "0", "1"],
            ["8477.56", "1", "0", "1"],
            ["8505.84", "8", "0", "1"],
            ["8506.37", "85", "0", "1"],
            ["8506.49", "2", "0", "1"],
            ["8506.96", "100", "0", "2"]
        ],
        "bids": [
            ["8476.97", "256", "0", "12"],
            ["8475.55", "101", "0", "1"],
            ["8475.54", "100", "0", "1"],
            ["8475.3", "1", "0", "1"],
            ["8447.32", "6", "0", "1"],
            ["8447.02", "246", "0", "1"],
            ["8446.83", "24", "0", "1"],
            ["8446", "95", "0", "3"]
        ],
        "ts": "1597026383085",
        "checksum": -855196043
    }]
}

And there is no "arg" property in class OkexOrderBook:

namespace Okex.Net.RestObjects.Market
{
    public class OkexOrderBook
    {
        public OkexOrderBook();

        [JsonProperty("asks")]
        public IEnumerable<OkexOrderBookRow> Asks { get; set; }
        [JsonProperty("bids")]
        public IEnumerable<OkexOrderBookRow> Bids { get; set; }
        [JsonConverter(typeof(OkexTimestampConverter))]
        [JsonProperty("ts")]
        public DateTime Time { get; set; }
        [JsonProperty("action")]
        public string Action { get; set; }
        [JsonProperty("checksum")]
        public long? Checksum { get; set; }
    }
}

In fact, “instId” is really useful for identify different data push.

burakoner commented 2 years ago

It's not simple as you write because I got only data section from CryptoExchange.Net library. But It's possible. I can do it when I am free to develop, in next days

burakoner commented 2 years ago

Hi. Please take a look to https://www.nuget.org/packages/OKEx.Net/5.1.3 or https://github.com/burakoner/OKEx.Net/commit/1892e867c6e19c0ffaaee244dde35815ce41de3b. It has been fixed.