Get position#
GET https://api.pro.anboto.xyz/api/v2/trading/position
shows the asset position != 0 ApiKeyAuth required.
Query params#
The exchange —
BINANCE, HUOBI, GATEIO, KUCOIN, OKX, BYBIT, BITGET, WOO, MEXC, BULLISH, B2C2, COINBASE_PRIME, COINBASE_INTL, HYPERLIQUID, … (15 values)subaccount stringSub-account
Headers#
| Header | ||
|---|---|---|
X-API-KEY |
string | required |
X-TIMESTAMP |
int64 ms | required |
X-SIGN |
string | required |
X-RECV-WINDOW |
int, default 5000 |
Responses#
| 200 | The list of asset positions != 0 |
| 401 | Unauthorized, Invalid Signature |
| 429 | Rate limit exceeded, retry later |
Response fields#
[].collateral numberThe collateral amount for the position
[].contracts numberThe number of contracts
[].entryPrice numberThe average entry price
[].leverage numberThe position leverage
[].liquidationPrice numberThe liquidation price
[].marginMode enumThe margin mode of the position —
CROSS, ISOLATED[].markPrice numberThe current mark price
[].notional numberThe notional value of the position
[].side enumThe position side —
LONG, SHORT, BOTH[].symbol stringThe trading symbol
[].timestamp integerUnix timestamp in milliseconds
[].unrealizedPnl numberThe unrealized profit and loss
curl -X GET "$BASE/api/v2/trading/position?exchange=BINANCE" \
-H "X-API-KEY: $API_KEY" -H "X-TIMESTAMP: $ts" \
-H "X-SIGN: $sign"
params = {"exchange": ..., "subaccount": ...}
r = requests.get(f"{BASE}/api/v2/trading/position",
params=params
headers=signed_headers_query(params))
print(r.json())
let resp = client
.get(format!("{BASE}/api/v2/trading/position?exchange=BINANCE"))
.headers(signed_headers_query(¶ms))
.send()?;
println!("{}", resp.text()?);
req, _ := http.NewRequest("GET", BASE+"/api/v2/trading/position?exchange=BINANCE", nil)
for k, v := range signedHeadersQuery(req.URL.Query()) {
req.Header.Set(k, v)
}
resp, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
io.Copy(os.Stdout, resp.Body)
HttpResponse<String> resp = client.send(
signedGet("/api/v2/trading/position?exchange=BINANCE"),
HttpResponse.BodyHandlers.ofString());
const res = await fetch(`${BASE}/api/v2/trading/position?exchange=BINANCE`, {
method: "GET",
headers: signedHeadersQuery(params),
});
const data = await res.json();
val request = signedGet("/api/v2/trading/position?exchange=BINANCE")
val response = client.send(request, HttpResponse.BodyHandlers.ofString())
println(response.body())
cpr::Response r = cpr::Get(
cpr::Url{BASE + "/api/v2/trading/position?exchange=BINANCE"},
signedHeadersQuery(params));
std::cout << r.text << std::endl;
const res = await fetch(`${BASE}/api/v2/trading/position?exchange=BINANCE`, {
method: "GET",
headers: signedHeadersQuery(params),
});
console.log(await res.json());
Response 200
[
{
"collateral": 0.0,
"contracts": 0.0,
"entryPrice": 0.0,
"leverage": 0.0,
"liquidationPrice": 0.0,
"marginMode": "CROSS",
"markPrice": 0.0,
"notional": 0.0,
"side": "LONG",
"symbol": "string",
"timestamp": 0,
"unrealizedPnl": 0.0
}
]