@dshtrading/api 0.6.2 → 0.7.0

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.
Files changed (2) hide show
  1. package/lib/index.d.ts +46 -1
  2. package/package.json +2 -2
package/lib/index.d.ts CHANGED
@@ -1122,6 +1122,12 @@ interface PredictionOutcomeBucket {
1122
1122
  readonly volume24h?: number | undefined;
1123
1123
  /** 最小报价粒度(上游 `orderPriceMinTickSize`)。 */
1124
1124
  readonly tickSize?: number | undefined;
1125
+ /**
1126
+ * 回填取数定位键(上游 gamma market `clobTokenIds[0]`,公开数据非凭据;客户端不消费)。
1127
+ * 历史价格按 token 扇出(CLOB `prices-history` 只认 token),客户端拿到的是
1128
+ * 按事件窗口聚合好的序列,不需要这个键。
1129
+ */
1130
+ readonly clobTokenId?: string | undefined;
1125
1131
  /**
1126
1132
  * 是否仍可下单(上游 market 级 `acceptingOrders`)。**不用 `active` 判断**:
1127
1133
  * 实测结算后 `active` 仍为 true,只有 `closed`/`acceptingOrders` 会翻转。
@@ -1165,6 +1171,38 @@ interface PredictionFeed {
1165
1171
  readonly fetchedAt: string;
1166
1172
  readonly meetings: readonly PredictionMeeting[];
1167
1173
  }
1174
+ /** 一条服务端历史价格读数(CLOB prices-history 的 t/p 原样,不换算单位)。 */
1175
+ interface PredictionPricePoint {
1176
+ /** 上游时间戳(unix 秒)。 */
1177
+ readonly t: number;
1178
+ /** 上游价格(midpoint 口径 0..1,与 gamma outcomePrices 等价)。 */
1179
+ readonly p: number;
1180
+ }
1181
+ /** 单档在请求窗口内的历史序列。 */
1182
+ interface PredictionPriceSeries {
1183
+ readonly bucketKey: string;
1184
+ readonly points: readonly PredictionPricePoint[];
1185
+ }
1186
+ /** 一段请求窗口的历史结果(服务端解析 token 后扇出各档)。 */
1187
+ interface PredictionPriceHistory {
1188
+ /** 取数时刻(ISO 8601 UTC)。 */
1189
+ readonly fetchedAt: string;
1190
+ /** 上游 event id。 */
1191
+ readonly meetingId: string;
1192
+ /** 请求窗口(epoch ms,原样回述以便客户端复算)。 */
1193
+ readonly fromMs: number;
1194
+ readonly toMs: number;
1195
+ /** 请求粒度(分钟)。 */
1196
+ readonly fidelityMinutes: number;
1197
+ readonly series: readonly PredictionPriceSeries[];
1198
+ }
1199
+ /** 历史请求(窗口上限 336 小时 = 上游 startTs/endTs 实测边界)。 */
1200
+ interface PredictionPriceHistoryRequest {
1201
+ readonly meetingId: string;
1202
+ readonly fromMs: number;
1203
+ readonly toMs: number;
1204
+ readonly fidelityMinutes?: number | undefined;
1205
+ }
1168
1206
  /**
1169
1207
  * 预测市场源契约(2026-10-11 Polymarket 接入,v1 只覆盖 FOMC 决议路径):
1170
1208
  * host 平面由 connector-polymarket provide `tradingPredictionFeed`,GUI 面板经桥
@@ -1178,6 +1216,13 @@ interface PredictionFeed {
1178
1216
  interface PredictionFeedService {
1179
1217
  /** 当前 FOMC 决议路径全部会议(含已结算;按 endDate 升序)。 */
1180
1218
  listFomcMeetings(): Promise<PredictionFeed>;
1219
+ /**
1220
+ * 单场会议在请求窗口内的逐档概率历史(2026-10-15 事件窗口回填)。
1221
+ *
1222
+ * 失败必须响亮:服务缺席/上游失败/窗口超限各自以可区分的错误抛出——**不得**
1223
+ * 以空 series 冒充「上游没有变动」(真无变动与取数失败在客户端是两个结论)。
1224
+ */
1225
+ listPriceHistory(request: PredictionPriceHistoryRequest): Promise<PredictionPriceHistory>;
1181
1226
  }
1182
1227
  /** 新闻聚合器注册表契约(Issue #37,router 插件提供)。 */
