Get PnL data for wallet positions
curl --request GET \
--url https://markets.dial.to/api/v0/positions/pnl \
--header 'x-dialect-client-key: <api-key>'import requests
url = "https://markets.dial.to/api/v0/positions/pnl"
headers = {"x-dialect-client-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-dialect-client-key': '<api-key>'}};
fetch('https://markets.dial.to/api/v0/positions/pnl', 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://markets.dial.to/api/v0/positions/pnl",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-dialect-client-key: <api-key>"
],
]);
$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://markets.dial.to/api/v0/positions/pnl"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-dialect-client-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://markets.dial.to/api/v0/positions/pnl")
.header("x-dialect-client-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://markets.dial.to/api/v0/positions/pnl")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-dialect-client-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"currency": "USD",
"total": 123,
"realized": 123,
"unrealized": 123,
"realizedLifetime": 123,
"totalLifetime": 123,
"positions": [
{
"positionId": "<string>",
"marketId": "<string>",
"ownerAddress": "<string>",
"total": 123,
"realized": 123,
"realizedLifetime": 123,
"totalLifetime": 123,
"unrealized": 123,
"capital": {
"invested": 123,
"investedLifetime": 123,
"netFlow": 123,
"netFlowLifetime": 123
}
}
]
}Positions
Get PnL data for wallet positions
Computes realized and unrealized PnL for all pnl-able positions (currently DFlow prediction only), including closed positions.
GET
/
v0
/
positions
/
pnl
Get PnL data for wallet positions
curl --request GET \
--url https://markets.dial.to/api/v0/positions/pnl \
--header 'x-dialect-client-key: <api-key>'import requests
url = "https://markets.dial.to/api/v0/positions/pnl"
headers = {"x-dialect-client-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-dialect-client-key': '<api-key>'}};
fetch('https://markets.dial.to/api/v0/positions/pnl', 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://markets.dial.to/api/v0/positions/pnl",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-dialect-client-key: <api-key>"
],
]);
$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://markets.dial.to/api/v0/positions/pnl"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-dialect-client-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://markets.dial.to/api/v0/positions/pnl")
.header("x-dialect-client-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://markets.dial.to/api/v0/positions/pnl")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-dialect-client-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"currency": "USD",
"total": 123,
"realized": 123,
"unrealized": 123,
"realizedLifetime": 123,
"totalLifetime": 123,
"positions": [
{
"positionId": "<string>",
"marketId": "<string>",
"ownerAddress": "<string>",
"total": 123,
"realized": 123,
"realizedLifetime": 123,
"totalLifetime": 123,
"unrealized": 123,
"capital": {
"invested": 123,
"investedLifetime": 123,
"netFlow": 123,
"netFlowLifetime": 123
}
}
]
}Authorizations
Client key for the Markets API
Query Parameters
Comma separated list of owner addresses. Currently only supports one address.
Response
200 - application/json
OK
Currency of the PnL values
Total PnL for all positions within the current session, unrealized + realized PnL
Realized PnL for all positions within the current session
Unrealized PnL for all positions. If position is closed, this field will be empty.
Realized PnL for all positions across all sessions
Total PnL for all positions across all sessions, unrealized + realized lifetime PnL
List of positions that contribute to PnL calculations. Each position is a separate entry.
Show child attributes
Show child attributes
Was this page helpful?