JKorf / Bybit.Net

A C# .netstandard client library for the Bybit REST and Websocket V5 API focusing on clear usage and models
https://jkorf.github.io/Bybit.Net/
91 stars 62 forks source link

V5LinearApi.SubscribeToOrderbookUpdatesAsync() - Snapshot data not return #200

Closed moonbugkr closed 3 months ago

moonbugkr commented 3 months ago

Sorry, my English is not very good

V5LinearApi.SubscribeToOrderbookUpdatesAsync() - Snapshot data not return

I noticed that the SnapshotHandler Action is missing from the above method of Orderbook. I thought Snapshot and Delta(Update) Action were integrated. However, I could only get Delta Data, not Snapshot Data. Where should I get my Snapshot Data from?

Thanks.

JKorf commented 3 months ago

Hi, the snapshot is still available, but it has been combined in the same handler. You can check the type like this:

await bybitSocketClient.V5LinearApi.SubscribeToOrderbookUpdatesAsync("BTCUSDT", data =>
{
    if (data.UpdateType == SocketUpdateType.Snapshot)
    {
        // snapshot
    }
    else
    {
        // update
    }
});
moonbugkr commented 3 months ago

I already know what it means, and it doesn't work. Only Delta Data comes in. Check it plz.

Thanks.

JKorf commented 3 months ago

I checked it and you're right. It's an easy fix, I'll push a new version later today.

The first update the server send when subscribing is the snapshot. However it already sends this before confirming the subscription, while the subscription only accepts messages once it has been confirmed.

moonbugkr commented 3 months ago

You've made it easy and saved me time and effort, thank you.

JKorf commented 3 months ago

Fixed in version 3.6.1

moonbugkr commented 3 months ago

Thank you for the fixed version. I've sent small donations a few times, but the BTC and ETH fees are higher than before. Why don't you add addresses for coins like USDT as well?

JKorf commented 3 months ago

Yeah that was something that went through my head as well. I'll add some stablecoin alternative(s)