How to repay remaining borrowed assests like in the app/site?

Hello,

Im struggle a bit…

I create a margin buy order, and then a closing order, but always i have remaining borrowing quantity… in the app or site we can click buttons „repay/repay all“, but how i can call this with the api?

Just c# code, creating test Sell Order…

client.SpotApi.Trading.PlaceMarginOrderAsync(“BTCUSDT”, OrderSide.Sell, SpotOrderType.Market, quantity: 0.1m, sideEffectType: SideEffectType.MarginBuy, isIsolated: false, price: null);

„Closing order“…
client.SpotApi.Trading.PlaceMarginOrderAsync(“BTCUSDT”, OrderSide.Buy, SpotOrderType.Market, quantity: 0.1m, sideEffectType: SideEffectType.AutoRepay, isIsolated: false, price: null);

If you see, i use marginbuy and autorepay, so i dont understand why there is always remaining quantity with autorepay…

Maybe anyone can help me :slight_smile:

Do you have enough funds to pay the generated interested? I would recommend to bring one or two margin order details to customer support. They will be helpful to understand why not all loan be repaid.

1 Like