@structbuild/sdk 0.3.0 → 0.3.2
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 +160 -26
- package/dist/generated/polymarket.d.ts +307 -115
- package/dist/generated/webhooks.d.ts +123 -44
- package/dist/generated/ws-alerts.d.ts +2652 -0
- package/dist/generated/ws.d.ts +1221 -0
- package/dist/index.cjs +558 -181
- package/dist/index.cjs.map +9 -8
- package/dist/index.d.ts +1 -0
- package/dist/index.js +558 -181
- package/dist/index.js.map +9 -8
- package/dist/namespaces/markets.d.ts +3 -3
- package/dist/namespaces/series.d.ts +2 -1
- package/dist/namespaces/trader.d.ts +4 -4
- package/dist/types/http.d.ts +1 -0
- package/dist/types/index.d.ts +7 -1
- package/dist/types/ws-helpers.d.ts +5 -0
- package/dist/types/ws.d.ts +128 -90
- package/dist/ws-alerts.d.ts +39 -0
- package/dist/ws-transport.d.ts +26 -7
- package/dist/ws.d.ts +28 -33
- package/package.json +9 -5
|
@@ -657,8 +657,11 @@ export interface components {
|
|
|
657
657
|
ConditionMetricsPayload: {
|
|
658
658
|
/** @description Market condition ID */
|
|
659
659
|
condition_id?: string | null;
|
|
660
|
-
/**
|
|
661
|
-
|
|
660
|
+
/**
|
|
661
|
+
* @description Aggregation window
|
|
662
|
+
* @enum {string|null}
|
|
663
|
+
*/
|
|
664
|
+
timeframe?: "1m" | "5m" | "30m" | "1h" | "6h" | "24h" | "7d" | "30d" | null;
|
|
662
665
|
/** @description Total trading volume in USD for this timeframe */
|
|
663
666
|
volume_usd?: number | null;
|
|
664
667
|
/** @description Total fees collected in USD */
|
|
@@ -694,8 +697,11 @@ export interface components {
|
|
|
694
697
|
EventMetricsPayload: {
|
|
695
698
|
/** @description Event slug */
|
|
696
699
|
event_slug?: string | null;
|
|
697
|
-
/**
|
|
698
|
-
|
|
700
|
+
/**
|
|
701
|
+
* @description Aggregation window
|
|
702
|
+
* @enum {string|null}
|
|
703
|
+
*/
|
|
704
|
+
timeframe?: "1m" | "5m" | "30m" | "1h" | "6h" | "24h" | "7d" | "30d" | null;
|
|
699
705
|
/** @description Total aggregated volume across all markets in the event (USD) */
|
|
700
706
|
volume_usd?: number | null;
|
|
701
707
|
/** @description Total fees collected in USD */
|
|
@@ -765,8 +771,11 @@ export interface components {
|
|
|
765
771
|
EventVolumeMilestonePayload: {
|
|
766
772
|
/** @description Event slug */
|
|
767
773
|
event_slug: string;
|
|
768
|
-
/**
|
|
769
|
-
|
|
774
|
+
/**
|
|
775
|
+
* @description Aggregation window
|
|
776
|
+
* @enum {string}
|
|
777
|
+
*/
|
|
778
|
+
timeframe: "1m" | "5m" | "30m" | "1h" | "6h" | "24h" | "7d" | "30d";
|
|
770
779
|
/** @description The USD milestone amount that was crossed */
|
|
771
780
|
milestone_usd: number;
|
|
772
781
|
/** @description Current aggregated event volume at time of trigger (USD) */
|
|
@@ -783,8 +792,11 @@ export interface components {
|
|
|
783
792
|
EventVolumeSpikePayload: {
|
|
784
793
|
/** @description Event slug */
|
|
785
794
|
event_slug: string;
|
|
786
|
-
/**
|
|
787
|
-
|
|
795
|
+
/**
|
|
796
|
+
* @description Aggregation window
|
|
797
|
+
* @enum {string}
|
|
798
|
+
*/
|
|
799
|
+
timeframe: "1m" | "5m" | "30m" | "1h" | "6h" | "1d" | "24h" | "7d" | "30d";
|
|
788
800
|
/** @description Current aggregated event volume at time of the spike (USD) */
|
|
789
801
|
current_volume_usd: number;
|
|
790
802
|
/** @description Volume at the snapshot baseline (USD) */
|
|
@@ -844,10 +856,16 @@ export interface components {
|
|
|
844
856
|
side: "Buy" | "Sell";
|
|
845
857
|
/** @description Outcome token price (0.0–1.0) */
|
|
846
858
|
price: number;
|
|
847
|
-
/**
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
859
|
+
/**
|
|
860
|
+
* @description Exchange contract that processed the trade
|
|
861
|
+
* @enum {string}
|
|
862
|
+
*/
|
|
863
|
+
exchange: "CTFExchange" | "NegRiskExchange" | "ConditionalTokens" | "NegRiskAdapter" | "Unknown";
|
|
864
|
+
/**
|
|
865
|
+
* @description Trade type (webhook events only fire on order fills)
|
|
866
|
+
* @enum {string}
|
|
867
|
+
*/
|
|
868
|
+
trade_type: "OrderFilled" | "OrdersMatched";
|
|
851
869
|
};
|
|
852
870
|
/** @description Payload delivered when a trader's global PnL (across all markets) crosses a configured threshold */
|
|
853
871
|
GlobalPnlPayload: {
|
|
@@ -1037,8 +1055,11 @@ export interface components {
|
|
|
1037
1055
|
MarketVolumeSpikePayload: {
|
|
1038
1056
|
/** @description Market condition ID */
|
|
1039
1057
|
condition_id: string;
|
|
1040
|
-
/**
|
|
1041
|
-
|
|
1058
|
+
/**
|
|
1059
|
+
* @description Aggregation window
|
|
1060
|
+
* @enum {string}
|
|
1061
|
+
*/
|
|
1062
|
+
timeframe: "1m" | "5m" | "30m" | "1h" | "6h" | "1d" | "24h" | "7d" | "30d";
|
|
1042
1063
|
/** @description Current volume at the time of the spike (USD) */
|
|
1043
1064
|
current_volume_usd: number;
|
|
1044
1065
|
/** @description Volume at the snapshot baseline (USD) */
|
|
@@ -1104,10 +1125,16 @@ export interface components {
|
|
|
1104
1125
|
price: number;
|
|
1105
1126
|
/** @description Implied probability (0.0–1.0); null when outcome is unknown */
|
|
1106
1127
|
probability?: number | null;
|
|
1107
|
-
/**
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1128
|
+
/**
|
|
1129
|
+
* @description Exchange contract that processed the trade
|
|
1130
|
+
* @enum {string}
|
|
1131
|
+
*/
|
|
1132
|
+
exchange: "CTFExchange" | "NegRiskExchange" | "ConditionalTokens" | "NegRiskAdapter" | "Unknown";
|
|
1133
|
+
/**
|
|
1134
|
+
* @description Trade type (webhook events only fire on order fills)
|
|
1135
|
+
* @enum {string}
|
|
1136
|
+
*/
|
|
1137
|
+
trade_type: "OrderFilled" | "OrdersMatched";
|
|
1111
1138
|
};
|
|
1112
1139
|
/** @description Payload delivered on every order-filled trade */
|
|
1113
1140
|
NewTradePayload: {
|
|
@@ -1158,10 +1185,16 @@ export interface components {
|
|
|
1158
1185
|
price: number;
|
|
1159
1186
|
/** @description Implied probability (0.0–1.0); null when outcome is unknown */
|
|
1160
1187
|
probability?: number | null;
|
|
1161
|
-
/**
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1188
|
+
/**
|
|
1189
|
+
* @description Exchange contract that processed the trade
|
|
1190
|
+
* @enum {string}
|
|
1191
|
+
*/
|
|
1192
|
+
exchange: "CTFExchange" | "NegRiskExchange" | "ConditionalTokens" | "NegRiskAdapter" | "Unknown";
|
|
1193
|
+
/**
|
|
1194
|
+
* @description Trade type (webhook events only fire on order fills)
|
|
1195
|
+
* @enum {string}
|
|
1196
|
+
*/
|
|
1197
|
+
trade_type: "OrderFilled" | "OrdersMatched";
|
|
1165
1198
|
};
|
|
1166
1199
|
/**
|
|
1167
1200
|
* @description PnL timeframe enum for webhook filtering
|
|
@@ -1357,8 +1390,11 @@ export interface components {
|
|
|
1357
1390
|
* @description Outcome index
|
|
1358
1391
|
*/
|
|
1359
1392
|
outcome_index?: number | null;
|
|
1360
|
-
/**
|
|
1361
|
-
|
|
1393
|
+
/**
|
|
1394
|
+
* @description Aggregation window
|
|
1395
|
+
* @enum {string|null}
|
|
1396
|
+
*/
|
|
1397
|
+
timeframe?: "1m" | "5m" | "30m" | "1h" | "6h" | "24h" | "7d" | "30d" | null;
|
|
1362
1398
|
/** @description Total trading volume in USD */
|
|
1363
1399
|
volume_usd?: number | null;
|
|
1364
1400
|
/** @description Buy volume in USD */
|
|
@@ -1397,8 +1433,11 @@ export interface components {
|
|
|
1397
1433
|
* @description Outcome index
|
|
1398
1434
|
*/
|
|
1399
1435
|
outcome_index?: number | null;
|
|
1400
|
-
/**
|
|
1401
|
-
|
|
1436
|
+
/**
|
|
1437
|
+
* @description Aggregation window
|
|
1438
|
+
* @enum {string}
|
|
1439
|
+
*/
|
|
1440
|
+
timeframe: "1m" | "5m" | "30m" | "1h" | "6h" | "24h" | "7d" | "30d";
|
|
1402
1441
|
/** @description The USD milestone amount that was crossed */
|
|
1403
1442
|
milestone_usd: number;
|
|
1404
1443
|
/** @description Current position volume at time of trigger (USD) */
|
|
@@ -1426,8 +1465,11 @@ export interface components {
|
|
|
1426
1465
|
outcome?: string | null;
|
|
1427
1466
|
/** Format: int16 */
|
|
1428
1467
|
outcome_index?: number | null;
|
|
1429
|
-
/**
|
|
1430
|
-
|
|
1468
|
+
/**
|
|
1469
|
+
* @description Aggregation window
|
|
1470
|
+
* @enum {string}
|
|
1471
|
+
*/
|
|
1472
|
+
timeframe: "1m" | "5m" | "30m" | "1h" | "6h" | "1d" | "24h" | "7d" | "30d";
|
|
1431
1473
|
/** @description Current position volume at the time of the spike (USD) */
|
|
1432
1474
|
current_volume_usd: number;
|
|
1433
1475
|
/** @description Volume at the snapshot baseline (USD) */
|
|
@@ -1523,8 +1565,11 @@ export interface components {
|
|
|
1523
1565
|
VolumeMilestonePayload: {
|
|
1524
1566
|
/** @description Market condition ID */
|
|
1525
1567
|
condition_id: string;
|
|
1526
|
-
/**
|
|
1527
|
-
|
|
1568
|
+
/**
|
|
1569
|
+
* @description Aggregation window that crossed the milestone
|
|
1570
|
+
* @enum {string}
|
|
1571
|
+
*/
|
|
1572
|
+
timeframe: "1m" | "5m" | "30m" | "1h" | "6h" | "24h" | "7d" | "30d";
|
|
1528
1573
|
/** @description The USD milestone amount that was crossed */
|
|
1529
1574
|
milestone_usd: number;
|
|
1530
1575
|
/** @description Current volume at time of trigger (USD) */
|
|
@@ -1548,13 +1593,16 @@ export interface components {
|
|
|
1548
1593
|
event: string;
|
|
1549
1594
|
/** @description Human-readable description */
|
|
1550
1595
|
description: string;
|
|
1551
|
-
/**
|
|
1552
|
-
|
|
1596
|
+
/**
|
|
1597
|
+
* @description Category grouping for the event type
|
|
1598
|
+
* @enum {string}
|
|
1599
|
+
*/
|
|
1600
|
+
category: "trader" | "market" | "event" | "position" | "assets";
|
|
1553
1601
|
/**
|
|
1554
1602
|
* Format: int64
|
|
1555
|
-
* @description
|
|
1603
|
+
* @description Millicredits consumed per webhook delivery (1 credit = 1000 mc)
|
|
1556
1604
|
*/
|
|
1557
|
-
|
|
1605
|
+
millicredits_cost: number;
|
|
1558
1606
|
/** @description Filter field names that apply to this event type */
|
|
1559
1607
|
applicable_filters: string[];
|
|
1560
1608
|
};
|
|
@@ -1570,6 +1618,8 @@ export interface components {
|
|
|
1570
1618
|
position_ids?: string[];
|
|
1571
1619
|
/** @description Filter by event slugs. Max 500 entries. */
|
|
1572
1620
|
event_slugs?: string[];
|
|
1621
|
+
/** @description Filter by tags or category names (case-insensitive) — for market_created. Max 500 entries. */
|
|
1622
|
+
tags?: string[];
|
|
1573
1623
|
/** @description Filter by outcomes (e.g. "Yes", "No") — for position metrics / close_to_bond. Max 500 entries. */
|
|
1574
1624
|
outcomes?: string[];
|
|
1575
1625
|
/** @description Filter by position outcome index — for close_to_bond. Position 0 = Yes/Up, 1 = No. Max 500 entries. */
|
|
@@ -1629,6 +1679,16 @@ export interface components {
|
|
|
1629
1679
|
* @description Minimum markets traded — for global_pnl / event_pnl
|
|
1630
1680
|
*/
|
|
1631
1681
|
min_markets_traded?: number | null;
|
|
1682
|
+
/**
|
|
1683
|
+
* Format: double
|
|
1684
|
+
* @description Minimum net shares held — for position-level filters
|
|
1685
|
+
*/
|
|
1686
|
+
min_net_shares?: number | null;
|
|
1687
|
+
/**
|
|
1688
|
+
* Format: double
|
|
1689
|
+
* @description Maximum net shares held — for position-level filters
|
|
1690
|
+
*/
|
|
1691
|
+
max_net_shares?: number | null;
|
|
1632
1692
|
/**
|
|
1633
1693
|
* Format: double
|
|
1634
1694
|
* @description Minimum fees (USD) — for metrics webhooks
|
|
@@ -1667,6 +1727,14 @@ export interface components {
|
|
|
1667
1727
|
* @description Spike ratio multiplier (must be > 1.0) — for volume_spike. E.g. 2.0 for 2x baseline
|
|
1668
1728
|
*/
|
|
1669
1729
|
spike_ratio?: number | null;
|
|
1730
|
+
spike_direction?: null | components["schemas"]["SpikeDirection"];
|
|
1731
|
+
/**
|
|
1732
|
+
* Format: int64
|
|
1733
|
+
* @description Observation window in seconds (max 600) — for probability_spike, price_spike, volume_spike
|
|
1734
|
+
*/
|
|
1735
|
+
window_secs?: number | null;
|
|
1736
|
+
/** @description When true, suppress webhooks for short-term "updown" markets */
|
|
1737
|
+
exclude_shortterm_markets?: boolean;
|
|
1670
1738
|
/**
|
|
1671
1739
|
* @description Filter by crypto asset symbol — for `asset_price_tick` and `asset_price_window_update`.
|
|
1672
1740
|
* Valid values: "BTC", "ETH", "SOL", "XRP", "DOGE", "BNB", "HYPE". Empty = all assets (send everything).
|
|
@@ -1690,8 +1758,11 @@ export interface components {
|
|
|
1690
1758
|
event: components["schemas"]["PolymarketWebhookEvent"];
|
|
1691
1759
|
/** @description Active filters (omitted when no filters are set) */
|
|
1692
1760
|
filters?: components["schemas"]["PolymarketWebhookFilter"];
|
|
1693
|
-
/**
|
|
1694
|
-
|
|
1761
|
+
/**
|
|
1762
|
+
* @description Current webhook status
|
|
1763
|
+
* @enum {string}
|
|
1764
|
+
*/
|
|
1765
|
+
status: "active" | "paused" | "disabled" | "suspended";
|
|
1695
1766
|
/**
|
|
1696
1767
|
* Format: int64
|
|
1697
1768
|
* @description Created timestamp (ms)
|
|
@@ -1788,10 +1859,16 @@ export interface components {
|
|
|
1788
1859
|
price: number;
|
|
1789
1860
|
/** @description Implied probability (0.0–1.0); null when outcome is unknown */
|
|
1790
1861
|
probability?: number | null;
|
|
1791
|
-
/**
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1862
|
+
/**
|
|
1863
|
+
* @description Exchange contract that processed the trade
|
|
1864
|
+
* @enum {string}
|
|
1865
|
+
*/
|
|
1866
|
+
exchange: "CTFExchange" | "NegRiskExchange" | "ConditionalTokens" | "NegRiskAdapter" | "Unknown";
|
|
1867
|
+
/**
|
|
1868
|
+
* @description Trade type (webhook events only fire on order fills)
|
|
1869
|
+
* @enum {string}
|
|
1870
|
+
*/
|
|
1871
|
+
trade_type: "OrderFilled" | "OrdersMatched";
|
|
1795
1872
|
};
|
|
1796
1873
|
/** @description Outer envelope for every webhook HTTP POST delivery. The `data` field contains the event-specific payload. Delivery headers sent with every POST: `X-Webhook-ID` (subscription UUID), `X-Delivery-ID` (this attempt's UUID), `X-Event-Type` (event name string, e.g. `trader_first_trade`), `X-Attempt` (attempt number, 1-indexed). When the webhook has a secret configured, `X-Webhook-Signature: sha256=<hmac-hex>` is also included — compute HMAC-SHA256 over the raw request body using your secret to verify. */
|
|
1797
1874
|
WebhookDeliveryEnvelope: {
|
|
@@ -1842,6 +1919,12 @@ export interface components {
|
|
|
1842
1919
|
condition_ids?: string[];
|
|
1843
1920
|
/** @description Restrict to markets belonging to these events. */
|
|
1844
1921
|
event_slugs?: string[];
|
|
1922
|
+
/** @description Minimum trade size in USD. Omit to match all sizes. */
|
|
1923
|
+
min_usd_value?: number;
|
|
1924
|
+
/** @description Only fire when the outcome probability is ≥ this value. */
|
|
1925
|
+
min_probability?: number;
|
|
1926
|
+
/** @description Only fire when the outcome probability is ≤ this value. */
|
|
1927
|
+
max_probability?: number;
|
|
1845
1928
|
/** @description When `true`, suppress webhooks for short-term "updown" markets. Default: `false`. */
|
|
1846
1929
|
exclude_shortterm_markets?: boolean;
|
|
1847
1930
|
};
|
|
@@ -1968,8 +2051,6 @@ export interface components {
|
|
|
1968
2051
|
MarketMetricsFilters: {
|
|
1969
2052
|
/** @description Restrict to these markets. Empty = all markets. */
|
|
1970
2053
|
condition_ids?: string[];
|
|
1971
|
-
/** @description Restrict to markets in these events. */
|
|
1972
|
-
event_slugs?: string[];
|
|
1973
2054
|
/** @description Restrict to these aggregation windows. Empty = all windows. */
|
|
1974
2055
|
timeframes?: ("1m" | "5m" | "30m" | "1h" | "6h" | "24h" | "7d" | "30d")[];
|
|
1975
2056
|
/** @description Only fire when volume ≥ this value (USD). */
|
|
@@ -2168,8 +2249,6 @@ export interface components {
|
|
|
2168
2249
|
MarketCreatedFilters: {
|
|
2169
2250
|
/** @description Restrict to markets with these tags or category names (case-insensitive match). */
|
|
2170
2251
|
tags?: string[];
|
|
2171
|
-
/** @description Restrict to these specific markets. */
|
|
2172
|
-
condition_ids?: string[];
|
|
2173
2252
|
/** @description Restrict to markets belonging to these events. */
|
|
2174
2253
|
event_slugs?: string[];
|
|
2175
2254
|
/** @description When `true`, suppress webhooks for short-term "updown" markets (event slugs containing `updown`). Default: `false`. */
|