python-kucoin icon indicating copy to clipboard operation
python-kucoin copied to clipboard

No Margin trade support?

Open psychoMLM opened this issue 4 years ago • 3 comments

I searched documentation and there is no mentions on margin trades.

psychoMLM avatar Feb 26 '21 15:02 psychoMLM

You can make margin trades by copying his procedure, calling his _post method and changing the endpoint.
Example: Copy his create_market_order procedure in full. At the bottom he calls: return self._post('orders', True, data=data) change your procedure to read return <client_object>._post('margin/order', True, data=data)

Notice that the only difference is the endpoint. They work the same. I've been working with margin orders successfully with this method.

kehrli avatar May 23 '21 18:05 kehrli

How would i state level of margin like a 4x margin?

psychoMLM avatar May 24 '21 13:05 psychoMLM

Actually, I didn't confront borrowing or repaying via the api. I borrowed and repaid through the KuCoin web interface. I just used python-kucoin to buy and sell with funds already in the margin account. I think there is a way to buy, with "auto-borrow", but you would have to do the calculations for 4x margin yourself.

In general, it's pretty easy to make calls to kucoin's api by copying the procedures you'll find in python-kucoin, and tailoring them to what you need.

kehrli avatar May 24 '21 14:05 kehrli