API METHODS

Hello!!!
What is the API method to close margin positions? It is the Margin Account Cancel Order?
This method closes the position and takes the profits or losses… or it cancells the order before is
fulfilled / started?
and What parameter specifies the STOP LOSS at which I want to exit the position for risk managment?
THANKYOU!!

For spot margin order, it’s very similar to spot that you can cancel open orders.