List open positions and pending limit orders
curl --request GET \
--url https://tx-builder-testnet.avantisfi.com/v2/positionsimport requests
url = "https://tx-builder-testnet.avantisfi.com/v2/positions"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://tx-builder-testnet.avantisfi.com/v2/positions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://tx-builder-testnet.avantisfi.com/v2/positions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://tx-builder-testnet.avantisfi.com/v2/positions"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://tx-builder-testnet.avantisfi.com/v2/positions")
.asString();require 'uri'
require 'net/http'
url = URI("https://tx-builder-testnet.avantisfi.com/v2/positions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"ok": true,
"data": {
"trader": "0x0000000000000000000000000000000000000000",
"trades": [
{
"trade": {
"trader": "0x0000000000000000000000000000000000000000",
"pairIndex": "<string>",
"index": "<string>",
"initialPosToken": "<string>",
"positionSizeUSDC": "<string>",
"openPrice": "<string>",
"buy": true,
"leverage": "<string>",
"tp": "<string>",
"sl": "<string>",
"timestamp": "<string>"
},
"tradeInfo": {
"openInterestUSDC": "<string>",
"tpLastUpdated": "<string>",
"slLastUpdated": "<string>",
"beingMarketClosed": true,
"lossProtection": "<string>"
},
"rolloverFee": "<string>",
"liquidationPrice": "<string>",
"isPnl": true,
"coinExposure": "<string>"
}
],
"orders": [
{
"order": {
"trader": "0x0000000000000000000000000000000000000000",
"pairIndex": "<string>",
"index": "<string>",
"positionSize": "<string>",
"buy": true,
"leverage": "<string>",
"tp": "<string>",
"sl": "<string>",
"price": "<string>",
"slippageP": "<string>",
"block": "<string>",
"executionFee": "<string>"
},
"liquidationPrice": "<string>",
"orderType": 123,
"coinExposure": "<string>"
}
]
}
}{
"ok": false,
"error": {
"code": "BAD_REQUEST",
"message": "<string>",
"details": "<unknown>"
}
}Reads
List open positions and pending limit orders
Reads all open positions (with liquidation price, exposure, and the open timestamp needed for close intents) and pending limit orders for a trader, directly from chain via the Multicall aggregator. All numeric values are decimal strings in on-chain units (USDC 1e6, prices/leverage 1e10).
GET
/
v2
/
positions
List open positions and pending limit orders
curl --request GET \
--url https://tx-builder-testnet.avantisfi.com/v2/positionsimport requests
url = "https://tx-builder-testnet.avantisfi.com/v2/positions"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://tx-builder-testnet.avantisfi.com/v2/positions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://tx-builder-testnet.avantisfi.com/v2/positions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://tx-builder-testnet.avantisfi.com/v2/positions"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://tx-builder-testnet.avantisfi.com/v2/positions")
.asString();require 'uri'
require 'net/http'
url = URI("https://tx-builder-testnet.avantisfi.com/v2/positions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"ok": true,
"data": {
"trader": "0x0000000000000000000000000000000000000000",
"trades": [
{
"trade": {
"trader": "0x0000000000000000000000000000000000000000",
"pairIndex": "<string>",
"index": "<string>",
"initialPosToken": "<string>",
"positionSizeUSDC": "<string>",
"openPrice": "<string>",
"buy": true,
"leverage": "<string>",
"tp": "<string>",
"sl": "<string>",
"timestamp": "<string>"
},
"tradeInfo": {
"openInterestUSDC": "<string>",
"tpLastUpdated": "<string>",
"slLastUpdated": "<string>",
"beingMarketClosed": true,
"lossProtection": "<string>"
},
"rolloverFee": "<string>",
"liquidationPrice": "<string>",
"isPnl": true,
"coinExposure": "<string>"
}
],
"orders": [
{
"order": {
"trader": "0x0000000000000000000000000000000000000000",
"pairIndex": "<string>",
"index": "<string>",
"positionSize": "<string>",
"buy": true,
"leverage": "<string>",
"tp": "<string>",
"sl": "<string>",
"price": "<string>",
"slippageP": "<string>",
"block": "<string>",
"executionFee": "<string>"
},
"liquidationPrice": "<string>",
"orderType": 123,
"coinExposure": "<string>"
}
]
}
}{
"ok": false,
"error": {
"code": "BAD_REQUEST",
"message": "<string>",
"details": "<unknown>"
}
}Query Parameters
The trader whose positions and orders are listed.
⌘I