@structbuild/sdk 0.1.6 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -0
- package/dist/client.d.ts +2 -2
- package/dist/generated/polymarket.d.ts +85 -142
- package/dist/generated/webhooks.d.ts +1548 -0
- package/dist/http.d.ts +3 -0
- package/dist/index.cjs +80 -42
- package/dist/index.cjs.map +12 -12
- package/dist/index.js +80 -42
- package/dist/index.js.map +12 -12
- package/dist/namespaces/base.d.ts +11 -0
- package/dist/namespaces/events.d.ts +1 -3
- package/dist/namespaces/index.d.ts +2 -2
- package/dist/namespaces/markets.d.ts +1 -3
- package/dist/namespaces/webhooks.d.ts +11 -0
- package/dist/types/helpers.d.ts +21 -3
- package/dist/types/index.d.ts +40 -65
- package/dist/types/webhook-helpers.d.ts +7 -0
- package/package.json +6 -3
- package/dist/namespaces/scoring.d.ts +0 -10
package/README.md
CHANGED
|
@@ -101,6 +101,45 @@ const tags = await client.tags.getTags();
|
|
|
101
101
|
const bonds = await client.bonds.getBonds();
|
|
102
102
|
```
|
|
103
103
|
|
|
104
|
+
### Webhooks
|
|
105
|
+
|
|
106
|
+
Manage webhook subscriptions for real-time event notifications. Webhook endpoints are platform-level (not venue-scoped).
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
const webhooks = await client.webhooks.list();
|
|
110
|
+
const webhook = await client.webhooks.create({
|
|
111
|
+
url: "https://example.com/webhook",
|
|
112
|
+
events: ["first_trade", "probability_spike"],
|
|
113
|
+
filters: {
|
|
114
|
+
condition_ids: ["0x..."],
|
|
115
|
+
min_usd_value: 100,
|
|
116
|
+
},
|
|
117
|
+
});
|
|
118
|
+
const detail = await client.webhooks.getWebhook({ webhookId: webhook.data.id });
|
|
119
|
+
await client.webhooks.update({ webhookId: webhook.data.id, events: ["first_trade"] });
|
|
120
|
+
await client.webhooks.test({ webhookId: webhook.data.id });
|
|
121
|
+
await client.webhooks.deleteWebhook({ webhookId: webhook.data.id });
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
#### Webhook Payload Types
|
|
125
|
+
|
|
126
|
+
The SDK exports typed payload schemas for building webhook receivers:
|
|
127
|
+
|
|
128
|
+
```typescript
|
|
129
|
+
import type {
|
|
130
|
+
FirstTradePayload,
|
|
131
|
+
ProbabilitySpikePayload,
|
|
132
|
+
GlobalPnlPayload,
|
|
133
|
+
VolumeMilestonePayload,
|
|
134
|
+
} from "@structbuild/sdk";
|
|
135
|
+
|
|
136
|
+
function handleWebhook(payload: FirstTradePayload) {
|
|
137
|
+
console.log(payload.trader, payload.price, payload.side);
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Available payload types: `FirstTradePayload`, `GlobalPnlPayload`, `MarketPnlPayload`, `EventPnlPayload`, `PositionPnlPayload`, `ConditionMetricsPayload`, `EventMetricsPayload`, `PositionMetricsPayload`, `VolumeMilestonePayload`, `EventVolumeMilestonePayload`, `PositionVolumeMilestonePayload`, `ProbabilitySpikePayload`.
|
|
142
|
+
|
|
104
143
|
## Pagination
|
|
105
144
|
|
|
106
145
|
Use the `paginate` helper to iterate through all results:
|
package/dist/client.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Venue } from "./types/common.js";
|
|
2
2
|
import type { RetryConfig, RequestHookInfo, ResponseHookInfo } from "./types/index.js";
|
|
3
|
-
import { HoldersNamespace,
|
|
3
|
+
import { HoldersNamespace, TagsNamespace, EventsNamespace, MarketsNamespace, SeriesNamespace, TraderNamespace, BondsNamespace, SearchNamespace, WebhooksNamespace } from "./namespaces/index.js";
|
|
4
4
|
export interface StructClientConfig {
|
|
5
5
|
apiKey: string;
|
|
6
6
|
baseUrl?: string;
|
|
@@ -13,7 +13,6 @@ export interface StructClientConfig {
|
|
|
13
13
|
}
|
|
14
14
|
export declare class StructClient {
|
|
15
15
|
readonly holders: HoldersNamespace;
|
|
16
|
-
readonly scoring: ScoringNamespace;
|
|
17
16
|
readonly tags: TagsNamespace;
|
|
18
17
|
readonly events: EventsNamespace;
|
|
19
18
|
readonly markets: MarketsNamespace;
|
|
@@ -21,5 +20,6 @@ export declare class StructClient {
|
|
|
21
20
|
readonly trader: TraderNamespace;
|
|
22
21
|
readonly bonds: BondsNamespace;
|
|
23
22
|
readonly search: SearchNamespace;
|
|
23
|
+
readonly webhooks: WebhooksNamespace;
|
|
24
24
|
constructor(config: StructClientConfig);
|
|
25
25
|
}
|
|
@@ -563,26 +563,6 @@ export interface paths {
|
|
|
563
563
|
patch?: never;
|
|
564
564
|
trace?: never;
|
|
565
565
|
};
|
|
566
|
-
"/polymarket/trader/pnl/{address}/positions": {
|
|
567
|
-
parameters: {
|
|
568
|
-
query?: never;
|
|
569
|
-
header?: never;
|
|
570
|
-
path?: never;
|
|
571
|
-
cookie?: never;
|
|
572
|
-
};
|
|
573
|
-
/**
|
|
574
|
-
* Get trader position PnL
|
|
575
|
-
* @description Retrieve position-level PnL breakdown for a trader
|
|
576
|
-
*/
|
|
577
|
-
get: operations["get_trader_position_pnl"];
|
|
578
|
-
put?: never;
|
|
579
|
-
post?: never;
|
|
580
|
-
delete?: never;
|
|
581
|
-
options?: never;
|
|
582
|
-
head?: never;
|
|
583
|
-
patch?: never;
|
|
584
|
-
trace?: never;
|
|
585
|
-
};
|
|
586
566
|
"/polymarket/trader/portfolio/{address}": {
|
|
587
567
|
parameters: {
|
|
588
568
|
query?: never;
|
|
@@ -612,7 +592,7 @@ export interface paths {
|
|
|
612
592
|
};
|
|
613
593
|
/**
|
|
614
594
|
* Get trader positions
|
|
615
|
-
* @description Retrieve a trader's active
|
|
595
|
+
* @description Retrieve a trader's active positions with PnL data, sorted by the specified field
|
|
616
596
|
*/
|
|
617
597
|
get: operations["get_portfolio_positions"];
|
|
618
598
|
put?: never;
|
|
@@ -752,7 +732,8 @@ export interface components {
|
|
|
752
732
|
ConditionMetricsResponse: {
|
|
753
733
|
condition_id: string;
|
|
754
734
|
timeframe: string;
|
|
755
|
-
|
|
735
|
+
/** Format: double */
|
|
736
|
+
volume_usd: number;
|
|
756
737
|
/** Format: double */
|
|
757
738
|
fees: number;
|
|
758
739
|
/** Format: int32 */
|
|
@@ -766,6 +747,8 @@ export interface components {
|
|
|
766
747
|
trader: components["schemas"]["Trader"];
|
|
767
748
|
/** @description Total shares across all positions in this event */
|
|
768
749
|
total_shares: string;
|
|
750
|
+
/** @description USD value of all shares (sum of shares * price per position) */
|
|
751
|
+
shares_usd?: string | null;
|
|
769
752
|
/**
|
|
770
753
|
* Format: int32
|
|
771
754
|
* @description Number of distinct positions held
|
|
@@ -773,7 +756,11 @@ export interface components {
|
|
|
773
756
|
position_count: number;
|
|
774
757
|
/** @description USD balance (USDe on Polygon) */
|
|
775
758
|
usd_balance?: string | null;
|
|
776
|
-
|
|
759
|
+
/**
|
|
760
|
+
* Format: double
|
|
761
|
+
* @description Lifetime realized PnL in USD
|
|
762
|
+
*/
|
|
763
|
+
realized_pnl_usd?: number | null;
|
|
777
764
|
};
|
|
778
765
|
/** @description Event-level PnL data for a holder */
|
|
779
766
|
EventHolderPnl: {
|
|
@@ -811,8 +798,6 @@ export interface components {
|
|
|
811
798
|
total_holders: number;
|
|
812
799
|
/** @description Top holders across all markets */
|
|
813
800
|
holders: components["schemas"]["EventHolder"][];
|
|
814
|
-
/** @description Pagination info */
|
|
815
|
-
has_more: boolean;
|
|
816
801
|
};
|
|
817
802
|
/** @description Enriched market data for event API responses */
|
|
818
803
|
EventMarket: {
|
|
@@ -858,10 +843,6 @@ export interface components {
|
|
|
858
843
|
category: string | null;
|
|
859
844
|
/** @default [] */
|
|
860
845
|
clob_rewards: components["schemas"]["ClobReward"][];
|
|
861
|
-
/** @default {} */
|
|
862
|
-
metrics: {
|
|
863
|
-
[key: string]: components["schemas"]["SimpleTimeframeMetrics"];
|
|
864
|
-
};
|
|
865
846
|
/** @default [] */
|
|
866
847
|
outcomes: components["schemas"]["EventMarketOutcome"][];
|
|
867
848
|
};
|
|
@@ -876,7 +857,8 @@ export interface components {
|
|
|
876
857
|
EventMetricsResponse: {
|
|
877
858
|
event_slug: string;
|
|
878
859
|
timeframe: string;
|
|
879
|
-
|
|
860
|
+
/** Format: double */
|
|
861
|
+
volume_usd: number;
|
|
880
862
|
/** Format: double */
|
|
881
863
|
fees: number;
|
|
882
864
|
/** Format: int32 */
|
|
@@ -889,7 +871,7 @@ export interface components {
|
|
|
889
871
|
/** @enum {string} */
|
|
890
872
|
EventSortBy: "volume" | "txns" | "unique_traders" | "title" | "creation_date" | "start_date" | "end_date" | "relevance";
|
|
891
873
|
/** @enum {string} */
|
|
892
|
-
GlobalPnlSortBy: "pnl_usd" | "
|
|
874
|
+
GlobalPnlSortBy: "pnl_usd" | "buys" | "sells" | "redemptions" | "merges" | "avg_hold_time" | "markets_traded" | "events_traded" | "markets_won" | "volume_usd" | "fees" | "best_trade" | "worst_trade";
|
|
893
875
|
/** @description Individual trader entry in the global PnL leaderboard */
|
|
894
876
|
GlobalPnlTrader: {
|
|
895
877
|
trader: components["schemas"]["TraderInfo"];
|
|
@@ -898,16 +880,8 @@ export interface components {
|
|
|
898
880
|
/** Format: int64 */
|
|
899
881
|
events_traded?: number | null;
|
|
900
882
|
/** Format: int64 */
|
|
901
|
-
positions_traded?: number | null;
|
|
902
|
-
/** Format: int64 */
|
|
903
883
|
markets_traded?: number | null;
|
|
904
884
|
/** Format: int64 */
|
|
905
|
-
winning_positions?: number | null;
|
|
906
|
-
/** Format: int64 */
|
|
907
|
-
losing_positions?: number | null;
|
|
908
|
-
/** Format: double */
|
|
909
|
-
win_rate_pct?: number | null;
|
|
910
|
-
/** Format: int64 */
|
|
911
885
|
markets_won?: number | null;
|
|
912
886
|
/** Format: int64 */
|
|
913
887
|
markets_lost?: number | null;
|
|
@@ -933,16 +907,20 @@ export interface components {
|
|
|
933
907
|
total_merges?: number | null;
|
|
934
908
|
/** Format: int64 */
|
|
935
909
|
total_trades?: number | null;
|
|
936
|
-
/** Format: int64 */
|
|
937
|
-
open_positions?: number | null;
|
|
938
910
|
/** Format: double */
|
|
939
911
|
total_fees?: number | null;
|
|
940
912
|
/** Format: double */
|
|
941
|
-
|
|
913
|
+
avg_pnl_per_market?: number | null;
|
|
942
914
|
/** Format: double */
|
|
943
915
|
avg_pnl_per_trade?: number | null;
|
|
944
916
|
/** Format: double */
|
|
945
917
|
avg_hold_time_seconds?: number | null;
|
|
918
|
+
/** Format: double */
|
|
919
|
+
best_trade_pnl_usd?: number | null;
|
|
920
|
+
best_trade_condition_id?: string | null;
|
|
921
|
+
/** Format: double */
|
|
922
|
+
worst_trade_pnl_usd?: number | null;
|
|
923
|
+
worst_trade_condition_id?: string | null;
|
|
946
924
|
/** Format: int64 */
|
|
947
925
|
first_trade_at?: number | null;
|
|
948
926
|
/** Format: int64 */
|
|
@@ -958,20 +936,18 @@ export interface components {
|
|
|
958
936
|
shares_usd?: string | null;
|
|
959
937
|
/** @description USD balance of wallet (USDe on Polygon) */
|
|
960
938
|
usd_balance?: string | null;
|
|
961
|
-
|
|
939
|
+
/**
|
|
940
|
+
* Format: double
|
|
941
|
+
* @description Lifetime realized PnL in USD
|
|
942
|
+
*/
|
|
943
|
+
realized_pnl_usd?: number | null;
|
|
962
944
|
};
|
|
963
945
|
/** @description Holder statistics data point (single time bucket) */
|
|
964
946
|
HolderHistoryCandle: {
|
|
965
|
-
/** Format: date-time */
|
|
966
|
-
bucket: string;
|
|
967
|
-
/** Format: int64 */
|
|
968
|
-
total_holders?: number | null;
|
|
969
|
-
/** Format: int64 */
|
|
970
|
-
bot_holders?: number | null;
|
|
971
947
|
/** Format: int64 */
|
|
972
|
-
|
|
948
|
+
timestamp: number;
|
|
973
949
|
/** Format: int64 */
|
|
974
|
-
|
|
950
|
+
total_holders?: number | null;
|
|
975
951
|
};
|
|
976
952
|
/** @description Market-level PnL data for a holder */
|
|
977
953
|
MarketHolderPnl: {
|
|
@@ -992,8 +968,6 @@ export interface components {
|
|
|
992
968
|
/** Format: int64 */
|
|
993
969
|
winning_outcomes?: number | null;
|
|
994
970
|
/** Format: int64 */
|
|
995
|
-
losing_outcomes?: number | null;
|
|
996
|
-
/** Format: int64 */
|
|
997
971
|
first_trade_at?: number | null;
|
|
998
972
|
/** Format: int64 */
|
|
999
973
|
last_trade_at?: number | null;
|
|
@@ -1028,7 +1002,15 @@ export interface components {
|
|
|
1028
1002
|
image_url?: string | null;
|
|
1029
1003
|
tags: string[];
|
|
1030
1004
|
/** Format: int64 */
|
|
1031
|
-
|
|
1005
|
+
created_time?: number | null;
|
|
1006
|
+
/** Format: int64 */
|
|
1007
|
+
start_time?: number | null;
|
|
1008
|
+
/** Format: int64 */
|
|
1009
|
+
game_start_time?: number | null;
|
|
1010
|
+
/** Format: int64 */
|
|
1011
|
+
closed_time?: number | null;
|
|
1012
|
+
/** Format: int64 */
|
|
1013
|
+
end_time?: number | null;
|
|
1032
1014
|
title?: string | null;
|
|
1033
1015
|
id?: string | null;
|
|
1034
1016
|
/** Format: double */
|
|
@@ -1070,7 +1052,7 @@ export interface components {
|
|
|
1070
1052
|
/** @enum {string} */
|
|
1071
1053
|
MarketPnlSortBy: "realized_pnl_usd" | "buy_usd" | "total_buys" | "total_fees" | "outcomes_traded";
|
|
1072
1054
|
/** @enum {string} */
|
|
1073
|
-
MarketSortBy: "volume" | "txns" | "unique_traders" | "liquidity" | "holders" | "
|
|
1055
|
+
MarketSortBy: "volume" | "txns" | "unique_traders" | "liquidity" | "holders" | "end_time" | "start_time" | "created_time" | "created_at" | "relevance";
|
|
1074
1056
|
/** @enum {string} */
|
|
1075
1057
|
MarketStatus: "open" | "closed";
|
|
1076
1058
|
MarketVolumeChartResponse: {
|
|
@@ -1110,7 +1092,7 @@ export interface components {
|
|
|
1110
1092
|
* Format: double
|
|
1111
1093
|
* @description Current price/probability
|
|
1112
1094
|
*/
|
|
1113
|
-
|
|
1095
|
+
price?: number | null;
|
|
1114
1096
|
/**
|
|
1115
1097
|
* Format: int64
|
|
1116
1098
|
* @description Total holders count from holder_stats
|
|
@@ -1119,6 +1101,8 @@ export interface components {
|
|
|
1119
1101
|
/** @description Top holders for this outcome */
|
|
1120
1102
|
holders: components["schemas"]["Holder"][];
|
|
1121
1103
|
};
|
|
1104
|
+
/** @enum {string} */
|
|
1105
|
+
OutcomeIndex: "0" | "1";
|
|
1122
1106
|
OutcomeTimeframeMetrics: {
|
|
1123
1107
|
/**
|
|
1124
1108
|
* Format: double
|
|
@@ -1244,6 +1228,8 @@ export interface components {
|
|
|
1244
1228
|
neg_risk_market_id: string | null;
|
|
1245
1229
|
/** @default null */
|
|
1246
1230
|
game_status: string | null;
|
|
1231
|
+
/** @default false */
|
|
1232
|
+
show_market_images: boolean;
|
|
1247
1233
|
/**
|
|
1248
1234
|
* @description Event status: "open" or "closed"
|
|
1249
1235
|
* @default null
|
|
@@ -1382,7 +1368,7 @@ export interface components {
|
|
|
1382
1368
|
* Format: double
|
|
1383
1369
|
* @description Current price
|
|
1384
1370
|
*/
|
|
1385
|
-
|
|
1371
|
+
price?: number | null;
|
|
1386
1372
|
/**
|
|
1387
1373
|
* Format: int64
|
|
1388
1374
|
* @description Total holders count from holder_stats
|
|
@@ -1390,17 +1376,18 @@ export interface components {
|
|
|
1390
1376
|
total_holders: number;
|
|
1391
1377
|
/** @description Top holders */
|
|
1392
1378
|
holders: components["schemas"]["Holder"][];
|
|
1393
|
-
/** @description Pagination info */
|
|
1394
|
-
has_more: boolean;
|
|
1395
1379
|
};
|
|
1396
1380
|
/** @description Response type for position metrics query */
|
|
1397
1381
|
PositionMetricsResponse: {
|
|
1398
1382
|
position_id: string;
|
|
1399
1383
|
condition_id: string;
|
|
1400
1384
|
timeframe: string;
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1385
|
+
/** Format: double */
|
|
1386
|
+
volume_usd: number;
|
|
1387
|
+
/** Format: double */
|
|
1388
|
+
buy_volume_usd: number;
|
|
1389
|
+
/** Format: double */
|
|
1390
|
+
sell_volume_usd: number;
|
|
1404
1391
|
/** Format: double */
|
|
1405
1392
|
fees: number;
|
|
1406
1393
|
/** Format: int32 */
|
|
@@ -1421,8 +1408,6 @@ export interface components {
|
|
|
1421
1408
|
price_close: number;
|
|
1422
1409
|
};
|
|
1423
1410
|
/** @enum {string} */
|
|
1424
|
-
PositionPnlSortBy: "realized_pnl_usd" | "buy_usd" | "net_shares" | "cost_basis" | "total_fees";
|
|
1425
|
-
/** @enum {string} */
|
|
1426
1411
|
PositionStatus: "active" | "resolved" | "all";
|
|
1427
1412
|
PositionVolumeChartResponse: {
|
|
1428
1413
|
volumes: components["schemas"]["PositionVolumeDataPoint"][];
|
|
@@ -1557,6 +1542,10 @@ export interface components {
|
|
|
1557
1542
|
token_id: string;
|
|
1558
1543
|
outcome: string;
|
|
1559
1544
|
};
|
|
1545
|
+
/** @enum {string} */
|
|
1546
|
+
TradeSide: "0" | "1";
|
|
1547
|
+
/** @enum {string} */
|
|
1548
|
+
TradeType: "0" | "1" | "2";
|
|
1560
1549
|
/**
|
|
1561
1550
|
* @description Trader profile info embedded in API responses
|
|
1562
1551
|
*
|
|
@@ -1628,8 +1617,8 @@ export interface operations {
|
|
|
1628
1617
|
sort_dir?: components["schemas"]["SortDirection"];
|
|
1629
1618
|
/** @description Metrics timeframe: 1m, 5m, 30m, 1h, 6h, 24h, 7d, 30d */
|
|
1630
1619
|
timeframe?: components["schemas"]["MetricsTimeframe"];
|
|
1631
|
-
/** @description Filter by status:
|
|
1632
|
-
status?:
|
|
1620
|
+
/** @description Filter by status: open or closed */
|
|
1621
|
+
status?: components["schemas"]["MarketStatus"];
|
|
1633
1622
|
/** @description Comma-separated category filters */
|
|
1634
1623
|
categories?: string;
|
|
1635
1624
|
/** @description Comma-separated categories to exclude */
|
|
@@ -1735,9 +1724,7 @@ export interface operations {
|
|
|
1735
1724
|
min_shares?: string;
|
|
1736
1725
|
/** @description Maximum total shares held (decimal string) */
|
|
1737
1726
|
max_shares?: string;
|
|
1738
|
-
/** @description
|
|
1739
|
-
include_pnl?: boolean;
|
|
1740
|
-
/** @description PnL timeframe: 1d, 7d, 30d, lifetime (default: 7d) */
|
|
1727
|
+
/** @description PnL timeframe: 1d, 7d, 30d, lifetime (default: lifetime) */
|
|
1741
1728
|
timeframe?: components["schemas"]["PnlTimeframe"];
|
|
1742
1729
|
};
|
|
1743
1730
|
header?: never;
|
|
@@ -1809,9 +1796,7 @@ export interface operations {
|
|
|
1809
1796
|
min_shares?: string;
|
|
1810
1797
|
/** @description Maximum shares held (decimal string) */
|
|
1811
1798
|
max_shares?: string;
|
|
1812
|
-
/** @description
|
|
1813
|
-
include_pnl?: boolean;
|
|
1814
|
-
/** @description PnL timeframe: 1d, 7d, 30d, lifetime (default: 7d) */
|
|
1799
|
+
/** @description PnL timeframe: 1d, 7d, 30d, lifetime (default: lifetime) */
|
|
1815
1800
|
timeframe?: components["schemas"]["PnlTimeframe"];
|
|
1816
1801
|
};
|
|
1817
1802
|
header?: never;
|
|
@@ -1885,10 +1870,6 @@ export interface operations {
|
|
|
1885
1870
|
min_shares?: string;
|
|
1886
1871
|
/** @description Maximum shares held (decimal string) */
|
|
1887
1872
|
max_shares?: string;
|
|
1888
|
-
/** @description Include position-level PnL data (costs extra credits, default: false) */
|
|
1889
|
-
include_pnl?: boolean;
|
|
1890
|
-
/** @description PnL timeframe: 1d, 7d, 30d, lifetime (default: 7d) */
|
|
1891
|
-
timeframe?: components["schemas"]["PnlTimeframe"];
|
|
1892
1873
|
};
|
|
1893
1874
|
header?: never;
|
|
1894
1875
|
path: {
|
|
@@ -1965,11 +1946,11 @@ export interface operations {
|
|
|
1965
1946
|
event_slugs?: string;
|
|
1966
1947
|
/** @description Filter by position ID(s) - comma-separated (max 50), resolved via market_outcomes table */
|
|
1967
1948
|
position_ids?: string;
|
|
1968
|
-
/** @description Search in title
|
|
1949
|
+
/** @description Search in title (3-100 characters) */
|
|
1969
1950
|
search?: string;
|
|
1970
1951
|
/** @description Filter by status: open or closed */
|
|
1971
1952
|
status?: components["schemas"]["MarketStatus"];
|
|
1972
|
-
/** @description Sort: volume, txns, unique_traders, liquidity, holders,
|
|
1953
|
+
/** @description Sort: volume, txns, unique_traders, liquidity, holders, end_time, start_time, created_time, created_at, relevance */
|
|
1973
1954
|
sort_by?: components["schemas"]["MarketSortBy"];
|
|
1974
1955
|
/** @description Sort direction: asc, desc (default: desc) */
|
|
1975
1956
|
sort_dir?: components["schemas"]["SortDirection"];
|
|
@@ -2003,9 +1984,9 @@ export interface operations {
|
|
|
2003
1984
|
tags?: string;
|
|
2004
1985
|
/** @description Comma-separated tags to exclude */
|
|
2005
1986
|
exclude_tags?: string;
|
|
2006
|
-
/** @description Filter markets with
|
|
1987
|
+
/** @description Filter markets with end_time >= start_time (Unix timestamp) */
|
|
2007
1988
|
start_time?: number;
|
|
2008
|
-
/** @description Filter markets with
|
|
1989
|
+
/** @description Filter markets with end_time <= end_time (Unix timestamp) */
|
|
2009
1990
|
end_time?: number;
|
|
2010
1991
|
/** @description Include tags array (default: true) */
|
|
2011
1992
|
include_tags?: boolean;
|
|
@@ -2015,10 +1996,8 @@ export interface operations {
|
|
|
2015
1996
|
include_metrics?: boolean;
|
|
2016
1997
|
/** @description Results limit (default: 50, max: 100) */
|
|
2017
1998
|
limit?: number;
|
|
2018
|
-
/** @description Cursor
|
|
2019
|
-
|
|
2020
|
-
/** @description Cursor ID for pagination (condition_id) */
|
|
2021
|
-
cursor_id?: string;
|
|
1999
|
+
/** @description Cursor-based pagination key (base64-encoded, obtained from previous response's pagination.pagination_key) */
|
|
2000
|
+
pagination_key?: string;
|
|
2022
2001
|
};
|
|
2023
2002
|
header?: never;
|
|
2024
2003
|
path?: never;
|
|
@@ -2253,14 +2232,14 @@ export interface operations {
|
|
|
2253
2232
|
position_ids?: string;
|
|
2254
2233
|
/** @description Comma-separated trader addresses (max 25) */
|
|
2255
2234
|
traders?: string;
|
|
2256
|
-
/** @description 0
|
|
2257
|
-
side?:
|
|
2235
|
+
/** @description Trade side: 0 (Buy), 1 (Sell) */
|
|
2236
|
+
side?: components["schemas"]["TradeSide"];
|
|
2258
2237
|
/** @description Outcome name filter (e.g. Yes, No) */
|
|
2259
2238
|
outcome?: string;
|
|
2260
|
-
/** @description Outcome index
|
|
2261
|
-
outcome_index?:
|
|
2262
|
-
/** @description 0
|
|
2263
|
-
trade_type?:
|
|
2239
|
+
/** @description Outcome index: 0 (Yes), 1 (No) */
|
|
2240
|
+
outcome_index?: components["schemas"]["OutcomeIndex"];
|
|
2241
|
+
/** @description Trade type: 0 (OrderFilled), 1 (Redemption), 2 (Merge) */
|
|
2242
|
+
trade_type?: components["schemas"]["TradeType"];
|
|
2264
2243
|
/** @description Min USD amount */
|
|
2265
2244
|
min_usd_amount?: number;
|
|
2266
2245
|
/** @description Max USD amount */
|
|
@@ -2519,9 +2498,9 @@ export interface operations {
|
|
|
2519
2498
|
get_global_pnl: {
|
|
2520
2499
|
parameters: {
|
|
2521
2500
|
query?: {
|
|
2522
|
-
/** @description Timeframe: 1d, 7d, 30d (default: 7d) */
|
|
2501
|
+
/** @description Timeframe: 1d, 7d, 30d, lifetime (default: 7d) */
|
|
2523
2502
|
timeframe?: components["schemas"]["PnlTimeframe"];
|
|
2524
|
-
/** @description Sort: pnl_usd,
|
|
2503
|
+
/** @description Sort: pnl_usd, buys, sells, redemptions, merges, avg_hold_time, markets_traded, events_traded, markets_won, volume_usd, fees, best_trade, worst_trade (default: pnl_usd) */
|
|
2525
2504
|
sort_by?: components["schemas"]["GlobalPnlSortBy"];
|
|
2526
2505
|
/** @description Sort direction: asc, desc (default: desc) */
|
|
2527
2506
|
sort_direction?: components["schemas"]["SortDirection"];
|
|
@@ -2678,42 +2657,6 @@ export interface operations {
|
|
|
2678
2657
|
};
|
|
2679
2658
|
};
|
|
2680
2659
|
};
|
|
2681
|
-
get_trader_position_pnl: {
|
|
2682
|
-
parameters: {
|
|
2683
|
-
query?: {
|
|
2684
|
-
/** @description Timeframe: 1d, 7d, 30d, lifetime (default: 7d) */
|
|
2685
|
-
timeframe?: components["schemas"]["PnlTimeframe"];
|
|
2686
|
-
/** @description Sort: realized_pnl_usd, buy_usd, net_shares, cost_basis, total_fees (default: realized_pnl_usd) */
|
|
2687
|
-
sort_by?: components["schemas"]["PositionPnlSortBy"];
|
|
2688
|
-
/** @description Sort direction: asc, desc (default: desc) */
|
|
2689
|
-
sort_direction?: components["schemas"]["SortDirection"];
|
|
2690
|
-
/** @description Results limit (default: 10, max: 200) */
|
|
2691
|
-
limit?: number;
|
|
2692
|
-
/** @description Offset-based pagination key */
|
|
2693
|
-
pagination_key?: number;
|
|
2694
|
-
/** @description Filter by condition ID */
|
|
2695
|
-
condition_id?: string;
|
|
2696
|
-
/** @description Filter by event slug */
|
|
2697
|
-
event_slug?: string;
|
|
2698
|
-
};
|
|
2699
|
-
header?: never;
|
|
2700
|
-
path: {
|
|
2701
|
-
/** @description Trader wallet address */
|
|
2702
|
-
address: string;
|
|
2703
|
-
};
|
|
2704
|
-
cookie?: never;
|
|
2705
|
-
};
|
|
2706
|
-
requestBody?: never;
|
|
2707
|
-
responses: {
|
|
2708
|
-
/** @description Position-level PnL entries for this trader */
|
|
2709
|
-
200: {
|
|
2710
|
-
headers: {
|
|
2711
|
-
[name: string]: unknown;
|
|
2712
|
-
};
|
|
2713
|
-
content?: never;
|
|
2714
|
-
};
|
|
2715
|
-
};
|
|
2716
|
-
};
|
|
2717
2660
|
get_portfolio: {
|
|
2718
2661
|
parameters: {
|
|
2719
2662
|
query?: {
|
|
@@ -2741,15 +2684,15 @@ export interface operations {
|
|
|
2741
2684
|
get_portfolio_positions: {
|
|
2742
2685
|
parameters: {
|
|
2743
2686
|
query?: {
|
|
2744
|
-
/** @description
|
|
2745
|
-
|
|
2687
|
+
/** @description Sort field: shares_usd (default), shares, realized_pnl_usd, price, buy_usd */
|
|
2688
|
+
sort_by?: string;
|
|
2689
|
+
/** @description Sort direction: asc, desc (default: desc) */
|
|
2690
|
+
sort_direction?: components["schemas"]["SortDirection"];
|
|
2746
2691
|
/** @description Filter by condition ID */
|
|
2747
2692
|
condition_id?: string;
|
|
2748
|
-
/** @description Filter by
|
|
2749
|
-
|
|
2750
|
-
/** @description
|
|
2751
|
-
question?: string;
|
|
2752
|
-
/** @description Results limit (default: 10, max: 100) */
|
|
2693
|
+
/** @description Filter by event slug */
|
|
2694
|
+
event_slug?: string;
|
|
2695
|
+
/** @description Results limit (default: 50, max: 200) */
|
|
2753
2696
|
limit?: number;
|
|
2754
2697
|
/** @description Offset-based pagination key (integer offset into result set) */
|
|
2755
2698
|
pagination_key?: number;
|
|
@@ -2763,7 +2706,7 @@ export interface operations {
|
|
|
2763
2706
|
};
|
|
2764
2707
|
requestBody?: never;
|
|
2765
2708
|
responses: {
|
|
2766
|
-
/** @description Trader positions with market metadata */
|
|
2709
|
+
/** @description Trader positions with market metadata and PnL */
|
|
2767
2710
|
200: {
|
|
2768
2711
|
headers: {
|
|
2769
2712
|
[name: string]: unknown;
|
|
@@ -2837,14 +2780,14 @@ export interface operations {
|
|
|
2837
2780
|
slugs?: string;
|
|
2838
2781
|
/** @description Comma-separated position IDs */
|
|
2839
2782
|
position_ids?: string;
|
|
2840
|
-
/** @description 0
|
|
2841
|
-
side?:
|
|
2783
|
+
/** @description Trade side: 0 (Buy), 1 (Sell) */
|
|
2784
|
+
side?: components["schemas"]["TradeSide"];
|
|
2842
2785
|
/** @description Outcome name filter (e.g. Yes, No) */
|
|
2843
2786
|
outcome?: string;
|
|
2844
|
-
/** @description Outcome index
|
|
2845
|
-
outcome_index?:
|
|
2846
|
-
/** @description 0
|
|
2847
|
-
trade_type?:
|
|
2787
|
+
/** @description Outcome index: 0 (Yes), 1 (No) */
|
|
2788
|
+
outcome_index?: components["schemas"]["OutcomeIndex"];
|
|
2789
|
+
/** @description Trade type: 0 (OrderFilled), 1 (Redemption), 2 (Merge) */
|
|
2790
|
+
trade_type?: components["schemas"]["TradeType"];
|
|
2848
2791
|
/** @description Min USD amount */
|
|
2849
2792
|
min_usd_amount?: number;
|
|
2850
2793
|
/** @description Max USD amount */
|