Active Position
curl --request POST \
--url https://api.datadash.xyz/api/v1/positions/active \
--header 'Content-Type: application/json' \
--data '
{
"orderBy": [
{
"direction": "desc",
"field": "value"
}
],
"page": {
"limit": 50,
"offset": 0
},
"userId": {
"operator": "in",
"value": [
"0x1234567890abcdef1234567890abcdef12345678"
]
}
}
'import requests
url = "https://api.datadash.xyz/api/v1/positions/active"
payload = {
"orderBy": [
{
"direction": "desc",
"field": "value"
}
],
"page": {
"limit": 50,
"offset": 0
},
"userId": {
"operator": "in",
"value": ["0x1234567890abcdef1234567890abcdef12345678"]
}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
orderBy: [{direction: 'desc', field: 'value'}],
page: {limit: 50, offset: 0},
userId: {operator: 'in', value: ['0x1234567890abcdef1234567890abcdef12345678']}
})
};
fetch('https://api.datadash.xyz/api/v1/positions/active', 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://api.datadash.xyz/api/v1/positions/active",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'orderBy' => [
[
'direction' => 'desc',
'field' => 'value'
]
],
'page' => [
'limit' => 50,
'offset' => 0
],
'userId' => [
'operator' => 'in',
'value' => [
'0x1234567890abcdef1234567890abcdef12345678'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.datadash.xyz/api/v1/positions/active"
payload := strings.NewReader("{\n \"orderBy\": [\n {\n \"direction\": \"desc\",\n \"field\": \"value\"\n }\n ],\n \"page\": {\n \"limit\": 50,\n \"offset\": 0\n },\n \"userId\": {\n \"operator\": \"in\",\n \"value\": [\n \"0x1234567890abcdef1234567890abcdef12345678\"\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.datadash.xyz/api/v1/positions/active")
.header("Content-Type", "application/json")
.body("{\n \"orderBy\": [\n {\n \"direction\": \"desc\",\n \"field\": \"value\"\n }\n ],\n \"page\": {\n \"limit\": 50,\n \"offset\": 0\n },\n \"userId\": {\n \"operator\": \"in\",\n \"value\": [\n \"0x1234567890abcdef1234567890abcdef12345678\"\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.datadash.xyz/api/v1/positions/active")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"orderBy\": [\n {\n \"direction\": \"desc\",\n \"field\": \"value\"\n }\n ],\n \"page\": {\n \"limit\": 50,\n \"offset\": 0\n },\n \"userId\": {\n \"operator\": \"in\",\n \"value\": [\n \"0x1234567890abcdef1234567890abcdef12345678\"\n ]\n }\n}"
response = http.request(request)
puts response.read_body[
{
"avgBuyPrice": 123,
"invested": 123,
"roi": 123,
"shares": 123,
"token": {
"eventId": 123,
"eventSlug": "<string>",
"isYesToken": true,
"marketClosed": true,
"marketClosedTime": "2023-11-07T05:31:56Z",
"marketEndDate": "2023-11-07T05:31:56Z",
"marketGroupItemTitle": "<string>",
"marketIcon": "<string>",
"marketId": 123,
"marketLiquidity": 123,
"marketOneDayPriceChange": 123,
"marketOpenInterest": 123,
"marketQuestion": "<string>",
"marketSlug": "<string>",
"marketStartDate": "2023-11-07T05:31:56Z",
"marketTraders": 123,
"marketTrades": 123,
"marketVolume": 123,
"marketVolume24h": 123,
"positionId": 123,
"tagIds": [
123
],
"tokenId": "<string>",
"tokenName": "<string>",
"tokenPrice": 123
},
"tokenId": "<string>",
"unrealizedCurrentPrice": 123,
"unrealizedPnl": 123,
"value": 123
}
]{
"code": "<string>",
"message": "<string>"
}{
"code": "<string>",
"message": "<string>"
}Positions
Active Position
Currently held (open) positions with unrealized PnL for a wallet or cohort. One row per position token; open (unresolved) markets only.
POST
/
api
/
v1
/
positions
/
active
Active Position
curl --request POST \
--url https://api.datadash.xyz/api/v1/positions/active \
--header 'Content-Type: application/json' \
--data '
{
"orderBy": [
{
"direction": "desc",
"field": "value"
}
],
"page": {
"limit": 50,
"offset": 0
},
"userId": {
"operator": "in",
"value": [
"0x1234567890abcdef1234567890abcdef12345678"
]
}
}
'import requests
url = "https://api.datadash.xyz/api/v1/positions/active"
payload = {
"orderBy": [
{
"direction": "desc",
"field": "value"
}
],
"page": {
"limit": 50,
"offset": 0
},
"userId": {
"operator": "in",
"value": ["0x1234567890abcdef1234567890abcdef12345678"]
}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
orderBy: [{direction: 'desc', field: 'value'}],
page: {limit: 50, offset: 0},
userId: {operator: 'in', value: ['0x1234567890abcdef1234567890abcdef12345678']}
})
};
fetch('https://api.datadash.xyz/api/v1/positions/active', 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://api.datadash.xyz/api/v1/positions/active",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'orderBy' => [
[
'direction' => 'desc',
'field' => 'value'
]
],
'page' => [
'limit' => 50,
'offset' => 0
],
'userId' => [
'operator' => 'in',
'value' => [
'0x1234567890abcdef1234567890abcdef12345678'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.datadash.xyz/api/v1/positions/active"
payload := strings.NewReader("{\n \"orderBy\": [\n {\n \"direction\": \"desc\",\n \"field\": \"value\"\n }\n ],\n \"page\": {\n \"limit\": 50,\n \"offset\": 0\n },\n \"userId\": {\n \"operator\": \"in\",\n \"value\": [\n \"0x1234567890abcdef1234567890abcdef12345678\"\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.datadash.xyz/api/v1/positions/active")
.header("Content-Type", "application/json")
.body("{\n \"orderBy\": [\n {\n \"direction\": \"desc\",\n \"field\": \"value\"\n }\n ],\n \"page\": {\n \"limit\": 50,\n \"offset\": 0\n },\n \"userId\": {\n \"operator\": \"in\",\n \"value\": [\n \"0x1234567890abcdef1234567890abcdef12345678\"\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.datadash.xyz/api/v1/positions/active")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"orderBy\": [\n {\n \"direction\": \"desc\",\n \"field\": \"value\"\n }\n ],\n \"page\": {\n \"limit\": 50,\n \"offset\": 0\n },\n \"userId\": {\n \"operator\": \"in\",\n \"value\": [\n \"0x1234567890abcdef1234567890abcdef12345678\"\n ]\n }\n}"
response = http.request(request)
puts response.read_body[
{
"avgBuyPrice": 123,
"invested": 123,
"roi": 123,
"shares": 123,
"token": {
"eventId": 123,
"eventSlug": "<string>",
"isYesToken": true,
"marketClosed": true,
"marketClosedTime": "2023-11-07T05:31:56Z",
"marketEndDate": "2023-11-07T05:31:56Z",
"marketGroupItemTitle": "<string>",
"marketIcon": "<string>",
"marketId": 123,
"marketLiquidity": 123,
"marketOneDayPriceChange": 123,
"marketOpenInterest": 123,
"marketQuestion": "<string>",
"marketSlug": "<string>",
"marketStartDate": "2023-11-07T05:31:56Z",
"marketTraders": 123,
"marketTrades": 123,
"marketVolume": 123,
"marketVolume24h": 123,
"positionId": 123,
"tagIds": [
123
],
"tokenId": "<string>",
"tokenName": "<string>",
"tokenPrice": 123
},
"tokenId": "<string>",
"unrealizedCurrentPrice": 123,
"unrealizedPnl": 123,
"value": 123
}
]{
"code": "<string>",
"message": "<string>"
}{
"code": "<string>",
"message": "<string>"
}Body
application/json
Response
List of Active Position rows