5 Commits

26 changed files with 1014 additions and 958 deletions
+5 -1
View File
@@ -424,4 +424,8 @@ sequenceDiagram
H-->>C: 200,neg_risk 为真 H-->>C: 200,neg_risk 为真
``` ```
GET /v2/tokens 支持逗号分隔的资产 ID 或条件及互斥组 ID。两个选择器择一,回执按资产关联市场、事件和裁决结果。 GET /v2/positions 查询钱包或单一市场的当前持仓、待赎回份额、互补仓位及已退出记录。用 pagination.next_cursor 续读时沿用原钱包或市场与筛选条件。
持仓页支持按标题、事件或最低份额与金额筛选。使用下一页游标时重发这三个筛选参数。
持仓页支持 sort_by=TIMESTAMP。start 和 end 按 Unix 秒包含两端,翻页时需重发。
+12 -12
View File
@@ -329,12 +329,12 @@ fn respond(mut req: Request, engine: &Mutex<Exchange>) -> std::io::Result<()> {
if req.method() == &Method::Get if req.method() == &Method::Get
&& matches!( && matches!(
path, path,
"/v2/tokens" "/v2/prices-history"
| "/v2/prices-history"
| "/v2/trades" | "/v2/trades"
| "/v2/resolutions" | "/v2/resolutions"
| "/v2/value" | "/v2/value"
| "/v2/oi" | "/v2/oi"
| "/v2/positions"
) )
{ {
let (status, body) = data_page(path, params, engine); let (status, body) = data_page(path, params, engine);
@@ -478,7 +478,7 @@ fn respond(mut req: Request, engine: &Mutex<Exchange>) -> std::io::Result<()> {
| "/market-clarifications" | "/market-clarifications"
| "/v2/oi" | "/v2/oi"
| "/v2/value" | "/v2/value"
| "/v2/tokens" | "/v2/positions"
| "/v2/trades" | "/v2/trades"
| "/v2/resolutions" | "/v2/resolutions"
| "/v2/prices-history", | "/v2/prices-history",
@@ -519,8 +519,8 @@ fn read_page<Q: serde::de::DeserializeOwned>(
fn data_page(path: &str, params: &str, engine: &Mutex<Exchange>) -> (u16, Value) { fn data_page(path: &str, params: &str, engine: &Mutex<Exchange>) -> (u16, Value) {
let page = match path { let page = match path {
"/v2/tokens" => read_page(params, engine, Exchange::public_tokens),
"/v2/oi" => read_page(params, engine, Exchange::public_open_interest), "/v2/oi" => read_page(params, engine, Exchange::public_open_interest),
"/v2/positions" => read_page(params, engine, Exchange::public_positions),
"/v2/value" => read_page(params, engine, Exchange::public_portfolio_value), "/v2/value" => read_page(params, engine, Exchange::public_portfolio_value),
"/v2/trades" => read_page(params, engine, Exchange::public_trade_feed), "/v2/trades" => read_page(params, engine, Exchange::public_trade_feed),
"/v2/resolutions" => read_page(params, engine, Exchange::public_resolutions), "/v2/resolutions" => read_page(params, engine, Exchange::public_resolutions),
@@ -532,14 +532,14 @@ fn data_page(path: &str, params: &str, engine: &Mutex<Exchange>) -> (u16, Value)
400, 400,
json!({"code":"invalid_request","error":message,"retryable":false}), json!({"code":"invalid_request","error":message,"retryable":false}),
), ),
Err(HistoryError::Unavailable) if path == "/v2/tokens" => (
503,
json!({"code":"unavailable","error":"token directory unavailable","retryable":true}),
),
Err(HistoryError::Unavailable) if path == "/v2/oi" => ( Err(HistoryError::Unavailable) if path == "/v2/oi" => (
503, 503,
json!({"code":"unavailable","error":"open interest unavailable","retryable":true}), json!({"code":"unavailable","error":"open interest unavailable","retryable":true}),
), ),
Err(HistoryError::Unavailable) if path == "/v2/positions" => (
503,
json!({"code":"unavailable","error":"positions unavailable","retryable":true}),
),
Err(HistoryError::Unavailable) if path == "/v2/value" => ( Err(HistoryError::Unavailable) if path == "/v2/value" => (
503, 503,
json!({"code":"unavailable","error":"portfolio valuation unavailable","retryable":true}), json!({"code":"unavailable","error":"portfolio valuation unavailable","retryable":true}),
@@ -700,16 +700,16 @@ mod tests {
assert_eq!(quoted["outcomePrices"], r#"["0.4","0.6"]"#); assert_eq!(quoted["outcomePrices"], r#"["0.4","0.6"]"#);
let empty_trades = json!({"data":[],"pagination":{"limit":100,"offset":0,"has_more":false,"next_cursor":null}}); let empty_trades = json!({"data":[],"pagination":{"limit":100,"offset":0,"has_more":false,"next_cursor":null}});
let cases = [ let cases = [
("GET","/v2/tokens?token_ids=eb:NO:s,00123,eb:NO:s,eb:YES:s",String::new(),200,Some(db.public_tokens(serde_json::from_value(json!({"token_id":"eb:NO:s,123,eb:YES:s"})).unwrap()).unwrap())),
("GET","/v2/tokens?condition=s&token_id=eb:YES:s",String::new(),400,None),
("GET","/v2/tokens?token_id=00123,123",String::new(),200,Some(json!({"data":[]}))),
("POST","/v2/tokens",String::new(),405,None),
("GET","/v2/oi?conditionId=s,s",String::new(),200,Some(json!({"data":[{"condition_id":"s","value":0}]}))), ("GET","/v2/oi?conditionId=s,s",String::new(),200,Some(json!({"data":[{"condition_id":"s","value":0}]}))),
("GET","/v2/oi?condition_id=0x0000000000000000000000000000000000000000000000000000000000000001",String::new(),200,Some(json!({"data":[]}))), ("GET","/v2/oi?condition_id=0x0000000000000000000000000000000000000000000000000000000000000001",String::new(),200,Some(json!({"data":[]}))),
("GET","/v2/oi?condition=bad-hash",String::new(),400,Some(json!({"code":"invalid_request","error":"invalid condition: bad-hash","retryable":false}))), ("GET","/v2/oi?condition=bad-hash",String::new(),400,Some(json!({"code":"invalid_request","error":"invalid condition: bad-hash","retryable":false}))),
("GET","/v2/oi",String::new(),503,None), ("GET","/v2/oi",String::new(),503,None),
("POST","/v2/oi",String::new(),405,None), ("POST","/v2/oi",String::new(),405,None),
("GET","/v2/value?user=0x0000000000000000000000000000000000000001",String::new(),200,Some(json!({"data":{"proxy_wallet":"0x0000000000000000000000000000000000000001","value":0}}))), ("GET","/v2/value?user=0x0000000000000000000000000000000000000001",String::new(),200,Some(json!({"data":{"proxy_wallet":"0x0000000000000000000000000000000000000001","value":0}}))),
("GET","/v2/positions?user=0x0000000000000000000000000000000000000001",String::new(),200,Some(json!({"data":[],"pagination":{"limit":100,"offset":0,"has_more":false,"next_cursor":null}}))),
("GET","/v2/positions",String::new(),400,None),
("GET","/v2/positions?user=unpriced-owner&cursor=invalid",String::new(),400,None),
("POST","/v2/positions",String::new(),405,None),
("GET","/v2/value",String::new(),400,None), ("GET","/v2/value",String::new(),400,None),
("GET","/v2/value?user=unpriced-owner",String::new(),503,None), ("GET","/v2/value?user=unpriced-owner",String::new(),503,None),
("GET","/v2/value?user=a&condition=",String::new(),400,None), ("GET","/v2/value?user=a&condition=",String::new(),400,None),
+13 -15
View File
@@ -1436,28 +1436,26 @@ sequenceDiagram
``` ```
### Data API 资产目录 ### 公开持仓生命周期
```mermaid ```mermaid
flowchart LR flowchart LR
http["cli/market_http.rs"] --> directory["token_directory.rs"] cli["cli/market_http.rs"] --> positions["portfolio/positions.rs"]
directory --> ids["assets.rs"] positions --> sql["portfolio/positions.sql"]
directory --> sql["token_directory.sql"] sql --> activity["成交、钱包流水及分侧赎回时间"]
sql --> catalog["市场、事件目录和互斥组"] positions --> mark["portfolio.rs 中的估值"]
positions --> cost["portfolio/economics.rs"]
cost --> fills["portfolio/economics.sql"]
``` ```
```mermaid ```mermaid
sequenceDiagram sequenceDiagram
participant H as HTTP participant H as HTTP
participant E as public_tokens participant P as public_positions
participant D as SQLite participant D as SQLite
H->>E: 结果资产、市场条件或互斥组 H->>P: 钱包或市场、持仓状态和游标
E->>E: 校验选择器、合并重复值 P->>D: 清理到期任务并读取同一快照中的仓位与市场
E->>D: 同一快照读取目录、结果及裁决 D-->>P: 持仓、配对份额、裁决、目录及活动时间
D-->>E: 结果标签、互补资产、事件及兑付 P->>P: 按有效排序键保留一页、签署下一页游标
E-->>H: 按请求顺序返回 data P-->>H: data 和 pagination
``` ```
`bind_polymarket_assets` 将完整协议配对绑定到已创建的本地市场。操作员用 zero_outcome 声明外场结果索引 0 对应本地 YES 或 NO。绑定和请求回执在同一事务提交。数字资产、外场条件和已绑定的结构条件可通过 GET /v2/tokens 反查;响应附带 local_asset_id。成交流程继续通过本地资产提交委托。
同一配对可携带 observed_at_ms 刷新外场状态。旧快照不会覆盖新状态,最终兑付冲突会回滚。
-2
View File
@@ -9,8 +9,6 @@ pub(crate) enum Command {
micros: Option<i64>, micros: Option<i64>,
}, },
Event(crate::catalog::Event), Event(crate::catalog::Event),
#[serde(rename = "bind_polymarket_assets")]
BindPolymarketAssets(crate::token_aliases::Bind),
#[serde(rename = "reschedule_sports")] #[serde(rename = "reschedule_sports")]
RescheduleSports { RescheduleSports {
event: String, event: String,
+1 -3
View File
@@ -41,8 +41,6 @@ mod resident;
mod resolution; mod resolution;
mod tick_changes; mod tick_changes;
mod tick_size; mod tick_size;
mod token_aliases;
mod token_directory;
use resident::Books; use resident::Books;
use anyhow::{ensure, Context, Result}; use anyhow::{ensure, Context, Result};
@@ -56,12 +54,12 @@ pub use gamma_directory::DirectoryKey;
pub use gamma_list::DirectoryResource; pub use gamma_list::DirectoryResource;
pub use open_interest::InterestQuery; pub use open_interest::InterestQuery;
pub use portfolio::http::ValueQuery; pub use portfolio::http::ValueQuery;
pub use portfolio::positions::PositionQuery;
pub use prices_history::http::HistoryQuery; pub use prices_history::http::HistoryQuery;
pub use prices_history::legacy::ClobHistoryQuery; pub use prices_history::legacy::ClobHistoryQuery;
pub use public_trades::http::TradeQuery; pub use public_trades::http::TradeQuery;
pub use quotes::{PriceQueryError, PriceRequest, PriceSide}; pub use quotes::{PriceQueryError, PriceRequest, PriceSide};
pub use resolution::http::ResolutionQuery; pub use resolution::http::ResolutionQuery;
pub use token_directory::TokenDirectoryQuery;
#[derive(Debug)] #[derive(Debug)]
pub enum MarketDataError { pub enum MarketDataError {
+13 -1
View File
@@ -16,7 +16,6 @@ pub(crate) fn apply(
request_id: &str, request_id: &str,
) -> Result<Value> { ) -> Result<Value> {
match command { match command {
Command::BindPolymarketAssets(binding) => binding.register(tx),
Command::Fund { Command::Fund {
account, account,
cents, cents,
@@ -480,6 +479,19 @@ fn redeem(
request_id: &str, request_id: &str,
amounts: Option<[i64; 2]>, amounts: Option<[i64; 2]>,
) -> Result<i64> { ) -> Result<i64> {
tx.execute(
"INSERT INTO position_redemption_times(account,market,outcome,at_ms)
SELECT account,market,outcome,CAST(unixepoch('subsec')*1000 AS INTEGER)
FROM position_units WHERE account=?1 AND market=?2 AND available>0
AND (?3 IS NULL OR CASE outcome WHEN 'YES' THEN ?3 ELSE ?4 END>0)
ON CONFLICT(account,market,outcome) DO UPDATE SET at_ms=excluded.at_ms",
params![
account,
market,
amounts.map(|a| a[0]),
amounts.map(|a| a[1])
],
)?;
let (shares, paid) = match amounts { let (shares, paid) = match amounts {
Some(amounts) => crate::neg_risk::burn_for_redemption(tx, market, account, amounts)?, Some(amounts) => crate::neg_risk::burn_for_redemption(tx, market, account, amounts)?,
None => burn_full_balance(tx, market, account)?, None => burn_full_balance(tx, market, account)?,
+2
View File
@@ -1,4 +1,6 @@
mod economics;
pub(crate) mod http; pub(crate) mod http;
pub(crate) mod positions;
mod protocol; mod protocol;
use crate::{ use crate::{
+166
View File
@@ -0,0 +1,166 @@
use crate::{inventory::decimal, lots};
use rusqlite::{params, Connection};
use serde_json::{json, Value};
const DOLLAR: i64 = 1_000_000;
// Dollars rounded to four places for position basis and PnL. Fees retain the
// exact ledger precision separately, and total cost sums the served columns.
pub(super) fn round_money(micros: i128) -> i128 {
micros.signum() * ((micros.abs() + 50) / 100) * 100
}
#[derive(Default)]
pub(super) struct Cost {
held_lots: i128,
bought_lots: i128,
lifetime_principal: i128,
principal: i128,
entry_fees: i128,
realized: i128,
}
impl Cost {
fn fill(&mut self, side: &str, quantity: i64, price: i64, fee: i64) -> Option<()> {
let qty = i128::from(quantity);
let amount = qty * i128::from(price);
let fee = i128::from(fee);
match side {
"buy" => {
self.held_lots += qty;
self.bought_lots += qty;
self.principal += amount;
self.lifetime_principal += amount;
self.entry_fees += fee;
self.realized -= fee;
}
"sell" if qty > 0 && qty <= self.held_lots => {
let basis = self.principal.checked_mul(qty)? / self.held_lots;
let entry_fees = self.entry_fees.checked_mul(qty)? / self.held_lots;
self.held_lots -= qty;
self.principal -= basis;
self.entry_fees -= entry_fees;
self.realized += amount - basis - fee;
}
_ => return None,
}
Some(())
}
fn avg_price(&self) -> Option<i128> {
let (basis, lots) = if self.held_lots > 0 {
(self.principal, self.held_lots)
} else {
(self.lifetime_principal, self.bought_lots)
};
(lots > 0).then(|| {
let scale = i128::from(crate::lots::PER_SHARE);
round_money((basis * scale + lots / 2) / lots)
})
}
fn realized_pnl(&self) -> i128 {
round_money(self.realized)
}
fn unrealized_pnl(&self, value: Option<i128>) -> Option<i128> {
value.map(|v| round_money(v) - round_money(self.principal))
}
pub(super) fn fields(&self, current_value: Option<i128>) -> Value {
let basis = round_money(self.principal);
let realized = self.realized_pnl();
let unrealized = self.unrealized_pnl(current_value);
json!({
"avg_price": self.avg_price().map(|v| decimal(v,DOLLAR)),
"total_size": decimal(self.bought_lots,lots::PER_SHARE),
"entry_cost_usdc":decimal(basis,DOLLAR),
"entry_fees_usdc":decimal(self.entry_fees,DOLLAR),
"total_cost_usdc":decimal(basis+self.entry_fees,DOLLAR),
"realized_pnl":decimal(realized,DOLLAR),
"unrealized_pnl":unrealized.map(|v|decimal(v,DOLLAR)),
"total_pnl":unrealized.map(|v|decimal(v+realized,DOLLAR)),
})
}
}
#[derive(Clone, Copy)]
pub(super) enum Metric {
Average,
Realized,
Unrealized,
Total,
}
impl Metric {
pub(super) fn parse(sort: &str) -> Option<Self> {
match sort {
"AVG_PRICE" => Some(Self::Average),
"REALIZED_PNL" => Some(Self::Realized),
"UNREALIZED_PNL" => Some(Self::Unrealized),
"TOTAL_PNL" => Some(Self::Total),
_ => None,
}
}
pub(super) fn rank(self, cost: &Cost, value: Option<i128>) -> Option<i128> {
match self {
Self::Average => cost.avg_price(),
Self::Realized => Some(cost.realized_pnl()),
Self::Unrealized => cost.unrealized_pnl(value),
Self::Total => cost.unrealized_pnl(value).map(|p| p + cost.realized_pnl()),
}
}
}
/// Reconstruct basis only when the recorded fills explain the actual holding.
pub(super) fn read(
db: &Connection,
account: &str,
market: &str,
outcome: &str,
current_size: i64,
) -> rusqlite::Result<Option<Cost>> {
let mut stmt = db.prepare_cached(include_str!("economics.sql"))?;
let mut rows = stmt.query(params![account, market, outcome])?;
let mut cost = Cost::default();
while let Some(row) = rows.next()? {
let side: String = row.get(0)?;
if cost
.fill(&side, row.get(2)?, row.get(1)?, row.get(3)?)
.is_none()
{
return Ok(None);
}
}
if cost.bought_lots == 0
|| cost.held_lots * i128::from(lots::MICROS) != i128::from(current_size)
{
return Ok(None);
}
Ok(Some(cost))
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn prorates_entry_basis_and_fees_after_a_partial_sale() {
let mut cost = Cost::default();
cost.fill("buy", 600, 4000, 600).unwrap();
cost.fill("buy", 400, 6500, 400).unwrap();
cost.fill("sell", 300, 8000, 300).unwrap();
assert_eq!(
cost.fields(Some(4_200_000)),
json!({
"avg_price":0.5, "total_size":10, "entry_cost_usdc":3.5,
"entry_fees_usdc":0.0007, "total_cost_usdc":3.5007,
"realized_pnl":0.8987, "unrealized_pnl":0.7, "total_pnl":1.5987
})
);
assert!(cost.fill("sell", 701, 5000, 0).is_none());
cost.fill("sell", 700, 5000, 0).unwrap();
assert_eq!(cost.fields(Some(0))["entry_cost_usdc"], 0);
}
}
@@ -0,0 +1,18 @@
SELECT t.side,t.price,t.quantity,COALESCE(f.fee_micros,0)
FROM wallet_trade_legs t
LEFT JOIN execution_fees f ON f.execution=t.execution AND f.taker_order=t.order_seq
WHERE t.account=?1 AND t.market=?2 AND t.outcome=?3
-- A fill-only reconstruction cannot assign basis to these custody changes.
AND NOT EXISTS (
SELECT 1 FROM wallet_movements w
WHERE w.account=?1 AND w.market=?2 AND w.kind IN ('SPLIT','MERGE','REDEEM')
)
AND NOT EXISTS (
SELECT 1 FROM neg_risk_members n WHERE n.market=?2 AND (
EXISTS (SELECT 1 FROM wallet_movements w
WHERE w.account=?1 AND w.group_id=n.group_id AND w.kind='CONVERSION')
OR EXISTS (SELECT 1 FROM neg_risk_conversion_fees f
WHERE f.group_id=n.group_id AND f.vault=?1)
)
)
ORDER BY t.execution,t.order_seq
+429
View File
@@ -0,0 +1,429 @@
use crate::{
assets, expiry,
inventory::{decimal, UNIT},
validation::{condition_filter, hex_id, identifier},
Exchange, MarketDataError,
};
use data_encoding::BASE64URL_NOPAD;
use hmac::{Hmac, Mac};
use rusqlite::{params, Connection, TransactionBehavior};
use serde::{Deserialize, Serialize};
use serde_json::{json, Value};
use sha2::Sha256;
use std::collections::BTreeMap;
#[derive(Deserialize)]
#[serde(deny_unknown_fields)]
pub struct PositionQuery {
user: Option<String>,
#[serde(alias = "condition_id", alias = "conditionId")]
condition: Option<String>,
status: Option<String>,
#[serde(alias = "eventId")]
event_id: Option<String>,
title: Option<String>,
#[serde(alias = "filterType")]
filter_type: Option<String>,
#[serde(alias = "filterAmount")]
filter_amount: Option<f64>,
#[serde(alias = "sortBy")]
sort_by: Option<String>,
#[serde(alias = "sortDirection")]
sort_direction: Option<String>,
#[serde(alias = "includeArchived")]
include_archived: Option<bool>,
start: Option<i64>,
end: Option<i64>,
limit: Option<u32>,
cursor: Option<String>,
}
#[derive(Serialize, Deserialize, PartialEq, Eq)]
struct Selection {
user: Option<String>,
conditions: Option<String>,
status: String,
sort: String,
direction: String,
archived: bool,
}
#[derive(Serialize, Deserialize)]
struct Cursor {
selection: Selection,
limit: u32,
offset: u64,
last: Key,
}
// Negate only the numeric rank for descending order. Identity is a stable
// tie-breaker regardless of direction or changes elsewhere in the portfolio.
type Key = (bool, i64, String, String, String);
fn invalid(message: &str) -> MarketDataError {
MarketDataError::Invalid(message.to_owned())
}
impl Cursor {
fn mac(db: &Connection) -> Result<Hmac<Sha256>, MarketDataError> {
let secret: Vec<u8> = db.query_row(
"SELECT secret FROM trade_cursor_key WHERE singleton=1",
[],
|row| row.get(0),
)?;
let mut mac =
Hmac::<Sha256>::new_from_slice(&secret).map_err(|_| MarketDataError::Unavailable)?;
mac.update(b"eventbook:/v2/positions:v1\0");
Ok(mac)
}
fn decode(db: &Connection, encoded: &str) -> Result<Self, MarketDataError> {
let bad = || invalid("invalid position cursor");
if encoded.len() > 8192 {
return Err(bad());
}
let bytes = BASE64URL_NOPAD
.decode(encoded.as_bytes())
.map_err(|_| bad())?;
let split = bytes.len().checked_sub(32).ok_or_else(bad)?;
let (payload, signature) = bytes.split_at(split);
let mut mac = Self::mac(db)?;
mac.update(payload);
mac.verify_slice(signature).map_err(|_| bad())?;
serde_json::from_slice(payload).map_err(|_| bad())
}
fn encode(&self, db: &Connection) -> Result<String, MarketDataError> {
let mut bytes = serde_json::to_vec(self).map_err(|_| MarketDataError::Unavailable)?;
let mut mac = Self::mac(db)?;
mac.update(&bytes);
bytes.extend_from_slice(&mac.finalize().into_bytes());
Ok(BASE64URL_NOPAD.encode(&bytes))
}
}
impl Exchange {
pub fn public_positions(&self, query: PositionQuery) -> Result<Value, MarketDataError> {
let tx = expiry::transaction(&self.db, TransactionBehavior::Deferred)
.map_err(|_| MarketDataError::Unavailable)?;
let mut user = query.user;
let wallet = user.as_deref().is_some_and(|id| hex_id(id, 40));
if let Some(id) = &mut user {
if wallet {
id.make_ascii_lowercase();
if super::protocol::CONTRACTS
.iter()
.any(|c| c.eq_ignore_ascii_case(id))
{
return Err(invalid("protocol contract is not a user"));
}
} else {
identifier(id).map_err(|_| invalid("invalid user"))?;
if !tx.query_row(
"SELECT EXISTS(SELECT 1 FROM accounts WHERE id=?1)",
[&*id],
|r| r.get::<_, bool>(0),
)? {
return Err(invalid("invalid user"));
}
}
}
if query.event_id.is_some() && (query.condition.is_some() || user.is_none()) {
return Err(invalid(if query.condition.is_some() {
"must provide either eventId or condition, not both"
} else {
"event_id requires a user"
}));
}
let events = query
.event_id
.as_deref()
.map(|raw| {
let ids: std::collections::BTreeSet<_> = raw
.split(',')
.map(str::trim)
.filter(|s| !s.is_empty())
.collect();
if ids.len() > 20 {
return Err(invalid("expected at most 20 event ids"));
}
let numeric: Vec<i64> = ids.into_iter().filter_map(|id| id.parse().ok()).collect();
serde_json::to_string(&numeric).map_err(|_| MarketDataError::Unavailable)
})
.transpose()?;
let title = query
.title
.as_deref()
.map(str::trim)
.filter(|s| !s.is_empty());
if title.is_some_and(|s| s.chars().count() > 200) {
return Err(invalid("title exceeds 200 characters"));
}
let title = title.map(|s| format!("%{s}%"));
let cash = match query.filter_type.as_deref() {
None => false,
Some(name) if name.eq_ignore_ascii_case("TOKENS") => false,
Some(name) if name.eq_ignore_ascii_case("CASH") => true,
Some(_) => return Err(invalid("filterType must be CASH or TOKENS")),
};
let floor = query
.filter_amount
.filter(|v| v.is_finite() && *v >= 0.0)
.map_or(0, |v| (v * UNIT as f64).ceil() as i64);
let shares_floor = if cash { 100_000 } else { floor.max(100_000) };
let conditions = condition_filter(query.condition.as_deref(), &tx)?;
if user.is_none() {
let count = conditions
.as_ref()
.map(|s| serde_json::from_str::<Vec<String>>(s))
.transpose()
.map_err(|_| MarketDataError::Unavailable)?
.map_or(0, |ids| ids.len());
if count != 1 {
return Err(invalid("expected a user or exactly one condition"));
}
}
let start = query.start.filter(|n| *n > 0);
let end = query.end.filter(|n| *n > 0);
if matches!((start, end), (Some(a), Some(b)) if b < a) {
return Err(invalid("end must not be before start"));
}
let cursor = query
.cursor
.as_deref()
.map(|encoded| Cursor::decode(&tx, encoded))
.transpose()?;
let prior = cursor.as_ref().map(|p| &p.selection);
let mut status = query
.status
.or_else(|| prior.map(|s| s.status.clone()))
.unwrap_or_else(|| "OPEN".into());
if !matches!(
status.as_str(),
"OPEN" | "CLOSED" | "REDEEMABLE" | "REDEEMABLE_LOST" | "MERGEABLE"
) || (user.is_none() && status == "REDEEMABLE_LOST")
{
return Err(invalid("invalid position status"));
}
if user.is_none() && status == "MERGEABLE" {
status = "OPEN".into();
}
if status == "CLOSED" && query.include_archived.is_some() {
return Err(invalid("include_archived is unavailable for CLOSED"));
}
let mut sort = query
.sort_by
.or_else(|| prior.map(|s| s.sort.clone()))
.unwrap_or_else(|| {
match status.as_str() {
"MERGEABLE" => "TOKENS",
"CLOSED" if user.is_some() => "REALIZED_PNL",
_ => "CURRENT_VALUE",
}
.into()
});
if user.is_some()
&& matches!(status.as_str(), "CLOSED" | "REDEEMABLE_LOST")
&& sort == "AVG_PRICE"
{
return Err(invalid(
"sortBy=AVG_PRICE is not supported on a user's CLOSED or REDEEMABLE_LOST positions",
));
}
if user.is_some()
&& status == "CLOSED"
&& matches!(
sort.as_str(),
"TOKENS" | "CURRENT_VALUE" | "PRICE" | "UNREALIZED_PNL"
)
{
sort = "REALIZED_PNL".into();
}
let metric = super::economics::Metric::parse(&sort);
let direction = query
.sort_direction
.or_else(|| prior.map(|s| s.direction.clone()))
.unwrap_or_else(|| "DESC".into());
if (metric.is_none()
&& !matches!(
sort.as_str(),
"CURRENT_VALUE" | "PRICE" | "TOKENS" | "TIMESTAMP"
))
|| !matches!(direction.as_str(), "ASC" | "DESC")
{
return Err(invalid("invalid or unsupported position sort"));
}
let selection = Selection {
user,
conditions,
status,
sort,
direction,
archived: query
.include_archived
.or_else(|| prior.map(|s| s.archived))
.unwrap_or(false),
};
let limit = cursor
.as_ref()
.map_or(query.limit.unwrap_or(100), |p| p.limit);
if limit > 1000 || cursor.as_ref().is_some_and(|p| p.selection != selection) {
return Err(invalid("invalid position limit or cursor filters"));
}
let offset = cursor.as_ref().map_or(0, |p| p.offset);
let mut page = BTreeMap::new();
if limit != 0 {
let mut stmt = tx.prepare_cached(include_str!("positions.sql"))?;
let mut rows = stmt.query(params![
selection.user,
wallet,
selection.conditions,
selection.status,
selection.archived,
events,
title,
shares_floor,
start,
end
])?;
while let Some(row) = rows.next()? {
let account: String = row.get(0)?;
let market: String = row.get(1)?;
let outcome: String = row.get(2)?;
let size: i64 = row.get(3)?;
let phase: String = row.get(4)?;
let payout: Option<i64> = row.get(5)?;
let mark = super::price(&tx, &market, &outcome, &phase, payout)
.map_err(|_| MarketDataError::Unavailable)?
.map(|(price, _)| price);
let value = super::holding_value(size, mark);
if cash && floor > 0 && value.is_none_or(|v| v < i128::from(floor)) {
continue;
}
let last_event_at: Option<i64> = row.get(13)?;
let first_entry_at: Option<i64> = row.get(14)?;
let (rank, cost) = if let Some(metric) = metric {
let cost = super::economics::read(&tx, &account, &market, &outcome, size)?;
let rank = cost.as_ref().and_then(|c| metric.rank(c, value));
let rank = rank
.map(i64::try_from)
.transpose()
.map_err(|_| MarketDataError::Unavailable)?;
(rank, cost)
} else {
let rank = match selection.sort.as_str() {
"TIMESTAMP" => last_event_at,
"TOKENS" => Some(size),
"PRICE" => Some(mark.unwrap_or(0)),
_ => Some(
value
.unwrap_or(0)
.try_into()
.map_err(|_| MarketDataError::Unavailable)?,
),
};
(rank, None)
};
let rank =
rank.map_or(
i64::MAX,
|n| {
if selection.direction == "DESC" {
-n
} else {
n
}
},
);
let losing = selection.status == "REDEEMABLE" && payout == Some(0);
let key = (
losing,
rank,
account.clone(),
market.clone(),
outcome.clone(),
);
if cursor.as_ref().is_some_and(|p| key <= p.last) {
continue;
}
let yes = outcome == "YES";
let opposite = if yes { "NO" } else { "YES" };
let redeemable = size > 0 && phase == "resolved";
let status = if selection.status == "CLOSED" {
"CLOSED"
} else if redeemable {
"REDEEMABLE"
} else {
"OPEN"
};
page.insert(key, (json!({
"proxy_wallet": account, "condition_id": market,
"token_id": assets::id(&market,&outcome), "opposite_token_id": assets::id(&market,opposite),
"current_size": decimal(size.into(),UNIT),
"last_event_at":last_event_at, "first_entry_at":first_entry_at,
"current_price": mark.map(|p| decimal(p.into(),UNIT)),
"current_value": value.map(|v| decimal(super::economics::round_money(v),UNIT)),
"status": status, "redeemable": redeemable, "mergeable": row.get::<_, bool>(7)?,
"archived": row.get::<_, bool>(6)?, "negative_risk": row.get::<_, bool>(12)?,
"title": row.get::<_, String>(8)?, "slug": row.get::<_, String>(9)?,
"outcome": row.get::<_, String>(if yes {10} else {11})?,
"opposite_outcome": row.get::<_, String>(if yes {11} else {10})?,
"outcome_index": if yes {0} else {1}
}), size, value, cost));
if page.len() > limit as usize + 1 {
page.pop_last();
}
}
}
let has_more = page.len() > limit as usize;
let next = if has_more {
page.pop_last();
let token = Cursor {
selection,
limit,
offset: offset.saturating_add(u64::from(limit)),
last: page.last_key_value().expect("nonempty page").0.clone(),
}
.encode(&tx)?;
Some(token)
} else {
None
};
let mut data = Vec::with_capacity(page.len());
for ((_, _, account, market, outcome), (mut row, size, value, cost)) in page {
let cost = if metric.is_some() {
cost
} else {
super::economics::read(&tx, &account, &market, &outcome, size)?
};
let row_fields = row.as_object_mut().expect("position is an object");
if let Some(cost) = cost {
let Value::Object(fields) = cost.fields(value) else {
unreachable!("cost fields form an object")
};
row_fields.extend(fields);
} else {
for key in [
"avg_price",
"entry_cost_usdc",
"entry_fees_usdc",
"total_cost_usdc",
"total_size",
"realized_pnl",
"unrealized_pnl",
"total_pnl",
] {
row_fields.insert(key.into(), Value::Null);
}
}
data.push(row);
}
tx.commit()?;
Ok(
json!({"data":data,"pagination":{"limit":limit,"offset":offset,"has_more":has_more,"next_cursor":next}}),
)
}
}
@@ -0,0 +1,63 @@
WITH held AS (
SELECT p.*,p.available+p.reserved AS size,
COALESCE(v.active,1) AS active, COALESCE(v.archived,0) AS archived
FROM position_units p LEFT JOIN market_visibility v USING(market)
WHERE (?1 IS NULL OR CASE WHEN ?2 THEN p.account COLLATE NOCASE=?1 ELSE p.account=?1 END)
AND (?3 IS NULL OR p.market IN (SELECT value FROM json_each(?3)))
AND (?6 IS NULL OR p.market IN (
SELECT l.market FROM listed_markets l JOIN event_directory_ids e ON e.event=l.event
WHERE e.id IN (SELECT value FROM json_each(?6))
))
), selected AS (
SELECT p.account,p.market,p.outcome,p.size,p.phase,p.payout_per_share,p.archived,
p.phase<>'resolved' AND p.size>=100000 AND COALESCE(other.size,0)>=100000 AS mergeable,
w.question,w.slug,w.yes_label,w.no_label,n.market IS NOT NULL AS negative_risk
FROM held p
JOIN market_wire_metadata w ON w.market=p.market
LEFT JOIN held other ON other.account=p.account AND other.market=p.market AND other.outcome<>p.outcome
LEFT JOIN neg_risk_members n ON n.market=p.market
WHERE (?7 IS NULL OR w.question LIKE ?7) AND CASE ?4
WHEN 'CLOSED' THEN p.size<CASE WHEN ?1 IS NULL THEN ?8 ELSE 100000 END
ELSE p.active AND (?5 OR NOT p.archived) AND p.size>=?8 AND CASE ?4
WHEN 'OPEN' THEN 1
WHEN 'REDEEMABLE' THEN p.phase='resolved'
WHEN 'REDEEMABLE_LOST' THEN p.phase='resolved' AND p.payout_per_share=0
WHEN 'MERGEABLE' THEN mergeable
END
END
), observations AS (
SELECT s.account,s.market,s.outcome,t.at_ms,t.side='buy' AS entry
FROM selected s JOIN wallet_trade_legs t
ON t.account=s.account AND t.market=s.market AND t.outcome=s.outcome
UNION ALL
SELECT s.account,s.market,s.outcome,w.at_ms,w.kind='SPLIT'
FROM selected s JOIN wallet_movements w ON w.account=s.account AND w.market=s.market
WHERE w.kind IN ('SPLIT','MERGE')
UNION ALL
SELECT s.account,s.market,s.outcome,w.at_ms,0
FROM selected s
JOIN wallet_movements w ON w.account=s.account AND w.market=s.market AND w.kind='REDEEM'
JOIN requests r ON r.id=w.request_id
WHERE json_extract(r.response,CASE s.outcome WHEN 'YES' THEN '$.amounts_micros[0]' ELSE '$.amounts_micros[1]' END)>0
UNION ALL
SELECT s.account,s.market,s.outcome,w.at_ms,s.outcome='YES'
FROM selected s
JOIN neg_risk_members n ON n.market=s.market
JOIN wallet_movements w ON w.account=s.account AND w.group_id=n.group_id AND w.kind='CONVERSION'
JOIN requests r ON r.id=w.request_id
WHERE s.market IN (
SELECT value FROM json_each(r.response,CASE s.outcome WHEN 'YES' THEN '$.yes_markets' ELSE '$.no_markets' END)
)
AND (s.outcome='NO' OR COALESCE(json_extract(r.response,'$.conversion_fee.bps'),0)<10000)
UNION ALL
SELECT s.account,s.market,s.outcome,r.at_ms,0
FROM selected s JOIN position_redemption_times r USING(account,market,outcome)
), clocks AS (
SELECT account,market,outcome,MAX(at_ms)/1000 AS last_event_at,
MIN(CASE WHEN entry THEN at_ms END)/1000 AS first_entry_at
FROM observations GROUP BY account,market,outcome
)
SELECT s.*,c.last_event_at,c.first_entry_at
FROM selected s LEFT JOIN clocks c USING(account,market,outcome)
WHERE (?9 IS NULL OR c.last_event_at>=?9)
AND (?10 IS NULL OR c.last_event_at<=?10)
+9 -26
View File
@@ -322,34 +322,17 @@ CREATE TABLE IF NOT EXISTS budget_spend_micros (
); );
-- Keep issued public trade cursors valid after a restart, scoped to this database. -- Keep issued public trade cursors valid after a restart, scoped to this database.
-- Preserve which outcome was actually burned by a full redemption.
CREATE TABLE IF NOT EXISTS position_redemption_times (
account TEXT NOT NULL REFERENCES accounts,
market TEXT NOT NULL REFERENCES markets,
outcome TEXT NOT NULL,
at_ms INTEGER NOT NULL,
PRIMARY KEY(account,market,outcome)
);
CREATE TABLE IF NOT EXISTS trade_cursor_key ( CREATE TABLE IF NOT EXISTS trade_cursor_key (
singleton INTEGER PRIMARY KEY CHECK(singleton=1), secret BLOB NOT NULL CHECK(length(secret)=32) singleton INTEGER PRIMARY KEY CHECK(singleton=1), secret BLOB NOT NULL CHECK(length(secret)=32)
); );
INSERT INTO trade_cursor_key(singleton,secret) INSERT INTO trade_cursor_key(singleton,secret)
SELECT 1,randomblob(32) WHERE NOT EXISTS(SELECT 1 FROM trade_cursor_key); SELECT 1,randomblob(32) WHERE NOT EXISTS(SELECT 1 FROM trade_cursor_key);
CREATE TABLE IF NOT EXISTS polymarket_market_aliases (
condition_id TEXT PRIMARY KEY,
market TEXT NOT NULL UNIQUE REFERENCES markets(id),
zero_outcome TEXT NOT NULL CHECK(zero_outcome IN ('YES','NO'))
);
CREATE TABLE IF NOT EXISTS polymarket_token_aliases (
token_id TEXT PRIMARY KEY,
condition_id TEXT NOT NULL REFERENCES polymarket_market_aliases(condition_id),
module TEXT NOT NULL, structure TEXT, group_id TEXT, question INTEGER,
slot INTEGER NOT NULL CHECK(slot IN (0,1)),
observation TEXT NOT NULL CHECK(json_valid(observation)),
UNIQUE(condition_id,module,slot)
);
CREATE INDEX IF NOT EXISTS pm_alias_structures ON polymarket_token_aliases(structure);
CREATE INDEX IF NOT EXISTS pm_alias_groups ON polymarket_token_aliases(group_id,question);
CREATE UNIQUE INDEX IF NOT EXISTS pm_alias_structure_slots
ON polymarket_token_aliases(structure,slot) WHERE structure IS NOT NULL;
CREATE UNIQUE INDEX IF NOT EXISTS pm_alias_question_slots
ON polymarket_token_aliases(group_id,question,module,slot) WHERE group_id IS NOT NULL;
CREATE TABLE IF NOT EXISTS polymarket_token_observation_times (
token_id TEXT PRIMARY KEY REFERENCES polymarket_token_aliases(token_id),
observed_at_ms INTEGER NOT NULL CHECK(observed_at_ms>0)
);
-373
View File
@@ -1,373 +0,0 @@
use crate::{
assets,
token_directory::{condition_hex, decimal_token},
validation::identifier,
};
use anyhow::{ensure, Context, Result};
use rusqlite::{params, OptionalExtension, Transaction};
use serde::Deserialize;
use serde_json::{json, Value};
use std::collections::BTreeMap;
#[derive(Deserialize)]
pub(crate) struct Bind {
market: String,
external_condition: String,
zero_outcome: String,
observed_at_ms: Option<i64>,
data: Vec<Value>,
}
struct Row<'a> {
token: &'a str,
opposite: &'a str,
module: &'a str,
structure: Option<&'a str>,
group: Option<&'a str>,
slot: usize,
question: Option<i64>,
}
fn full_condition(id: &str) -> bool {
id.len() == 66 && condition_hex(id).as_deref() == Some(id)
}
fn position_id(raw: &str) -> [u8; 32] {
// The decimal string has already been checked against uint256::MAX.
let mut bytes = [0u8; 32];
for digit in raw.bytes() {
let mut carry = u16::from(digit - b'0');
for byte in bytes.iter_mut().rev() {
let next = u16::from(*byte) * 10 + carry;
*byte = next as u8;
carry = next >> 8;
}
}
bytes
}
impl<'a> Row<'a> {
fn read(row: &'a Value, condition: &str) -> Result<Self> {
let token = row["token_id"].as_str().context("token_id is required")?;
let opposite = row["opposite_token_id"]
.as_str()
.context("opposite_token_id is required")?;
ensure!(
decimal_token(token) == Some(token)
&& decimal_token(opposite) == Some(opposite)
&& token != opposite,
"invalid external outcome identifiers"
);
ensure!(
row["condition_id"] == condition,
"external condition mismatch"
);
let module = row["module"].as_str().context("module is required")?;
let slot = row["outcome_index"]
.as_u64()
.filter(|i| *i < 2)
.context("invalid outcome index")? as usize;
let structure = row["structural_condition_id"].as_str();
let group = row["neg_risk_market_id"].as_str();
let question = row["question_index"].as_i64();
ensure!(
group.is_some() == question.is_some()
&& group.is_none_or(full_condition)
&& question.is_none_or(|q| q >= 0),
"invalid negative-risk question reference"
);
match module {
"v1_ctf" => ensure!(
row["structural_condition_id"].is_null(),
"CTF has no structure ID"
),
"binary" | "neg_risk" => {
ensure!(
(module == "neg_risk") == group.is_some(),
"V2 module mismatch"
);
let bytes = position_id(token);
let other = position_id(opposite);
let mut expected = String::from("0x");
use std::fmt::Write;
for byte in &bytes[..31] {
write!(expected, "{byte:02x}")?;
}
expected.push_str("00");
ensure!(
structure == Some(expected.as_str())
&& usize::from(bytes[31]) == slot
&& bytes[..31] == other[..31]
&& usize::from(other[31]) == 1 - slot,
"V2 token does not encode the supplied condition and outcome"
);
}
_ => anyhow::bail!("unsupported external token module"),
}
Ok(Self {
token,
opposite,
module,
structure,
group,
slot,
question,
})
}
}
impl Bind {
pub(crate) fn register(self, tx: &Transaction<'_>) -> Result<Value> {
identifier(&self.market)?;
ensure!(
self.observed_at_ms.is_none_or(|ms| ms > 0),
"invalid observation time"
);
ensure!(
matches!(self.zero_outcome.as_str(), "YES" | "NO"),
"zero_outcome must be YES or NO"
);
ensure!(
full_condition(&self.external_condition),
"expected a canonical external market condition"
);
ensure!(
(2..=4).contains(&self.data.len()),
"provide a complete outcome pair for each protocol"
);
let mut families = BTreeMap::new();
for value in &self.data {
let token = Row::read(value, &self.external_condition)?;
let slot = token.slot;
let pair = families.entry(token.module).or_insert_with(|| [None, None]);
ensure!(
pair[slot].replace(token).is_none(),
"repeated protocol outcome"
);
}
if self.observed_at_ms.is_some() {
let mut states = BTreeMap::new();
for value in &self.data {
let row = Row::read(value, &self.external_condition)?;
let state = SnapshotState::read(value)?;
let pair = states.entry(row.module).or_insert_with(|| [None, None]);
pair[row.slot] = Some(state);
}
for pair in states.values() {
let [Some(a), Some(b)] = pair else {
anyhow::bail!("incomplete protocol pair");
};
ensure!(
a.closed == b.closed && a.resolved == b.resolved,
"protocol pair has inconsistent lifecycle"
);
if let (Some(a), Some(b)) = (a.price, b.price) {
ensure!((a + b - 1.0).abs() <= 1e-9, "final payouts must sum to one");
}
}
}
let v2_count = families.keys().filter(|m| **m != "v1_ctf").count();
ensure!(v2_count <= 1, "multiple V2 protocols for the same market");
let mut group_ref = None;
for pair in families.values() {
let [Some(a), Some(b)] = pair else {
anyhow::bail!("incomplete protocol pair");
};
ensure!(
a.opposite == b.token
&& b.opposite == a.token
&& a.structure == b.structure
&& a.group == b.group
&& a.question == b.question,
"outcomes do not form one pair"
);
if let Some((group, question)) = group_ref {
ensure!(
(a.group, a.question) == (group, question),
"protocols identify different questions"
);
}
group_ref = Some((a.group, a.question));
}
let listed: bool = tx.query_row(
"SELECT EXISTS(SELECT 1 FROM markets WHERE id=?1)",
[&self.market],
|r| r.get(0),
)?;
ensure!(listed, "unknown local market");
tx.execute("INSERT INTO polymarket_market_aliases VALUES(?1,?2,?3) ON CONFLICT(condition_id) DO NOTHING",
params![self.external_condition,self.market,self.zero_outcome])?;
let bound: (String, String) = tx.query_row(
"SELECT market,zero_outcome FROM polymarket_market_aliases WHERE condition_id=?1",
[&self.external_condition],
|r| Ok((r.get(0)?, r.get(1)?)),
)?;
ensure!(
bound == (self.market.clone(), self.zero_outcome.clone()),
"market condition already bound with different identity"
);
let current_group: Option<(Option<String>, Option<i64>)> = tx.query_row(
"SELECT group_id,question FROM polymarket_token_aliases WHERE condition_id=?1 LIMIT 1",
[&self.external_condition], |row| Ok((row.get(0)?,row.get(1)?)),
).optional()?;
if let (Some((stored_group, stored_question)), Some((group, question))) =
(current_group, group_ref)
{
ensure!(
(stored_group.as_deref(), stored_question) == (group, question),
"market already bound to a different question"
);
}
for value in &self.data {
let row = Row::read(value, &self.external_condition)?;
// Only retain fields exposed by the external directory.
let observation: serde_json::Map<_, _> = [
"token_id",
"condition_id",
"structural_condition_id",
"module",
"outcome_index",
"clob_index",
"outcome",
"opposite_token_id",
"resolved",
"final_price",
"title",
"market_slug",
"closed",
"neg_risk",
"neg_risk_market_id",
"question_index",
"event_id",
"event_slug",
]
.into_iter()
.map(|key| (key.to_owned(), value[key].clone()))
.collect();
let observation = Value::Object(observation);
tx.execute(
"INSERT INTO polymarket_token_aliases VALUES(?1,?2,?3,?4,?5,?6,?7,?8)
ON CONFLICT(token_id) DO NOTHING",
params![
row.token,
self.external_condition,
row.module,
row.structure,
row.group,
row.question,
row.slot as i64,
observation.to_string()
],
)?;
let observed: Option<String> = tx
.query_row(
"SELECT observation FROM polymarket_token_aliases WHERE token_id=?1",
[row.token],
|r| r.get(0),
)
.optional()?;
let prior: Value = serde_json::from_str(&observed.context("missing stored token")?)?;
let prior_identity = Row::read(&prior, &self.external_condition)?;
ensure!(
prior_identity.module == row.module
&& prior_identity.structure == row.structure
&& prior_identity.slot == row.slot
&& prior_identity.group == row.group
&& prior_identity.question == row.question
&& prior_identity.opposite == row.opposite,
"token already bound with different identity"
);
if let Some(observed_at_ms) = self.observed_at_ms {
refresh(tx, row.token, prior, &observation, observed_at_ms)?;
}
}
Ok(
json!({"market":self.market,"external_condition":self.external_condition,
"zero_asset_id":assets::id(&self.market,&self.zero_outcome),"tokens":self.data.len()}),
)
}
}
struct SnapshotState {
closed: bool,
resolved: bool,
price: Option<f64>,
}
impl SnapshotState {
fn read(data: &Value) -> Result<Self> {
let closed = data["closed"]
.as_bool()
.context("closed must be a boolean")?;
let resolved = data["resolved"]
.as_bool()
.context("resolved must be a boolean")?;
let price = data["final_price"].as_f64();
if resolved {
ensure!(
closed && price.is_some_and(|p| (0.0..=1.0).contains(&p)),
"invalid final payout"
);
} else {
ensure!(
data["final_price"].is_null(),
"unresolved asset has a final payout"
);
}
Ok(Self {
closed,
resolved,
price,
})
}
}
const LIVE_FIELDS: &[&str] = &["closed", "resolved", "final_price", "outcome"];
fn refresh(
tx: &Transaction<'_>,
token: &str,
mut prior: Value,
incoming: &Value,
observed_at_ms: i64,
) -> Result<()> {
let last: Option<i64> = tx
.query_row(
"SELECT observed_at_ms FROM polymarket_token_observation_times WHERE token_id=?1",
[token],
|r| r.get(0),
)
.optional()?;
if let Some(last) = last {
if observed_at_ms < last {
return Ok(());
}
if observed_at_ms == last {
ensure!(
LIVE_FIELDS.iter().all(|&key| prior[key] == incoming[key]),
"conflicting observations at the same time"
);
return Ok(());
}
}
if prior["resolved"] == true {
ensure!(
incoming["resolved"] == true
&& prior["final_price"].as_f64() == incoming["final_price"].as_f64(),
"observation contradicts a recorded final payout"
);
}
for &key in LIVE_FIELDS {
prior[key] = incoming[key].clone();
}
tx.execute(
"UPDATE polymarket_token_aliases SET observation=?1 WHERE token_id=?2",
params![prior.to_string(), token],
)?;
tx.execute(
"INSERT INTO polymarket_token_observation_times VALUES(?1,?2)
ON CONFLICT(token_id) DO UPDATE SET observed_at_ms=excluded.observed_at_ms",
params![token, observed_at_ms],
)?;
Ok(())
}
-16
View File
@@ -1,16 +0,0 @@
WITH selectors AS (
SELECT key AS ordinal, json_extract(value,'$[0]') AS id,
json_extract(value,'$[2]') AS kind
FROM json_each(?1)
)
SELECT s.ordinal,t.observation,m.market,
CASE WHEN t.slot=0 THEN m.zero_outcome
WHEN m.zero_outcome='YES' THEN 'NO' ELSE 'YES' END AS outcome,o.observed_at_ms
FROM selectors s
JOIN polymarket_token_aliases t ON
(s.kind='external_token' AND t.token_id=s.id)
OR (s.kind='condition' AND
(t.condition_id=s.id OR t.group_id=s.id OR t.structure=s.id OR t.structure=s.id||'00'))
JOIN polymarket_market_aliases m ON m.condition_id=t.condition_id
LEFT JOIN polymarket_token_observation_times o ON o.token_id=t.token_id
ORDER BY s.ordinal,t.question,t.condition_id,(t.module<>'v1_ctf'),t.slot
-141
View File
@@ -1,141 +0,0 @@
use crate::{assets, inventory::decimal, Exchange, MarketDataError};
use serde::Deserialize;
use serde_json::{json, Value};
use std::collections::HashSet;
const MAX_TOKEN: &str =
"115792089237316195423570985008687907853269984665640564039457584007913129639935";
#[derive(Deserialize)]
pub struct TokenDirectoryQuery {
#[serde(alias = "token_ids")]
token_id: Option<String>,
#[serde(alias = "condition_id", alias = "conditionId")]
condition: Option<String>,
}
fn invalid(message: impl Into<String>) -> MarketDataError {
MarketDataError::Invalid(message.into())
}
pub(crate) fn condition_hex(value: &str) -> Option<String> {
let hex = value
.strip_prefix("0x")
.or_else(|| value.strip_prefix("0X"))?;
if !matches!(hex.len(), 62 | 64) || !hex.bytes().all(|b| b.is_ascii_hexdigit()) {
return None;
}
Some(format!("0x{}", hex.to_ascii_lowercase()))
}
pub(crate) fn decimal_token(value: &str) -> Option<&str> {
let digits = value.trim_start_matches('0');
if value.is_empty()
|| !value.bytes().all(|b| b.is_ascii_digit())
|| digits.len() > MAX_TOKEN.len()
|| (digits.len() == MAX_TOKEN.len() && digits > MAX_TOKEN)
{
return None;
}
Some(if digits.is_empty() { "0" } else { digits })
}
impl Exchange {
pub fn public_tokens(&self, query: TokenDirectoryQuery) -> Result<Value, MarketDataError> {
let token = query.token_id.as_deref().filter(|s| !s.trim().is_empty());
let condition = query.condition.as_deref().filter(|s| !s.trim().is_empty());
let (raw, is_token, limit, selector) = match (token, condition) {
(Some(raw), None) => (raw, true, 50, "token_id"),
(None, Some(raw)) => (raw, false, 10, "condition"),
_ => return Err(invalid("provide exactly one of 'token_id' or 'condition'")),
};
let tx = self.db.unchecked_transaction()?;
let mut seen = HashSet::new();
let mut keys = Vec::new();
for value in raw.split(',').map(str::trim) {
let (key, outcome, kind) = if is_token {
if let Ok((outcome, market)) = assets::parse_id(value) {
(market.to_owned(), Some(outcome), "local_token")
} else {
let token = decimal_token(value)
.ok_or_else(|| invalid(format!("invalid token id: {value}")))?;
(token.to_owned(), None, "external_token")
}
} else if let Some(hex) = condition_hex(value) {
(hex, None, "condition")
} else {
let listed: bool = tx.query_row(
"SELECT EXISTS(SELECT 1 FROM markets WHERE id=?1)
OR EXISTS(SELECT 1 FROM neg_risk_groups WHERE id=?1)",
[value],
|row| row.get(0),
)?;
if !listed {
return Err(invalid(format!("invalid condition id: {value}")));
}
(value.to_owned(), None, "condition")
};
if seen.insert((key.clone(), outcome)) {
if seen.len() > limit {
return Err(invalid(format!(
"'{selector}' accepts at most {limit} distinct values"
)));
}
keys.push((key, outcome, kind));
}
}
let input = serde_json::to_string(&keys).map_err(|_| MarketDataError::Unavailable)?;
let mut data = {
let mut stmt = tx.prepare_cached(include_str!("token_directory.sql"))?;
let rows = stmt.query_map([&input], |r| {
let market: String = r.get(0)?;
let phase: String = r.get(5)?;
let winner: Option<String> = r.get(6)?;
let index: i64 = r.get(7)?;
let (outcome, other) = if index == 0 { ("YES", "NO") } else { ("NO", "YES") };
let group: Option<String> = r.get(8)?;
let price = winner.as_deref().filter(|_| phase=="resolved").map(|winner| {
if winner == "VOID" { decimal(5,10) } else { decimal(i128::from(winner == outcome),1) }
});
Ok((r.get::<_, i64>(12)?, json!({
"token_id":assets::id(&market,outcome),"condition_id":market,
"structural_condition_id":null,"module":if group.is_some() { "local_neg_risk" } else { "local_binary" },
"outcome_index":index,"clob_index":null,"outcome":r.get::<_,String>(if index==0 {3} else {4})?,
"opposite_token_id":assets::id(&market,other),
"resolved":phase=="resolved","closed":matches!(phase.as_str(),"closed"|"resolved"),
"final_price":price,"title":r.get::<_,String>(1)?,"market_slug":r.get::<_,String>(2)?,
"neg_risk":group.is_some(),"neg_risk_market_id":group,"question_index":r.get::<_,Option<i64>>(9)?,
"event_id":r.get::<_,Option<i64>>(10)?,"event_slug":r.get::<_,Option<String>>(11)?
})))
})?;
rows.collect::<rusqlite::Result<Vec<_>>>()?
};
let externals = {
let mut stmt = tx.prepare_cached(include_str!("token_aliases.sql"))?;
let rows = stmt.query_map([&input], |r| {
Ok((
r.get::<_, i64>(0)?,
r.get::<_, String>(1)?,
r.get::<_, String>(2)?,
r.get::<_, String>(3)?,
r.get::<_, Option<i64>>(4)?,
))
})?;
rows.collect::<rusqlite::Result<Vec<_>>>()?
};
let external_ordinals: HashSet<_> = externals.iter().map(|r| r.0).collect();
data.retain(|(ordinal, _)| !external_ordinals.contains(ordinal));
for (ordinal, raw, market, outcome, observed_at_ms) in externals {
let mut row: Value =
serde_json::from_str(&raw).map_err(|_| MarketDataError::Unavailable)?;
row["local_condition_id"] = json!(market);
row["local_asset_id"] = json!(assets::id(&market, &outcome));
row["observed_at_ms"] = json!(observed_at_ms);
data.push((ordinal, row));
}
data.sort_by_key(|row| row.0);
let data: Vec<_> = data.into_iter().map(|(_, row)| row).collect();
tx.commit()?;
Ok(json!({"data":data}))
}
}
-22
View File
@@ -1,22 +0,0 @@
WITH selectors AS (
SELECT key AS ordinal, json_extract(value,'$[0]') AS market,
json_extract(value,'$[1]') AS outcome, json_extract(value,'$[2]') AS kind
FROM json_each(?1)
), markets_selected AS (
SELECT s.ordinal,m.id AS market,s.outcome
FROM selectors s JOIN markets m ON m.id=s.market
WHERE s.kind<>'external_token'
UNION ALL
SELECT s.ordinal,n.market,NULL
FROM selectors s JOIN neg_risk_members n ON n.group_id=s.market
WHERE s.kind='condition' AND s.outcome IS NULL AND NOT EXISTS (SELECT 1 FROM markets m WHERE m.id=s.market)
), slots(outcome, outcome_index) AS (VALUES ('YES',0),('NO',1))
SELECT m.id,w.question,w.slug,w.yes_label,w.no_label,m.phase,m.winner,s.outcome_index,
n.group_id,n.ordinal,e.event_id,e.slug,x.ordinal
FROM markets_selected x JOIN markets m ON m.id=x.market
JOIN market_wire_metadata w ON w.market=x.market
JOIN slots s ON x.outcome IS NULL OR s.outcome=x.outcome
LEFT JOIN neg_risk_members n ON n.market=x.market
LEFT JOIN listed_markets l ON l.market=x.market
LEFT JOIN numbered_events e ON e.id=l.event
ORDER BY x.ordinal,n.ordinal,m.id,s.outcome_index
+157 -122
View File
@@ -4178,139 +4178,174 @@ fn order_submission_terms_survive_fills_cancel_retries_and_legacy_upgrade() {
} }
#[test] #[test]
fn public_token_directory_routes_results_and_expands_negative_risk_groups() { fn public_positions_walk_a_mergeable_pair_and_held_settlement() {
let mut exchange = Exchange::open(":memory:").unwrap();
for line in include_str!("../../../docs/examples/neg-risk.jsonl")
.lines()
.take(5)
{
exchange
.execute(serde_json::from_str(line).unwrap())
.unwrap();
}
let read = |e: &Exchange, value| {
e.public_tokens(serde_json::from_value(value).unwrap())
.unwrap()["data"]
.clone()
};
let group = read(&exchange, json!({"condition":"winner"}));
assert_eq!(group.as_array().unwrap().len(), 6);
assert_eq!(group[0]["condition_id"], "a");
assert_eq!(group[0]["question_index"], 0);
assert_eq!(group[1]["opposite_token_id"], group[0]["token_id"]);
assert_eq!(group[4]["condition_id"], "other");
assert!(group[0]["event_id"].is_number());
let rows = read(
&exchange,
json!({"token_ids":"eb:NO:a,123,eb:YES:a,eb:NO:a"}),
);
assert_eq!(rows, json!([group[1], group[0]]));
assert_eq!(rows[0]["final_price"], Value::Null);
setup(&mut exchange);
exchange
.execute(json!({"op":"close","id":"close-e","market":"e"}))
.unwrap();
exchange
.execute(json!({"op":"finalize","id":"void-e","market":"e","winner":"VOID"}))
.unwrap();
let voided = read(&exchange, json!({"conditionId":"e"}));
assert_eq!(voided[0]["closed"], true);
assert_eq!(voided[1]["resolved"], true);
assert_eq!(voided[0]["final_price"], 0.5);
assert_eq!(voided[1]["final_price"], 0.5);
}
#[test]
fn polymarket_asset_bindings_preserve_protocols_and_explicit_outcome_direction() {
let dir = tempdir().unwrap(); let dir = tempdir().unwrap();
let path = dir.path().join("venue-ids.db"); let path = dir.path().join("positions.db");
let mut e = Exchange::open(&path).unwrap(); let mut e = Exchange::open(&path).unwrap();
setup(&mut e); setup(&mut e);
let fixture: Value = serde_json::from_str(include_str!( let read =
"../../../docs/examples/polymarket-asset-binding.json" |engine: &Exchange, query| engine.public_positions(serde_json::from_value(query).unwrap());
)) for cmd in [
json!({"op":"list","id":"dust-list","market":"dust","rules":"dust"}),
json!({"op":"split","id":"dust-split","market":"dust","account":"bob","qty_micros":8800}),
json!({"op":"close","id":"dust-close","market":"dust"}),
json!({"op":"finalize","id":"dust-win","market":"dust","winner":"YES"}),
] {
e.execute(cmd).unwrap();
}
assert_eq!(
read(&e, json!({"user":"bob","condition":"dust"})).unwrap()["data"],
json!([])
);
let dust = read(
&e,
json!({"user":"bob","condition":"dust","status":"CLOSED"}),
)
.unwrap(); .unwrap();
let mut command = json!({"op":"bind_polymarket_assets","id":"bind","market":"e","zero_outcome":"NO", let winning_dust = dust["data"]
"external_condition":fixture["external_condition"], "data":fixture["data"]}); .as_array()
let receipt = e.execute(command.clone()).unwrap(); .unwrap()
assert_eq!(receipt["tokens"], 4); .iter()
assert_eq!(e.execute(command.clone()).unwrap(), receipt); .find(|row| row["token_id"] == "eb:YES:dust")
command["id"] = json!("flipped"); .unwrap();
command["zero_outcome"] = json!("YES"); assert_eq!(winning_dust["current_size"], 0.0088);
assert!(e.execute(command).is_err()); assert_eq!(winning_dust["redeemable"], true);
drop(e); assert_eq!(
let e = Exchange::open(path).unwrap(); read(
let lookup = |query| { &e,
e.public_tokens(serde_json::from_value(query).unwrap()) json!({"user":"alice","title":"%e%","filter_type":"tokens","filter_amount":10})
)
.unwrap()["data"]
.as_array()
.unwrap() .unwrap()
}; .len(),
let condition = lookup(json!({"condition":fixture["external_condition"]})); 2
let rows = condition["data"].as_array().unwrap();
assert_eq!(rows.len(), 4);
assert_eq!(rows[0]["module"], "v1_ctf");
assert_eq!(rows[2]["module"], "neg_risk");
assert_eq!(rows[2]["local_asset_id"], "eb:NO:e");
assert_eq!(rows[3]["local_asset_id"], "eb:YES:e");
let structural = rows[2]["structural_condition_id"].as_str().unwrap();
assert_eq!(
lookup(json!({"condition":&structural[..64]}))["data"],
json!([rows[2], rows[3]])
); );
let token = rows[3]["token_id"].as_str().unwrap();
assert_eq!( assert_eq!(
lookup(json!({"token_id":format!("00{token},00123,eb:NO:e")}))["data"][0], read(&e, json!({"user":"alice","filter_amount":10.001})).unwrap()["data"],
rows[3] json!([])
); );
assert_eq!(
read(&e, json!({"user":"alice","title":"unmatched title"})).unwrap()["data"],
json!([])
);
assert_eq!(
read(&e, json!({"user":"alice","event_id":"unmatched"})).unwrap()["data"],
json!([])
);
assert!(read(&e, json!({"user":"alice","event_id":"1","condition":"e"})).is_err());
let db = rusqlite::Connection::open(&path).unwrap();
db.execute(
"UPDATE wallet_movements SET at_ms=123999 WHERE request_id='s'",
[],
)
.unwrap();
let instant = read(
&e,
json!({"user":"alice","start":123,"end":123,"sort_by":"TIMESTAMP"}),
)
.unwrap();
assert_eq!(instant["data"].as_array().unwrap().len(), 2);
assert_eq!(instant["data"][0]["first_entry_at"], 123);
assert_eq!(instant["data"][0]["last_event_at"], 123);
assert_eq!(
read(&e, json!({"user":"alice","start":124})).unwrap()["data"],
json!([])
);
assert!(read(&e, json!({"user":"alice","start":124,"end":123})).is_err());
drop(db);
let first = read(&e, json!({"user":"alice","status":"MERGEABLE","limit":1})).unwrap();
assert_eq!(first["data"][0]["mergeable"], true);
let cursor = first["pagination"]["next_cursor"].as_str().unwrap();
assert!(read(&e, json!({"user":"bob","cursor":cursor})).is_err());
assert!(read(&e, json!({"user":"alice","status":"OPEN","cursor":cursor})).is_err());
drop(e);
let mut e = Exchange::open(path).unwrap();
let next = read(&e, json!({"user":"alice","cursor":cursor,"limit":5})).unwrap();
assert_eq!(next["pagination"]["limit"], 1);
assert_eq!(next["pagination"]["offset"], 1);
assert_eq!(next["pagination"]["has_more"], false);
assert_ne!(next["data"][0]["token_id"], first["data"][0]["token_id"]);
e.execute(json!({"op":"close","id":"close","market":"e"}))
.unwrap();
e.execute(json!({"op":"finalize","id":"win","market":"e","winner":"YES"}))
.unwrap();
let held = read(&e, json!({"user":"alice","condition":"e","status":"OPEN"})).unwrap();
assert_eq!(held["data"][0]["status"], "REDEEMABLE");
assert_eq!(held["data"][0]["current_value"], 10);
assert_eq!(held["data"][0]["mergeable"], false);
let cash = read(
&e,
json!({"user":"alice","filterType":"cash","filterAmount":10}),
)
.unwrap();
assert_eq!(cash["data"].as_array().unwrap().len(), 1);
assert_eq!(cash["data"][0]["token_id"], "eb:YES:e");
let lost = read(&e, json!({"user":"alice","status":"REDEEMABLE_LOST"})).unwrap();
assert_eq!(lost["data"].as_array().unwrap().len(), 1);
assert_eq!(lost["data"][0]["token_id"], "eb:NO:e");
e.execute(json!({"op":"redeem","id":"claim","market":"e","account":"alice"}))
.unwrap();
assert_eq!(
read(&e, json!({"user":"alice"})).unwrap()["data"],
json!([])
);
let closed = read(&e, json!({"user":"alice","status":"CLOSED"})).unwrap();
assert_eq!(closed["data"].as_array().unwrap().len(), 2);
} }
#[test] #[test]
fn polymarket_observations_refresh_without_reverting_a_final_payout() { fn public_positions_reconstructs_trade_basis_after_a_partial_sale() {
let dir = tempdir().unwrap(); let mut e = Exchange::open(":memory:").unwrap();
let path = dir.path().join("refresh.db"); setup(&mut e);
let mut engine = Exchange::open(&path).unwrap(); for cmd in [
setup(&mut engine); json!({"op":"fund","id":"fund-trader","account":"trader","cents":2000}),
let fixture: Value = serde_json::from_str(include_str!( json!({"op":"open","id":"open","market":"e"}),
"../../../docs/examples/polymarket-asset-refresh.json" order("ask", "alice", "sell", 40, 10),
)) order("entry", "trader", "buy", 40, 10),
.unwrap(); order("exit", "trader", "sell", 80, 3),
let resolved = fixture["directory"]["body"]["data"].clone(); order("buyer", "bob", "buy", 80, 3),
let mut open = resolved.clone(); ] {
for item in open.as_array_mut().unwrap() { e.execute(cmd).unwrap();
item["closed"] = json!(false);
item["resolved"] = json!(false);
item["final_price"] = Value::Null;
} }
let late = fixture["directory"]["observed_at_ms"].as_i64().unwrap(); for command in [
let early = fixture["prior_book"]["observed_at_ms"].as_i64().unwrap(); json!({"op":"list","id":"other-list","market":"other","rules":"other result"}),
let condition = &resolved[0]["condition_id"]; json!({"op":"split","id":"other-split","market":"other","account":"alice","qty":5}),
let obs = |id, stamp, rows: &Value| { json!({"op":"open","id":"other-open","market":"other"}),
json!({ ] {
"op":"bind_polymarket_assets", "id":id,"market":"e","zero_outcome":"YES", e.execute(command).unwrap();
"external_condition":condition,"observed_at_ms":stamp,"data":rows }
}) for (id, account, side, price, qty) in [
("other-ask", "alice", "sell", 60, 5),
("other-buy", "trader", "buy", 60, 5),
("other-exit", "trader", "sell", 40, 5),
("other-take", "bob", "buy", 40, 5),
] {
let mut command = order(id, account, side, price, qty);
command["market"] = json!("other");
e.execute(command).unwrap();
}
let read = |user| {
e.public_positions(serde_json::from_value(json!({"user":user})).unwrap())
.unwrap()
}; };
engine.execute(obs("before", early, &open)).unwrap(); let page = read("trader");
engine.execute(obs("final", late, &resolved)).unwrap(); let row = &page["data"][0];
engine.execute(obs("old", early, &open)).unwrap(); assert_eq!(row["current_size"], 7);
assert!(engine assert_eq!(row["total_size"], 10);
.execute(obs("same-time-conflict", late, &open)) assert_eq!(row["entry_cost_usdc"], 2.8);
.is_err()); assert_eq!(row["realized_pnl"], 1.2);
assert!(engine assert_eq!(row["unrealized_pnl"], 2.8);
.execute(obs("new-conflict", late + 1, &open)) assert_eq!(row["total_pnl"], 4);
.is_err()); let sorted = |params| e.public_positions(serde_json::from_value(params).unwrap());
drop(engine); let closed = sorted(json!({"user":"trader","status":"CLOSED","sort_by":"PRICE"})).unwrap();
let engine = Exchange::open(path).unwrap(); assert_eq!(closed["data"][0]["realized_pnl"], -1);
let lookup = engine assert_eq!(closed["data"][0]["avg_price"], 0.6);
.public_tokens(serde_json::from_value(json!({"condition":condition})).unwrap()) assert!(sorted(json!({"user":"trader","status":"CLOSED","sort_by":"AVG_PRICE"})).is_err());
.unwrap(); let market = sorted(json!({"condition":"e","sort_by":"AVG_PRICE","limit":1})).unwrap();
let rows = lookup["data"].as_array().unwrap(); assert_eq!(market["data"][0]["proxy_wallet"], "bob");
assert_eq!(rows.len(), 4); let cursor = market["pagination"]["next_cursor"].as_str().unwrap();
for row in rows { let next = sorted(json!({"condition":"e","cursor":cursor})).unwrap();
assert_eq!(row["resolved"], true); assert_eq!(next["data"][0]["proxy_wallet"], "trader");
assert_eq!(row["observed_at_ms"], late); assert!(read("alice")["data"][0]["entry_cost_usdc"].is_null());
}
let local = engine
.public_tokens(serde_json::from_value(json!({"condition":"e"})).unwrap())
.unwrap();
assert_eq!(local["data"][0]["resolved"], false);
} }
@@ -1,87 +0,0 @@
{
"source": "https://data-api.polymarket.com/v2/tokens?condition=0xdfb674d9eb1ca2f4b1c38d36562b725d6dca8364b3b1eea2dafc773608959c80",
"date": "Fri, 04 Dec 2026 21:03:26 GMT",
"external_condition": "0xdfb674d9eb1ca2f4b1c38d36562b725d6dca8364b3b1eea2dafc773608959c80",
"data": [
{
"token_id": "56766704504589537417119461476407464198158915644205212964421261364010493123785",
"condition_id": "0xdfb674d9eb1ca2f4b1c38d36562b725d6dca8364b3b1eea2dafc773608959c80",
"structural_condition_id": null,
"module": "v1_ctf",
"outcome_index": 0,
"clob_index": 0,
"outcome": "Yes",
"opposite_token_id": "33748178601941852783056114873418965902944929138778460252404676407918318867810",
"resolved": false,
"final_price": null,
"title": "Will Paris Saint-Germain FC win on 2026-12-04?",
"market_slug": "fl1-tou-psg-2026-12-04-psg",
"closed": false,
"neg_risk": true,
"neg_risk_market_id": "0xbac6a2a3e5faf30fdabab133b0258ed9bf5052dd0f75c60464fe2f290bc93000",
"question_index": 2,
"event_id": 1465085,
"event_slug": "fl1-tou-psg-2026-12-04"
},
{
"token_id": "33748178601941852783056114873418965902944929138778460252404676407918318867810",
"condition_id": "0xdfb674d9eb1ca2f4b1c38d36562b725d6dca8364b3b1eea2dafc773608959c80",
"structural_condition_id": null,
"module": "v1_ctf",
"outcome_index": 1,
"clob_index": 1,
"outcome": "No",
"opposite_token_id": "56766704504589537417119461476407464198158915644205212964421261364010493123785",
"resolved": false,
"final_price": null,
"title": "Will Paris Saint-Germain FC win on 2026-12-04?",
"market_slug": "fl1-tou-psg-2026-12-04-psg",
"closed": false,
"neg_risk": true,
"neg_risk_market_id": "0xbac6a2a3e5faf30fdabab133b0258ed9bf5052dd0f75c60464fe2f290bc93000",
"question_index": 2,
"event_id": 1465085,
"event_slug": "fl1-tou-psg-2026-12-04"
},
{
"token_id": "1242647860242950490718683690862688823036949349322148957738072940768458179072",
"condition_id": "0xdfb674d9eb1ca2f4b1c38d36562b725d6dca8364b3b1eea2dafc773608959c80",
"structural_condition_id": "0x02bf5052dd0f75c60464fe2f290bc93000000300000000000000000000000200",
"module": "neg_risk",
"outcome_index": 0,
"clob_index": null,
"outcome": "Yes",
"opposite_token_id": "1242647860242950490718683690862688823036949349322148957738072940768458179073",
"resolved": false,
"final_price": null,
"title": "Will Paris Saint-Germain FC win on 2026-12-04?",
"market_slug": "fl1-tou-psg-2026-12-04-psg",
"closed": false,
"neg_risk": true,
"neg_risk_market_id": "0xbac6a2a3e5faf30fdabab133b0258ed9bf5052dd0f75c60464fe2f290bc93000",
"question_index": 2,
"event_id": 1465085,
"event_slug": "fl1-tou-psg-2026-12-04"
},
{
"token_id": "1242647860242950490718683690862688823036949349322148957738072940768458179073",
"condition_id": "0xdfb674d9eb1ca2f4b1c38d36562b725d6dca8364b3b1eea2dafc773608959c80",
"structural_condition_id": "0x02bf5052dd0f75c60464fe2f290bc93000000300000000000000000000000200",
"module": "neg_risk",
"outcome_index": 1,
"clob_index": null,
"outcome": "No",
"opposite_token_id": "1242647860242950490718683690862688823036949349322148957738072940768458179072",
"resolved": false,
"final_price": null,
"title": "Will Paris Saint-Germain FC win on 2026-12-04?",
"market_slug": "fl1-tou-psg-2026-12-04-psg",
"closed": false,
"neg_risk": true,
"neg_risk_market_id": "0xbac6a2a3e5faf30fdabab133b0258ed9bf5052dd0f75c60464fe2f290bc93000",
"question_index": 2,
"event_id": 1465085,
"event_slug": "fl1-tou-psg-2026-12-04"
}
]
}
-110
View File
@@ -1,110 +0,0 @@
{
"prior_book": {
"url": "https://clob.polymarket.com/book?token_id=64069535502365350520464017439278800338614209934309608490621606944970108681676",
"date": "Thu, 03 Dec 2026 07:55:53 GMT",
"status": 200,
"body": {
"market": "0xe5febd2f236a15ef7c1cc70a481e081bb64223d3e67aa3870677cccd72530853",
"asset_id": "64069535502365350520464017439278800338614209934309608490621606944970108681676",
"timestamp": "1796284481649",
"hash": "575e315a02461b9280427591ba1fe7e48b3b70ce",
"bids": [],
"asks": [],
"min_order_size": "5",
"tick_size": "0.01",
"neg_risk": false,
"last_trade_price": ""
},
"observed_at_ms": 1796284553000
},
"directory": {
"url": "https://data-api.polymarket.com/v2/tokens?condition=0xe5febd2f236a15ef7c1cc70a481e081bb64223d3e67aa3870677cccd72530853",
"status": 200,
"date": "Fri, 04 Dec 2026 21:11:06 GMT",
"body": {
"data": [
{
"token_id": "64069535502365350520464017439278800338614209934309608490621606944970108681676",
"condition_id": "0xe5febd2f236a15ef7c1cc70a481e081bb64223d3e67aa3870677cccd72530853",
"structural_condition_id": null,
"module": "v1_ctf",
"outcome_index": 0,
"clob_index": 0,
"outcome": "Over",
"opposite_token_id": "24637903833591077899504141654082654473942967248855682279041797174393952421575",
"resolved": true,
"final_price": 0.0,
"title": "Map 1 Total Rounds: Over/Under 27.5",
"market_slug": "cs2-bb3-lgc-2026-12-03-game1-round-total-27pt5",
"closed": true,
"neg_risk": false,
"neg_risk_market_id": null,
"question_index": null,
"event_id": 1495714,
"event_slug": "cs2-bb3-lgc-2026-12-03"
},
{
"token_id": "24637903833591077899504141654082654473942967248855682279041797174393952421575",
"condition_id": "0xe5febd2f236a15ef7c1cc70a481e081bb64223d3e67aa3870677cccd72530853",
"structural_condition_id": null,
"module": "v1_ctf",
"outcome_index": 1,
"clob_index": 1,
"outcome": "Under",
"opposite_token_id": "64069535502365350520464017439278800338614209934309608490621606944970108681676",
"resolved": true,
"final_price": 1.0,
"title": "Map 1 Total Rounds: Over/Under 27.5",
"market_slug": "cs2-bb3-lgc-2026-12-03-game1-round-total-27pt5",
"closed": true,
"neg_risk": false,
"neg_risk_market_id": null,
"question_index": null,
"event_id": 1495714,
"event_slug": "cs2-bb3-lgc-2026-12-03"
},
{
"token_id": "774335495545660990871175894688282765790269993344601020630233166497523433472",
"condition_id": "0xe5febd2f236a15ef7c1cc70a481e081bb64223d3e67aa3870677cccd72530853",
"structural_condition_id": "0x01b64223d3e67aa3870677cccd72530853000000000000000000000000000000",
"module": "binary",
"outcome_index": 0,
"clob_index": null,
"outcome": "Over",
"opposite_token_id": "774335495545660990871175894688282765790269993344601020630233166497523433473",
"resolved": true,
"final_price": 0.0,
"title": "Map 1 Total Rounds: Over/Under 27.5",
"market_slug": "cs2-bb3-lgc-2026-12-03-game1-round-total-27pt5",
"closed": true,
"neg_risk": false,
"neg_risk_market_id": null,
"question_index": null,
"event_id": 1495714,
"event_slug": "cs2-bb3-lgc-2026-12-03"
},
{
"token_id": "774335495545660990871175894688282765790269993344601020630233166497523433473",
"condition_id": "0xe5febd2f236a15ef7c1cc70a481e081bb64223d3e67aa3870677cccd72530853",
"structural_condition_id": "0x01b64223d3e67aa3870677cccd72530853000000000000000000000000000000",
"module": "binary",
"outcome_index": 1,
"clob_index": null,
"outcome": "Under",
"opposite_token_id": "774335495545660990871175894688282765790269993344601020630233166497523433472",
"resolved": true,
"final_price": 1.0,
"title": "Map 1 Total Rounds: Over/Under 27.5",
"market_slug": "cs2-bb3-lgc-2026-12-03-game1-round-total-27pt5",
"closed": true,
"neg_risk": false,
"neg_risk_market_id": null,
"question_index": null,
"event_id": 1495714,
"event_slug": "cs2-bb3-lgc-2026-12-03"
}
]
},
"observed_at_ms": 1796418666000
}
}
@@ -0,0 +1,12 @@
{
"AVG_PRICE": {"url":"https://data-api.polymarket.com/v2/positions?user=0xbc79e27f2c94124aeefb08d74b4e4fd3ac834e4d&limit=7&sort_by=AVG_PRICE","status":200,"date":"Fri, 04 Dec 2026 20:56:44 GMT","body":{"data":[{"token_id":"60488319664307907808238843684363128940030194181923783216789526080413999461490","status":"REDEEMABLE","avg_price":0.8899,"current_price":0.0,"current_value":0.0,"realized_pnl":-2.354,"unrealized_pnl":-10.0025,"total_pnl":-12.3565,"current_size":11.239},{"token_id":"98073668715220604074158446612974804298018754563117252335606186300079136804004","status":"REDEEMABLE","avg_price":0.8399,"current_price":0.0,"current_value":0.0,"realized_pnl":-0.04,"unrealized_pnl":-4.9999,"total_pnl":-5.0399,"current_size":5.9523},{"token_id":"47077648217971757308720798158325917219531658951054235799631815254380459178462","status":"REDEEMABLE","avg_price":0.8299,"current_price":0.0,"current_value":0.0,"realized_pnl":-0.0175,"unrealized_pnl":-2.0499,"total_pnl":-2.0674,"current_size":2.4698},{"token_id":"70856206809794487052236221713547822530745876986932371021154800731989645923129","status":"REDEEMABLE","avg_price":0.792,"current_price":0.0,"current_value":0.0,"realized_pnl":-0.052,"unrealized_pnl":-4.9999,"total_pnl":-5.0519,"current_size":6.3125},{"token_id":"108440305255097343955145320114677386272816360228724390087556347183639101640370","status":"REDEEMABLE","avg_price":0.7899,"current_price":0.0,"current_value":0.0,"realized_pnl":-0.0525,"unrealized_pnl":-4.9999,"total_pnl":-5.0524,"current_size":6.3291},{"token_id":"63234107892075973252894556579763050283535055859503091414443970074757771467750","status":"REDEEMABLE","avg_price":0.7899,"current_price":0.0,"current_value":0.0,"realized_pnl":-0.0436,"unrealized_pnl":-4.1499,"total_pnl":-4.1935,"current_size":5.2531},{"token_id":"74071744813515333849424646391280658530446865984842804791705239676919358527019","status":"REDEEMABLE","avg_price":0.7898,"current_price":0.0,"current_value":0.0,"realized_pnl":2.7632,"unrealized_pnl":-10.0053,"total_pnl":-7.2421,"current_size":12.6673}],"pagination":{"limit":7,"offset":0,"has_more":true}}},
"REALIZED_PNL": {"url":"https://data-api.polymarket.com/v2/positions?user=0xbc79e27f2c94124aeefb08d74b4e4fd3ac834e4d&limit=7&sort_by=REALIZED_PNL","status":200,"date":"Fri, 04 Dec 2026 20:56:43 GMT","body":{"data":[{"token_id":"85950283731933994682282061396049926478670817100428423549552644750092884541497","status":"REDEEMABLE","avg_price":0.3021,"current_price":0.0,"current_value":0.0,"realized_pnl":9.075,"unrealized_pnl":-5.0007,"total_pnl":4.0743,"current_size":16.552},{"token_id":"74071744813515333849424646391280658530446865984842804791705239676919358527019","status":"REDEEMABLE","avg_price":0.7898,"current_price":0.0,"current_value":0.0,"realized_pnl":2.7632,"unrealized_pnl":-10.0053,"total_pnl":-7.2421,"current_size":12.6673},{"token_id":"63086340633867374166296916716767345159121388286341018941116828465599669741959","status":"REDEEMABLE","avg_price":0.5897,"current_price":0.0,"current_value":0.0,"realized_pnl":1.1111,"unrealized_pnl":-3.0007,"total_pnl":-1.8896,"current_size":5.0882},{"token_id":"548462943067324124336689254204000269948663684506167200680384187254947446784","status":"OPEN","avg_price":0.5799,"current_price":0.0005,"current_value":0.0043,"realized_pnl":0.0,"unrealized_pnl":-4.9957,"total_pnl":-4.9957,"current_size":8.6206},{"token_id":"874402096953853186496076533822258356735156175384049251327656694874617413633","status":"OPEN","avg_price":0.4599,"current_price":0.0005,"current_value":0.0054,"realized_pnl":0.0,"unrealized_pnl":-4.9946,"total_pnl":-4.9946,"current_size":10.8695},{"token_id":"49458764017597659514573234731940998982339359646087074270291874830372572595732","status":"REDEEMABLE","avg_price":0.0199,"current_price":0.0,"current_value":0.0,"realized_pnl":-0.01,"unrealized_pnl":-0.2039,"total_pnl":-0.2139,"current_size":10.2},{"token_id":"2618591573832738162913679271927267207972968872239887962293396886053858554649","status":"REDEEMABLE","avg_price":0.7299,"current_price":0.0,"current_value":0.0,"realized_pnl":-0.0149,"unrealized_pnl":-1.0999,"total_pnl":-1.1148,"current_size":1.5068}],"pagination":{"limit":7,"offset":0,"has_more":true}}},
"UNREALIZED_PNL": {"url":"https://data-api.polymarket.com/v2/positions?user=0xbc79e27f2c94124aeefb08d74b4e4fd3ac834e4d&limit=7&sort_by=UNREALIZED_PNL","status":200,"date":"Fri, 04 Dec 2026 20:56:43 GMT","body":{"data":[{"token_id":"49932611791842248277648635261891267637049151266001723816279042019553905945029","status":"OPEN","avg_price":0.0767,"current_price":0.0845,"current_value":1.5914,"realized_pnl":-2.7801,"unrealized_pnl":0.1462,"total_pnl":-2.6339,"current_size":18.8333},{"token_id":"49458764017597659514573234731940998982339359646087074270291874830372572595732","status":"REDEEMABLE","avg_price":0.0199,"current_price":0.0,"current_value":0.0,"realized_pnl":-0.01,"unrealized_pnl":-0.2039,"total_pnl":-0.2139,"current_size":10.2},{"token_id":"2618591573832738162913679271927267207972968872239887962293396886053858554649","status":"REDEEMABLE","avg_price":0.7299,"current_price":0.0,"current_value":0.0,"realized_pnl":-0.0149,"unrealized_pnl":-1.0999,"total_pnl":-1.1148,"current_size":1.5068},{"token_id":"54065802348264340781180366286468940160774623409772296945681445781417976930148","status":"REDEEMABLE","avg_price":0.4199,"current_price":0.0,"current_value":0.0,"realized_pnl":-0.0412,"unrealized_pnl":-1.4199,"total_pnl":-1.4611,"current_size":3.3809},{"token_id":"41330338653304219709555029188568269032082472789433655579873196372491063819991","status":"REDEEMABLE","avg_price":0.5299,"current_price":0.0,"current_value":0.0,"realized_pnl":-0.0452,"unrealized_pnl":-1.9199,"total_pnl":-1.9651,"current_size":3.6226},{"token_id":"110628429202387177247865174708140645662223783382160894070566377074936174195944","status":"REDEEMABLE","avg_price":0.01,"current_price":0.0,"current_value":0.0,"realized_pnl":-0.099,"unrealized_pnl":-2.0,"total_pnl":-2.099,"current_size":200.0},{"token_id":"17081582571570121060773872712824914681371082713110525237465736969237633904493","status":"REDEEMABLE","avg_price":0.01,"current_price":0.0,"current_value":0.0,"realized_pnl":-0.099,"unrealized_pnl":-2.0,"total_pnl":-2.099,"current_size":200.0}],"pagination":{"limit":7,"offset":0,"has_more":true}}},
"TOTAL_PNL": {"url":"https://data-api.polymarket.com/v2/positions?user=0xbc79e27f2c94124aeefb08d74b4e4fd3ac834e4d&limit=7&sort_by=TOTAL_PNL","status":200,"date":"Fri, 04 Dec 2026 20:56:43 GMT","body":{"data":[{"token_id":"85950283731933994682282061396049926478670817100428423549552644750092884541497","status":"REDEEMABLE","avg_price":0.3021,"current_price":0.0,"current_value":0.0,"realized_pnl":9.075,"unrealized_pnl":-5.0007,"total_pnl":4.0743,"current_size":16.552},{"token_id":"49458764017597659514573234731940998982339359646087074270291874830372572595732","status":"REDEEMABLE","avg_price":0.0199,"current_price":0.0,"current_value":0.0,"realized_pnl":-0.01,"unrealized_pnl":-0.2039,"total_pnl":-0.2139,"current_size":10.2},{"token_id":"2618591573832738162913679271927267207972968872239887962293396886053858554649","status":"REDEEMABLE","avg_price":0.7299,"current_price":0.0,"current_value":0.0,"realized_pnl":-0.0149,"unrealized_pnl":-1.0999,"total_pnl":-1.1148,"current_size":1.5068},{"token_id":"54065802348264340781180366286468940160774623409772296945681445781417976930148","status":"REDEEMABLE","avg_price":0.4199,"current_price":0.0,"current_value":0.0,"realized_pnl":-0.0412,"unrealized_pnl":-1.4199,"total_pnl":-1.4611,"current_size":3.3809},{"token_id":"63086340633867374166296916716767345159121388286341018941116828465599669741959","status":"REDEEMABLE","avg_price":0.5897,"current_price":0.0,"current_value":0.0,"realized_pnl":1.1111,"unrealized_pnl":-3.0007,"total_pnl":-1.8896,"current_size":5.0882},{"token_id":"41330338653304219709555029188568269032082472789433655579873196372491063819991","status":"REDEEMABLE","avg_price":0.5299,"current_price":0.0,"current_value":0.0,"realized_pnl":-0.0452,"unrealized_pnl":-1.9199,"total_pnl":-1.9651,"current_size":3.6226},{"token_id":"47077648217971757308720798158325917219531658951054235799631815254380459178462","status":"REDEEMABLE","avg_price":0.8299,"current_price":0.0,"current_value":0.0,"realized_pnl":-0.0175,"unrealized_pnl":-2.0499,"total_pnl":-2.0674,"current_size":2.4698}],"pagination":{"limit":7,"offset":0,"has_more":true}}},
"closed_default": {"url":"https://data-api.polymarket.com/v2/positions?user=0xbc79e27f2c94124aeefb08d74b4e4fd3ac834e4d&limit=7&status=CLOSED","status":200,"date":"Fri, 04 Dec 2026 20:56:44 GMT","body":{"data":[{"token_id":"64620987201699714450904116765860966371545498125118736828680924169103742549403","status":"CLOSED","avg_price":0.2563,"current_price":1.0,"current_value":0.0,"realized_pnl":140.2894,"unrealized_pnl":0.0,"total_pnl":140.2894,"current_size":0.0},{"token_id":"75330054133399519852942415648680462506229215995803834711708101333223557605575","status":"CLOSED","avg_price":0.1397,"current_price":1.0,"current_value":0.0,"realized_pnl":109.1872,"unrealized_pnl":0.0,"total_pnl":109.1872,"current_size":0.0},{"token_id":"72888742932028991999466800216526896647951096092660478043802178498251332433741","status":"CLOSED","avg_price":0.487,"current_price":1.0,"current_value":0.0,"realized_pnl":90.3027,"unrealized_pnl":0.0,"total_pnl":90.3027,"current_size":0.0},{"token_id":"86843952992160665672559618028215743820638930427178683578703356678040675334819","status":"CLOSED","avg_price":0.4409,"current_price":1.0,"current_value":0.0,"realized_pnl":76.3429,"unrealized_pnl":0.0,"total_pnl":76.3429,"current_size":0.0},{"token_id":"55777510390318665492467086761401190607530819299865696880260617846434456780822","status":"CLOSED","avg_price":0.3715,"current_price":1.0,"current_value":0.0088,"realized_pnl":69.8901,"unrealized_pnl":0.0,"total_pnl":69.8901,"current_size":0.0088},{"token_id":"44996766623670111163185478315686536955427082108927675029181126638545537017422","status":"CLOSED","avg_price":0.1583,"current_price":1.0,"current_value":0.0,"realized_pnl":66.0998,"unrealized_pnl":0.0,"total_pnl":66.0998,"current_size":0.0},{"token_id":"651293246995138689769147052202072185438268329505895120511651147642598064129","status":"CLOSED","avg_price":0.1734,"current_price":1.0,"current_value":0.0,"realized_pnl":59.5228,"unrealized_pnl":0.0,"total_pnl":59.5228,"current_size":0.0}],"pagination":{"limit":7,"offset":0,"has_more":true}}},
"closed_price": {"url":"https://data-api.polymarket.com/v2/positions?user=0xbc79e27f2c94124aeefb08d74b4e4fd3ac834e4d&limit=7&status=CLOSED&sort_by=PRICE","status":200,"date":"Fri, 04 Dec 2026 20:56:44 GMT","body":{"data":[{"token_id":"64620987201699714450904116765860966371545498125118736828680924169103742549403","status":"CLOSED","avg_price":0.2563,"current_price":1.0,"current_value":0.0,"realized_pnl":140.2894,"unrealized_pnl":0.0,"total_pnl":140.2894,"current_size":0.0},{"token_id":"75330054133399519852942415648680462506229215995803834711708101333223557605575","status":"CLOSED","avg_price":0.1397,"current_price":1.0,"current_value":0.0,"realized_pnl":109.1872,"unrealized_pnl":0.0,"total_pnl":109.1872,"current_size":0.0},{"token_id":"72888742932028991999466800216526896647951096092660478043802178498251332433741","status":"CLOSED","avg_price":0.487,"current_price":1.0,"current_value":0.0,"realized_pnl":90.3027,"unrealized_pnl":0.0,"total_pnl":90.3027,"current_size":0.0},{"token_id":"86843952992160665672559618028215743820638930427178683578703356678040675334819","status":"CLOSED","avg_price":0.4409,"current_price":1.0,"current_value":0.0,"realized_pnl":76.3429,"unrealized_pnl":0.0,"total_pnl":76.3429,"current_size":0.0},{"token_id":"55777510390318665492467086761401190607530819299865696880260617846434456780822","status":"CLOSED","avg_price":0.3715,"current_price":1.0,"current_value":0.0088,"realized_pnl":69.8901,"unrealized_pnl":0.0,"total_pnl":69.8901,"current_size":0.0088},{"token_id":"44996766623670111163185478315686536955427082108927675029181126638545537017422","status":"CLOSED","avg_price":0.1583,"current_price":1.0,"current_value":0.0,"realized_pnl":66.0998,"unrealized_pnl":0.0,"total_pnl":66.0998,"current_size":0.0},{"token_id":"651293246995138689769147052202072185438268329505895120511651147642598064129","status":"CLOSED","avg_price":0.1734,"current_price":1.0,"current_value":0.0,"realized_pnl":59.5228,"unrealized_pnl":0.0,"total_pnl":59.5228,"current_size":0.0}],"pagination":{"limit":7,"offset":0,"has_more":true}}},
"closed_value": {"url":"https://data-api.polymarket.com/v2/positions?user=0xbc79e27f2c94124aeefb08d74b4e4fd3ac834e4d&limit=7&status=CLOSED&sort_by=CURRENT_VALUE","status":200,"date":"Fri, 04 Dec 2026 20:56:44 GMT","body":{"data":[{"token_id":"64620987201699714450904116765860966371545498125118736828680924169103742549403","status":"CLOSED","avg_price":0.2563,"current_price":1.0,"current_value":0.0,"realized_pnl":140.2894,"unrealized_pnl":0.0,"total_pnl":140.2894,"current_size":0.0},{"token_id":"75330054133399519852942415648680462506229215995803834711708101333223557605575","status":"CLOSED","avg_price":0.1397,"current_price":1.0,"current_value":0.0,"realized_pnl":109.1872,"unrealized_pnl":0.0,"total_pnl":109.1872,"current_size":0.0},{"token_id":"72888742932028991999466800216526896647951096092660478043802178498251332433741","status":"CLOSED","avg_price":0.487,"current_price":1.0,"current_value":0.0,"realized_pnl":90.3027,"unrealized_pnl":0.0,"total_pnl":90.3027,"current_size":0.0},{"token_id":"86843952992160665672559618028215743820638930427178683578703356678040675334819","status":"CLOSED","avg_price":0.4409,"current_price":1.0,"current_value":0.0,"realized_pnl":76.3429,"unrealized_pnl":0.0,"total_pnl":76.3429,"current_size":0.0},{"token_id":"55777510390318665492467086761401190607530819299865696880260617846434456780822","status":"CLOSED","avg_price":0.3715,"current_price":1.0,"current_value":0.0088,"realized_pnl":69.8901,"unrealized_pnl":0.0,"total_pnl":69.8901,"current_size":0.0088},{"token_id":"44996766623670111163185478315686536955427082108927675029181126638545537017422","status":"CLOSED","avg_price":0.1583,"current_price":1.0,"current_value":0.0,"realized_pnl":66.0998,"unrealized_pnl":0.0,"total_pnl":66.0998,"current_size":0.0},{"token_id":"651293246995138689769147052202072185438268329505895120511651147642598064129","status":"CLOSED","avg_price":0.1734,"current_price":1.0,"current_value":0.0,"realized_pnl":59.5228,"unrealized_pnl":0.0,"total_pnl":59.5228,"current_size":0.0}],"pagination":{"limit":7,"offset":0,"has_more":true}}},
"closed_avg": {"url":"https://data-api.polymarket.com/v2/positions?user=0xbc79e27f2c94124aeefb08d74b4e4fd3ac834e4d&limit=7&status=CLOSED&sort_by=AVG_PRICE","status":400,"date":"Fri, 04 Dec 2026 20:56:44 GMT","body":{"error":"sortBy=AVG_PRICE is not supported on a user's CLOSED or REDEEMABLE_LOST positions","code":"invalid_request","parameter":"sort_by","retryable":false}},
"lost_avg": {"url":"https://data-api.polymarket.com/v2/positions?user=0xbc79e27f2c94124aeefb08d74b4e4fd3ac834e4d&limit=7&status=REDEEMABLE_LOST&sort_by=AVG_PRICE","status":400,"date":"Fri, 04 Dec 2026 20:56:44 GMT","body":{"error":"sortBy=AVG_PRICE is not supported on a user's CLOSED or REDEEMABLE_LOST positions","code":"invalid_request","parameter":"sort_by","retryable":false}},
"realized_asc": {"url":"https://data-api.polymarket.com/v2/positions?user=0xbc79e27f2c94124aeefb08d74b4e4fd3ac834e4d&limit=7&sort_by=REALIZED_PNL&sort_direction=ASC","status":200,"date":"Fri, 04 Dec 2026 20:56:45 GMT","body":{"data":[{"token_id":"49932611791842248277648635261891267637049151266001723816279042019553905945029","status":"OPEN","avg_price":0.0767,"current_price":0.0845,"current_value":1.5914,"realized_pnl":-2.7801,"unrealized_pnl":0.1462,"total_pnl":-2.6339,"current_size":18.8333},{"token_id":"1188548547445269520707219060348990378779441344231931183199848184706112898196","status":"REDEEMABLE","avg_price":0.4867,"current_price":0.0,"current_value":0.0,"realized_pnl":-2.5321,"unrealized_pnl":-4.2565,"total_pnl":-6.7886,"current_size":8.745},{"token_id":"60488319664307907808238843684363128940030194181923783216789526080413999461490","status":"REDEEMABLE","avg_price":0.8899,"current_price":0.0,"current_value":0.0,"realized_pnl":-2.354,"unrealized_pnl":-10.0025,"total_pnl":-12.3565,"current_size":11.239},{"token_id":"892410193561107172609378383902568085199971906757190112078441271767169236993","status":"REDEEMABLE","avg_price":0.2521,"current_price":0.0,"current_value":0.0,"realized_pnl":-0.5598,"unrealized_pnl":-15.0,"total_pnl":-15.5598,"current_size":59.4884},{"token_id":"95229129827670087220727100480106541228024373756540169057303133111627214417806","status":"REDEEMABLE","avg_price":0.4514,"current_price":0.0,"current_value":0.0,"realized_pnl":-0.5483,"unrealized_pnl":-19.9999,"total_pnl":-20.5482,"current_size":44.3002},{"token_id":"93415544680886777702827441791006010294818009048547752679075414774317684068568","status":"REDEEMABLE","avg_price":0.4265,"current_price":0.0,"current_value":0.0,"realized_pnl":-0.5375,"unrealized_pnl":-18.9999,"total_pnl":-19.5374,"current_size":44.5414},{"token_id":"62981699707887980466392119482265940477346988633684735288536223089899860523618","status":"REDEEMABLE","avg_price":0.7096,"current_price":0.0,"current_value":0.0,"realized_pnl":-0.43,"unrealized_pnl":-29.9998,"total_pnl":-30.4298,"current_size":42.2733}],"pagination":{"limit":7,"offset":0,"has_more":true}}}
}
@@ -0,0 +1,47 @@
{
"position": {
"condition_id": "0xdc8c47c5b5d38a0da237b5a82f500ebc5cf5150de902962ac6ff76051ffe9159",
"token_id": "49932611791842248277648635261891267637049151266001723816279042019553905945029",
"proxy_wallet": "0xbc79e27f2c94124aeefb08d74b4e4fd3ac834e4d",
"current_size": 18.8333,
"total_size": 63.8333,
"avg_price": 0.0767,
"current_value": 0.9322,
"entry_cost_usdc": 1.4451,
"entry_fees_usdc": 0.066709,
"total_cost_usdc": 1.511809,
"realized_pnl": -2.7801,
"unrealized_pnl": -0.5129,
"total_pnl": -3.293
},
"trades": {
"url": "https://data-api.polymarket.com/v2/trades?user=0xbc79e27f2c94124aeefb08d74b4e4fd3ac834e4d&condition=0xdc8c47c5b5d38a0da237b5a82f500ebc5cf5150de902962ac6ff76051ffe9159&limit=50",
"status": 200,
"date": "Fri, 04 Dec 2026 20:53:08 GMT",
"body": {
"data": [
{
"token_id": "49932611791842248277648635261891267637049151266001723816279042019553905945029",
"side": "SELL",
"price": 0.0194444444,
"size": 45.0,
"timestamp": 1796380585
},
{
"token_id": "49932611791842248277648635261891267637049151266001723816279042019553905945029",
"side": "BUY",
"price": 0.077,
"size": 24.65,
"timestamp": 1796319905
},
{
"token_id": "49932611791842248277648635261891267637049151266001723816279042019553905945029",
"side": "BUY",
"price": 0.0765630793,
"size": 39.183377,
"timestamp": 1796319905
}
]
}
}
}
@@ -0,0 +1,17 @@
{
"baseline": {"url":"https://data-api.polymarket.com/v2/positions?user=0x0000000000000000000000000000000000000001&condition=0x87822b3d4ccba1835d698354b01c050b55f20c5f34b14908bff4ea5a6d58af4c&status=OPEN&limit=5","status":200,"date":"Fri, 04 Dec 2026 20:46:44 GMT","body":{"data":[{"token_id":"29677413448356631423250052573262008356913370083986817030510370064664558041792","condition_id":"0x87822b3d4ccba1835d698354b01c050b55f20c5f34b14908bff4ea5a6d58af4c","event_id":"16125","title":"Will Mark Carney be the next Canadian Prime Minister?","current_size":10.0,"current_value":10.0,"status":"REDEEMABLE"}]}},
"title": {"url":"https://data-api.polymarket.com/v2/positions?user=0x0000000000000000000000000000000000000001&condition=0x87822b3d4ccba1835d698354b01c050b55f20c5f34b14908bff4ea5a6d58af4c&status=OPEN&limit=5&title=wILL+mARK+cARNEY+BE+THE+NEXT+cANADIAN+pRIME+mINISTER%3F","status":200,"date":"Fri, 04 Dec 2026 20:46:44 GMT","body":{"data":[{"token_id":"29677413448356631423250052573262008356913370083986817030510370064664558041792","condition_id":"0x87822b3d4ccba1835d698354b01c050b55f20c5f34b14908bff4ea5a6d58af4c","event_id":"16125","title":"Will Mark Carney be the next Canadian Prime Minister?","current_size":10.0,"current_value":10.0,"status":"REDEEMABLE"}]}},
"wildcard": {"url":"https://data-api.polymarket.com/v2/positions?user=0x0000000000000000000000000000000000000001&condition=0x87822b3d4ccba1835d698354b01c050b55f20c5f34b14908bff4ea5a6d58af4c&status=OPEN&limit=5&title=%25","status":200,"date":"Fri, 04 Dec 2026 20:46:44 GMT","body":{"data":[{"token_id":"29677413448356631423250052573262008356913370083986817030510370064664558041792","condition_id":"0x87822b3d4ccba1835d698354b01c050b55f20c5f34b14908bff4ea5a6d58af4c","event_id":"16125","title":"Will Mark Carney be the next Canadian Prime Minister?","current_size":10.0,"current_value":10.0,"status":"REDEEMABLE"}]}},
"missing_title": {"url":"https://data-api.polymarket.com/v2/positions?user=0x0000000000000000000000000000000000000001&condition=0x87822b3d4ccba1835d698354b01c050b55f20c5f34b14908bff4ea5a6d58af4c&status=OPEN&limit=5&title=unmatched-xzyz","status":200,"date":"Fri, 04 Dec 2026 20:46:44 GMT","body":{"data":[]}},
"event_id": {"url":"https://data-api.polymarket.com/v2/positions?user=0x0000000000000000000000000000000000000001&status=OPEN&limit=5&event_id=16125","status":200,"date":"Fri, 04 Dec 2026 20:46:45 GMT","body":{"data":[{"token_id":"29677413448356631423250052573262008356913370083986817030510370064664558041792","condition_id":"0x87822b3d4ccba1835d698354b01c050b55f20c5f34b14908bff4ea5a6d58af4c","event_id":"16125","title":"Will Mark Carney be the next Canadian Prime Minister?","current_size":10.0,"current_value":10.0,"status":"REDEEMABLE"}]}},
"eventId": {"url":"https://data-api.polymarket.com/v2/positions?user=0x0000000000000000000000000000000000000001&status=OPEN&limit=5&eventId=16125","status":200,"date":"Fri, 04 Dec 2026 20:46:44 GMT","body":{"data":[{"token_id":"29677413448356631423250052573262008356913370083986817030510370064664558041792","condition_id":"0x87822b3d4ccba1835d698354b01c050b55f20c5f34b14908bff4ea5a6d58af4c","event_id":"16125","title":"Will Mark Carney be the next Canadian Prime Minister?","current_size":10.0,"current_value":10.0,"status":"REDEEMABLE"}]}},
"conflict": {"url":"https://data-api.polymarket.com/v2/positions?user=0x0000000000000000000000000000000000000001&condition=0x87822b3d4ccba1835d698354b01c050b55f20c5f34b14908bff4ea5a6d58af4c&status=OPEN&limit=5&event_id=16125","status":400,"date":"Fri, 04 Dec 2026 20:46:45 GMT","body":{"error":"must provide either eventId or condition, not both","code":"invalid_request","retryable":false}},
"wrong_event": {"url":"https://data-api.polymarket.com/v2/positions?user=0x0000000000000000000000000000000000000001&status=OPEN&limit=5&event_id=1","status":200,"date":"Fri, 04 Dec 2026 20:46:45 GMT","body":{"data":[]}},
"invalid_event": {"url":"https://data-api.polymarket.com/v2/positions?user=0x0000000000000000000000000000000000000001&status=OPEN&limit=5&event_id=bad","status":200,"date":"Fri, 04 Dec 2026 20:46:45 GMT","body":{"data":[]}},
"threshold": {"url":"https://data-api.polymarket.com/v2/positions?user=0x0000000000000000000000000000000000000001&condition=0x87822b3d4ccba1835d698354b01c050b55f20c5f34b14908bff4ea5a6d58af4c&status=OPEN&limit=5&filter_type=TOKENS&filter_amount=10.0","status":200,"date":"Fri, 04 Dec 2026 20:46:45 GMT","body":{"data":[{"token_id":"29677413448356631423250052573262008356913370083986817030510370064664558041792","condition_id":"0x87822b3d4ccba1835d698354b01c050b55f20c5f34b14908bff4ea5a6d58af4c","event_id":"16125","title":"Will Mark Carney be the next Canadian Prime Minister?","current_size":10.0,"current_value":10.0,"status":"REDEEMABLE"}]}},
"above_threshold": {"url":"https://data-api.polymarket.com/v2/positions?user=0x0000000000000000000000000000000000000001&condition=0x87822b3d4ccba1835d698354b01c050b55f20c5f34b14908bff4ea5a6d58af4c&status=OPEN&limit=5&filter_type=TOKENS&filter_amount=11.0","status":200,"date":"Fri, 04 Dec 2026 20:46:45 GMT","body":{"data":[]}},
"cash": {"url":"https://data-api.polymarket.com/v2/positions?user=0x0000000000000000000000000000000000000001&condition=0x87822b3d4ccba1835d698354b01c050b55f20c5f34b14908bff4ea5a6d58af4c&status=OPEN&limit=5&filter_type=CASH&filter_amount=11.0","status":200,"date":"Fri, 04 Dec 2026 20:46:45 GMT","body":{"data":[]}},
"lowercase_type": {"url":"https://data-api.polymarket.com/v2/positions?user=0x0000000000000000000000000000000000000001&condition=0x87822b3d4ccba1835d698354b01c050b55f20c5f34b14908bff4ea5a6d58af4c&status=OPEN&limit=5&filter_type=cash&filter_amount=11.0","status":200,"date":"Fri, 04 Dec 2026 20:46:45 GMT","body":{"data":[]}},
"invalid_type": {"url":"https://data-api.polymarket.com/v2/positions?user=0x0000000000000000000000000000000000000001&condition=0x87822b3d4ccba1835d698354b01c050b55f20c5f34b14908bff4ea5a6d58af4c&status=OPEN&limit=5&filter_type=weird&filter_amount=11.0","status":400,"date":"Fri, 04 Dec 2026 20:46:45 GMT","body":{"error":"filterType must be CASH or TOKENS","code":"invalid_request","parameter":"filter_type","retryable":false}},
"negative_amount": {"url":"https://data-api.polymarket.com/v2/positions?user=0x0000000000000000000000000000000000000001&condition=0x87822b3d4ccba1835d698354b01c050b55f20c5f34b14908bff4ea5a6d58af4c&status=OPEN&limit=5&filter_type=TOKENS&filter_amount=-1","status":200,"date":"Fri, 04 Dec 2026 20:46:46 GMT","body":{"data":[{"token_id":"29677413448356631423250052573262008356913370083986817030510370064664558041792","condition_id":"0x87822b3d4ccba1835d698354b01c050b55f20c5f34b14908bff4ea5a6d58af4c","event_id":"16125","title":"Will Mark Carney be the next Canadian Prime Minister?","current_size":10.0,"current_value":10.0,"status":"REDEEMABLE"}]}}
}
@@ -0,0 +1,27 @@
[
{"status":"OPEN","request":"https://data-api.polymarket.com/v2/positions?user=0xbc79e27f2c94124aeefb08d74b4e4fd3ac834e4d&status=OPEN&limit=5","observed_at":"Fri, 04 Dec 2026 20:39:57 GMT","http_status":200,"data":[{"proxy_wallet":"0xbc79e27f2c94124aeefb08d74b4e4fd3ac834e4d","condition_id":"0x016124720ad566f88bc302b21b492db296000000000000000000000000000000","token_id":"623948551310085686003807523523823512265834388288292452103061352323364159488","current_size":15.1515,"current_value":15.0757,"current_price":0.995,"status":"OPEN","mergeable":false,"redeemable":false,"archived":false},{"proxy_wallet":"0xbc79e27f2c94124aeefb08d74b4e4fd3ac834e4d","condition_id":"0x016bf4066e82571228813b876d04127934000000000000000000000000000000","token_id":"643049684020821311351796507355633171121115944121291300545830924465303715840","current_size":8.9285,"current_value":4.5982,"current_price":0.515,"status":"OPEN","mergeable":false,"redeemable":false,"archived":false},{"proxy_wallet":"0xbc79e27f2c94124aeefb08d74b4e4fd3ac834e4d","condition_id":"0xdc8c47c5b5d38a0da237b5a82f500ebc5cf5150de902962ac6ff76051ffe9159","token_id":"49932611791842248277648635261891267637049151266001723816279042019553905945029","current_size":18.8333,"current_value":0.9322,"current_price":0.0495,"status":"OPEN","mergeable":false,"redeemable":false,"archived":false},{"proxy_wallet":"0xbc79e27f2c94124aeefb08d74b4e4fd3ac834e4d","condition_id":"0x01f91615c9f752dc4e9138a6d1c9ded081000000000000000000000000000000","token_id":"892410193561107172609378383902568085199971906757190112078441271767169236993","current_size":59.4884,"current_value":0.0297,"current_price":0.0005,"status":"OPEN","mergeable":false,"redeemable":false,"archived":false},{"proxy_wallet":"0xbc79e27f2c94124aeefb08d74b4e4fd3ac834e4d","condition_id":"0x01eee4e05ca8e4c40c00966bddccf9acb1000000000000000000000000000000","token_id":"874402096953853186496076533822258356735156175384049251327656694874617413633","current_size":10.8695,"current_value":0.0054,"current_price":0.0005,"status":"OPEN","mergeable":false,"redeemable":false,"archived":false}],"has_more":true},
{"status":"REDEEMABLE","request":"https://data-api.polymarket.com/v2/positions?user=0xbc79e27f2c94124aeefb08d74b4e4fd3ac834e4d&status=REDEEMABLE&limit=5","observed_at":"Fri, 04 Dec 2026 20:39:57 GMT","http_status":200,"data":[{"proxy_wallet":"0xbc79e27f2c94124aeefb08d74b4e4fd3ac834e4d","condition_id":"0x73cbafa706ecd442f1d425760bf6990956d02f80a05218e2572ed8ff7d86600b","token_id":"100763846727527357412896243147875965206285074082132692057261517775218157995567","current_size":6.0,"current_value":0.0,"current_price":0.0,"status":"REDEEMABLE","mergeable":false,"redeemable":true,"archived":false},{"proxy_wallet":"0xbc79e27f2c94124aeefb08d74b4e4fd3ac834e4d","condition_id":"0x4b447aa24c5102be629d34e69972b4b8e9dad5692fb254627a66872add7ba02d","token_id":"103877075039694027145965660409462575325733871480609040594710427223250156456853","current_size":5.0847,"current_value":0.0,"current_price":0.0,"status":"REDEEMABLE","mergeable":false,"redeemable":true,"archived":false},{"proxy_wallet":"0xbc79e27f2c94124aeefb08d74b4e4fd3ac834e4d","condition_id":"0x7a7f7d7dcf69d3da887bf3732e7b4b2e8027ddad31395723d59ff759fe9bde56","token_id":"104746504118717300110262411640865393647451671620802814999140848418915045458343","current_size":4.8873,"current_value":0.0,"current_price":0.0,"status":"REDEEMABLE","mergeable":false,"redeemable":true,"archived":false},{"proxy_wallet":"0xbc79e27f2c94124aeefb08d74b4e4fd3ac834e4d","condition_id":"0x1737056c8ea1cc123713358625034c7bfa7cd5774ef640be9b8b199b9ace1552","token_id":"105214925774848454231506621805852425090385120703591449046381705680407825366975","current_size":11.6279,"current_value":0.0,"current_price":0.0,"status":"REDEEMABLE","mergeable":false,"redeemable":true,"archived":false},{"proxy_wallet":"0xbc79e27f2c94124aeefb08d74b4e4fd3ac834e4d","condition_id":"0xe1ae15398ca106ac2e444ba2258b108889b532e0990f89b1e7822b4ffb799eaf","token_id":"105426785463374522069343252785158212507372409184321993521191917200251587638020","current_size":30.9246,"current_value":0.0,"current_price":0.0,"status":"REDEEMABLE","mergeable":false,"redeemable":true,"archived":false}],"has_more":true},
{"status":"REDEEMABLE_LOST","request":"https://data-api.polymarket.com/v2/positions?user=0xbc79e27f2c94124aeefb08d74b4e4fd3ac834e4d&status=REDEEMABLE_LOST&limit=5","observed_at":"Fri, 04 Dec 2026 20:39:57 GMT","http_status":200,"data":[{"proxy_wallet":"0xbc79e27f2c94124aeefb08d74b4e4fd3ac834e4d","condition_id":"0x73cbafa706ecd442f1d425760bf6990956d02f80a05218e2572ed8ff7d86600b","token_id":"100763846727527357412896243147875965206285074082132692057261517775218157995567","current_size":6.0,"current_value":0.0,"current_price":0.0,"status":"REDEEMABLE","mergeable":false,"redeemable":true,"archived":false},{"proxy_wallet":"0xbc79e27f2c94124aeefb08d74b4e4fd3ac834e4d","condition_id":"0x4b447aa24c5102be629d34e69972b4b8e9dad5692fb254627a66872add7ba02d","token_id":"103877075039694027145965660409462575325733871480609040594710427223250156456853","current_size":5.0847,"current_value":0.0,"current_price":0.0,"status":"REDEEMABLE","mergeable":false,"redeemable":true,"archived":false},{"proxy_wallet":"0xbc79e27f2c94124aeefb08d74b4e4fd3ac834e4d","condition_id":"0x7a7f7d7dcf69d3da887bf3732e7b4b2e8027ddad31395723d59ff759fe9bde56","token_id":"104746504118717300110262411640865393647451671620802814999140848418915045458343","current_size":4.8873,"current_value":0.0,"current_price":0.0,"status":"REDEEMABLE","mergeable":false,"redeemable":true,"archived":false},{"proxy_wallet":"0xbc79e27f2c94124aeefb08d74b4e4fd3ac834e4d","condition_id":"0x1737056c8ea1cc123713358625034c7bfa7cd5774ef640be9b8b199b9ace1552","token_id":"105214925774848454231506621805852425090385120703591449046381705680407825366975","current_size":11.6279,"current_value":0.0,"current_price":0.0,"status":"REDEEMABLE","mergeable":false,"redeemable":true,"archived":false},{"proxy_wallet":"0xbc79e27f2c94124aeefb08d74b4e4fd3ac834e4d","condition_id":"0xe1ae15398ca106ac2e444ba2258b108889b532e0990f89b1e7822b4ffb799eaf","token_id":"105426785463374522069343252785158212507372409184321993521191917200251587638020","current_size":30.9246,"current_value":0.0,"current_price":0.0,"status":"REDEEMABLE","mergeable":false,"redeemable":true,"archived":false}],"has_more":true},
{"status":"MERGEABLE","request":"https://data-api.polymarket.com/v2/positions?user=0xbc79e27f2c94124aeefb08d74b4e4fd3ac834e4d&status=MERGEABLE&limit=5","observed_at":"Fri, 04 Dec 2026 20:39:57 GMT","http_status":200,"data":[],"has_more":false},
{"status":"CLOSED","request":"https://data-api.polymarket.com/v2/positions?user=0xbc79e27f2c94124aeefb08d74b4e4fd3ac834e4d&status=CLOSED&limit=5","observed_at":"Fri, 04 Dec 2026 20:39:57 GMT","http_status":200,"data":[{"proxy_wallet":"0xbc79e27f2c94124aeefb08d74b4e4fd3ac834e4d","condition_id":"0x738bf8bbf91b9dfd7e7d17e361ecfea7176ef33d383b6028ce9668fd69c4467d","token_id":"64620987201699714450904116765860966371545498125118736828680924169103742549403","current_size":0.0,"current_value":0.0,"current_price":1.0,"status":"CLOSED","mergeable":false,"redeemable":false,"archived":false},{"proxy_wallet":"0xbc79e27f2c94124aeefb08d74b4e4fd3ac834e4d","condition_id":"0x6dec4720e43ba8dd413f37760e97af043c54926dfbae4ffccd732cca308068ed","token_id":"75330054133399519852942415648680462506229215995803834711708101333223557605575","current_size":0.0,"current_value":0.0,"current_price":1.0,"status":"CLOSED","mergeable":false,"redeemable":false,"archived":false},{"proxy_wallet":"0xbc79e27f2c94124aeefb08d74b4e4fd3ac834e4d","condition_id":"0x0b0e47715d9901114b4c59b2908251b15a315207f7ab9b9799de81c831828b1a","token_id":"72888742932028991999466800216526896647951096092660478043802178498251332433741","current_size":0.0,"current_value":0.0,"current_price":1.0,"status":"CLOSED","mergeable":false,"redeemable":false,"archived":false},{"proxy_wallet":"0xbc79e27f2c94124aeefb08d74b4e4fd3ac834e4d","condition_id":"0x6fa1a21ce8cb9f6aa46edf5cf83e854afa2f7c96c535f06f0621d5f2016f3a89","token_id":"86843952992160665672559618028215743820638930427178683578703356678040675334819","current_size":0.0,"current_value":0.0,"current_price":1.0,"status":"CLOSED","mergeable":false,"redeemable":false,"archived":false},{"proxy_wallet":"0xbc79e27f2c94124aeefb08d74b4e4fd3ac834e4d","condition_id":"0x584f4cbc22ad93f05c1bde730a3b0c90a0ca3aee5d645d7641d4603b43ee305e","token_id":"55777510390318665492467086761401190607530819299865696880260617846434456780822","current_size":0.0088,"current_value":0.0088,"current_price":1.0,"status":"CLOSED","mergeable":false,"redeemable":true,"archived":false}],"has_more":true},
{"status":"OPEN","request":"https://data-api.polymarket.com/v2/positions?user=0xf7ca80f9a8f7c060a95392779210f74f2c356c84&status=OPEN&limit=5","observed_at":"Fri, 04 Dec 2026 20:39:57 GMT","http_status":200,"data":[{"proxy_wallet":"0xf7ca80f9a8f7c060a95392779210f74f2c356c84","condition_id":"0x01c1a020b58e05a3009ee507a3ff4f0729000000000000000000000000000000","token_id":"794419493339223664676140421620832224698646438653725751911329865844933001216","current_size":124.78,"current_value":123.8441,"current_price":0.9925,"status":"OPEN","mergeable":true,"redeemable":false,"archived":false},{"proxy_wallet":"0xf7ca80f9a8f7c060a95392779210f74f2c356c84","condition_id":"0x01c1a020b58e05a3009ee507a3ff4f0729000000000000000000000000000000","token_id":"794419493339223664676140421620832224698646438653725751911329865844933001217","current_size":125.41,"current_value":0.9405,"current_price":0.0075,"status":"OPEN","mergeable":true,"redeemable":false,"archived":false},{"proxy_wallet":"0xf7ca80f9a8f7c060a95392779210f74f2c356c84","condition_id":"0x637c9bdf7f8890c61c2d9488f8257575d8dfbc8e5708dae5f9aeaf47eb732959","token_id":"7802863854525654123138575151927839237553910654992019912159611729274188962237","current_size":0.29,"current_value":0.29,"current_price":1.0,"status":"REDEEMABLE","mergeable":false,"redeemable":true,"archived":false},{"proxy_wallet":"0xf7ca80f9a8f7c060a95392779210f74f2c356c84","condition_id":"0x2354b05ead4943bd86185e11fde68d4211e96cdc17a5d5c73f1116f21768fb70","token_id":"41775945706322230419100317170276564072148810772947737407607911013106626106551","current_size":0.27,"current_value":0.27,"current_price":1.0,"status":"REDEEMABLE","mergeable":false,"redeemable":true,"archived":false},{"proxy_wallet":"0xf7ca80f9a8f7c060a95392779210f74f2c356c84","condition_id":"0x6cddabbdd2162d82cbc45f20bbabf25cffa07f82da3fa981881d924701b79dbb","token_id":"100039973924308094011065672661860176642793653560164320857887841908176930183682","current_size":80.726,"current_value":0.0,"current_price":0.0,"status":"REDEEMABLE","mergeable":false,"redeemable":true,"archived":false}],"has_more":true},
{"status":"REDEEMABLE","request":"https://data-api.polymarket.com/v2/positions?user=0xf7ca80f9a8f7c060a95392779210f74f2c356c84&status=REDEEMABLE&limit=5","observed_at":"Fri, 04 Dec 2026 20:39:57 GMT","http_status":200,"data":[{"proxy_wallet":"0xf7ca80f9a8f7c060a95392779210f74f2c356c84","condition_id":"0x637c9bdf7f8890c61c2d9488f8257575d8dfbc8e5708dae5f9aeaf47eb732959","token_id":"7802863854525654123138575151927839237553910654992019912159611729274188962237","current_size":0.29,"current_value":0.29,"current_price":1.0,"status":"REDEEMABLE","mergeable":false,"redeemable":true,"archived":false},{"proxy_wallet":"0xf7ca80f9a8f7c060a95392779210f74f2c356c84","condition_id":"0x2354b05ead4943bd86185e11fde68d4211e96cdc17a5d5c73f1116f21768fb70","token_id":"41775945706322230419100317170276564072148810772947737407607911013106626106551","current_size":0.27,"current_value":0.27,"current_price":1.0,"status":"REDEEMABLE","mergeable":false,"redeemable":true,"archived":false},{"proxy_wallet":"0xf7ca80f9a8f7c060a95392779210f74f2c356c84","condition_id":"0x6cddabbdd2162d82cbc45f20bbabf25cffa07f82da3fa981881d924701b79dbb","token_id":"100039973924308094011065672661860176642793653560164320857887841908176930183682","current_size":80.726,"current_value":0.0,"current_price":0.0,"status":"REDEEMABLE","mergeable":false,"redeemable":true,"archived":false},{"proxy_wallet":"0xf7ca80f9a8f7c060a95392779210f74f2c356c84","condition_id":"0x1d02405b049b76beba2320c827e9bc7024ce076d5f690aaafaddb37ef4618312","token_id":"100116739742939922754784677284710427936553332398602782242024802232507374504067","current_size":526.5287,"current_value":0.0,"current_price":0.0,"status":"REDEEMABLE","mergeable":false,"redeemable":true,"archived":false},{"proxy_wallet":"0xf7ca80f9a8f7c060a95392779210f74f2c356c84","condition_id":"0x15e6b013a3543a0383f89abb8830afd2e8be0c842849170aaa600ae3dfbaaa6c","token_id":"100393779853577963580513954385583070858358777009499003882127685996315097055067","current_size":200.0,"current_value":0.0,"current_price":0.0,"status":"REDEEMABLE","mergeable":false,"redeemable":true,"archived":false}],"has_more":true},
{"status":"REDEEMABLE_LOST","request":"https://data-api.polymarket.com/v2/positions?user=0xf7ca80f9a8f7c060a95392779210f74f2c356c84&status=REDEEMABLE_LOST&limit=5","observed_at":"Fri, 04 Dec 2026 20:39:57 GMT","http_status":200,"data":[{"proxy_wallet":"0xf7ca80f9a8f7c060a95392779210f74f2c356c84","condition_id":"0x6cddabbdd2162d82cbc45f20bbabf25cffa07f82da3fa981881d924701b79dbb","token_id":"100039973924308094011065672661860176642793653560164320857887841908176930183682","current_size":80.726,"current_value":0.0,"current_price":0.0,"status":"REDEEMABLE","mergeable":false,"redeemable":true,"archived":false},{"proxy_wallet":"0xf7ca80f9a8f7c060a95392779210f74f2c356c84","condition_id":"0x1d02405b049b76beba2320c827e9bc7024ce076d5f690aaafaddb37ef4618312","token_id":"100116739742939922754784677284710427936553332398602782242024802232507374504067","current_size":526.5287,"current_value":0.0,"current_price":0.0,"status":"REDEEMABLE","mergeable":false,"redeemable":true,"archived":false},{"proxy_wallet":"0xf7ca80f9a8f7c060a95392779210f74f2c356c84","condition_id":"0x15e6b013a3543a0383f89abb8830afd2e8be0c842849170aaa600ae3dfbaaa6c","token_id":"100393779853577963580513954385583070858358777009499003882127685996315097055067","current_size":200.0,"current_value":0.0,"current_price":0.0,"status":"REDEEMABLE","mergeable":false,"redeemable":true,"archived":false},{"proxy_wallet":"0xf7ca80f9a8f7c060a95392779210f74f2c356c84","condition_id":"0xab1b6f5658808737521e83c0967158c1982116c46283ecece415375eb34ac7c7","token_id":"101285568154310971208307776855119673478596477267029240818545990219942975297335","current_size":100.0,"current_value":0.0,"current_price":0.0,"status":"REDEEMABLE","mergeable":false,"redeemable":true,"archived":false},{"proxy_wallet":"0xf7ca80f9a8f7c060a95392779210f74f2c356c84","condition_id":"0xb0e7e2a75362969bf6a6a12cfeda88080fca19cf83fb5e07ada602fba135c993","token_id":"101529303986380227797820995397675670838146600395802452608313597769581050384853","current_size":80.0,"current_value":0.0,"current_price":0.0,"status":"REDEEMABLE","mergeable":false,"redeemable":true,"archived":false}],"has_more":true},
{"status":"MERGEABLE","request":"https://data-api.polymarket.com/v2/positions?user=0xf7ca80f9a8f7c060a95392779210f74f2c356c84&status=MERGEABLE&limit=5","observed_at":"Fri, 04 Dec 2026 20:39:58 GMT","http_status":200,"data":[{"proxy_wallet":"0xf7ca80f9a8f7c060a95392779210f74f2c356c84","condition_id":"0x01c1a020b58e05a3009ee507a3ff4f0729000000000000000000000000000000","token_id":"794419493339223664676140421620832224698646438653725751911329865844933001217","current_size":125.41,"current_value":0.9405,"current_price":0.0075,"status":"OPEN","mergeable":true,"redeemable":false,"archived":false},{"proxy_wallet":"0xf7ca80f9a8f7c060a95392779210f74f2c356c84","condition_id":"0x01c1a020b58e05a3009ee507a3ff4f0729000000000000000000000000000000","token_id":"794419493339223664676140421620832224698646438653725751911329865844933001216","current_size":124.78,"current_value":123.8441,"current_price":0.9925,"status":"OPEN","mergeable":true,"redeemable":false,"archived":false}],"has_more":false},
{"status":"CLOSED","request":"https://data-api.polymarket.com/v2/positions?user=0xf7ca80f9a8f7c060a95392779210f74f2c356c84&status=CLOSED&limit=5","observed_at":"Fri, 04 Dec 2026 20:39:58 GMT","http_status":200,"data":[{"proxy_wallet":"0xf7ca80f9a8f7c060a95392779210f74f2c356c84","condition_id":"0xe9981200d697d4729963dada67485373d8b79a53eb255939a7069e42d46d4f6c","token_id":"99975885905088265651270566134319140793798341996806903249122353498509388749063","current_size":0.0,"current_value":0.0,"current_price":1.0,"status":"CLOSED","mergeable":false,"redeemable":false,"archived":false},{"proxy_wallet":"0xf7ca80f9a8f7c060a95392779210f74f2c356c84","condition_id":"0xd8f6e1a887b882f35b3bbf7fb85b9d826870a9a1920c00caaa53bd949cffa949","token_id":"105306919281568750525162884908349813267467919393753767766216631616424696605401","current_size":0.0,"current_value":0.0,"current_price":1.0,"status":"CLOSED","mergeable":false,"redeemable":false,"archived":false},{"proxy_wallet":"0xf7ca80f9a8f7c060a95392779210f74f2c356c84","condition_id":"0xb8dc298e91d22304a5cbff5742ff1aaff244a65abf3c9996bc4a280b43b0c0b9","token_id":"88695616369657695855103828387547750759012457957971788345643843623803550935910","current_size":0.0,"current_value":0.0,"current_price":1.0,"status":"CLOSED","mergeable":false,"redeemable":false,"archived":false},{"proxy_wallet":"0xf7ca80f9a8f7c060a95392779210f74f2c356c84","condition_id":"0xfdce02fefc76b251a487dc9c98d37f78827e40eb70d6d255b2286c003bf7484c","token_id":"7013566801704553053137262927590994113649140483746153978660013661321438752729","current_size":0.0,"current_value":0.0,"current_price":1.0,"status":"CLOSED","mergeable":false,"redeemable":false,"archived":false},{"proxy_wallet":"0xf7ca80f9a8f7c060a95392779210f74f2c356c84","condition_id":"0x392bf5a52839711126181d97eb499caaac15fdecd0e56d44042f958c54a59220","token_id":"31995302506920258679115983355300175302934302898810308908401438376519603649683","current_size":0.0,"current_value":0.0,"current_price":1.0,"status":"CLOSED","mergeable":false,"redeemable":false,"archived":false}],"has_more":true},
{"status":"OPEN","request":"https://data-api.polymarket.com/v2/positions?user=0x234d32aa641177b3b6f7f646c5ef2d4c884d5898&status=OPEN&limit=5","observed_at":"Fri, 04 Dec 2026 20:39:58 GMT","http_status":200,"data":[{"proxy_wallet":"0x234d32aa641177b3b6f7f646c5ef2d4c884d5898","condition_id":"0x016bf4066e82571228813b876d04127934000000000000000000000000000000","token_id":"643049684020821311351796507355633171121115944121291300545830924465303715841","current_size":4.4444,"current_value":2.2444,"current_price":0.505,"status":"OPEN","mergeable":false,"redeemable":false,"archived":false},{"proxy_wallet":"0x234d32aa641177b3b6f7f646c5ef2d4c884d5898","condition_id":"0x016124720ad566f88bc302b21b492db296000000000000000000000000000000","token_id":"623948551310085686003807523523823512265834388288292452103061352323364159489","current_size":7.1428,"current_value":0.0357,"current_price":0.005,"status":"OPEN","mergeable":false,"redeemable":false,"archived":false},{"proxy_wallet":"0x234d32aa641177b3b6f7f646c5ef2d4c884d5898","condition_id":"0xf5351030d387eb7c021652d6f891f772cff8b0063ceb03e58f8c0b6c4d71f04f","token_id":"100068124601642237151788915119212498183404504460402310236684671438891194396112","current_size":2.8571,"current_value":0.0,"current_price":0.0,"status":"REDEEMABLE","mergeable":false,"redeemable":true,"archived":false},{"proxy_wallet":"0x234d32aa641177b3b6f7f646c5ef2d4c884d5898","condition_id":"0xeaadc51d3e5083118368ddde5c2b66654223707abf104d035fd7de9461c793a7","token_id":"100150378208475896629216696395655000392920954575626044733969466382236387653470","current_size":15.8871,"current_value":0.0,"current_price":0.0,"status":"REDEEMABLE","mergeable":false,"redeemable":true,"archived":false},{"proxy_wallet":"0x234d32aa641177b3b6f7f646c5ef2d4c884d5898","condition_id":"0xbe22ebd236997b54936b94f0b4a310c003732eb50dc78a93821b71a130d9178f","token_id":"100163301955613618223861608386405333660480045417003308533532425336949272565405","current_size":6.6666,"current_value":0.0,"current_price":0.0,"status":"REDEEMABLE","mergeable":false,"redeemable":true,"archived":false}],"has_more":true},
{"status":"REDEEMABLE","request":"https://data-api.polymarket.com/v2/positions?user=0x234d32aa641177b3b6f7f646c5ef2d4c884d5898&status=REDEEMABLE&limit=5","observed_at":"Fri, 04 Dec 2026 20:39:58 GMT","http_status":200,"data":[{"proxy_wallet":"0x234d32aa641177b3b6f7f646c5ef2d4c884d5898","condition_id":"0xf5351030d387eb7c021652d6f891f772cff8b0063ceb03e58f8c0b6c4d71f04f","token_id":"100068124601642237151788915119212498183404504460402310236684671438891194396112","current_size":2.8571,"current_value":0.0,"current_price":0.0,"status":"REDEEMABLE","mergeable":false,"redeemable":true,"archived":false},{"proxy_wallet":"0x234d32aa641177b3b6f7f646c5ef2d4c884d5898","condition_id":"0xeaadc51d3e5083118368ddde5c2b66654223707abf104d035fd7de9461c793a7","token_id":"100150378208475896629216696395655000392920954575626044733969466382236387653470","current_size":15.8871,"current_value":0.0,"current_price":0.0,"status":"REDEEMABLE","mergeable":false,"redeemable":true,"archived":false},{"proxy_wallet":"0x234d32aa641177b3b6f7f646c5ef2d4c884d5898","condition_id":"0xbe22ebd236997b54936b94f0b4a310c003732eb50dc78a93821b71a130d9178f","token_id":"100163301955613618223861608386405333660480045417003308533532425336949272565405","current_size":6.6666,"current_value":0.0,"current_price":0.0,"status":"REDEEMABLE","mergeable":false,"redeemable":true,"archived":false},{"proxy_wallet":"0x234d32aa641177b3b6f7f646c5ef2d4c884d5898","condition_id":"0x50eed781c1dd0a60b90ad26c1663a866de2ba07768651b51b7ec8c5789c95d5a","token_id":"100367409921233883296261093339211137996368453206234319171305571116788301736111","current_size":4.1666,"current_value":0.0,"current_price":0.0,"status":"REDEEMABLE","mergeable":false,"redeemable":true,"archived":false},{"proxy_wallet":"0x234d32aa641177b3b6f7f646c5ef2d4c884d5898","condition_id":"0x2d899daacd8b355a453ac10932b8fc8f24b20afabdaa7ff57604faf2814194ee","token_id":"100418145250952185995386017588754248391407603189163355707143814476900315526896","current_size":3.3333,"current_value":0.0,"current_price":0.0,"status":"REDEEMABLE","mergeable":false,"redeemable":true,"archived":false}],"has_more":true},
{"status":"REDEEMABLE_LOST","request":"https://data-api.polymarket.com/v2/positions?user=0x234d32aa641177b3b6f7f646c5ef2d4c884d5898&status=REDEEMABLE_LOST&limit=5","observed_at":"Fri, 04 Dec 2026 20:39:58 GMT","http_status":200,"data":[{"proxy_wallet":"0x234d32aa641177b3b6f7f646c5ef2d4c884d5898","condition_id":"0xf5351030d387eb7c021652d6f891f772cff8b0063ceb03e58f8c0b6c4d71f04f","token_id":"100068124601642237151788915119212498183404504460402310236684671438891194396112","current_size":2.8571,"current_value":0.0,"current_price":0.0,"status":"REDEEMABLE","mergeable":false,"redeemable":true,"archived":false},{"proxy_wallet":"0x234d32aa641177b3b6f7f646c5ef2d4c884d5898","condition_id":"0xeaadc51d3e5083118368ddde5c2b66654223707abf104d035fd7de9461c793a7","token_id":"100150378208475896629216696395655000392920954575626044733969466382236387653470","current_size":15.8871,"current_value":0.0,"current_price":0.0,"status":"REDEEMABLE","mergeable":false,"redeemable":true,"archived":false},{"proxy_wallet":"0x234d32aa641177b3b6f7f646c5ef2d4c884d5898","condition_id":"0xbe22ebd236997b54936b94f0b4a310c003732eb50dc78a93821b71a130d9178f","token_id":"100163301955613618223861608386405333660480045417003308533532425336949272565405","current_size":6.6666,"current_value":0.0,"current_price":0.0,"status":"REDEEMABLE","mergeable":false,"redeemable":true,"archived":false},{"proxy_wallet":"0x234d32aa641177b3b6f7f646c5ef2d4c884d5898","condition_id":"0x50eed781c1dd0a60b90ad26c1663a866de2ba07768651b51b7ec8c5789c95d5a","token_id":"100367409921233883296261093339211137996368453206234319171305571116788301736111","current_size":4.1666,"current_value":0.0,"current_price":0.0,"status":"REDEEMABLE","mergeable":false,"redeemable":true,"archived":false},{"proxy_wallet":"0x234d32aa641177b3b6f7f646c5ef2d4c884d5898","condition_id":"0x2d899daacd8b355a453ac10932b8fc8f24b20afabdaa7ff57604faf2814194ee","token_id":"100418145250952185995386017588754248391407603189163355707143814476900315526896","current_size":3.3333,"current_value":0.0,"current_price":0.0,"status":"REDEEMABLE","mergeable":false,"redeemable":true,"archived":false}],"has_more":true},
{"status":"MERGEABLE","request":"https://data-api.polymarket.com/v2/positions?user=0x234d32aa641177b3b6f7f646c5ef2d4c884d5898&status=MERGEABLE&limit=5","observed_at":"Fri, 04 Dec 2026 20:39:58 GMT","http_status":200,"data":[],"has_more":false},
{"status":"CLOSED","request":"https://data-api.polymarket.com/v2/positions?user=0x234d32aa641177b3b6f7f646c5ef2d4c884d5898&status=CLOSED&limit=5","observed_at":"Fri, 04 Dec 2026 20:39:58 GMT","http_status":200,"data":[{"proxy_wallet":"0x234d32aa641177b3b6f7f646c5ef2d4c884d5898","condition_id":"0x6bbb7ea04dc336e578662000c6929bebacf36ff47652aabb1b9a06d35a957b4d","token_id":"32250452259858625197208821141035109957279303585472265423681761943649363177306","current_size":0.0,"current_value":0.0,"current_price":1.0,"status":"CLOSED","mergeable":false,"redeemable":false,"archived":false},{"proxy_wallet":"0x234d32aa641177b3b6f7f646c5ef2d4c884d5898","condition_id":"0xc7a02400f015eff5bd1b43d96a27ddd3831b83370d1592e1ac3f432ef5c83ec9","token_id":"36368021161523860163338053935989864202333714982664338848644977086573258801930","current_size":0.0,"current_value":0.0,"current_price":1.0,"status":"CLOSED","mergeable":false,"redeemable":false,"archived":false},{"proxy_wallet":"0x234d32aa641177b3b6f7f646c5ef2d4c884d5898","condition_id":"0x35cfa37bab442283afa3b0f722c2057c0aad24a4473c2f8b0007ceec1adf25f6","token_id":"57962399175893558324976286608643798416417838125923251650067757839664970395717","current_size":0.0,"current_value":0.0,"current_price":1.0,"status":"CLOSED","mergeable":false,"redeemable":false,"archived":false},{"proxy_wallet":"0x234d32aa641177b3b6f7f646c5ef2d4c884d5898","condition_id":"0xdd228d32d0f3b15ad1768a78a317bc51456f5b2f57917567239e1fd67983cb90","token_id":"38346828385519716434059560916428795367702672794427008722087251895584250368963","current_size":0.0,"current_value":0.0,"current_price":1.0,"status":"CLOSED","mergeable":false,"redeemable":false,"archived":false},{"proxy_wallet":"0x234d32aa641177b3b6f7f646c5ef2d4c884d5898","condition_id":"0xa1f529ba68ee418003297582f04b5b8fe99081551c34779cc4b8356deec548ef","token_id":"93031934626579772395730415777505121846594645275192433981225161762801687539627","current_size":0.0,"current_value":0.0,"current_price":1.0,"status":"CLOSED","mergeable":false,"redeemable":false,"archived":false}],"has_more":true},
{"status":"OPEN","request":"https://data-api.polymarket.com/v2/positions?user=0xb6c9344216d8139ebda93f9648bcbe1240936e57&status=OPEN&limit=5","observed_at":"Fri, 04 Dec 2026 20:39:58 GMT","http_status":200,"data":[{"proxy_wallet":"0xb6c9344216d8139ebda93f9648bcbe1240936e57","condition_id":"0x9ca22f7af33ec67d48965de02eadfe5d6523f712e973f4b3519139973c4bec29","token_id":"90489244946727857927478579210986058033850864162778431818016847041565184722190","current_size":33.3333,"current_value":29.8333,"current_price":0.895,"status":"OPEN","mergeable":false,"redeemable":false,"archived":false},{"proxy_wallet":"0xb6c9344216d8139ebda93f9648bcbe1240936e57","condition_id":"0x7586a96520578acaaaa4ea84a2582f197f84255da1f3392a7aa300386c187b37","token_id":"20006732765674855733524007935991362439352594042415161039767275461950712817548","current_size":44.453,"current_value":4.3119,"current_price":0.097,"status":"OPEN","mergeable":false,"redeemable":false,"archived":false},{"proxy_wallet":"0xb6c9344216d8139ebda93f9648bcbe1240936e57","condition_id":"0x684e5b72d4e407695397a79ed75ef37273c2655ca2548791a4153233d3744696","token_id":"11876606915924142133615854761923277060697657209957870741155164849437788272266","current_size":154.1538,"current_value":3.7767,"current_price":0.0245,"status":"OPEN","mergeable":false,"redeemable":false,"archived":false},{"proxy_wallet":"0xb6c9344216d8139ebda93f9648bcbe1240936e57","condition_id":"0x63da7b2d523ba263304447b6f0ef4a6ea180b89ae91f8f256bbd8397b0c03888","token_id":"54142434400360599628100949386530479498068835619855720955715377508216403661205","current_size":1.9607,"current_value":1.9607,"current_price":1.0,"status":"REDEEMABLE","mergeable":false,"redeemable":true,"archived":false},{"proxy_wallet":"0xb6c9344216d8139ebda93f9648bcbe1240936e57","condition_id":"0x75743159df076ee110ede9e386bf9cad91df081c8bd04f3f05e5d7c141a51f33","token_id":"12288525947764397960021713424576849007970406950510265136663237558531782770669","current_size":79.06,"current_value":1.8974,"current_price":0.024,"status":"OPEN","mergeable":false,"redeemable":false,"archived":false}],"has_more":true},
{"status":"REDEEMABLE","request":"https://data-api.polymarket.com/v2/positions?user=0xb6c9344216d8139ebda93f9648bcbe1240936e57&status=REDEEMABLE&limit=5","observed_at":"Fri, 04 Dec 2026 20:39:59 GMT","http_status":200,"data":[{"proxy_wallet":"0xb6c9344216d8139ebda93f9648bcbe1240936e57","condition_id":"0x63da7b2d523ba263304447b6f0ef4a6ea180b89ae91f8f256bbd8397b0c03888","token_id":"54142434400360599628100949386530479498068835619855720955715377508216403661205","current_size":1.9607,"current_value":1.9607,"current_price":1.0,"status":"REDEEMABLE","mergeable":false,"redeemable":true,"archived":false},{"proxy_wallet":"0xb6c9344216d8139ebda93f9648bcbe1240936e57","condition_id":"0x89e9eec16f900a6b24f54d0287d8fcae2cb033d2aff7f7e70b76ff39d2096746","token_id":"6190838905626139275138287078725780734402030701897525505916200372078494079316","current_size":1.8181,"current_value":1.8181,"current_price":1.0,"status":"REDEEMABLE","mergeable":false,"redeemable":true,"archived":false},{"proxy_wallet":"0xb6c9344216d8139ebda93f9648bcbe1240936e57","condition_id":"0xb67a10d8e7aa0ecefdec67617bfe7de13a5e4450a6366babdc11a0be61095fec","token_id":"105220676801298290597520454980520144355742641714821188587322329229931781495341","current_size":41.6666,"current_value":0.0,"current_price":0.0,"status":"REDEEMABLE","mergeable":false,"redeemable":true,"archived":false},{"proxy_wallet":"0xb6c9344216d8139ebda93f9648bcbe1240936e57","condition_id":"0x3e518a48b72535b40c6aec922930a2ca4c3a84374b1fd3a755309bccc4edc9d8","token_id":"106675605315891515362400993057244154389996801258820216339420752929151210370605","current_size":25.641,"current_value":0.0,"current_price":0.0,"status":"REDEEMABLE","mergeable":false,"redeemable":true,"archived":false},{"proxy_wallet":"0xb6c9344216d8139ebda93f9648bcbe1240936e57","condition_id":"0x69aeb202063d522a2138eea4af2b246ded0b5f0a369e3533844d3c3a91126b7a","token_id":"106777711314668536375213333774224943218460456889313536158654065973760832135255","current_size":13.3333,"current_value":0.0,"current_price":0.0,"status":"REDEEMABLE","mergeable":false,"redeemable":true,"archived":false}],"has_more":true},
{"status":"REDEEMABLE_LOST","request":"https://data-api.polymarket.com/v2/positions?user=0xb6c9344216d8139ebda93f9648bcbe1240936e57&status=REDEEMABLE_LOST&limit=5","observed_at":"Fri, 04 Dec 2026 20:39:59 GMT","http_status":200,"data":[{"proxy_wallet":"0xb6c9344216d8139ebda93f9648bcbe1240936e57","condition_id":"0xb67a10d8e7aa0ecefdec67617bfe7de13a5e4450a6366babdc11a0be61095fec","token_id":"105220676801298290597520454980520144355742641714821188587322329229931781495341","current_size":41.6666,"current_value":0.0,"current_price":0.0,"status":"REDEEMABLE","mergeable":false,"redeemable":true,"archived":false},{"proxy_wallet":"0xb6c9344216d8139ebda93f9648bcbe1240936e57","condition_id":"0x3e518a48b72535b40c6aec922930a2ca4c3a84374b1fd3a755309bccc4edc9d8","token_id":"106675605315891515362400993057244154389996801258820216339420752929151210370605","current_size":25.641,"current_value":0.0,"current_price":0.0,"status":"REDEEMABLE","mergeable":false,"redeemable":true,"archived":false},{"proxy_wallet":"0xb6c9344216d8139ebda93f9648bcbe1240936e57","condition_id":"0x69aeb202063d522a2138eea4af2b246ded0b5f0a369e3533844d3c3a91126b7a","token_id":"106777711314668536375213333774224943218460456889313536158654065973760832135255","current_size":13.3333,"current_value":0.0,"current_price":0.0,"status":"REDEEMABLE","mergeable":false,"redeemable":true,"archived":false},{"proxy_wallet":"0xb6c9344216d8139ebda93f9648bcbe1240936e57","condition_id":"0xcd231ad5fb3feb95c4f270e5f5445ba739a0d62413b4fcd449bbfacc0e2fb0d0","token_id":"111167256144913771457317512438671267306129441178434599434929288584618561589335","current_size":6.7567,"current_value":0.0,"current_price":0.0,"status":"REDEEMABLE","mergeable":false,"redeemable":true,"archived":false},{"proxy_wallet":"0xb6c9344216d8139ebda93f9648bcbe1240936e57","condition_id":"0x0fd33cd06a60ca6445ca184deda2da5751d090eca6f50835392edfa667d6ba5a","token_id":"111378315534273870693607410636433225023407397602928550105530263480212651559012","current_size":14.4927,"current_value":0.0,"current_price":0.0,"status":"REDEEMABLE","mergeable":false,"redeemable":true,"archived":false}],"has_more":true},
{"status":"MERGEABLE","request":"https://data-api.polymarket.com/v2/positions?user=0xb6c9344216d8139ebda93f9648bcbe1240936e57&status=MERGEABLE&limit=5","observed_at":"Fri, 04 Dec 2026 20:39:59 GMT","http_status":200,"data":[],"has_more":false},
{"status":"CLOSED","request":"https://data-api.polymarket.com/v2/positions?user=0xb6c9344216d8139ebda93f9648bcbe1240936e57&status=CLOSED&limit=5","observed_at":"Fri, 04 Dec 2026 20:39:59 GMT","http_status":200,"data":[{"proxy_wallet":"0xb6c9344216d8139ebda93f9648bcbe1240936e57","condition_id":"0x258ff19b4baff0ed24bc28f58e83c8be6f2f91d9134700703e0aa51810c51a63","token_id":"1689950543806317773337530280926430142670579667870391801780343754845480907767","current_size":0.0,"current_value":0.0,"current_price":1.0,"status":"CLOSED","mergeable":false,"redeemable":false,"archived":false},{"proxy_wallet":"0xb6c9344216d8139ebda93f9648bcbe1240936e57","condition_id":"0xcceae66d81c60f90c9679ab531b865bd7e9f95cc54f7b0634a24095519b10d65","token_id":"107409796822153809778143872196236532785178617102787858261374110829112218839748","current_size":0.0,"current_value":0.0,"current_price":1.0,"status":"CLOSED","mergeable":false,"redeemable":false,"archived":false},{"proxy_wallet":"0xb6c9344216d8139ebda93f9648bcbe1240936e57","condition_id":"0x72bee1e573407d221b7fe3a8b5494fa159118cef5b4fc1155df8b62a1891e22f","token_id":"67769739493433108294547688091351634385240379761911714880507494310949784810747","current_size":0.0,"current_value":0.0,"current_price":1.0,"status":"CLOSED","mergeable":false,"redeemable":false,"archived":false},{"proxy_wallet":"0xb6c9344216d8139ebda93f9648bcbe1240936e57","condition_id":"0x09685805d0cf45bac3bdcabfc78866b2ca98aa45561ade9e73ec234366d12fbe","token_id":"50502754578080065229596734683657247352680854573482409167312994130978096359720","current_size":0.0,"current_value":0.0,"current_price":1.0,"status":"CLOSED","mergeable":false,"redeemable":false,"archived":false},{"proxy_wallet":"0xb6c9344216d8139ebda93f9648bcbe1240936e57","condition_id":"0xb24de8e22e871ba3bbedb6c6c8ee70b1ac54875efd9e61981075b0b4ba6f8293","token_id":"102466397314063543880416078637408206323333520330416790306498580370424355602908","current_size":0.0,"current_value":0.0,"current_price":1.0,"status":"CLOSED","mergeable":false,"redeemable":false,"archived":false}],"has_more":true},
{"status":"OPEN","request":"https://data-api.polymarket.com/v2/positions?user=0x0000000000000000000000000000000000000001&status=OPEN&limit=5","observed_at":"Fri, 04 Dec 2026 20:39:59 GMT","http_status":200,"data":[{"proxy_wallet":"0x0000000000000000000000000000000000000001","condition_id":"0x87822b3d4ccba1835d698354b01c050b55f20c5f34b14908bff4ea5a6d58af4c","token_id":"29677413448356631423250052573262008356913370083986817030510370064664558041792","current_size":10.0,"current_value":10.0,"current_price":1.0,"status":"REDEEMABLE","mergeable":false,"redeemable":true,"archived":false},{"proxy_wallet":"0x0000000000000000000000000000000000000001","condition_id":"0xc587bda904f031a973ad3cb57128ca011bfab0f45e6cb3734ed2227c4d4be419","token_id":"69119940120690198080427862456277899176151352667092917892731174838615809844766","current_size":5000.0,"current_value":0.0,"current_price":0.0,"status":"REDEEMABLE","mergeable":false,"redeemable":true,"archived":false}],"has_more":false},
{"status":"REDEEMABLE","request":"https://data-api.polymarket.com/v2/positions?user=0x0000000000000000000000000000000000000001&status=REDEEMABLE&limit=5","observed_at":"Fri, 04 Dec 2026 20:39:59 GMT","http_status":200,"data":[{"proxy_wallet":"0x0000000000000000000000000000000000000001","condition_id":"0x87822b3d4ccba1835d698354b01c050b55f20c5f34b14908bff4ea5a6d58af4c","token_id":"29677413448356631423250052573262008356913370083986817030510370064664558041792","current_size":10.0,"current_value":10.0,"current_price":1.0,"status":"REDEEMABLE","mergeable":false,"redeemable":true,"archived":false},{"proxy_wallet":"0x0000000000000000000000000000000000000001","condition_id":"0xc587bda904f031a973ad3cb57128ca011bfab0f45e6cb3734ed2227c4d4be419","token_id":"69119940120690198080427862456277899176151352667092917892731174838615809844766","current_size":5000.0,"current_value":0.0,"current_price":0.0,"status":"REDEEMABLE","mergeable":false,"redeemable":true,"archived":false}],"has_more":false},
{"status":"REDEEMABLE_LOST","request":"https://data-api.polymarket.com/v2/positions?user=0x0000000000000000000000000000000000000001&status=REDEEMABLE_LOST&limit=5","observed_at":"Fri, 04 Dec 2026 20:39:59 GMT","http_status":200,"data":[{"proxy_wallet":"0x0000000000000000000000000000000000000001","condition_id":"0xc587bda904f031a973ad3cb57128ca011bfab0f45e6cb3734ed2227c4d4be419","token_id":"69119940120690198080427862456277899176151352667092917892731174838615809844766","current_size":5000.0,"current_value":0.0,"current_price":0.0,"status":"REDEEMABLE","mergeable":false,"redeemable":true,"archived":false}],"has_more":false},
{"status":"MERGEABLE","request":"https://data-api.polymarket.com/v2/positions?user=0x0000000000000000000000000000000000000001&status=MERGEABLE&limit=5","observed_at":"Fri, 04 Dec 2026 20:39:59 GMT","http_status":200,"data":[],"has_more":false},
{"status":"CLOSED","request":"https://data-api.polymarket.com/v2/positions?user=0x0000000000000000000000000000000000000001&status=CLOSED&limit=5","observed_at":"Fri, 04 Dec 2026 20:40:00 GMT","http_status":200,"data":[{"proxy_wallet":"0x0000000000000000000000000000000000000001","condition_id":"0x94aa22f01a34a4b127130126790bd0d81c04fff5f838a985e57fe1d9b0ffd9d8","token_id":"27425216295922979944979664970690470308097061041637644521425228902515084341296","current_size":0.0,"current_value":0.0,"current_price":0.0,"status":"CLOSED","mergeable":false,"redeemable":true,"archived":false}],"has_more":false}
]
+10
View File
@@ -0,0 +1,10 @@
{
"sort_desc": {"url":"https://data-api.polymarket.com/v2/positions?user=0x19b3823092892c026517fd0ff58df4889abe0b9b&status=OPEN&sort_by=TIMESTAMP&limit=5","status":200,"date":"Fri, 04 Dec 2026 20:49:44 GMT","body":{"data":[{"token_id":"720714510152246054130276515843293825241395125263705983303209818949486116865","condition_id":"0x0197e8f2f080b39c8703e35e54c228192b000000000000000000000000000000","status":"OPEN","last_event_at":1796417320,"first_entry_at":1796417119},{"token_id":"720714510152246054130276515843293825241395125263705983303209818949486116864","condition_id":"0x0197e8f2f080b39c8703e35e54c228192b000000000000000000000000000000","status":"OPEN","last_event_at":1796417318,"first_entry_at":1796417101},{"token_id":"643049684020821311351796507355633171121115944121291300545830924465303715840","condition_id":"0x016bf4066e82571228813b876d04127934000000000000000000000000000000","status":"REDEEMABLE","last_event_at":1796417123,"first_entry_at":1796416804},{"token_id":"623948551310085686003807523523823512265834388288292452103061352323364159489","condition_id":"0x016124720ad566f88bc302b21b492db296000000000000000000000000000000","status":"REDEEMABLE","last_event_at":1796416819,"first_entry_at":1796416496},{"token_id":"595598232364135711271605858900428478751902694056243533045033760895327535105","condition_id":"0x015118be44ab1eaf0539263c3943a4c95f000000000000000000000000000000","status":"REDEEMABLE","last_event_at":1796416525,"first_entry_at":1796416165}]}},
"sort_asc": {"url":"https://data-api.polymarket.com/v2/positions?user=0x19b3823092892c026517fd0ff58df4889abe0b9b&status=OPEN&sort_by=TIMESTAMP&sort_direction=ASC&limit=5","status":200,"date":"Fri, 04 Dec 2026 20:49:47 GMT","body":{"data":[{"token_id":"108211118887905827198085240321612246840377385685588945381741674294231397172455","condition_id":"0xbe5219d1c82daaa110a20c0b50dae77f681f05eb43094e05ea24fe833c5ec47f","status":"REDEEMABLE","last_event_at":1744791574,"first_entry_at":1744779538},{"token_id":"44939317539819072767368114561139572498853620329975668979095413555067370578574","condition_id":"0xb12a219f75d35ad91ee9428d22e47f1ee6de61f5d79466b1749c8b66aed2f2d9","status":"REDEEMABLE","last_event_at":1748760251,"first_entry_at":1747881352},{"token_id":"77444435762420711044339640645792265526010696615911175439180482698545420366139","condition_id":"0xa4f51ae09144ebedb1e4329a28597dcb25217be1050fb76b86335837943bf519","status":"REDEEMABLE","last_event_at":1748986412,"first_entry_at":1748847554},{"token_id":"46741667374359006482611348910695433711657619345444561736608864383253626406210","condition_id":"0x461bc99cf3a7d76bd9fd52ab850d62d1d985cee88b940c80ae9888a94176e83b","status":"REDEEMABLE","last_event_at":1749879384,"first_entry_at":1749701035},{"token_id":"57190891280800009123681638917785245658930686322518532172325806346323335059331","condition_id":"0x6edc6c77c16ef3ba1bcd646159f12f8b8a39528e500dcff95b9220ccfbb75141","status":"REDEEMABLE","last_event_at":1750663953,"first_entry_at":1747628175}]}},
"instant": {"url":"https://data-api.polymarket.com/v2/positions?user=0x19b3823092892c026517fd0ff58df4889abe0b9b&condition=0x0197e8f2f080b39c8703e35e54c228192b000000000000000000000000000000&start=1796417320&end=1796417320","status":200,"date":"Fri, 04 Dec 2026 20:49:44 GMT","body":{"data":[{"token_id":"720714510152246054130276515843293825241395125263705983303209818949486116865","condition_id":"0x0197e8f2f080b39c8703e35e54c228192b000000000000000000000000000000","status":"OPEN","last_event_at":1796417320,"first_entry_at":1796417119}]}},
"after": {"url":"https://data-api.polymarket.com/v2/positions?user=0x19b3823092892c026517fd0ff58df4889abe0b9b&condition=0x0197e8f2f080b39c8703e35e54c228192b000000000000000000000000000000&start=1796417321","status":200,"date":"Fri, 04 Dec 2026 20:49:44 GMT","body":{"data":[]}},
"before": {"url":"https://data-api.polymarket.com/v2/positions?user=0x19b3823092892c026517fd0ff58df4889abe0b9b&condition=0x0197e8f2f080b39c8703e35e54c228192b000000000000000000000000000000&end=1796417319","status":200,"date":"Fri, 04 Dec 2026 20:49:44 GMT","body":{"data":[{"token_id":"720714510152246054130276515843293825241395125263705983303209818949486116864","condition_id":"0x0197e8f2f080b39c8703e35e54c228192b000000000000000000000000000000","status":"OPEN","last_event_at":1796417318,"first_entry_at":1796417101}]}},
"inversion": {"url":"https://data-api.polymarket.com/v2/positions?user=0x19b3823092892c026517fd0ff58df4889abe0b9b&condition=0x0197e8f2f080b39c8703e35e54c228192b000000000000000000000000000000&start=1796417321&end=1796417320","status":400,"date":"Fri, 04 Dec 2026 20:49:44 GMT","body":{"error":"end must not be before start","code":"invalid_request","retryable":false}},
"negative": {"url":"https://data-api.polymarket.com/v2/positions?user=0x19b3823092892c026517fd0ff58df4889abe0b9b&condition=0x0197e8f2f080b39c8703e35e54c228192b000000000000000000000000000000&start=-1","status":200,"date":"Fri, 04 Dec 2026 20:49:44 GMT","body":{"data":[{"token_id":"720714510152246054130276515843293825241395125263705983303209818949486116864","condition_id":"0x0197e8f2f080b39c8703e35e54c228192b000000000000000000000000000000","status":"OPEN","last_event_at":1796417318,"first_entry_at":1796417101},{"token_id":"720714510152246054130276515843293825241395125263705983303209818949486116865","condition_id":"0x0197e8f2f080b39c8703e35e54c228192b000000000000000000000000000000","status":"OPEN","last_event_at":1796417320,"first_entry_at":1796417119}]}},
"market_instant": {"url":"https://data-api.polymarket.com/v2/positions?condition=0x0197e8f2f080b39c8703e35e54c228192b000000000000000000000000000000&start=1796417320&end=1796417320&limit=3","status":200,"date":"Fri, 04 Dec 2026 20:49:45 GMT","body":{"data":[{"token_id":"720714510152246054130276515843293825241395125263705983303209818949486116864","condition_id":"0x0197e8f2f080b39c8703e35e54c228192b000000000000000000000000000000","status":"OPEN","last_event_at":1796417320,"first_entry_at":1796417122},{"token_id":"720714510152246054130276515843293825241395125263705983303209818949486116864","condition_id":"0x0197e8f2f080b39c8703e35e54c228192b000000000000000000000000000000","status":"OPEN","last_event_at":1796417320,"first_entry_at":1796417128},{"token_id":"720714510152246054130276515843293825241395125263705983303209818949486116864","condition_id":"0x0197e8f2f080b39c8703e35e54c228192b000000000000000000000000000000","status":"OPEN","last_event_at":1796417320,"first_entry_at":1796417129}]}}
}
-21
View File
@@ -1,21 +0,0 @@
{
"one": {"url":"https://data-api.polymarket.com/v2/tokens?token_id=759916398134244316868652908232832573045153963965173623897622651599218278400","status":200,"date":"Fri, 04 Dec 2026 20:59:33 GMT","body":{"data":[{"token_id":"759916398134244316868652908232832573045153963965173623897622651599218278400","condition_id":"0x01ae18f1c798f53d0efe0903889e57483c000000000000000000000000000000","structural_condition_id":"0x01ae18f1c798f53d0efe0903889e57483c000000000000000000000000000000","module":"binary","outcome_index":0,"clob_index":null,"outcome":"Nikolenko Anatolii","opposite_token_id":"759916398134244316868652908232832573045153963965173623897622651599218278401","resolved":true,"final_price":1.0,"title":"Nikolenko Anatolii vs. Fokin Illia","market_slug":"setkameua-anat-illia-2026-12-03","closed":true,"neg_risk":false,"neg_risk_market_id":null,"question_index":null,"event_id":1496938,"event_slug":"setkameua-anat-illia-2026-12-03"}]}},
"alias": {"url":"https://data-api.polymarket.com/v2/tokens?tokenId=759916398134244316868652908232832573045153963965173623897622651599218278400","status":400,"date":"Fri, 04 Dec 2026 20:59:33 GMT","body":{"error":"provide exactly one of 'token_id' or 'condition'","code":"invalid_request","retryable":false}},
"pair": {"url":"https://data-api.polymarket.com/v2/tokens?condition=0x01ae18f1c798f53d0efe0903889e57483c000000000000000000000000000000","status":200,"date":"Fri, 04 Dec 2026 20:59:34 GMT","body":{"data":[{"token_id":"759916398134244316868652908232832573045153963965173623897622651599218278400","condition_id":"0x01ae18f1c798f53d0efe0903889e57483c000000000000000000000000000000","structural_condition_id":"0x01ae18f1c798f53d0efe0903889e57483c000000000000000000000000000000","module":"binary","outcome_index":0,"clob_index":null,"outcome":"Nikolenko Anatolii","opposite_token_id":"759916398134244316868652908232832573045153963965173623897622651599218278401","resolved":true,"final_price":1.0,"title":"Nikolenko Anatolii vs. Fokin Illia","market_slug":"setkameua-anat-illia-2026-12-03","closed":true,"neg_risk":false,"neg_risk_market_id":null,"question_index":null,"event_id":1496938,"event_slug":"setkameua-anat-illia-2026-12-03"},{"token_id":"759916398134244316868652908232832573045153963965173623897622651599218278401","condition_id":"0x01ae18f1c798f53d0efe0903889e57483c000000000000000000000000000000","structural_condition_id":"0x01ae18f1c798f53d0efe0903889e57483c000000000000000000000000000000","module":"binary","outcome_index":1,"clob_index":null,"outcome":"Fokin Illia","opposite_token_id":"759916398134244316868652908232832573045153963965173623897622651599218278400","resolved":true,"final_price":0.0,"title":"Nikolenko Anatolii vs. Fokin Illia","market_slug":"setkameua-anat-illia-2026-12-03","closed":true,"neg_risk":false,"neg_risk_market_id":null,"question_index":null,"event_id":1496938,"event_slug":"setkameua-anat-illia-2026-12-03"}]}},
"pair_alias": {"url":"https://data-api.polymarket.com/v2/tokens?conditionId=0x01ae18f1c798f53d0efe0903889e57483c000000000000000000000000000000","status":200,"date":"Fri, 04 Dec 2026 20:59:33 GMT","body":{"data":[{"token_id":"759916398134244316868652908232832573045153963965173623897622651599218278400","condition_id":"0x01ae18f1c798f53d0efe0903889e57483c000000000000000000000000000000","structural_condition_id":"0x01ae18f1c798f53d0efe0903889e57483c000000000000000000000000000000","module":"binary","outcome_index":0,"clob_index":null,"outcome":"Nikolenko Anatolii","opposite_token_id":"759916398134244316868652908232832573045153963965173623897622651599218278401","resolved":true,"final_price":1.0,"title":"Nikolenko Anatolii vs. Fokin Illia","market_slug":"setkameua-anat-illia-2026-12-03","closed":true,"neg_risk":false,"neg_risk_market_id":null,"question_index":null,"event_id":1496938,"event_slug":"setkameua-anat-illia-2026-12-03"},{"token_id":"759916398134244316868652908232832573045153963965173623897622651599218278401","condition_id":"0x01ae18f1c798f53d0efe0903889e57483c000000000000000000000000000000","structural_condition_id":"0x01ae18f1c798f53d0efe0903889e57483c000000000000000000000000000000","module":"binary","outcome_index":1,"clob_index":null,"outcome":"Fokin Illia","opposite_token_id":"759916398134244316868652908232832573045153963965173623897622651599218278400","resolved":true,"final_price":0.0,"title":"Nikolenko Anatolii vs. Fokin Illia","market_slug":"setkameua-anat-illia-2026-12-03","closed":true,"neg_risk":false,"neg_risk_market_id":null,"question_index":null,"event_id":1496938,"event_slug":"setkameua-anat-illia-2026-12-03"}]}},
"v1": {"url":"https://data-api.polymarket.com/v2/tokens?token_id=73979342585906843441145134109923710004884703083095161594360108477170435492453","status":200,"date":"Fri, 04 Dec 2026 20:59:34 GMT","body":{"data":[{"token_id":"73979342585906843441145134109923710004884703083095161594360108477170435492453","condition_id":"0xdf04a0495b0a16dbce386acdc16d9aed19784db9888be53d150354b83b7c18b1","structural_condition_id":null,"module":"v1_ctf","outcome_index":0,"clob_index":0,"outcome":"Over","opposite_token_id":"78188826358032258311424545486331333398838521699262460256542567713692269401385","resolved":true,"final_price":0.0,"title":"Map 1 Total Rounds: Over/Under 30.5","market_slug":"cs2-bb3-lgc-2026-12-03-game1-round-total-30pt5","closed":true,"neg_risk":false,"neg_risk_market_id":null,"question_index":null,"event_id":1495714,"event_slug":"cs2-bb3-lgc-2026-12-03"}]}},
"multi": {"url":"https://data-api.polymarket.com/v2/tokens?token_id=759916398134244316868652908232832573045153963965173623897622651599218278401%2C123%2C759916398134244316868652908232832573045153963965173623897622651599218278400%2C759916398134244316868652908232832573045153963965173623897622651599218278401","status":200,"date":"Fri, 04 Dec 2026 20:59:34 GMT","body":{"data":[{"token_id":"759916398134244316868652908232832573045153963965173623897622651599218278401","condition_id":"0x01ae18f1c798f53d0efe0903889e57483c000000000000000000000000000000","structural_condition_id":"0x01ae18f1c798f53d0efe0903889e57483c000000000000000000000000000000","module":"binary","outcome_index":1,"clob_index":null,"outcome":"Fokin Illia","opposite_token_id":"759916398134244316868652908232832573045153963965173623897622651599218278400","resolved":true,"final_price":0.0,"title":"Nikolenko Anatolii vs. Fokin Illia","market_slug":"setkameua-anat-illia-2026-12-03","closed":true,"neg_risk":false,"neg_risk_market_id":null,"question_index":null,"event_id":1496938,"event_slug":"setkameua-anat-illia-2026-12-03"},{"token_id":"759916398134244316868652908232832573045153963965173623897622651599218278400","condition_id":"0x01ae18f1c798f53d0efe0903889e57483c000000000000000000000000000000","structural_condition_id":"0x01ae18f1c798f53d0efe0903889e57483c000000000000000000000000000000","module":"binary","outcome_index":0,"clob_index":null,"outcome":"Nikolenko Anatolii","opposite_token_id":"759916398134244316868652908232832573045153963965173623897622651599218278401","resolved":true,"final_price":1.0,"title":"Nikolenko Anatolii vs. Fokin Illia","market_slug":"setkameua-anat-illia-2026-12-03","closed":true,"neg_risk":false,"neg_risk_market_id":null,"question_index":null,"event_id":1496938,"event_slug":"setkameua-anat-illia-2026-12-03"}]}},
"both": {"url":"https://data-api.polymarket.com/v2/tokens?token_id=759916398134244316868652908232832573045153963965173623897622651599218278400&condition=0x01ae18f1c798f53d0efe0903889e57483c000000000000000000000000000000","status":400,"date":"Fri, 04 Dec 2026 20:59:34 GMT","body":{"error":"provide exactly one of 'token_id' or 'condition'","code":"invalid_request","retryable":false}},
"none": {"url":"https://data-api.polymarket.com/v2/tokens?","status":400,"date":"Fri, 04 Dec 2026 20:59:34 GMT","body":{"error":"provide exactly one of 'token_id' or 'condition'","code":"invalid_request","retryable":false}},
"missing": {"url":"https://data-api.polymarket.com/v2/tokens?token_id=123","status":200,"date":"Fri, 04 Dec 2026 20:59:34 GMT","body":{"data":[]}},
"malformed": {"url":"https://data-api.polymarket.com/v2/tokens?token_id=abc","status":400,"date":"Fri, 04 Dec 2026 20:59:34 GMT","body":{"error":"invalid token id: abc","code":"invalid_request","parameter":"token_id","retryable":false}},
"bad_condition": {"url":"https://data-api.polymarket.com/v2/tokens?condition=invalid","status":400,"date":"Fri, 04 Dec 2026 20:59:34 GMT","body":{"error":"invalid condition id: invalid","code":"invalid_request","parameter":"condition","retryable":false}},
"unknown_condition": {"url":"https://data-api.polymarket.com/v2/tokens?condition=0x0000000000000000000000000000000000000000000000000000000000000000","status":200,"date":"Fri, 04 Dec 2026 20:59:34 GMT","body":{"data":[]}},
"multi_condition": {"url":"https://data-api.polymarket.com/v2/tokens?condition=0x01ae18f1c798f53d0efe0903889e57483c000000000000000000000000000000%2C0xdf04a0495b0a16dbce386acdc16d9aed19784db9888be53d150354b83b7c18b1","status":200,"date":"Fri, 04 Dec 2026 20:59:35 GMT","body":{"data":[{"token_id":"759916398134244316868652908232832573045153963965173623897622651599218278400","condition_id":"0x01ae18f1c798f53d0efe0903889e57483c000000000000000000000000000000","structural_condition_id":"0x01ae18f1c798f53d0efe0903889e57483c000000000000000000000000000000","module":"binary","outcome_index":0,"clob_index":null,"outcome":"Nikolenko Anatolii","opposite_token_id":"759916398134244316868652908232832573045153963965173623897622651599218278401","resolved":true,"final_price":1.0,"title":"Nikolenko Anatolii vs. Fokin Illia","market_slug":"setkameua-anat-illia-2026-12-03","closed":true,"neg_risk":false,"neg_risk_market_id":null,"question_index":null,"event_id":1496938,"event_slug":"setkameua-anat-illia-2026-12-03"},{"token_id":"759916398134244316868652908232832573045153963965173623897622651599218278401","condition_id":"0x01ae18f1c798f53d0efe0903889e57483c000000000000000000000000000000","structural_condition_id":"0x01ae18f1c798f53d0efe0903889e57483c000000000000000000000000000000","module":"binary","outcome_index":1,"clob_index":null,"outcome":"Fokin Illia","opposite_token_id":"759916398134244316868652908232832573045153963965173623897622651599218278400","resolved":true,"final_price":0.0,"title":"Nikolenko Anatolii vs. Fokin Illia","market_slug":"setkameua-anat-illia-2026-12-03","closed":true,"neg_risk":false,"neg_risk_market_id":null,"question_index":null,"event_id":1496938,"event_slug":"setkameua-anat-illia-2026-12-03"},{"token_id":"73979342585906843441145134109923710004884703083095161594360108477170435492453","condition_id":"0xdf04a0495b0a16dbce386acdc16d9aed19784db9888be53d150354b83b7c18b1","structural_condition_id":null,"module":"v1_ctf","outcome_index":0,"clob_index":0,"outcome":"Over","opposite_token_id":"78188826358032258311424545486331333398838521699262460256542567713692269401385","resolved":true,"final_price":0.0,"title":"Map 1 Total Rounds: Over/Under 30.5","market_slug":"cs2-bb3-lgc-2026-12-03-game1-round-total-30pt5","closed":true,"neg_risk":false,"neg_risk_market_id":null,"question_index":null,"event_id":1495714,"event_slug":"cs2-bb3-lgc-2026-12-03"},{"token_id":"78188826358032258311424545486331333398838521699262460256542567713692269401385","condition_id":"0xdf04a0495b0a16dbce386acdc16d9aed19784db9888be53d150354b83b7c18b1","structural_condition_id":null,"module":"v1_ctf","outcome_index":1,"clob_index":1,"outcome":"Under","opposite_token_id":"73979342585906843441145134109923710004884703083095161594360108477170435492453","resolved":true,"final_price":1.0,"title":"Map 1 Total Rounds: Over/Under 30.5","market_slug":"cs2-bb3-lgc-2026-12-03-game1-round-total-30pt5","closed":true,"neg_risk":false,"neg_risk_market_id":null,"question_index":null,"event_id":1495714,"event_slug":"cs2-bb3-lgc-2026-12-03"}]}},
"plural": {"url":"https://data-api.polymarket.com/v2/tokens?token_ids=759916398134244316868652908232832573045153963965173623897622651599218278400","status":200,"date":"Fri, 04 Dec 2026 21:00:05 GMT","body":{"data":[{"token_id":"759916398134244316868652908232832573045153963965173623897622651599218278400","condition_id":"0x01ae18f1c798f53d0efe0903889e57483c000000000000000000000000000000","structural_condition_id":"0x01ae18f1c798f53d0efe0903889e57483c000000000000000000000000000000","module":"binary","outcome_index":0,"clob_index":null,"outcome":"Nikolenko Anatolii","opposite_token_id":"759916398134244316868652908232832573045153963965173623897622651599218278401","resolved":true,"final_price":1.0,"title":"Nikolenko Anatolii vs. Fokin Illia","market_slug":"setkameua-anat-illia-2026-12-03","closed":true,"neg_risk":false,"neg_risk_market_id":null,"question_index":null,"event_id":1496938,"event_slug":"setkameua-anat-illia-2026-12-03"}]}},
"zero_prefix": {"url":"https://data-api.polymarket.com/v2/tokens?token_id=000759916398134244316868652908232832573045153963965173623897622651599218278400","status":200,"date":"Fri, 04 Dec 2026 21:00:05 GMT","body":{"data":[{"token_id":"759916398134244316868652908232832573045153963965173623897622651599218278400","condition_id":"0x01ae18f1c798f53d0efe0903889e57483c000000000000000000000000000000","structural_condition_id":"0x01ae18f1c798f53d0efe0903889e57483c000000000000000000000000000000","module":"binary","outcome_index":0,"clob_index":null,"outcome":"Nikolenko Anatolii","opposite_token_id":"759916398134244316868652908232832573045153963965173623897622651599218278401","resolved":true,"final_price":1.0,"title":"Nikolenko Anatolii vs. Fokin Illia","market_slug":"setkameua-anat-illia-2026-12-03","closed":true,"neg_risk":false,"neg_risk_market_id":null,"question_index":null,"event_id":1496938,"event_slug":"setkameua-anat-illia-2026-12-03"}]}},
"empty_token": {"url":"https://data-api.polymarket.com/v2/tokens?token_id=","status":400,"date":"Fri, 04 Dec 2026 21:00:05 GMT","body":{"error":"provide exactly one of 'token_id' or 'condition'","code":"invalid_request","retryable":false}},
"huge": {"url":"https://data-api.polymarket.com/v2/tokens?token_id=999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999","status":400,"date":"Fri, 04 Dec 2026 21:00:05 GMT","body":{"error":"invalid token id: 999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999","code":"invalid_request","parameter":"token_id","retryable":false}},
"short_condition": {"url":"https://data-api.polymarket.com/v2/tokens?condition=0x01ae18f1c798f53d0efe0903889e57483c0000000000000000000000000000","status":200,"date":"Fri, 04 Dec 2026 21:00:05 GMT","body":{"data":[{"token_id":"759916398134244316868652908232832573045153963965173623897622651599218278400","condition_id":"0x01ae18f1c798f53d0efe0903889e57483c000000000000000000000000000000","structural_condition_id":"0x01ae18f1c798f53d0efe0903889e57483c000000000000000000000000000000","module":"binary","outcome_index":0,"clob_index":null,"outcome":"Nikolenko Anatolii","opposite_token_id":"759916398134244316868652908232832573045153963965173623897622651599218278401","resolved":true,"final_price":1.0,"title":"Nikolenko Anatolii vs. Fokin Illia","market_slug":"setkameua-anat-illia-2026-12-03","closed":true,"neg_risk":false,"neg_risk_market_id":null,"question_index":null,"event_id":1496938,"event_slug":"setkameua-anat-illia-2026-12-03"},{"token_id":"759916398134244316868652908232832573045153963965173623897622651599218278401","condition_id":"0x01ae18f1c798f53d0efe0903889e57483c000000000000000000000000000000","structural_condition_id":"0x01ae18f1c798f53d0efe0903889e57483c000000000000000000000000000000","module":"binary","outcome_index":1,"clob_index":null,"outcome":"Fokin Illia","opposite_token_id":"759916398134244316868652908232832573045153963965173623897622651599218278400","resolved":true,"final_price":0.0,"title":"Nikolenko Anatolii vs. Fokin Illia","market_slug":"setkameua-anat-illia-2026-12-03","closed":true,"neg_risk":false,"neg_risk_market_id":null,"question_index":null,"event_id":1496938,"event_slug":"setkameua-anat-illia-2026-12-03"}]}},
"cap_tokens": {"url":"https://data-api.polymarket.com/v2/tokens?token_id=0%2C1%2C2%2C3%2C4%2C5%2C6%2C7%2C8%2C9%2C10%2C11%2C12%2C13%2C14%2C15%2C16%2C17%2C18%2C19%2C20%2C21%2C22%2C23%2C24%2C25%2C26%2C27%2C28%2C29%2C30%2C31%2C32%2C33%2C34%2C35%2C36%2C37%2C38%2C39%2C40%2C41%2C42%2C43%2C44%2C45%2C46%2C47%2C48%2C49%2C50","status":400,"date":"Fri, 04 Dec 2026 21:00:05 GMT","body":{"error":"'token_id' accepts at most 50 distinct values","code":"invalid_request","parameter":"token_id","retryable":false}}
}
+13 -6
View File
@@ -468,13 +468,20 @@ SDK 使用 `GET /neg-risk?token_id=…`,也可以从已缓存的 CLOB 市场
`open_orders` 的列表和精确查询均返回 `created_at`(Unix 秒)、`order_type` 和本地扩展 `post_only`。升级已有数据库时,用已受理的命令回执和 GTD 截止记录恢复提交指令;没有原始时钟记录的受理时间为 null。缺少原始回执的历史行仍可查询,未知字段保留为 null。官方当前将累计成交和逐笔对账分别放在订单的 size_matched 和账户成交记录;其单笔订单 HTTP 接口需要账户认证。本地验证使用可信操作员的 JSONL 接口,订单号与账户是模拟环境的标识。生产私有接口尚未实测。[官方订单查询](https://docs.polymarket.com/trading/manage-orders) `open_orders` 的列表和精确查询均返回 `created_at`(Unix 秒)、`order_type` 和本地扩展 `post_only`。升级已有数据库时,用已受理的命令回执和 GTD 截止记录恢复提交指令;没有原始时钟记录的受理时间为 null。缺少原始回执的历史行仍可查询,未知字段保留为 null。官方当前将累计成交和逐笔对账分别放在订单的 size_matched 和账户成交记录;其单笔订单 HTTP 接口需要账户认证。本地验证使用可信操作员的 JSONL 接口,订单号与账户是模拟环境的标识。生产私有接口尚未实测。[官方订单查询](https://docs.polymarket.com/trading/manage-orders)
### Data API 资产反查 ### Data API 持仓生命周期
GET /v2/tokens 接受 token_id / token_ids 或 condition / condition_id / conditionId,二选一。生产样本中,资产查询保持请求顺序并合并重复项,数字标识的前导零会被归一。合法的未知资产返回空数组。用本地市场 ID 返回 YES、NO 两侧,用本地互斥组 ID 按题目序号展开成员。已裁决市场可返回最终兑付值,VOID 有两项 0.5。回执保留稳定的本地 eb 标识并自描述本地模块。对照样本覆盖原生 V2、CTF 和短条件 ID,外场同一市场的多协议资产映射仍待接入本地目录。[生产请求和响应](examples/public-token-directory.json) · [官方 OpenAPI](https://data-api.polymarket.com/v2/openapi.json) 公开 GET /v2/positions 已接入本地账本。可按钱包查询,或用一个市场查持有人,也可对钱包附加市场条件。OPEN 包含仍持有的已裁决资产,REDEEMABLE 保留待兑付的胜负两侧,REDEEMABLE_LOST 选出尚未核销的零兑付资产。MERGEABLE 返回持有互补份额的两侧,CLOSED 查询已经退出或低于 0.1 份的仓位。当前持仓使用 0.1 份下限。游标由本地签名,绑定查询、页大小及最后一行的排序键。逐页使用各自的已提交快照,仓位变动可能改变后续排序。
### 本地登记 Polymarket 资产对照 这一版返回数量、估值、配对与赎回标记、结果身份和目录标题。本地支持份额、价格和当前价值排序。跨钱包关闭记录仍待接入。实测 0.0088 份已裁决余额出现在 CLOSED,仍标记 redeemable。用相同条件查询 OPEN 和 REDEEMABLE 均为空,即使传入 filter_amount=0。生产响应中的姓名和签名游标未保存在样本里。[公开生产响应摘要](examples/public-position-lifecycle.json) · [官方持仓规范](https://data-api.polymarket.com/v2/openapi.json)
可信 JSONL 命令 bind_polymarket_assets 接受本地市场、external_condition、zero_outcome 及官方 data 数组。每种协议必须提供互补一对。登记时核对 V2 编码、互斥组与题目归属,禁止冲突重绑。登记后用外场数字资产或条件查询 /v2/tokens 可得到原协议观察字段及 local_asset_id。互斥组查询仅返回已登记成员。外场状态与兑付值由观测快照提供。[生产登记样本](examples/polymarket-asset-binding.json)
对同一绑定重复提交带 observed_at_ms 的配对可刷新状态及结果标签。旧观测不会覆盖更新状态,同毫秒互相矛盾的快照和推翻最终兑付的请求会拒绝,整笔事务回滚。反查回执带观测时间。一个此前能公开读取盘口的电竞盘,后续 CTF 与 V2 目录均返回裁决输赢。回归使用它的真实裁决响应,并用同一资产生成开放快照来覆盖乱序。刷新由可信操作者提供观测,生产接口的传播时延和自动拉取仍待接入。[生产盘口及裁决快照](examples/polymarket-asset-refresh.json) 持仓列表支持 title(不区分 ASCII 大小写、保留 SQL LIKE 通配符)、event_id(最多 20 个事件、仅钱包查询、与 condition 互斥)和 filter_type / filter_amount。TOKENS 按当前份额过滤,CASH 按当前估值过滤,门槛包含等值。无效筛选类型返回 400,负门槛采用默认行为。翻页时继续发送标题、事件和金额参数。钱包 CLOSED 维持 0.1 份的边界,市场维度的份额门槛会移动 OPEN 与 CLOSED 分界。标题非 ASCII 大小写及市场维度边界仍待生产对照。[生产筛选样本](examples/public-position-filters.json)
持仓活动时间按结果资产从成交、拆分、合并、互斥转换及赎回推导。start/end 按 Unix 秒包含两端,非正数表示无界。有界查询排除没有可信时间的行。可用 TIMESTAMP 排序,翻页时重发窗口。本地 first_entry_at 是最早有记录的取得时间。历史全额赎回缺少分侧数据,转换费用金库的入账时间及在平仓后重新入场的时间口径仍待核验。新赎回按实际烧掉的结果记录时间。裁决、挂单或撤单本身不增加持仓活动。[生产时间窗口样本](examples/public-position-time.json)
公开持仓的可重建成交仓位返回平均买入价、累计买入份额、剩余入场本金和费用、以及已实现和未实现盈亏。部分卖出按加权成本摊销本金和入场费用。费用从真实账本读取,发生时计入已实现盈亏。四位小数的本金、估值和盈亏与六位费用分开舍入。只有成交流水能解释当前持有量时才提供成本字段。涉及拆分、合并、赎回或互斥转换时现阶段返回 null。尚未核验外场买卖费用的逐笔归因、平仓再买后的成本口径。[生产持仓和对应成交](examples/public-position-economics.json) · [官方持仓字段](https://data-api.polymarket.com/v2/openapi.json)
持仓页可按 AVG_PRICE、REALIZED_PNL、UNREALIZED_PNL 和 TOTAL_PNL 排序,已知值按返回精度比较,缺少可重建成本的仓位排列在末尾。钱包 CLOSED 默认按已实现盈亏排序,给它 TOKENS、CURRENT_VALUE、PRICE 或 UNREALIZED_PNL 时也采用已实现盈亏。钱包 CLOSED 和 REDEEMABLE_LOST 拒绝 AVG_PRICE。游标绑定实际采用的排序。旧 CLOSED 游标使用被替代的排序键时要从第一页重新获取。生产未核验缺成本行的相对位置。[生产排序样本](examples/public-position-economics-sorts.json)