1183
1228
  interface TradingNewsRegistry {
@@ -1186,4 +1231,4 @@ interface TradingNewsRegistry {
1186
1231
  markets(): string[];
1187
1232
  }
1188
1233
  //#endregion
1189
- export { AccountBalance, ActiveBuySnapshot, AggregateNewsOptions, AggregateNewsResult, AuctionSnapshot, BuybackItem, CRON_MAX, CompanyProfile, type CordisContext, CronSchedule, CryptoFundamentals, DEFAULT_MAX_INFLIGHT_EXECUTIONS, DEFAULT_SESSION_PERMISSION, DEFAULT_TASK_AGENT_PRESET, DEFAULT_TASK_PERMISSION, DerivativesData, DerivativesHistory, DerivativesPoint, Disposable, DividendItem, DragonTigerItem, EXECUTION_HISTORY_LIMIT, ExecutionRecord, FinancialCell, FinancialIndicatorRow, FinancialReportGroup, FinancialReportMatrix, FlashFeedService, ForecastSummary, FundamentalsPackage, HolderNumSummary, IAccount, InsiderTradeItem, InstitutionalHoldingItem, InstrumentAssetClass, InstrumentContract, InstrumentForm, InstrumentRef, Interval, Kline, KlineCapability, LeverageSetting, LimitUpPoolItem, MacroCalendarEntry, MacroFeedService, MacroRateEntry, MainOperationSegment, MarginMode, MarketDataRegistration, MarketDataRegistry, MarketDataService, MarketRouterService, NewTaskInput, NewsAggregator, NewsItem, OperatingEfficiency, Order, OrderRequest, OrderSide, OrderStatus, OrderType, Orderbook, OrderbookLevel, PIN_MAX, PROMPT_MAX, Position, PositionSide, PredictionFeed, PredictionFeedService, PredictionMeeting, PredictionOutcomeBucket, ResearchReportItem, SWAP_SYMBOL_SUFFIX, ScheduleRule, ScheduleSkipRecord, SetLeverageRequest, ShareholderItem, SouthboundHoldingHistory, SouthboundHoldingPoint, SplitItem, StockFundamentals, TASKS_ACTION_BYTES_LIMIT, TASKS_API_SUBPATH, TASKS_SCHEMA_VERSION, TASK_PERMISSIONS, TASK_SKIP_REASONS, TITLE_MAX, TaskPermission, TaskRecord, TaskSkipReason, TaskUpdatePatch, TasksAction, TasksActionEnvelope, TasksSchedulerSnapshot, TasksSnapshot, Ticker, TradeFill, TradeRegistration, TradeRegistry, TradeService, TradeTick, TradingError, TradingErrorCode, TradingNewsRegistry, countOpenExecutions, hasOpenExecution, instrumentFormOf, isTaskPermission, isTaskSkipReason, isValidCron, nextRunAtMs, parseCron, parseNewTaskInput, parseTaskUpdatePatch, parseTasksAction, parseTasksEnvelope, permissionPending, permissionRank, retainRecentExecutions };
1234
+ export { AccountBalance, ActiveBuySnapshot, AggregateNewsOptions, AggregateNewsResult, AuctionSnapshot, BuybackItem, CRON_MAX, CompanyProfile, type CordisContext, CronSchedule, CryptoFundamentals, DEFAULT_MAX_INFLIGHT_EXECUTIONS, DEFAULT_SESSION_PERMISSION, DEFAULT_TASK_AGENT_PRESET, DEFAULT_TASK_PERMISSION, DerivativesData, DerivativesHistory, DerivativesPoint, Disposable, DividendItem, DragonTigerItem, EXECUTION_HISTORY_LIMIT, ExecutionRecord, FinancialCell, FinancialIndicatorRow, FinancialReportGroup, FinancialReportMatrix, FlashFeedService, ForecastSummary, FundamentalsPackage, HolderNumSummary, IAccount, InsiderTradeItem, InstitutionalHoldingItem, InstrumentAssetClass, InstrumentContract, InstrumentForm, InstrumentRef, Interval, Kline, KlineCapability, LeverageSetting, LimitUpPoolItem, MacroCalendarEntry, MacroFeedService, MacroRateEntry, MainOperationSegment, MarginMode, MarketDataRegistration, MarketDataRegistry, MarketDataService, MarketRouterService, NewTaskInput, NewsAggregator, NewsItem, OperatingEfficiency, Order, OrderRequest, OrderSide, OrderStatus, OrderType, Orderbook, OrderbookLevel, PIN_MAX, PROMPT_MAX, Position, PositionSide, PredictionFeed, PredictionFeedService, PredictionMeeting, PredictionOutcomeBucket, PredictionPriceHistory, PredictionPriceHistoryRequest, PredictionPricePoint, PredictionPriceSeries, ResearchReportItem, SWAP_SYMBOL_SUFFIX, ScheduleRule, ScheduleSkipRecord, SetLeverageRequest, ShareholderItem, SouthboundHoldingHistory, SouthboundHoldingPoint, SplitItem, StockFundamentals, TASKS_ACTION_BYTES_LIMIT, TASKS_API_SUBPATH, TASKS_SCHEMA_VERSION, TASK_PERMISSIONS, TASK_SKIP_REASONS, TITLE_MAX, TaskPermission, TaskRecord, TaskSkipReason, TaskUpdatePatch, TasksAction, TasksActionEnvelope, TasksSchedulerSnapshot, TasksSnapshot, Ticker, TradeFill, TradeRegistration, TradeRegistry, TradeService, TradeTick, TradingError, TradingErrorCode, TradingNewsRegistry, countOpenExecutions, hasOpenExecution, instrumentFormOf, isTaskPermission, isTaskSkipReason, isValidCron, nextRunAtMs, parseCron, parseNewTaskInput, parseTaskUpdatePatch, parseTasksAction, parseTasksEnvelope, permissionPending, permissionRank, retainRecentExecutions };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dshtrading/api",
3
3
  "description": "Pure TypeScript contracts for dsh-trading: market-data/trade service interfaces, domain types, and the shared error vocabulary",
4
- "version": "0.6.2",
4
+ "version": "0.7.0",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
7
7
  "types": "./lib/index.d.ts",
@@ -17,7 +17,7 @@
17
17
  ],
18
18
  "license": "PolyForm-Noncommercial-1.0.0",
19
19
  "devDependencies": {
20
- "@deepseek-ai/cordis": "^4.0.5",
20
+ "@deepseek-ai/cordis": "^4.1.0",
21
21
  "tsdown": "^0.22.0",
22
22
  "vitest": "^3.0.0"
23
23
  },