hitbtc-com / hitbtc-api

HitBTC API
GNU Lesser General Public License v3.0
322 stars 152 forks source link

Margin account of position not found #245

Closed hakabane closed 3 years ago

hakabane commented 3 years ago

When trying to close a margin BTCUSD position by calling API v2 DELETE /margin/position/BTCUSD, the API always return: { "error": { "code": 20032, "message": "Margin account of position not found" } } (as a side note : DELETE /margin/position is working fine and delete all the positions)

hakabane commented 3 years ago

Some more log from my golang client :

2020/07/24 10:58:27 dumpReq ok:GET /api/2/margin/account/BTCUSD HTTP/1.1
Host: api.hitbtc.com
Accept: application/json
Authorization: Basic ...

2020/07/24 10:58:27 dumpResponse ok:HTTP/1.1 200 OK
Content-Length: 451
Connection: keep-alive
Content-Type: application/json; charset=UTF-8
Date: Fri, 24 Jul 2020 08:58:27 GMT
Referrer-Policy: strict-origin-when-cross-origin
Request-Id: ...
Server: nginx

{"symbol":"BTCUSD","leverage":"10.00","marginBalance":"98.720275408890","marginBalanceOrders":"0","marginBalanceRequired":"28.483150199672","createdAt":"2020-07-23T14:51:02.036Z","updatedAt":"2020-07-24T08:56:12.264Z","position":{"id":1966,"symbol":"BTCUSD","quantity":"-0.02966","pnl":"0","priceEntry":"9509.08","priceMarginCall":"11840.14","priceLiquidation":"12215.69","createdAt":"2020-07-23T14:51:02.036Z","updatedAt":"2020-07-24T08:56:12.264Z"}}

2020/07/24 10:58:27 dumpReq ok:DELETE /api/2/margin/position/BTCUSD HTTP/1.1
Host: api.hitbtc.com
Accept: application/json
Authorization: Basic ...

2020/07/24 10:58:27 dumpResponse ok:HTTP/1.1 400 Bad Request
Content-Length: 73
Connection: keep-alive
Content-Type: application/json; charset=UTF-8
Date: Fri, 24 Jul 2020 08:58:27 GMT
Server: nginx

{"error":{"code":20032,"message":"Margin account of position not found"}}
panic: 400 Bad Request
hitbtc-com commented 3 years ago

Thanks a lot for the informative bug report. The bug was fixed.