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

Spot Socket API -> Not Working for SubAccount #117

Open
emin-karadag opened this issue Mar 18, 2023 · 1 comment
Open

Spot Socket API -> Not Working for SubAccount #117

emin-karadag opened this issue Mar 18, 2023 · 1 comment

Comments

@emin-karadag
Copy link

Hello,
I am using Bybit.Net v1.5.2.

  1. I created a sub-account to be linked to my main account.

  2. I created API Key and Secret Key for my sub-account.

  3. I wanted to listen to socket using Bybit.Net library.

But socket listen didn't work. By the way, I am using -> "Unified Trading" account for Sub-Account.

NOTE: Socket listening for my main account works successfully, subject to the condition I specified in issiue #116.

Notworking Code:

var socketClient = new BybitSocketClient(new BybitSocketClientOptions
{
    ApiCredentials = new ApiCredentials(_appSettings.ExchangeSettings.ApiKey, _appSettings.ExchangeSettings.SecretKey)
});
await socketClient.SpotStreamsV2.SubscribeToAccountUpdatesAsync(
 accountUpdate =>
 {
     if (accountUpdate is not null)
     {

     }
 }, orderUpdate =>
 {
     if (orderUpdate is not null)
     {

     }
 }, stopOrderUpdate =>
 {
     if (stopOrderUpdate is not null)
     {

     }
 }, tradeUpdate =>
 {
     if (tradeUpdate is not null)
     {

     }
 }, stoppingToken);

Notworking Code:

var socketClient = new BybitSocketClient(new BybitSocketClientOptions
{
    ApiCredentials = new ApiCredentials(_appSettings.ExchangeSettings.ApiKey, _appSettings.ExchangeSettings.SecretKey)
});

await socketClient.SpotStreamsV3.SubscribeToAccountUpdatesAsync(data =>
{
    if (data is not null)
    {

    }
}, stoppingToken);

Notworking Code:

var socketClient = new BybitSocketClient(new BybitSocketClientOptions
{
    ApiCredentials = new ApiCredentials(_appSettings.ExchangeSettings.ApiKey, _appSettings.ExchangeSettings.SecretKey)
});

await socketClient.SpotStreamsV3.SubscribeToUserOrdersUpdatesAsync(data =>
{
    if (data is not null)
    {

    }
}, stoppingToken);
@emin-karadag
Copy link
Author

NOTE: I opened a new sub-account in "Standard Account" mode, and then I was able to listen to sockets with API information.

As far as I understand, socket listening cannot be done specifically for "Unified Trading Account" mode.

It looks like this might be an issue on the Bybit side.

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

1 participant