@yuants/vendor-okx 0.23.3 → 0.23.5

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/lib/ws.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"ws.js","sourceRoot":"","sources":["../src/ws.ts"],"names":[],"mappings":";;;AAAA,+CAA0D;AAC1D,yCAAuD;AACvD,+BAA0G;AAE1G,MAAM,gCAAgC,GAAG,uBAAY,CAAC,MAAM,CAC1D,OAAO,EACP,2BAA2B,EAC3B,4CAA4C,CAC7C,CAAC;AAEF,MAAM,4BAA4B,GAAG,uBAAY,CAAC,MAAM,CACtD,OAAO,EACP,uBAAuB,EACvB,6CAA6C,CAC9C,CAAC;AAGF,MAAM,QAAQ,GAAG,mBAAQ,CAAC,WAAW,EAAE,CAAC;AAExC,MAAM,WAAW;IA+Gf,YAAY,IAAY;QA/EP,YAAO,GAAW,uBAAuB,CAAC;QAGnD,kBAAa,GAAkB,QAAQ,CAAC;QAE/B,kBAAa,GAAG,IAAI,GAAG,EAMrC,CAAC;QACa,aAAQ,GAA6B,EAAE,CAAC;QACxC,wBAAmB,GAAkD;YACpF,KAAK,EAAE,IAAI,GAAG,EAAE;YAChB,KAAK,EAAE,IAAI,GAAG,EAAE;SACjB,CAAC;QAEe,eAAU,GAAG,GAAG,EAAE;YACjC,IAAI,CAAC,aAAa,GAAG,WAAW,CAAC;YACjC,OAAO,CAAC,IAAI,CAAC,IAAA,kBAAU,EAAC,IAAI,CAAC,GAAG,EAAE,CAAC,EAAE,gBAAgB,CAAC,CAAC;YACvD,KAAK,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,EAAE;gBAC7D,IAAI,CAAC,oBAAoB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;aAC5C;QACH,CAAC,CAAC;QAEe,kBAAa,GAAG,CAAC,GAAiB,EAAE,EAAE;;YACrD,IAAI,GAA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MAAM,CAAC,CAAC,IAAI;AAC3E,EAAE;AACF,IAAA,aAAM,EAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAClC,CAAC;AAJS,QAAA,OAAO,WAIhB","sourcesContent":["import { PromRegistry, Terminal } from '@yuants/protocol';\nimport { encodePath, formatTime } from '@yuants/utils';\nimport { catchError, defer, EMPTY, filter, interval, Observable, Subscription, tap, timeout } from 'rxjs';\n\nconst MetricsWebSocketConnectionsGauge = PromRegistry.create(\n 'gauge',\n 'okx_websocket_connections',\n 'Number of active OKX WebSocket connections',\n);\n\nconst MetricsWebSocketChannelGauge = PromRegistry.create(\n 'gauge',\n 'okx_websocket_channel',\n 'Number of OKX WebSocket channels subscribed',\n);\n\ntype ConnectStatus = 'connecting' | 'connected' | 'closed' | 'reconnecting';\nconst terminal = Terminal.fromNodeEnv();\n\nclass OKXWsClient {\n private static readonly pool: {\n path: string;\n client: OKXWsClient;\n requests: number;\n isFull: boolean;\n }[] = [];\n\n // ISSUE: 连接限制:3 次/秒 (基于IP)\n // https://www.okx.com/docs-v5/zh/#overview-websocket-connect\n // 每个连接 对于 订阅/取消订阅/登录 请求的总次数限制为 480 次/小时\n static GetWsClient(path: string): OKXWsClient {\n const existing = OKXWsClient.pool.find((item) => item.path === path && !item.isFull);\n if (existing && !existing.client.isClosed()) {\n existing.requests++;\n if (existing.requests >= 480) {\n existing.isFull = true;\n }\n return existing.client;\n }\n\n const client = existing?.client?.isClosed() ? existing.client.revive() : new OKXWsClient(path);\n if (existing) {\n existing.client = client;\n existing.requests = 1;\n existing.isFull = false;\n } else {\n OKXWsClient.pool.push({ path, client, requests: 1, isFull: false });\n }\n return client;\n }\n\n private readonly baseURL: string = `wss://ws.okx.com:8443`;\n private readonly path: string;\n private ws!: WebSocket;\n private connectStatus: ConnectStatus = 'closed';\n private keepAlive?: Subscription;\n private readonly subscriptions = new Map<\n string,\n {\n channel: string;\n instId?: string;\n }\n >();\n private readonly handlers: Record<string, Function> = {};\n private readonly connectionListeners: Record<'error' | 'close', Set<EventListener>> = {\n error: new Set(),\n close: new Set(),\n };\n\n private readonly handleOpen = () => {\n this.connectStatus = 'connected';\n console.info(formatTime(Date.now()), '✅ WS connected');\n for (const { channel, instId } of this.subscriptions.values()) {\n this.sendSubscribeMessage(channel, instId);\n }\n };\n\n private readonly handleMessage = (raw: MessageEvent) => {\n if (raw.data === 'pong') {\n return;\n }\n const msg = JSON.parse(raw.data);\n if (msg.arg?.channel) {\n const channelId = encodePath(msg.arg.channel, msg.arg.instId);\n const data = msg.data;\n const handler = this.handlers[channelId];\n if (data && handler) {\n handler(data, msg.arg);\n }\n } else if (msg.event) {\n console.info(formatTime(Date.now()), 'Event:', msg);\n }\n };\n\n private readonly handleError = (event: Event) => {\n console.error(formatTime(Date.now()), '❌ WS error', event);\n };\n\n private readonly handleClose = (event: CloseEvent) => {\n console.error(formatTime(Date.now()), '❌ WS closed', event);\n MetricsWebSocketConnectionsGauge.dec({ path: this.path });\n\n const closedSocket = event.target as WebSocket;\n if (closedSocket !== this.ws) {\n return;\n }\n\n if (this.connectStatus === 'reconnecting') {\n return;\n }\n\n this.connectStatus = 'closed';\n\n if (this.subscriptions.size === 0) {\n return;\n }\n\n this.connectStatus = 'reconnecting';\n setTimeout(() => {\n if (this.connectStatus === 'connecting' || this.connectStatus === 'connected') {\n return;\n }\n if (this.subscriptions.size === 0) {\n this.connectStatus = 'closed';\n return;\n }\n this.initSocket();\n }, 1000);\n };\n\n constructor(path: string) {\n this.path = path;\n this.initSocket();\n this.startKeepAlive();\n }\n\n private revive(): OKXWsClient {\n this.initSocket();\n this.startKeepAlive();\n return this;\n }\n\n private initSocket() {\n this.connectStatus = 'connecting';\n this.ws = new WebSocket(`${this.baseURL}/${this.path}`);\n MetricsWebSocketConnectionsGauge.inc({ path: this.path, terminal_id: terminal.terminal_id });\n\n this.ws.addEventListener('open', this.handleOpen);\n this.ws.addEventListener('message', this.handleMessage);\n this.ws.addEventListener('error', this.handleError);\n this.ws.addEventListener('close', this.handleClose);\n\n for (const listener of this.connectionListeners.error) {\n this.ws.addEventListener('error', listener);\n }\n for (const listener of this.connectionListeners.close) {\n this.ws.addEventListener('close', listener);\n }\n }\n\n private startKeepAlive() {\n if (this.keepAlive && !this.keepAlive.closed) {\n return;\n }\n this.keepAlive = interval(25_000)\n .pipe(\n tap(() => {\n if (this.connectStatus === 'connected') {\n this.ws.send('ping');\n }\n }),\n )\n .subscribe();\n }\n\n private stopKeepAlive() {\n if (this.keepAlive && !this.keepAlive.closed) {\n this.keepAlive.unsubscribe();\n }\n }\n\n private isClosed() {\n return this.ws?.readyState === WebSocket.CLOSING || this.ws?.readyState === WebSocket.CLOSED;\n }\n\n private sendSubscribeMessage(channel: string, instId?: string) {\n const message = {\n op: 'subscribe',\n args: [{ channel, instId }],\n };\n this.ws.send(JSON.stringify(message));\n const channelId = encodePath(channel, instId);\n console.info(formatTime(Date.now()), `📩 Sent subscribe for ${channelId}`);\n }\n\n private sendUnsubscribeMessage(channel: string, instId?: string) {\n const message = {\n op: 'unsubscribe',\n args: [{ channel, instId }],\n };\n this.ws.send(JSON.stringify(message));\n const channelId = encodePath(channel, instId);\n console.info(formatTime(Date.now()), `📩 Sent unsubscribe for ${channelId}`);\n }\n\n addConnectionListener(type: 'error' | 'close', listener: EventListener): () => void {\n this.connectionListeners[type].add(listener);\n this.ws.addEventListener(type, listener);\n return () => {\n this.connectionListeners[type].delete(listener);\n this.ws.removeEventListener(type, listener);\n };\n }\n\n subscribe(channel: string, instId?: string, handler?: Function) {\n const channelId = encodePath(channel, instId);\n if (this.subscriptions.has(channelId)) {\n console.info(formatTime(Date.now()), `⚠️ Already subscribed: ${channelId}`);\n return;\n }\n\n this.subscriptions.set(channelId, { channel, instId });\n MetricsWebSocketChannelGauge.inc({ channel, terminal_id: terminal.terminal_id });\n\n if (handler) {\n this.handlers[channelId] = handler;\n }\n\n this.startKeepAlive();\n\n if (this.connectStatus === 'connected') {\n this.sendSubscribeMessage(channel, instId);\n } else if (this.isClosed()) {\n this.initSocket();\n } else {\n console.info(formatTime(Date.now()), `📩 Queued subscribe for ${channelId} waiting for connection`);\n }\n }\n\n unsubscribe(channel: string, instId?: string) {\n const channelId = encodePath(channel, instId);\n if (!this.subscriptions.has(channelId)) return;\n\n if (this.connectStatus === 'connected') {\n this.sendUnsubscribeMessage(channel, instId);\n }\n this.subscriptions.delete(channelId);\n MetricsWebSocketChannelGauge.dec({ channel });\n delete this.handlers[channelId];\n\n if (this.subscriptions.size === 0) {\n this.stopKeepAlive();\n if (this.ws.readyState === WebSocket.OPEN || this.ws.readyState === WebSocket.CONNECTING) {\n this.ws.close();\n }\n }\n }\n}\n\nconst fromWsChannelAndInstId = <T>(path: string, channel: string, instId: string) =>\n defer(\n () =>\n new Observable<T>((subscriber) => {\n const client = OKXWsClient.GetWsClient(path);\n client.subscribe(channel, instId, (data: T) => {\n subscriber.next(data);\n });\n const removeError = client.addConnectionListener('error', (err) => {\n subscriber.error(err);\n });\n const removeClose = client.addConnectionListener('close', () => {\n subscriber.error('WS Connection Closed');\n });\n subscriber.add(() => {\n removeError();\n removeClose();\n client.unsubscribe(channel, instId);\n });\n }),\n ).pipe(\n // 防止单个连接断开导致数据流关闭\n timeout(60_000),\n tap({\n error: (err) => {\n console.info(formatTime(Date.now()), 'WS_SUBSCRIBE_ERROR', channel, instId, err);\n },\n }),\n // 暂时不太确定是否能支持 retry\n // retry({ delay: 1000 }),\n catchError(() => EMPTY),\n );\n\nexport const useTicker = (instId: string) =>\n fromWsChannelAndInstId<\n {\n instId: string;\n last: string;\n askPx: string;\n bidPx: string;\n askSz: string;\n bidSz: string;\n }[]\n >('ws/v5/public', 'tickers', instId).pipe(\n //\n filter((data) => data.length > 0),\n );\n\nexport const useOpenInterest = (instId: string) =>\n fromWsChannelAndInstId<\n {\n instId: string;\n oi: string; // open interest\n }[]\n >('ws/v5/public', 'open-interest', instId).pipe(\n //\n filter((data) => data.length > 0),\n );\n\nexport const useOHLC = (candleType: string, instId: string) =>\n fromWsChannelAndInstId<string[][]>('ws/v5/business', candleType, instId).pipe(\n //\n filter((data) => data.length > 0),\n );\n"]}
1
+ {"version":3,"file":"ws.js","sourceRoot":"","sources":["../src/ws.ts"],"names":[],"mappings":";;;AAAA,+CAA0D;AAC1D,yCAAuD;AACvD,+BAA0G;AAE1G,MAAM,gCAAgC,GAAG,uBAAY,CAAC,MAAM,CAC1D,OAAO,EACP,2BAA2B,EAC3B,4CAA4C,CAC7C,CAAC;AAEF,MAAM,4BAA4B,GAAG,uBAAY,CAAC,MAAM,CACtD,OAAO,EACP,uBAAuB,EACvB,6CAA6C,CAC9C,CAAC;AAGF,MAAM,QAAQ,GAAG,mBAAQ,CAAC,WAAW,EAAE,CAAC;AAExC,MAAM,WAAW;IA+Gf,YAAY,IAAY;QA/EP,YAAO,GAAW,uBAAuB,CAAC;QAGnD,kBAAa,GAAkB,QAAQ,CAAC;QAE/B,kBAAa,GAAG,IAAI,GAAG,EAMrC,CAAC;QACa,aAAQ,GAA6B,EAAE,CAAC;QACxC,wBAAmB,GAAkD;YACpF,KAAK,EAAE,IAAI,GAAG,EAAE;YAChB,KAAK,EAAE,IAAI,GAAG,EAAE;SACjB,CAAC;QAEe,eAAU,GAAG,GAAG,EAAE;YACjC,IAAI,CAAC,aAAa,GAAG,WAAW,CAAC;YACjC,OAAO,CAAC,IAAI,CAAC,IAAA,kBAAU,EAAC,IAAI,CAAC,GAAG,EAAE,CAAC,EAAE,gBAAgB,CAAC,CAAC;YACvD,KAAK,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,EAAE;gBAC7D,IAAI,CAAC,oBAAoB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;aAC5C;QACH,CAAC,CAAC;QAEe,kBAAa,GAAG,CAAC,GAAiB,EAAE,EAAE;;YACrD,IAAI,GAAG,CAAC,IAAI,KAAK,MAAM,EAAE;gBACvB,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F,IAAA,aAAM,EAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAClC,CAAC;AAJS,QAAA,OAAO,WAIhB;AAEG,MAAM,cAAc,GAAG,CAC5B,OAA2E,EAC3E,MAAc,EACd,EAAE,CACF,sBAAsB,CASpB,cAAc,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,IAAI;AACrC,EAAE;AACF,IAAA,aAAM,EAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAClC,CAAC;AAhBS,QAAA,cAAc,kBAgBvB","sourcesContent":["import { PromRegistry, Terminal } from '@yuants/protocol';\nimport { encodePath, formatTime } from '@yuants/utils';\nimport { catchError, defer, EMPTY, filter, interval, Observable, Subscription, tap, timeout } from 'rxjs';\n\nconst MetricsWebSocketConnectionsGauge = PromRegistry.create(\n 'gauge',\n 'okx_websocket_connections',\n 'Number of active OKX WebSocket connections',\n);\n\nconst MetricsWebSocketChannelGauge = PromRegistry.create(\n 'gauge',\n 'okx_websocket_channel',\n 'Number of OKX WebSocket channels subscribed',\n);\n\ntype ConnectStatus = 'connecting' | 'connected' | 'closed' | 'reconnecting';\nconst terminal = Terminal.fromNodeEnv();\n\nclass OKXWsClient {\n private static readonly pool: {\n path: string;\n client: OKXWsClient;\n requests: number;\n isFull: boolean;\n }[] = [];\n\n // ISSUE: 连接限制:3 次/秒 (基于IP)\n // https://www.okx.com/docs-v5/zh/#overview-websocket-connect\n // 每个连接 对于 订阅/取消订阅/登录 请求的总次数限制为 480 次/小时\n static GetWsClient(path: string): OKXWsClient {\n const existing = OKXWsClient.pool.find((item) => item.path === path && !item.isFull);\n if (existing && !existing.client.isClosed()) {\n existing.requests++;\n if (existing.requests >= 480) {\n existing.isFull = true;\n }\n return existing.client;\n }\n\n const client = existing?.client?.isClosed() ? existing.client.revive() : new OKXWsClient(path);\n if (existing) {\n existing.client = client;\n existing.requests = 1;\n existing.isFull = false;\n } else {\n OKXWsClient.pool.push({ path, client, requests: 1, isFull: false });\n }\n return client;\n }\n\n private readonly baseURL: string = `wss://ws.okx.com:8443`;\n private readonly path: string;\n private ws!: WebSocket;\n private connectStatus: ConnectStatus = 'closed';\n private keepAlive?: Subscription;\n private readonly subscriptions = new Map<\n string,\n {\n channel: string;\n instId?: string;\n }\n >();\n private readonly handlers: Record<string, Function> = {};\n private readonly connectionListeners: Record<'error' | 'close', Set<EventListener>> = {\n error: new Set(),\n close: new Set(),\n };\n\n private readonly handleOpen = () => {\n this.connectStatus = 'connected';\n console.info(formatTime(Date.now()), '✅ WS connected');\n for (const { channel, instId } of this.subscriptions.values()) {\n this.sendSubscribeMessage(channel, instId);\n }\n };\n\n private readonly handleMessage = (raw: MessageEvent) => {\n if (raw.data === 'pong') {\n return;\n }\n const msg = JSON.parse(raw.data);\n if (msg.arg?.channel) {\n const channelId = encodePath(msg.arg.channel, msg.arg.instId);\n const data = msg.data;\n const handler = this.handlers[channelId];\n if (data && handler) {\n handler(data, msg.arg);\n }\n } else if (msg.event) {\n console.info(formatTime(Date.now()), 'Event:', msg);\n }\n };\n\n private readonly handleError = (event: Event) => {\n console.error(formatTime(Date.now()), '❌ WS error', event);\n };\n\n private readonly handleClose = (event: CloseEvent) => {\n console.error(formatTime(Date.now()), '❌ WS closed', event);\n MetricsWebSocketConnectionsGauge.dec({ path: this.path });\n\n const closedSocket = event.target as WebSocket;\n if (closedSocket !== this.ws) {\n return;\n }\n\n if (this.connectStatus === 'reconnecting') {\n return;\n }\n\n this.connectStatus = 'closed';\n\n if (this.subscriptions.size === 0) {\n return;\n }\n\n this.connectStatus = 'reconnecting';\n setTimeout(() => {\n if (this.connectStatus === 'connecting' || this.connectStatus === 'connected') {\n return;\n }\n if (this.subscriptions.size === 0) {\n this.connectStatus = 'closed';\n return;\n }\n this.initSocket();\n }, 1000);\n };\n\n constructor(path: string) {\n this.path = path;\n this.initSocket();\n this.startKeepAlive();\n }\n\n private revive(): OKXWsClient {\n this.initSocket();\n this.startKeepAlive();\n return this;\n }\n\n private initSocket() {\n this.connectStatus = 'connecting';\n this.ws = new WebSocket(`${this.baseURL}/${this.path}`);\n MetricsWebSocketConnectionsGauge.inc({ path: this.path, terminal_id: terminal.terminal_id });\n\n this.ws.addEventListener('open', this.handleOpen);\n this.ws.addEventListener('message', this.handleMessage);\n this.ws.addEventListener('error', this.handleError);\n this.ws.addEventListener('close', this.handleClose);\n\n for (const listener of this.connectionListeners.error) {\n this.ws.addEventListener('error', listener);\n }\n for (const listener of this.connectionListeners.close) {\n this.ws.addEventListener('close', listener);\n }\n }\n\n private startKeepAlive() {\n if (this.keepAlive && !this.keepAlive.closed) {\n return;\n }\n this.keepAlive = interval(25_000)\n .pipe(\n tap(() => {\n if (this.connectStatus === 'connected') {\n this.ws.send('ping');\n }\n }),\n )\n .subscribe();\n }\n\n private stopKeepAlive() {\n if (this.keepAlive && !this.keepAlive.closed) {\n this.keepAlive.unsubscribe();\n }\n }\n\n private isClosed() {\n return this.ws?.readyState === WebSocket.CLOSING || this.ws?.readyState === WebSocket.CLOSED;\n }\n\n private sendSubscribeMessage(channel: string, instId?: string) {\n const message = {\n op: 'subscribe',\n args: [{ channel, instId }],\n };\n this.ws.send(JSON.stringify(message));\n const channelId = encodePath(channel, instId);\n console.info(formatTime(Date.now()), `📩 Sent subscribe for ${channelId}`);\n }\n\n private sendUnsubscribeMessage(channel: string, instId?: string) {\n const message = {\n op: 'unsubscribe',\n args: [{ channel, instId }],\n };\n this.ws.send(JSON.stringify(message));\n const channelId = encodePath(channel, instId);\n console.info(formatTime(Date.now()), `📩 Sent unsubscribe for ${channelId}`);\n }\n\n addConnectionListener(type: 'error' | 'close', listener: EventListener): () => void {\n this.connectionListeners[type].add(listener);\n this.ws.addEventListener(type, listener);\n return () => {\n this.connectionListeners[type].delete(listener);\n this.ws.removeEventListener(type, listener);\n };\n }\n\n subscribe(channel: string, instId?: string, handler?: Function) {\n const channelId = encodePath(channel, instId);\n if (this.subscriptions.has(channelId)) {\n console.info(formatTime(Date.now()), `⚠️ Already subscribed: ${channelId}`);\n return;\n }\n\n this.subscriptions.set(channelId, { channel, instId });\n MetricsWebSocketChannelGauge.inc({ channel, terminal_id: terminal.terminal_id });\n\n if (handler) {\n this.handlers[channelId] = handler;\n }\n\n this.startKeepAlive();\n\n if (this.connectStatus === 'connected') {\n this.sendSubscribeMessage(channel, instId);\n } else if (this.isClosed()) {\n this.initSocket();\n } else {\n console.info(formatTime(Date.now()), `📩 Queued subscribe for ${channelId} waiting for connection`);\n }\n }\n\n unsubscribe(channel: string, instId?: string) {\n const channelId = encodePath(channel, instId);\n if (!this.subscriptions.has(channelId)) return;\n\n if (this.connectStatus === 'connected') {\n this.sendUnsubscribeMessage(channel, instId);\n }\n this.subscriptions.delete(channelId);\n MetricsWebSocketChannelGauge.dec({ channel });\n delete this.handlers[channelId];\n\n if (this.subscriptions.size === 0) {\n this.stopKeepAlive();\n if (this.ws.readyState === WebSocket.OPEN || this.ws.readyState === WebSocket.CONNECTING) {\n this.ws.close();\n }\n }\n }\n}\n\nconst fromWsChannelAndInstId = <T>(path: string, channel: string, instId: string) =>\n defer(\n () =>\n new Observable<T>((subscriber) => {\n const client = OKXWsClient.GetWsClient(path);\n client.subscribe(channel, instId, (data: T) => {\n subscriber.next(data);\n });\n const removeError = client.addConnectionListener('error', (err) => {\n subscriber.error(err);\n });\n const removeClose = client.addConnectionListener('close', () => {\n subscriber.error('WS Connection Closed');\n });\n subscriber.add(() => {\n removeError();\n removeClose();\n client.unsubscribe(channel, instId);\n });\n }),\n ).pipe(\n // 防止单个连接断开导致数据流关闭\n timeout(60_000),\n tap({\n error: (err) => {\n console.info(formatTime(Date.now()), 'WS_SUBSCRIBE_ERROR', channel, instId, err);\n },\n }),\n // 暂时不太确定是否能支持 retry\n // retry({ delay: 1000 }),\n catchError(() => EMPTY),\n );\n\nexport const useTicker = (instId: string) =>\n fromWsChannelAndInstId<\n {\n instId: string;\n last: string;\n askPx: string;\n bidPx: string;\n askSz: string;\n bidSz: string;\n }[]\n >('ws/v5/public', 'tickers', instId).pipe(\n //\n filter((data) => data.length > 0),\n );\n\nexport const useOpenInterest = (instId: string) =>\n fromWsChannelAndInstId<\n {\n instId: string;\n oi: string; // open interest\n }[]\n >('ws/v5/public', 'open-interest', instId).pipe(\n //\n filter((data) => data.length > 0),\n );\n\nexport const useOHLC = (candleType: string, instId: string) =>\n fromWsChannelAndInstId<string[][]>('ws/v5/business', candleType, instId).pipe(\n //\n filter((data) => data.length > 0),\n );\n\nexport const useMarketBooks = (\n channel: 'books' | 'books5' | 'bbo-tbt' | 'books-l2-tbt' | 'books50-l2-tbt',\n instId: string,\n) =>\n fromWsChannelAndInstId<\n {\n asks: [price: string, volume: string, abandon: string, order_number: string][];\n bids: [price: string, volume: string, abandon: string, order_number: string][];\n ts: string;\n prevSeqId: number;\n seqId: number;\n checksum: number;\n }[]\n >('ws/v5/public', channel, instId).pipe(\n //\n filter((data) => data.length > 0),\n );\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuants/vendor-okx",
3
- "version": "0.23.3",
3
+ "version": "0.23.5",
4
4
  "bin": "lib/cli.js",
5
5
  "main": "lib/index.js",
6
6
  "files": [
@@ -9,19 +9,19 @@
9
9
  "temp"
10
10
  ],
11
11
  "dependencies": {
12
- "@yuants/protocol": "0.46.0",
13
- "@yuants/transfer": "0.2.19",
14
- "@yuants/data-account": "0.5.2",
15
- "@yuants/data-order": "0.2.16",
12
+ "@yuants/protocol": "0.46.1",
13
+ "@yuants/transfer": "0.2.20",
14
+ "@yuants/data-account": "0.5.3",
15
+ "@yuants/data-order": "0.2.17",
16
16
  "@yuants/utils": "0.8.0",
17
- "@yuants/sql": "0.9.10",
18
- "@yuants/data-series": "0.3.31",
19
- "@yuants/data-product": "0.3.3",
20
- "@yuants/data-ohlc": "0.4.2",
21
- "@yuants/data-interest-rate": "0.1.28",
22
- "@yuants/data-quote": "0.2.23",
23
- "@yuants/data-trade": "0.1.1",
24
- "@yuants/secret": "0.2.14",
17
+ "@yuants/sql": "0.9.11",
18
+ "@yuants/data-series": "0.3.32",
19
+ "@yuants/data-product": "0.3.4",
20
+ "@yuants/data-ohlc": "0.4.3",
21
+ "@yuants/data-interest-rate": "0.1.29",
22
+ "@yuants/data-quote": "0.2.24",
23
+ "@yuants/data-trade": "0.1.2",
24
+ "@yuants/secret": "0.2.15",
25
25
  "rxjs": "~7.5.6",
26
26
  "crypto-js": "^4.2.0",
27
27
  "ws": "~8.8.1"
@@ -1,22 +1,23 @@
1
1
  {
2
- "apps/vendor-okx/CHANGELOG.json": "cf7d6e02d5352530d4a2d5c2578a0faa7d2f075d",
3
- "apps/vendor-okx/CHANGELOG.md": "8452ef595959401c5b85e6e8f63e9a8fea04f8c4",
2
+ "apps/vendor-okx/CHANGELOG.json": "a1bdb665809cea2f6273bfa0c8cf0cc495691130",
3
+ "apps/vendor-okx/CHANGELOG.md": "d8a06179a533f2f1d73f408b074d5e634dd92b4c",
4
4
  "apps/vendor-okx/README.md": "ac3d1f6c4c8d73066664699b0bb1b01db02e67a2",
5
5
  "apps/vendor-okx/api-extractor.json": "62f4fd324425b9a235f0c117975967aab09ced0c",
6
6
  "apps/vendor-okx/config/jest.config.json": "4bb17bde3ee911163a3edb36a6eb71491d80b1bd",
7
7
  "apps/vendor-okx/config/rig.json": "f6c7b5537dc77a3170ba9f008bae3b6c3ee11956",
8
8
  "apps/vendor-okx/config/typescript.json": "854907e8a821f2050f6533368db160c649c25348",
9
9
  "apps/vendor-okx/etc/vendor-okx.api.md": "92c54ccd547d2ad81ca6088158ca193e85c208df",
10
- "apps/vendor-okx/package.json": "5de3c6739de3e515a16a8b4ccbc8fde4a9b45e29",
10
+ "apps/vendor-okx/package.json": "ab68ac9dac1783d6eca522707f4839fa5e48e3d1",
11
11
  "apps/vendor-okx/src/account.ts": "ecfbe5017d6b5d4d1bc833de9f48fe72db76bdb7",
12
- "apps/vendor-okx/src/api.ts": "a818895fddbfe76eab517cd0bbba9fafe6c0c2cc",
12
+ "apps/vendor-okx/src/api.ts": "1ed5d9e4a758523e5f97183a1e6377bed0d75493",
13
13
  "apps/vendor-okx/src/cli.ts": "9bf6b5559a6c6f33da20e74cc6c5d702c60ec891",
14
14
  "apps/vendor-okx/src/cluster.ts": "9971d8d5e6af16e09d2d1fe5e9f05ccee87281e8",
15
- "apps/vendor-okx/src/index.ts": "78fc886f9977fd57bc27ec96537fbb243cc1045c",
15
+ "apps/vendor-okx/src/index.ts": "21c3f194a9572692a949bb307005baf87141fbfb",
16
16
  "apps/vendor-okx/src/interest_rate.ts": "cf3a12813e8703add74de929d5ddda0bf3e7b45f",
17
17
  "apps/vendor-okx/src/legacy_index.ts": "e46abcfaa52f957ce5e8c42ca26cd0fc2c576965",
18
18
  "apps/vendor-okx/src/loan-account.ts": "fa37d6e51a992443ddba130e5136de7a58c34286",
19
19
  "apps/vendor-okx/src/logger.ts": "d25d427e74f46819a601e0cb17d5358b22c8db7b",
20
+ "apps/vendor-okx/src/market-order.ts": "1c11c55ddf3402469e82a51989e54a47dcfdb5ac",
20
21
  "apps/vendor-okx/src/ohlc.ts": "01861f583022bf33803bd8d376296d170c4aa8f5",
21
22
  "apps/vendor-okx/src/order.ts": "945865088271a194eb1c684af0f10e6b54d89f6b",
22
23
  "apps/vendor-okx/src/product.ts": "d5aea86778190d0a73f0a61c3b2cf178f3b57df9",
@@ -27,22 +28,22 @@
27
28
  "apps/vendor-okx/src/strategy-account.ts": "3d55c425df2688eeb3ecdd3a3ff2e428b10fa2a1",
28
29
  "apps/vendor-okx/src/trade.ts": "5265a7215b803c5f357842e1ece7ddca53f7e7fc",
29
30
  "apps/vendor-okx/src/websocket.ts": "6c0199bbb9db714ec96b59d90b35b3c801975194",
30
- "apps/vendor-okx/src/ws.ts": "27f5dbc86937905136203e02bd6214c4a93e8eb1",
31
+ "apps/vendor-okx/src/ws.ts": "1a8cfac0a5e86139db4b6a8f8dfd6d2b0a82e729",
31
32
  "apps/vendor-okx/tsconfig.json": "81da8f78196974b5d15da0edb6b2d9f48641063c",
32
33
  "apps/vendor-okx/.rush/temp/shrinkwrap-deps.json": "0a6205550d411d42b6d36324572e5e2a0ba166b2",
33
- "libraries/protocol/temp/package-deps.json": "050758a526f03fc32ff32d7b02b223b60af56564",
34
- "libraries/transfer/temp/package-deps.json": "2050686789a87ac826bb8777f3f566022399b2f8",
35
- "libraries/data-account/temp/package-deps.json": "ae86ceb287f70fd0533186579d2dcca931457acb",
36
- "libraries/data-order/temp/package-deps.json": "804a58fdbc9da925b4cfa239c40ede857ccde214",
34
+ "libraries/protocol/temp/package-deps.json": "62bc1cb0a7d7ffadb33a35dfa823e03a48ad8572",
35
+ "libraries/transfer/temp/package-deps.json": "6c45e5623e560e2602ecf792eea3e8a3141076cf",
36
+ "libraries/data-account/temp/package-deps.json": "e77f6cfba0d46e3ea05892041b1bc184c1af7a9f",
37
+ "libraries/data-order/temp/package-deps.json": "55f1b82dd7d30da8d33d768584241d9a901aa22a",
37
38
  "libraries/utils/temp/package-deps.json": "56def945d0e67a9d0ca13447d2333155be0138f2",
38
- "libraries/sql/temp/package-deps.json": "66a80d6afc07b7092446e9e2153f96d7d15d411f",
39
- "libraries/data-series/temp/package-deps.json": "3b319ba643d3d8403e8a4b491ae0cd34df637489",
40
- "libraries/data-product/temp/package-deps.json": "e44ded303b20ff9dd75c3fe8165ae89ec52b0d3d",
41
- "libraries/data-ohlc/temp/package-deps.json": "c440ac38fdce4c32f00e991b1f1cde25ae85b9dc",
42
- "libraries/data-interest-rate/temp/package-deps.json": "84fa579d5731acdc3d4e214e12f9e107ebe4eba5",
43
- "libraries/data-quote/temp/package-deps.json": "ee26127008b1a3a48524a7a4576bc2fe7ea05cc4",
44
- "libraries/data-trade/temp/package-deps.json": "4784b890c2f47e9bcaafdf5f9918d4ec5bd782df",
45
- "libraries/secret/temp/package-deps.json": "245fedf0b82b9d1898f355b8766389ede7ebd8d7",
39
+ "libraries/sql/temp/package-deps.json": "5e5778a9e2daa9352ca5876b282d3aca297b5d01",
40
+ "libraries/data-series/temp/package-deps.json": "dd0e72dde51b63200a7665d1172c162a65214f5a",
41
+ "libraries/data-product/temp/package-deps.json": "194e42a18245a4840d501a1a4ce27222df2a8044",
42
+ "libraries/data-ohlc/temp/package-deps.json": "58097dcb73f96778762461d6d8f6de473fe64b44",
43
+ "libraries/data-interest-rate/temp/package-deps.json": "159afc02f2441c569dc7c73ffecfbec83f65b036",
44
+ "libraries/data-quote/temp/package-deps.json": "d3eb234bbfb2463cb53367151eaefdfbb03da111",
45
+ "libraries/data-trade/temp/package-deps.json": "4277985318172b3e8710bfd38a932c8d71a761ea",
46
+ "libraries/secret/temp/package-deps.json": "f57c6ada82811718f20cf7fa40d53d846678d628",
46
47
  "libraries/extension/temp/package-deps.json": "1e2fec9acb35353b204eff0d4cc0af65c3b2582a",
47
48
  "tools/toolkit/temp/package-deps.json": "3bef053db16659f0cdaceea64c8a8580c0131633"
48
49
  }