I open long position and the price goes high.
So my program order sell position for the exact same quantity of the long position to close the position.
However, I receive error message : {“code”: Number(-2019), “msg”: String(“Margin is insufficient.”)}
I tried both limit and market sell order, but received the same message.
What is the poblem and how can I solve it?
long order parameters:
symbol={}&side=BUY&type=MARKET&quantity={}×tamp={}
short limit paramters:
symbol={}&side=SELL&type=LIMIT&quantity={}&price={}&timeInForce=GTC×tamp={}
short market paramters:
symbol={}&side=SELL&type=MARKET&quantity={}×tamp={}