1) Currently there is no notification, if a margin call happens. The position is closed. It should be easy to understand
when a position is closed because of a margin call, but if you think it may help, we can add (maybe) a note
field to position.
And which call do I have to understand? Or where would you add a note?
My bot needs to know it, when a margin call happend. I guess at the moment the position will just disappear from the open_position list? This is not enough, because positons also disappear if my bot does any new opposite margin order.
The best thing would to include the info about margin call in the
https://api.therocktrading.com/v1/funds/:fund_id/orders/id Call. *
Position Balances API call returns the balance of all positions (related to that currency pairs). Position trading balance
is the balance not locked for closing those positions.
And yes, balance and position balance are different things, depend on different calculations, so
they are two distinctive calls. Note, you should be interested in position balance only to close a position,
so you should request it only when needed. Having a single call to respond with all the balances,
might make sense on your side, but from a server point of view it would take a lot of burden,
99% of time unneeded.
Okay, I thought it would be no deal to just include 2 more values in a response, but I guess your exchange has to figure out these values, which sums up to alot of wasted time, if unnecessary.
Maybe I will calculate the position balance on my own, with help of the positions list, which I will call every few minutes, to keep track of my used margin.
I'm interested in your (and others) bot activity with margin trading: API for margin trading
can still be modified, so if there is something we can improve or would like to be modified,
we can discuss it.
/paci
Great
I will write down all my thoughts while implementing it (don't know if it will be today or the next days or later)
Some question I already have:
1) In the positions list, there is only one "amount" entry. Is this the opening amount, or the rest amount? I hope it is the rest amount, but a closed position can't have a rest amount... so it seems to be the opening amount? Then you have to add a rest amount, because when I have a 1BTC long position open and place a 0.4short position, the result in total would be a 0.6btc long position. Or will that be a new position with a new id ??
2) At place_order Call I read:
"position_id required on "close_long" and "close_short" orders only." So when placing an opposite margin order, I have to tell you, which position I want to close? Is it possible to not include a position ID and then you will close the open positions according to FIFO ?
3) How does the open_position List looks like, if I place a margin position about 1 BTC, but only 0.4 BTC are filled yet? Will this create 2 positions 0.4 btc and later 0.6 BTc ? Or how is this done?
* I just saw I can also call closed orders in the positions list (is the default parameter for status "both"?). So just include a note in that list, that a position was closed due to margin call and everything should be fine
edit:
I get the feeling, that placing a short position via API, won't close a long position automatically, like I would expect..?
So how is it done at therocktrading? I have 1 BTC long position and want to place a 0.4 short position, which should result in a 0.6 BTC long position in total. It seems at your exchange I only can close the 1BTC position completly ?
If so, this would be urgent margin trading feature request. It should be the way I described.