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

I Cannot Send Orders in Hedge Mode. #1483

Open
MatrixYusuf opened this issue Feb 15, 2025 · 0 comments
Open

I Cannot Send Orders in Hedge Mode. #1483

MatrixYusuf opened this issue Feb 15, 2025 · 0 comments

Comments

@MatrixYusuf
Copy link

Hello. Thanks a lot for this super api. While hedge mode is active, I cannot send orders with the link request below. Can you share an example code that will allow me to send orders while hedge mode is active?

`var services = new ServiceCollection();

services.AddBinance((restClientOptions, socketClientOptions) =>
{
restClientOptions.ApiCredentials = new BinanceApiCredentials(textapi.Text, textsecret.Text);
restClientOptions.SpotApiOptions = new BinanceApiClientOptions
{
AutoTimestamp = true,
TimestampRecalculationInterval = TimeSpan.FromMinutes(30),
RateLimitingBehaviour = RateLimitingBehaviour.Wait
};
restClientOptions.LogLevel = LogLevel.Trace;
restClientOptions.LogWriters = new List { new ConsoleLogger() };

socketClientOptions.ApiCredentials = new BinanceApiCredentials(textapi.Text, textsecret.Text);
socketClientOptions.UsdFuturesStreamsOptions = new BinanceSocketApiClientOptions
{
    
    AutoReconnect = true,
    ReconnectInterval = TimeSpan.FromSeconds(15)
};

}, ServiceLifetime.Transient);

var serviceProvider = services.BuildServiceProvider();

var restClient = serviceProvider.GetRequiredService();`

This is the structure I send orders to.

var longemir = await restClient.UsdFuturesApi.Trading.PlaceOrderAsync(listBox1.SelectedItem.ToString() + "USDT", OrderSide.Buy, FuturesOrderType.Market, quantity: Convert.ToDecimal(textBox1.Text));

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