@polyester/sdk 0.36.0-devnet-20261118141710 → 0.36.0-devnet-20261118184607
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/CHANGELOG.md +5 -1
- package/dist/realtime/ready-gated-subscription.js +1 -1
- package/dist/realtime/snapshot-then-stream.js +2 -0
- package/dist/realtime/snapshot-then-stream.js.map +1 -1
- package/dist/services/account-activity/account-activity.schemas.d.ts +2 -2
- package/dist/services/assistant/assistant-events.schemas.d.ts +27 -27
- package/dist/services/assistant/assistant.schemas.d.ts +1 -1
- package/dist/services/auto-withdraw/auto-withdraw.schemas.d.ts +3 -3
- package/dist/services/candles/candles.schemas.d.ts +10 -10
- package/dist/services/changelog/changelog.schemas.d.ts +38 -38
- package/dist/services/checkpoints/checkpoints.schemas.d.ts +1 -1
- package/dist/services/claims/claims.schemas.d.ts +2 -2
- package/dist/services/dust-conversion/dust-conversion.schemas.d.ts +2 -2
- package/dist/services/heatmap/heatmap.schemas.d.ts +4 -4
- package/dist/services/internal-transfers/internal-transfers.schemas.d.ts +6 -6
- package/dist/services/lifecycle/lifecycle.js +1 -1
- package/dist/services/lifecycle/lifecycle.js.map +1 -1
- package/dist/services/lifecycle/lifecycle.schemas.d.ts +39 -39
- package/dist/services/orderbook/orderbook.js +1 -1
- package/dist/services/orders/order-errors.schemas.d.ts +9 -9
- package/dist/services/orders/orders-batch.schemas.d.ts +102 -102
- package/dist/services/orders/orders-input.schemas.d.ts +15 -15
- package/dist/services/orders/orders-output.schemas.d.ts +14 -14
- package/dist/services/orders/orders.d.ts.map +1 -1
- package/dist/services/orders/orders.js +47 -43
- package/dist/services/orders/orders.js.map +1 -1
- package/dist/services/rewards/rewards.schemas.d.ts +4 -4
- package/dist/services/statement-exports/statement-exports.schemas.d.ts +6 -6
- package/dist/services/subaccounts/subaccounts.schemas.d.ts +4 -4
- package/dist/services/system/system.schemas.d.ts +13 -13
- package/dist/services/trades/trades.d.ts.map +1 -1
- package/dist/services/trades/trades.js +12 -4
- package/dist/services/trades/trades.js.map +1 -1
- package/dist/services/trades/trades.schemas.d.ts +1 -1
- package/dist/services/triggers/trigger-input.schemas.d.ts +1 -1
- package/dist/services/triggers/triggers-output.schemas.d.ts +50 -50
- package/dist/services/triggers/triggers.d.ts.map +1 -1
- package/dist/services/triggers/triggers.js +14 -10
- package/dist/services/triggers/triggers.js.map +1 -1
- package/dist/shared/connect-error-mapping.d.ts.map +1 -1
- package/dist/shared/connect-error-mapping.js +4 -1
- package/dist/shared/connect-error-mapping.js.map +1 -1
- package/dist/shared/decimal-surface.d.ts +6 -0
- package/dist/shared/decimal-surface.d.ts.map +1 -1
- package/dist/shared/decimal-surface.js +65 -1
- package/dist/shared/decimal-surface.js.map +1 -1
- package/dist/shared/rate-limit.schemas.d.ts +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @polyester/sdk
|
|
2
2
|
|
|
3
|
-
## 0.36.0-devnet-
|
|
3
|
+
## 0.36.0-devnet-20261118184607
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
|
|
11
11
|
- Breaking: price alert status and the assistant `run_failed` failure category now spell canceled `"canceled"` (was `"cancelled"`), matching orders, triggers and the rest of the SDK. This covers `PriceAlert["status"]`, the `priceAlerts.list` `statuses` filter and `AssistantFailureCategory`. There are no aliases: `"cancelled"` is now rejected as an input. ([#254](https://github.com/Fabric-Labs/polyester-sdk-typescript/pull/254))
|
|
12
12
|
|
|
13
|
+
- Breaking: order, trigger and trade reads no longer drop or fail on a pair listed after the client loaded its catalog. When a result names a symbol the catalog lacks, the SDK refreshes the catalog and formats it again; misses within 30 seconds share one refresh. A symbol still unknown after that throws `CatalogLookupError`. Before, `orders.listOpen`, `orders.listHistory` and `orders.subscribe` silently skipped those orders. This covers `orders.listOpen`, `orders.listHistory`, `orders.getDetails`, `triggers.get`, `triggers.list`, `triggers.fromProto` and `trades.list`. On `orders.subscribe`, `triggers.subscribe` and `trades.subscribe`, a publication naming such a symbol waits for the refresh, and later publications wait behind it, so callbacks keep their order; an order still unknown then reaches `onError` as a `CatalogLookupError` and is left out of `onSnapshot`. ([#265](https://github.com/Fabric-Labs/polyester-sdk-typescript/pull/265))
|
|
14
|
+
|
|
13
15
|
- Breaking: `lifecycle.listFlows` selects an account only by `{ kind: "smartAccountAddress" }`; the `accountId` and `ownerAccountId` selectors are gone, and flow summaries and transaction matches no longer carry `ownerAccountId`. Use `listAccountFlows` for the signed-in account's flows. ([#258](https://github.com/Fabric-Labs/polyester-sdk-typescript/pull/258))
|
|
14
16
|
|
|
15
17
|
- Breaking: Lifecycle `zipperReason.code` is a label such as `"deposit_amount_below_minimum"` instead of a number, like every other enum. An uncataloged code reads `unknown_zipper_reason_${code}`. ([#255](https://github.com/Fabric-Labs/polyester-sdk-typescript/pull/255))
|
|
@@ -142,6 +144,8 @@
|
|
|
142
144
|
|
|
143
145
|
- Docs: trading rate limits apply per account and are shared by all its API keys and sessions; `getTradingLimits` `apiKeyRules` are informational, not enforced. ([#258](https://github.com/Fabric-Labs/polyester-sdk-typescript/pull/258))
|
|
144
146
|
|
|
147
|
+
- The order book stops retrying its snapshot once `realtime.disconnect()` closes the socket. `lifecycle.subscribeOpenFlows` trims a padded `accountId` again, and a `null` `accountId` throws instead of opening the public all-accounts channel. A `ServiceUnavailableError` from a gateway that only says "service temporarily unavailable" now carries `retryAfterMs` from `Retry-After`. ([#265](https://github.com/Fabric-Labs/polyester-sdk-typescript/pull/265))
|
|
148
|
+
|
|
145
149
|
- `orderbook.get` returns the snapshot's `ts`, `orders.cancelAll` returns `tsNs`, and `internalTransfers.create` returns `acceptedAtNs`, fields the server already sent but the SDK dropped. ([#258](https://github.com/Fabric-Labs/polyester-sdk-typescript/pull/258))
|
|
146
150
|
|
|
147
151
|
- `ServiceUnavailableError` carries the server's `Retry-After` as `retryAfterMs`, as `RateLimitError` already does. ([#263](https://github.com/Fabric-Labs/polyester-sdk-typescript/pull/263))
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createReadyGate } from "../shared/decimal-surface.js";
|
|
2
1
|
import { publicationHandlerErrorContext } from "../shared/subscription-errors.js";
|
|
2
|
+
import { createReadyGate } from "../shared/decimal-surface.js";
|
|
3
3
|
//#region src/realtime/ready-gated-subscription.ts
|
|
4
4
|
/**
|
|
5
5
|
* Connects a transition feed whose publications require asynchronous catalog
|
|
@@ -80,6 +80,8 @@ function snapshotThenStream(params) {
|
|
|
80
80
|
retryAttempts++;
|
|
81
81
|
retryTimer = setTimeout(() => {
|
|
82
82
|
retryTimer = null;
|
|
83
|
+
const kind = params.channel.startsWith("private:") ? "private" : "public";
|
|
84
|
+
if (params.realtime.connection[kind].state === "disconnected") return;
|
|
83
85
|
refreshSnapshot(false);
|
|
84
86
|
}, delayMs);
|
|
85
87
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snapshot-then-stream.js","names":[],"sources":["../../src/realtime/snapshot-then-stream.ts"],"sourcesContent":["import type { DescMessage, MessageShape } from \"@bufbuild/protobuf\";\nimport {\n createSdkSubscriptionErrorContext,\n type SdkSubscriptionErrorContext,\n} from \"../shared/subscription-errors.js\";\nimport type { PolyesterRealtime } from \"./types.js\";\nimport { formatConnectError } from \"../utils/errors.js\";\nimport { PolyesterError } from \"../shared/errors.js\";\nimport { isDev } from \"../utils/is-dev.js\";\n\nexport interface SnapshotThenStreamSubscription {\n unsubscribe: () => void;\n refreshSnapshot: () => void;\n isReady: () => boolean;\n isDisposed: () => boolean;\n}\n\nexport interface SnapshotThenStreamInput<TSchema extends DescMessage, TSnapshot, TPublication> {\n realtime: PolyesterRealtime;\n channel: string;\n schema: TSchema;\n maxBufferedPublications?: number;\n bufferPublicationKey?: (publication: TPublication) => PropertyKey;\n /** Exponential backoff from `delayMs`, capped at `maxDelayMs`; never retries a non-retryable PolyesterError. */\n snapshotRetry?: {\n maxAttempts: number;\n delayMs: number;\n maxDelayMs?: number;\n };\n snapshotFailureMode?: \"wait\" | \"live\" | ((error: unknown) => \"wait\" | \"live\");\n snapshotErrorLog?: string;\n fetchSnapshot: () => Promise<TSnapshot>;\n readPublication: (message: MessageShape<TSchema>) => readonly TPublication[];\n applySnapshot: (snapshot: TSnapshot, bufferedPublications: readonly TPublication[]) => void;\n applyLivePublications: (publications: readonly TPublication[]) => void;\n onOpen?: () => void;\n onClose?: () => void;\n onError?: (ctx: SdkSubscriptionErrorContext) => void;\n}\n\n/**\n * Snapshot-then-stream for feed state. By default, the buffer caps at\n * `maxBufferedPublications` and drops the OLDEST publications, which is correct for\n * ephemeral feeds where a later publication supersedes earlier ones. Keyed state can\n * provide `bufferPublicationKey` to retain the latest value for every key without FIFO\n * loss. Entity transitions (orders, triggers, balances, trades) must NOT use this —\n * their ordering contract lives in the app-side `EntityStreamStore`, which buffers\n * unbounded and replays because dropping an event loses a row transition.\n */\nexport function snapshotThenStream<TSchema extends DescMessage, TSnapshot, TPublication>(\n params: SnapshotThenStreamInput<TSchema, TSnapshot, TPublication>,\n): SnapshotThenStreamSubscription {\n const maxBufferedPublications = params.maxBufferedPublications ?? 200;\n let droppedPublications = 0;\n\n let ready = false;\n let disposed = false;\n let refreshGeneration = 0;\n let pendingPublications: TPublication[] = [];\n let retryAttempts = 0;\n let retryTimer: ReturnType<typeof setTimeout> | null = null;\n\n function reportSnapshotError(error: unknown): void {\n if (isDev() && params.snapshotErrorLog) {\n console.error(params.snapshotErrorLog, error);\n }\n params.onError?.(\n createSdkSubscriptionErrorContext(\n params.channel,\n \"snapshot\",\n error instanceof Error ? error : formatConnectError(error, \"snapshot failed\"),\n ),\n );\n }\n\n function takePendingPublications(): TPublication[] {\n const buffered = pendingPublications;\n pendingPublications = [];\n return buffered;\n }\n\n function applyBufferedAsLive(): void {\n const buffered = takePendingPublications();\n if (buffered.length === 0) return;\n applyLivePublications(buffered);\n }\n\n function bufferPublications(publications: readonly TPublication[]): void {\n if (params.bufferPublicationKey) {\n const byKey = new Map<PropertyKey, TPublication>();\n for (const publication of pendingPublications) {\n byKey.set(params.bufferPublicationKey(publication), publication);\n }\n for (const publication of publications) {\n byKey.set(params.bufferPublicationKey(publication), publication);\n }\n pendingPublications = Array.from(byKey.values());\n return;\n }\n\n const next = pendingPublications.concat(publications);\n if (next.length > maxBufferedPublications) {\n droppedPublications += next.length - maxBufferedPublications;\n if (isDev()) {\n console.warn(\n `[snapshot-then-stream] ${params.channel}: buffer cap dropped ${droppedPublications} publication(s) while snapshot in flight`,\n );\n }\n }\n pendingPublications = next.slice(-maxBufferedPublications);\n }\n\n function clearRetryTimer(): void {\n if (retryTimer === null) return;\n clearTimeout(retryTimer);\n retryTimer = null;\n }\n\n function reportBufferedPublicationError(error: unknown): void {\n params.onError?.(\n createSdkSubscriptionErrorContext(params.channel, \"publication_handler\", error),\n );\n }\n\n function applyLivePublications(publications: readonly TPublication[]): void {\n try {\n params.applyLivePublications(publications);\n } catch (error) {\n reportBufferedPublicationError(error);\n }\n }\n\n function applySnapshot(\n snapshot: TSnapshot,\n bufferedPublications: readonly TPublication[],\n ): void {\n try {\n params.applySnapshot(snapshot, bufferedPublications);\n } catch (error) {\n reportBufferedPublicationError(error);\n }\n }\n\n function scheduleSnapshotRetry(error: unknown): void {\n const retry = params.snapshotRetry;\n if (!retry || retryAttempts >= retry.maxAttempts || disposed) return;\n if (error instanceof PolyesterError && !error.retryable) return;\n\n const delayMs = Math.min(\n retry.delayMs * 2 ** retryAttempts,\n retry.maxDelayMs ?? Number.POSITIVE_INFINITY,\n );\n retryAttempts++;\n retryTimer = setTimeout(() => {\n retryTimer = null;\n refreshSnapshot(false);\n }, delayMs);\n }\n\n function refreshSnapshot(resetRetries = true): void {\n if (disposed) return;\n clearRetryTimer();\n if (resetRetries) retryAttempts = 0;\n\n const generation = ++refreshGeneration;\n ready = false;\n\n Promise.resolve()\n .then(() => params.fetchSnapshot())\n .then((snapshot) => {\n if (disposed || generation !== refreshGeneration) return;\n\n const buffered = takePendingPublications();\n applySnapshot(snapshot, buffered);\n\n if (disposed || generation !== refreshGeneration) return;\n ready = true;\n retryAttempts = 0;\n })\n .catch((error: unknown) => {\n if (disposed || generation !== refreshGeneration) return;\n reportSnapshotError(error);\n const failureMode =\n typeof params.snapshotFailureMode === \"function\"\n ? params.snapshotFailureMode(error)\n : params.snapshotFailureMode;\n if (failureMode === \"live\") {\n ready = true;\n applyBufferedAsLive();\n }\n scheduleSnapshotRetry(error);\n });\n }\n\n const unsubscribeRealtime = params.realtime.connectProtoChannel({\n channel: params.channel,\n schema: params.schema,\n onPublication: (message) => {\n const publications = params.readPublication(message);\n if (publications.length === 0) return;\n\n if (!ready) {\n bufferPublications(publications);\n return;\n }\n\n applyLivePublications(publications);\n },\n onConnected: () => {\n if (disposed) return;\n pendingPublications = [];\n refreshSnapshot();\n params.onOpen?.();\n },\n onDisconnected: () => {\n if (disposed) return;\n clearRetryTimer();\n refreshGeneration++;\n ready = false;\n pendingPublications = [];\n params.onClose?.();\n },\n onError: params.onError,\n });\n\n function unsubscribe(): void {\n disposed = true;\n clearRetryTimer();\n refreshGeneration++;\n pendingPublications = [];\n try {\n unsubscribeRealtime();\n } catch {\n // noop\n }\n }\n\n return {\n unsubscribe,\n refreshSnapshot,\n isReady: () => ready,\n isDisposed: () => disposed,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;AAiDA,SAAgB,mBACZ,QAC8B;CAC9B,MAAM,0BAA0B,OAAO,2BAA2B;CAClE,IAAI,sBAAsB;CAE1B,IAAI,QAAQ;CACZ,IAAI,WAAW;CACf,IAAI,oBAAoB;CACxB,IAAI,sBAAsC,CAAC;CAC3C,IAAI,gBAAgB;CACpB,IAAI,aAAmD;CAEvD,SAAS,oBAAoB,OAAsB;EAC/C,IAAI,MAAM,KAAK,OAAO,kBAClB,QAAQ,MAAM,OAAO,kBAAkB,KAAK;EAEhD,OAAO,UACH,kCACI,OAAO,SACP,YACA,iBAAiB,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AAQ;GACR,sBAAsB,CAAC;GACvB,OAAO,UAAU;EACrB;EACA,SAAS,OAAO;CACpB,CAAC;CAED,SAAS,cAAoB;EACzB,WAAW;EACX,gBAAgB;EAChB;EACA,sBAAsB,CAAC;EACvB,IAAI;GACA,oBAAoB;EACxB,QAAQ,CAER;CACJ;CAEA,OAAO;EACH;EACA;EACA,eAAe;EACf,kBAAkB;CACtB;AACJ"}
|
|
1
|
+
{"version":3,"file":"snapshot-then-stream.js","names":[],"sources":["../../src/realtime/snapshot-then-stream.ts"],"sourcesContent":["import type { DescMessage, MessageShape } from \"@bufbuild/protobuf\";\nimport {\n createSdkSubscriptionErrorContext,\n type SdkSubscriptionErrorContext,\n} from \"../shared/subscription-errors.js\";\nimport type { PolyesterRealtime } from \"./types.js\";\nimport { formatConnectError } from \"../utils/errors.js\";\nimport { PolyesterError } from \"../shared/errors.js\";\nimport { isDev } from \"../utils/is-dev.js\";\n\nexport interface SnapshotThenStreamSubscription {\n unsubscribe: () => void;\n refreshSnapshot: () => void;\n isReady: () => boolean;\n isDisposed: () => boolean;\n}\n\nexport interface SnapshotThenStreamInput<TSchema extends DescMessage, TSnapshot, TPublication> {\n realtime: PolyesterRealtime;\n channel: string;\n schema: TSchema;\n maxBufferedPublications?: number;\n bufferPublicationKey?: (publication: TPublication) => PropertyKey;\n /** Exponential backoff from `delayMs`, capped at `maxDelayMs`; never retries a non-retryable PolyesterError. */\n snapshotRetry?: {\n maxAttempts: number;\n delayMs: number;\n maxDelayMs?: number;\n };\n snapshotFailureMode?: \"wait\" | \"live\" | ((error: unknown) => \"wait\" | \"live\");\n snapshotErrorLog?: string;\n fetchSnapshot: () => Promise<TSnapshot>;\n readPublication: (message: MessageShape<TSchema>) => readonly TPublication[];\n applySnapshot: (snapshot: TSnapshot, bufferedPublications: readonly TPublication[]) => void;\n applyLivePublications: (publications: readonly TPublication[]) => void;\n onOpen?: () => void;\n onClose?: () => void;\n onError?: (ctx: SdkSubscriptionErrorContext) => void;\n}\n\n/**\n * Snapshot-then-stream for feed state. By default, the buffer caps at\n * `maxBufferedPublications` and drops the OLDEST publications, which is correct for\n * ephemeral feeds where a later publication supersedes earlier ones. Keyed state can\n * provide `bufferPublicationKey` to retain the latest value for every key without FIFO\n * loss. Entity transitions (orders, triggers, balances, trades) must NOT use this —\n * their ordering contract lives in the app-side `EntityStreamStore`, which buffers\n * unbounded and replays because dropping an event loses a row transition.\n */\nexport function snapshotThenStream<TSchema extends DescMessage, TSnapshot, TPublication>(\n params: SnapshotThenStreamInput<TSchema, TSnapshot, TPublication>,\n): SnapshotThenStreamSubscription {\n const maxBufferedPublications = params.maxBufferedPublications ?? 200;\n let droppedPublications = 0;\n\n let ready = false;\n let disposed = false;\n let refreshGeneration = 0;\n let pendingPublications: TPublication[] = [];\n let retryAttempts = 0;\n let retryTimer: ReturnType<typeof setTimeout> | null = null;\n\n function reportSnapshotError(error: unknown): void {\n if (isDev() && params.snapshotErrorLog) {\n console.error(params.snapshotErrorLog, error);\n }\n params.onError?.(\n createSdkSubscriptionErrorContext(\n params.channel,\n \"snapshot\",\n error instanceof Error ? error : formatConnectError(error, \"snapshot failed\"),\n ),\n );\n }\n\n function takePendingPublications(): TPublication[] {\n const buffered = pendingPublications;\n pendingPublications = [];\n return buffered;\n }\n\n function applyBufferedAsLive(): void {\n const buffered = takePendingPublications();\n if (buffered.length === 0) return;\n applyLivePublications(buffered);\n }\n\n function bufferPublications(publications: readonly TPublication[]): void {\n if (params.bufferPublicationKey) {\n const byKey = new Map<PropertyKey, TPublication>();\n for (const publication of pendingPublications) {\n byKey.set(params.bufferPublicationKey(publication), publication);\n }\n for (const publication of publications) {\n byKey.set(params.bufferPublicationKey(publication), publication);\n }\n pendingPublications = Array.from(byKey.values());\n return;\n }\n\n const next = pendingPublications.concat(publications);\n if (next.length > maxBufferedPublications) {\n droppedPublications += next.length - maxBufferedPublications;\n if (isDev()) {\n console.warn(\n `[snapshot-then-stream] ${params.channel}: buffer cap dropped ${droppedPublications} publication(s) while snapshot in flight`,\n );\n }\n }\n pendingPublications = next.slice(-maxBufferedPublications);\n }\n\n function clearRetryTimer(): void {\n if (retryTimer === null) return;\n clearTimeout(retryTimer);\n retryTimer = null;\n }\n\n function reportBufferedPublicationError(error: unknown): void {\n params.onError?.(\n createSdkSubscriptionErrorContext(params.channel, \"publication_handler\", error),\n );\n }\n\n function applyLivePublications(publications: readonly TPublication[]): void {\n try {\n params.applyLivePublications(publications);\n } catch (error) {\n reportBufferedPublicationError(error);\n }\n }\n\n function applySnapshot(\n snapshot: TSnapshot,\n bufferedPublications: readonly TPublication[],\n ): void {\n try {\n params.applySnapshot(snapshot, bufferedPublications);\n } catch (error) {\n reportBufferedPublicationError(error);\n }\n }\n\n function scheduleSnapshotRetry(error: unknown): void {\n const retry = params.snapshotRetry;\n if (!retry || retryAttempts >= retry.maxAttempts || disposed) return;\n if (error instanceof PolyesterError && !error.retryable) return;\n\n const delayMs = Math.min(\n retry.delayMs * 2 ** retryAttempts,\n retry.maxDelayMs ?? Number.POSITIVE_INFINITY,\n );\n retryAttempts++;\n retryTimer = setTimeout(() => {\n retryTimer = null;\n // realtime.disconnect() drops handlers without onDisconnected; stop once the socket is gone.\n const kind = params.channel.startsWith(\"private:\") ? \"private\" : \"public\";\n if (params.realtime.connection[kind].state === \"disconnected\") return;\n refreshSnapshot(false);\n }, delayMs);\n }\n\n function refreshSnapshot(resetRetries = true): void {\n if (disposed) return;\n clearRetryTimer();\n if (resetRetries) retryAttempts = 0;\n\n const generation = ++refreshGeneration;\n ready = false;\n\n Promise.resolve()\n .then(() => params.fetchSnapshot())\n .then((snapshot) => {\n if (disposed || generation !== refreshGeneration) return;\n\n const buffered = takePendingPublications();\n applySnapshot(snapshot, buffered);\n\n if (disposed || generation !== refreshGeneration) return;\n ready = true;\n retryAttempts = 0;\n })\n .catch((error: unknown) => {\n if (disposed || generation !== refreshGeneration) return;\n reportSnapshotError(error);\n const failureMode =\n typeof params.snapshotFailureMode === \"function\"\n ? params.snapshotFailureMode(error)\n : params.snapshotFailureMode;\n if (failureMode === \"live\") {\n ready = true;\n applyBufferedAsLive();\n }\n scheduleSnapshotRetry(error);\n });\n }\n\n const unsubscribeRealtime = params.realtime.connectProtoChannel({\n channel: params.channel,\n schema: params.schema,\n onPublication: (message) => {\n const publications = params.readPublication(message);\n if (publications.length === 0) return;\n\n if (!ready) {\n bufferPublications(publications);\n return;\n }\n\n applyLivePublications(publications);\n },\n onConnected: () => {\n if (disposed) return;\n pendingPublications = [];\n refreshSnapshot();\n params.onOpen?.();\n },\n onDisconnected: () => {\n if (disposed) return;\n clearRetryTimer();\n refreshGeneration++;\n ready = false;\n pendingPublications = [];\n params.onClose?.();\n },\n onError: params.onError,\n });\n\n function unsubscribe(): void {\n disposed = true;\n clearRetryTimer();\n refreshGeneration++;\n pendingPublications = [];\n try {\n unsubscribeRealtime();\n } catch {\n // noop\n }\n }\n\n return {\n unsubscribe,\n refreshSnapshot,\n isReady: () => ready,\n isDisposed: () => disposed,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;AAiDA,SAAgB,mBACZ,QAC8B;CAC9B,MAAM,0BAA0B,OAAO,2BAA2B;CAClE,IAAI,sBAAsB;CAE1B,IAAI,QAAQ;CACZ,IAAI,WAAW;CACf,IAAI,oBAAoB;CACxB,IAAI,sBAAsC,CAAC;CAC3C,IAAI,gBAAgB;CACpB,IAAI,aAAmD;CAEvD,SAAS,oBAAoB,OAAsB;EAC/C,IAAI,MAAM,KAAK,OAAO,kBAClB,QAAQ,MAAM,OAAO,kBAAkB,KAAK;EAEhD,OAAO,UACH,kCACI,OAAO,SACP,YACA,iBAAiB,QAAQ,QAAQ,mBAAmB,OAAO,iBAAiB,CAChF,CACJ;CACJ;CAEA,SAAS,0BAA0C;EAC/C,MAAM,WAAW;EACjB,sBAAsB,CAAC;EACvB,OAAO;CACX;CAEA,SAAS,sBAA4B;EACjC,MAAM,WAAW,wBAAwB;EACzC,IAAI,SAAS,WAAW,GAAG;EAC3B,sBAAsB,QA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gBAAgB;EAChB;EACA,sBAAsB,CAAC;EACvB,IAAI;GACA,oBAAoB;EACxB,QAAQ,CAER;CACJ;CAEA,OAAO;EACH;EACA;EACA,eAAe;EACf,kBAAkB;CACtB;AACJ"}
|
|
@@ -27,7 +27,7 @@ declare const ListAccountActivityInputSchema: v.SchemaWithPipe<readonly [v.Stric
|
|
|
27
27
|
}, undefined>, v.TransformAction<{
|
|
28
28
|
subaccountIds?: bigint[] | undefined;
|
|
29
29
|
includeMainAccount?: boolean | undefined;
|
|
30
|
-
entityKinds?: ("
|
|
30
|
+
entityKinds?: ("subaccount" | "api_key" | "account" | "session" | "member" | "policy" | "invite" | "security" | "destination")[] | undefined;
|
|
31
31
|
eventActions?: ("disabled" | "revoked" | "removed" | "created" | "updated" | "deleted" | "enabled" | "role_set" | "received" | "replied" | "failed" | "blocked" | "hold_placed" | "hold_released" | "requested" | "applied")[] | undefined;
|
|
32
32
|
sources?: ("web" | "mobile" | "api")[] | undefined;
|
|
33
33
|
apiKeyId?: bigint | undefined;
|
|
@@ -57,7 +57,7 @@ declare const ListAccountActivityResultSchema: v.ObjectSchema<{
|
|
|
57
57
|
seconds: bigint;
|
|
58
58
|
nanos: number;
|
|
59
59
|
} | undefined, number | undefined>]>;
|
|
60
|
-
readonly entityKind: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "
|
|
60
|
+
readonly entityKind: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "subaccount" | "api_key" | "account" | "session" | "member" | "policy" | "invite" | "security" | "destination">]>;
|
|
61
61
|
readonly eventAction: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "disabled" | "revoked" | "removed" | "created" | "updated" | "deleted" | "enabled" | "role_set" | "received" | "replied" | "failed" | "blocked" | "hold_placed" | "hold_released" | "requested" | "applied">]>;
|
|
62
62
|
readonly source: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "web" | "mobile" | "api">]>;
|
|
63
63
|
readonly ip: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
@@ -1077,9 +1077,9 @@ declare function formatApprovalPreview(p: ApprovalRequested["preview"]): {
|
|
|
1077
1077
|
triggerType: "unspecified" | "twap" | "ladder" | "stop_loss" | "take_profit" | "trailing_stop";
|
|
1078
1078
|
side: "unspecified" | "buy" | "sell";
|
|
1079
1079
|
quantity: string;
|
|
1080
|
-
action: "unspecified" | "
|
|
1080
|
+
action: "unspecified" | "pause" | "modify" | "resume";
|
|
1081
1081
|
before: {
|
|
1082
|
-
status: "unspecified" | "created" | "failed" | "
|
|
1082
|
+
status: "unspecified" | "created" | "failed" | "completed" | "canceled" | "paused" | "armed" | "running";
|
|
1083
1083
|
triggerPrice: string | undefined;
|
|
1084
1084
|
trailingDistance: {
|
|
1085
1085
|
kind: "distance";
|
|
@@ -1103,7 +1103,7 @@ declare function formatApprovalPreview(p: ApprovalRequested["preview"]): {
|
|
|
1103
1103
|
limitPrice: string | undefined;
|
|
1104
1104
|
} | undefined;
|
|
1105
1105
|
after: {
|
|
1106
|
-
status: "unspecified" | "created" | "failed" | "
|
|
1106
|
+
status: "unspecified" | "created" | "failed" | "completed" | "canceled" | "paused" | "armed" | "running";
|
|
1107
1107
|
triggerPrice: string | undefined;
|
|
1108
1108
|
trailingDistance: {
|
|
1109
1109
|
kind: "distance";
|
|
@@ -1311,7 +1311,7 @@ declare function formatView(view: View, scales: SdkScales): {
|
|
|
1311
1311
|
attachedRisk: {
|
|
1312
1312
|
takeProfit: {
|
|
1313
1313
|
state: {
|
|
1314
|
-
status: "unspecified" | "created" | "failed" | "
|
|
1314
|
+
status: "unspecified" | "created" | "failed" | "completed" | "canceled" | "paused" | "armed" | "running" | "not_configured";
|
|
1315
1315
|
armedTs: number | undefined;
|
|
1316
1316
|
armedTsNs: string | undefined;
|
|
1317
1317
|
terminalTs: number | undefined;
|
|
@@ -1331,7 +1331,7 @@ declare function formatView(view: View, scales: SdkScales): {
|
|
|
1331
1331
|
} | undefined;
|
|
1332
1332
|
stopLoss: {
|
|
1333
1333
|
state: {
|
|
1334
|
-
status: "unspecified" | "created" | "failed" | "
|
|
1334
|
+
status: "unspecified" | "created" | "failed" | "completed" | "canceled" | "paused" | "armed" | "running" | "not_configured";
|
|
1335
1335
|
armedTs: number | undefined;
|
|
1336
1336
|
armedTsNs: string | undefined;
|
|
1337
1337
|
terminalTs: number | undefined;
|
|
@@ -1351,7 +1351,7 @@ declare function formatView(view: View, scales: SdkScales): {
|
|
|
1351
1351
|
} | undefined;
|
|
1352
1352
|
trailingStop: {
|
|
1353
1353
|
state: {
|
|
1354
|
-
status: "unspecified" | "created" | "failed" | "
|
|
1354
|
+
status: "unspecified" | "created" | "failed" | "completed" | "canceled" | "paused" | "armed" | "running" | "not_configured";
|
|
1355
1355
|
armedTs: number | undefined;
|
|
1356
1356
|
armedTsNs: string | undefined;
|
|
1357
1357
|
terminalTs: number | undefined;
|
|
@@ -1382,7 +1382,7 @@ declare function formatView(view: View, scales: SdkScales): {
|
|
|
1382
1382
|
oco: boolean;
|
|
1383
1383
|
} | undefined;
|
|
1384
1384
|
cancelReason?: "unspecified" | "system" | "user_request" | "ioc_remainder" | "market_remainder" | "stp_expire_maker" | "stp_expire_taker" | "stp_expire_both" | "replaced" | "gtd_expired" | "qty_at_or_below_filled" | "pair_drain" | "attached_risk_refused" | "cancel_all_after" | "account_repair" | "twap_rollover" | "strategy_cancel" | "market_halted" | "attached_exit_fired" | "stp_decrement" | "price_band" | "cancel_on_disconnect" | undefined;
|
|
1385
|
-
rejectReason?: "STALE_QUOTE" | "UNSPECIFIED" | "UNAUTHENTICATED" | "RATE_LIMIT_EXCEEDED" | "INTERNAL_ERROR" | "
|
|
1385
|
+
rejectReason?: "STALE_QUOTE" | "UNSPECIFIED" | "INSUFFICIENT_FUNDS" | "UNAUTHENTICATED" | "PERMISSION_DENIED" | "RATE_LIMIT_EXCEEDED" | "INTERNAL_ERROR" | "NOT_FOUND" | "SUBACCOUNT_INACTIVE" | "BAD_REQUEST" | "INVALID_ARGUMENT" | "UNKNOWN_SYMBOL" | "BAD_PRICE" | "BAD_QTY" | "MIN_NOTIONAL" | "QTY_STEP_SIZE" | "CONFLICT_DUPLICATE_CLIENT_ORDER_ID" | "UNAVAILABLE" | "UPSTREAM_ERROR" | "FEE_ASSET_NOT_ALLOWED" | "PAIR_DISABLED" | "ORDER_UNKNOWN" | "POLICY_MARKET_DENY" | "POLICY_MAX_NOTIONAL" | "POLICY_TRADING_HALTED" | "POLICY_SPOT_TRADE_DENY" | "API_KEY_ROOT_SCOPE_ONLY" | "API_KEY_SUB_SCOPE_ONLY" | "API_KEY_SUBACCOUNT_MISMATCH" | "API_KEY_POLICY_REQUIRED" | "API_KEY_UNKNOWN" | "API_KEY_MARKET_DENY" | "API_KEY_SPOT_TRADE_DENY" | "PRICE_TICK_SIZE" | "MIN_QTY" | "POST_ONLY_LIMIT_ONLY" | "BATCH_TOO_LARGE" | "POLICY_MAX_OPEN_ORDERS" | "MODIFICATION_REQUIRES_REPLACE" | "CONFLICT_IDEMPOTENCY_KEY_REUSE" | "MARKET_PRICE_UNAVAILABLE" | "PAIR_NOT_LISTED_YET" | "PAIR_DELISTED" | "PAIR_CANCEL_ONLY" | "PAIR_POST_ONLY" | "PAIR_REDUCE_ONLY" | "RISK_LIMIT" | "MARKET_HALTED" | "ACCOUNT_UNKNOWN" | "POST_ONLY_CROSS" | "REDUCE_ONLY_BLOCKED" | "PRICE_BAND_VIOLATION" | "MARKET_CAP_VIOLATION" | "EMPTY_BOOK" | "FOK_INSUFFICIENT_LIQUIDITY" | "ORDER_ALREADY_TERMINAL" | "TRIGGER_PRICE_INVALID" | "TRIGGER_PRICE_SOURCE_UNSUPPORTED" | "TRAILING_DISTANCE_INVALID" | "TRIGGER_NOT_FOUND" | "TRIGGER_STATUS_INVALID" | "TRIGGER_NOT_MODIFIABLE" | "CONFLICT_DUPLICATE_CLIENT_TRIGGER_ID" | "MAX_SLIPPAGE_INVALID" | "VALIDATION_ERROR" | "OVERLOADED" | "QUOTE_SIZE_TOO_SMALL" | "SUBACCOUNT_READ_FORBIDDEN" | "POLICY_SPOT_READ_DENY" | "API_KEY_SPOT_READ_DENY" | "CANCEL_REQUEST_EXPIRED" | "MAX_QTY" | "MAX_NOTIONAL" | "QTY_AT_OR_BELOW_FILLED" | "GATEWAY_MISCONFIGURED" | "INVALID_ORDER_ID" | "CHILD_QTY_RAISE_NOT_ALLOWED" | "ATTACHED_RISK_NOT_SUPPORTED" | "SETTLEMENT_BACKLOGGED" | "PRICE_LEVEL_QUANTITY_LIMIT" | "MARKET_QUOTE_STALE" | "MARKET_QUOTE_UNHEALTHY" | "INVALID_TIME_IN_FORCE" | "QUICKSWAP_NOT_PERMITTED" | "DUPLICATE_ORDER_ID" | "MAX_OPEN_ORDERS_TOTAL" | "STP_MODE_NOT_ALLOWED" | "PAIR_BACKLOGGED" | "PRICE_LEVELS_EXHAUSTED" | "CLIENT_ORDER_IDS_EXHAUSTED" | "ORDER_ID_CONFLICT" | "INVALID_SIDE" | "INVALID_ORDER_TYPE" | "INVALID_STP_MODE" | "INVALID_ORDER_FLAGS" | "BATCH_OTHER_ITEM_INVALID" | "REPLACE_ONTO_OWN_ID" | "INVALID_CLIENT_ORDER_ID" | "ORDER_SEQUENCE_EXHAUSTED" | "INVALID_HANDLING_MODE" | "FEE_SCHEDULE_UNAVAILABLE" | "POLICY_UNAVAILABLE" | "CANCEL_ALL_AFTER_TIMEOUT_INVALID" | "CANCEL_SCOPE_TOO_LARGE" | "RATE_LIMIT_POLICY_UNAVAILABLE" | "SYSTEM_RATE_LIMITED" | "ORDER_MODIFY_IN_PROGRESS" | "ORDER_PLACEMENT_PENDING" | "INVALID_MODIFY_BEHAVIOR" | "BATCH_REPLACE_ONLY_REQUIRED" | "BATCH_SINGLE_SYMBOL_REQUIRED" | "REQUEST_RECEIPTS_EXHAUSTED" | "INTENT_ID_INVALID" | "DRY_RUN_INVALID" | "CANCEL_ALL_AFTER_SCOPE_CONFLICT" | "NEW_ACCOUNT_CAPACITY_REACHED" | "TRIGGER_CHILD_PRICE_NOT_MODIFIABLE" | "TRIGGER_GENERATIONS_EXHAUSTED" | "TRIGGER_CONTROL_SHARE_EXHAUSTED" | "TRIGGER_CONTROLS_BUSY" | "TRIGGER_TYPE_NOT_SUPPORTED" | "INVALID_TRIGGER_TYPE" | "TRIGGER_DIRECTION_INVALID" | "TRIGGER_QTY_INVALID" | "TRIGGER_BUY_REQUIRES_LIMIT" | "ACCOUNT_ROUTING_INVALID" | "TRIGGER_LIMIT_EXCEEDED" | "TRIGGER_CONTROL_IN_PROGRESS" | "TRIGGER_PATCH_EMPTY" | "CLIENT_TRIGGER_ID_INVALID" | "TRIGGER_ACTIVATION_PRICE_INVALID" | "SLIPPAGE_TICKS_INVALID" | "SLIPPAGE_BPS_INVALID" | "TRIGGER_CONTROL_OUTCOME_UNKNOWN" | "TRIGGER_CAPACITY_REACHED" | "RESERVATION_CAPACITY_REACHED" | "CLIENT_ORDER_ID_CAPACITY_REACHED" | "ACCOUNT_RESERVATION_LIMIT_REACHED" | "INVALID_TRIGGER_CONTROL" | "TRIGGER_PATCH_NOT_ALLOWED" | "TRIGGER_PATCH_FIELD_UNKNOWN" | "TRIGGER_PATCH_VALUE_UNMASKED" | "TRIGGER_PATCH_PRICE_MODE_INVALID" | "ACCOUNT_ORDERS_SUSPENDED" | "TRAILING_SIDE_NOT_SUPPORTED" | "TRAILING_CHILD_NOT_MARKET" | "TWAP_DURATION_INVALID" | "LIMIT_CHILD_SLIPPAGE_SET" | "SLIPPAGE_BOUNDS_CONFLICT" | "TWAP_INTERVAL_INVALID" | "LADDER_LEVEL_REJECTED" | "LADDER_RANGE_TOO_NARROW" | "LADDER_LEVELS_INVALID" | "ORDER_LIMITS_UNAVAILABLE" | "ORDER_TYPE_NOT_ALLOWED_IN_AUCTION" | "POST_ONLY_NOT_ALLOWED_IN_AUCTION" | "QUICKSWAP_FEE_DETAILS_INCOMPLETE" | "QUICKSWAP_MARKET_NOT_PRICED" | "QUICKSWAP_BROKER_FEE_TERMS_MISMATCH" | "QUICKSWAP_FEE_RECIPIENT_IS_PAYER" | "QUICKSWAP_BROKER_FEE_TERMS_UNAVAILABLE" | "QUICKSWAP_BROKER_ACCOUNT_UNAVAILABLE" | "QUICKSWAP_ACCOUNT_OWNER_UNKNOWN" | "QUICKSWAP_DISABLED" | "QUICKSWAP_ATTACHED_RISK_NOT_ALLOWED" | "QUICKSWAP_ORDER_NOT_MODIFIABLE" | "QUICKSWAP_FEE_TOTAL_TOO_HIGH" | "QUICKSWAP_BROKER_FEE_TERMS_INVALID" | "QUICKSWAP_BROKER_INVALID" | "QUICKSWAP_FEE_SCHEDULE_INVALID" | "QUICKSWAP_MARKET_FEE_INVALID" | "QUICKSWAP_SETUP_INVALID" | "QUICKSWAP_CAPACITY_REACHED" | "ATTACHED_EXIT_WORKING" | "MARKET_TRIGGER_LIMIT_EXCEEDED" | "MARKET_TWAP_LIMIT_EXCEEDED" | "MARKET_LADDER_LIMIT_EXCEEDED" | "CHILD_QTY_EXCEEDS_REMAINING" | "ORDER_CANCEL_OUTCOME_UNKNOWN" | "ORDER_MODIFY_OUTCOME_UNKNOWN" | "ORDER_REPAIRING" | "ACCOUNT_REPAIRING" | "TRIGGER_WOULD_TRIGGER_IMMEDIATELY" | "ORDER_CREATE_OUTCOME_UNKNOWN" | "TRIGGER_CREATE_OUTCOME_UNKNOWN" | "TRIGGER_SYMBOL_MISMATCH" | "MAX_OPEN_ORDERS_PER_PAIR" | "SELF_TRADE_PREVENTED" | "ATTACHED_LEGS_EXCEEDED" | "FEE_ASSET_INVALID" | "FEE_CEILING_INVALID" | "UNSUPPORTED_FIELD_SET" | "TRIGGER_FIRE_LIMIT_REACHED" | "CONDITION_FLAGS_INVALID" | "CONDITION_PARAMETER_SET" | "TWAP_CAPACITY_REACHED" | "CHILD_ORDER_INCONSISTENT" | "PATH_BODY_ID_MISMATCH" | "REQUEST_DEADLINE_EXCEEDED" | "ICEBERG_NOT_ALLOWED" | "ICEBERG_DISPLAY_TOO_SMALL" | "ICEBERG_DISPLAY_INVALID" | "PEG_LIMIT_VIOLATION" | "PEG_REFERENCE_UNAVAILABLE" | "INVALID_PEG" | "TRIGGER_ACTIVATION_PRICE_NOT_MODIFIABLE" | "CLIENT_LIST_ID_INVALID" | undefined;
|
|
1386
1386
|
price: string;
|
|
1387
1387
|
createdTs: number;
|
|
1388
1388
|
terminalTs: number;
|
|
@@ -1397,7 +1397,7 @@ declare function formatView(view: View, scales: SdkScales): {
|
|
|
1397
1397
|
hiddenQty?: string | undefined;
|
|
1398
1398
|
symbolId: number;
|
|
1399
1399
|
clientOrderId: string;
|
|
1400
|
-
status: "unspecified" | "
|
|
1400
|
+
status: "unspecified" | "pending" | "canceled" | "rejected" | "pending_cancel" | "working" | "filled" | "partial";
|
|
1401
1401
|
side: "unspecified" | "buy" | "sell";
|
|
1402
1402
|
orderType: "unspecified" | "limit" | "market";
|
|
1403
1403
|
timeInForce: "unspecified" | "gtc" | "ioc" | "fok" | "gtd";
|
|
@@ -1441,7 +1441,7 @@ declare function formatView(view: View, scales: SdkScales): {
|
|
|
1441
1441
|
triggerId: string;
|
|
1442
1442
|
subaccountId: string;
|
|
1443
1443
|
symbolId: number;
|
|
1444
|
-
status: "unspecified" | "created" | "failed" | "
|
|
1444
|
+
status: "unspecified" | "created" | "failed" | "completed" | "canceled" | "paused" | "armed" | "running";
|
|
1445
1445
|
parentOrderId: string | undefined;
|
|
1446
1446
|
orderListId: string | undefined;
|
|
1447
1447
|
qty: string;
|
|
@@ -1627,7 +1627,7 @@ declare function formatView(view: View, scales: SdkScales): {
|
|
|
1627
1627
|
triggerId: string;
|
|
1628
1628
|
subaccountId: string;
|
|
1629
1629
|
symbolId: number;
|
|
1630
|
-
status: "unspecified" | "created" | "failed" | "
|
|
1630
|
+
status: "unspecified" | "created" | "failed" | "completed" | "canceled" | "paused" | "armed" | "running";
|
|
1631
1631
|
parentOrderId: string | undefined;
|
|
1632
1632
|
orderListId: string | undefined;
|
|
1633
1633
|
qty: string;
|
|
@@ -1813,7 +1813,7 @@ declare function formatView(view: View, scales: SdkScales): {
|
|
|
1813
1813
|
triggerId: string;
|
|
1814
1814
|
subaccountId: string;
|
|
1815
1815
|
symbolId: number;
|
|
1816
|
-
status: "unspecified" | "created" | "failed" | "
|
|
1816
|
+
status: "unspecified" | "created" | "failed" | "completed" | "canceled" | "paused" | "armed" | "running";
|
|
1817
1817
|
parentOrderId: string | undefined;
|
|
1818
1818
|
orderListId: string | undefined;
|
|
1819
1819
|
qty: string;
|
|
@@ -2037,10 +2037,10 @@ declare function formatView(view: View, scales: SdkScales): {
|
|
|
2037
2037
|
} | {
|
|
2038
2038
|
type: "price_chart";
|
|
2039
2039
|
symbolId: number;
|
|
2040
|
-
timeframe: "unspecified" | "1s" | "1m" | "3m" | "5m" | "15m" | "30m" | "1h" | "2h" | "4h" | "6h" | "8h" | "12h" | "
|
|
2040
|
+
timeframe: "unspecified" | "1d" | "1s" | "1m" | "3m" | "5m" | "15m" | "30m" | "1h" | "2h" | "4h" | "6h" | "8h" | "12h" | "3d" | "1w" | "1mo";
|
|
2041
2041
|
candles: {
|
|
2042
2042
|
symbolId: number;
|
|
2043
|
-
timeframe: DecodedEnum<"1s" | "1m" | "3m" | "5m" | "15m" | "30m" | "1h" | "2h" | "4h" | "6h" | "8h" | "12h" | "
|
|
2043
|
+
timeframe: DecodedEnum<"1d" | "1s" | "1m" | "3m" | "5m" | "15m" | "30m" | "1h" | "2h" | "4h" | "6h" | "8h" | "12h" | "3d" | "1w" | "1mo">;
|
|
2044
2044
|
time: number;
|
|
2045
2045
|
open: string;
|
|
2046
2046
|
high: string;
|
|
@@ -3353,9 +3353,9 @@ declare function formatRunEvent(event: RunEvent, scales: SdkScales): {
|
|
|
3353
3353
|
triggerType: "unspecified" | "twap" | "ladder" | "stop_loss" | "take_profit" | "trailing_stop";
|
|
3354
3354
|
side: "unspecified" | "buy" | "sell";
|
|
3355
3355
|
quantity: string;
|
|
3356
|
-
action: "unspecified" | "
|
|
3356
|
+
action: "unspecified" | "pause" | "modify" | "resume";
|
|
3357
3357
|
before: {
|
|
3358
|
-
status: "unspecified" | "created" | "failed" | "
|
|
3358
|
+
status: "unspecified" | "created" | "failed" | "completed" | "canceled" | "paused" | "armed" | "running";
|
|
3359
3359
|
triggerPrice: string | undefined;
|
|
3360
3360
|
trailingDistance: {
|
|
3361
3361
|
kind: "distance";
|
|
@@ -3379,7 +3379,7 @@ declare function formatRunEvent(event: RunEvent, scales: SdkScales): {
|
|
|
3379
3379
|
limitPrice: string | undefined;
|
|
3380
3380
|
} | undefined;
|
|
3381
3381
|
after: {
|
|
3382
|
-
status: "unspecified" | "created" | "failed" | "
|
|
3382
|
+
status: "unspecified" | "created" | "failed" | "completed" | "canceled" | "paused" | "armed" | "running";
|
|
3383
3383
|
triggerPrice: string | undefined;
|
|
3384
3384
|
trailingDistance: {
|
|
3385
3385
|
kind: "distance";
|
|
@@ -3589,7 +3589,7 @@ declare function formatRunEvent(event: RunEvent, scales: SdkScales): {
|
|
|
3589
3589
|
} | {
|
|
3590
3590
|
type: "approval_resolved";
|
|
3591
3591
|
approvalId: string;
|
|
3592
|
-
status: "unspecified" | "
|
|
3592
|
+
status: "unspecified" | "pending" | "expired" | "rejected" | "approved";
|
|
3593
3593
|
text?: undefined;
|
|
3594
3594
|
fromSeq?: undefined;
|
|
3595
3595
|
toolCallId?: undefined;
|
|
@@ -3638,7 +3638,7 @@ declare function formatRunEvent(event: RunEvent, scales: SdkScales): {
|
|
|
3638
3638
|
attachedRisk: {
|
|
3639
3639
|
takeProfit: {
|
|
3640
3640
|
state: {
|
|
3641
|
-
status: "unspecified" | "created" | "failed" | "
|
|
3641
|
+
status: "unspecified" | "created" | "failed" | "completed" | "canceled" | "paused" | "armed" | "running" | "not_configured";
|
|
3642
3642
|
armedTs: number | undefined;
|
|
3643
3643
|
armedTsNs: string | undefined;
|
|
3644
3644
|
terminalTs: number | undefined;
|
|
@@ -3658,7 +3658,7 @@ declare function formatRunEvent(event: RunEvent, scales: SdkScales): {
|
|
|
3658
3658
|
} | undefined;
|
|
3659
3659
|
stopLoss: {
|
|
3660
3660
|
state: {
|
|
3661
|
-
status: "unspecified" | "created" | "failed" | "
|
|
3661
|
+
status: "unspecified" | "created" | "failed" | "completed" | "canceled" | "paused" | "armed" | "running" | "not_configured";
|
|
3662
3662
|
armedTs: number | undefined;
|
|
3663
3663
|
armedTsNs: string | undefined;
|
|
3664
3664
|
terminalTs: number | undefined;
|
|
@@ -3678,7 +3678,7 @@ declare function formatRunEvent(event: RunEvent, scales: SdkScales): {
|
|
|
3678
3678
|
} | undefined;
|
|
3679
3679
|
trailingStop: {
|
|
3680
3680
|
state: {
|
|
3681
|
-
status: "unspecified" | "created" | "failed" | "
|
|
3681
|
+
status: "unspecified" | "created" | "failed" | "completed" | "canceled" | "paused" | "armed" | "running" | "not_configured";
|
|
3682
3682
|
armedTs: number | undefined;
|
|
3683
3683
|
armedTsNs: string | undefined;
|
|
3684
3684
|
terminalTs: number | undefined;
|
|
@@ -3709,7 +3709,7 @@ declare function formatRunEvent(event: RunEvent, scales: SdkScales): {
|
|
|
3709
3709
|
oco: boolean;
|
|
3710
3710
|
} | undefined;
|
|
3711
3711
|
cancelReason?: "unspecified" | "system" | "user_request" | "ioc_remainder" | "market_remainder" | "stp_expire_maker" | "stp_expire_taker" | "stp_expire_both" | "replaced" | "gtd_expired" | "qty_at_or_below_filled" | "pair_drain" | "attached_risk_refused" | "cancel_all_after" | "account_repair" | "twap_rollover" | "strategy_cancel" | "market_halted" | "attached_exit_fired" | "stp_decrement" | "price_band" | "cancel_on_disconnect" | undefined;
|
|
3712
|
-
rejectReason?: "STALE_QUOTE" | "UNSPECIFIED" | "UNAUTHENTICATED" | "RATE_LIMIT_EXCEEDED" | "INTERNAL_ERROR" | "
|
|
3712
|
+
rejectReason?: "STALE_QUOTE" | "UNSPECIFIED" | "INSUFFICIENT_FUNDS" | "UNAUTHENTICATED" | "PERMISSION_DENIED" | "RATE_LIMIT_EXCEEDED" | "INTERNAL_ERROR" | "NOT_FOUND" | "SUBACCOUNT_INACTIVE" | "BAD_REQUEST" | "INVALID_ARGUMENT" | "UNKNOWN_SYMBOL" | "BAD_PRICE" | "BAD_QTY" | "MIN_NOTIONAL" | "QTY_STEP_SIZE" | "CONFLICT_DUPLICATE_CLIENT_ORDER_ID" | "UNAVAILABLE" | "UPSTREAM_ERROR" | "FEE_ASSET_NOT_ALLOWED" | "PAIR_DISABLED" | "ORDER_UNKNOWN" | "POLICY_MARKET_DENY" | "POLICY_MAX_NOTIONAL" | "POLICY_TRADING_HALTED" | "POLICY_SPOT_TRADE_DENY" | "API_KEY_ROOT_SCOPE_ONLY" | "API_KEY_SUB_SCOPE_ONLY" | "API_KEY_SUBACCOUNT_MISMATCH" | "API_KEY_POLICY_REQUIRED" | "API_KEY_UNKNOWN" | "API_KEY_MARKET_DENY" | "API_KEY_SPOT_TRADE_DENY" | "PRICE_TICK_SIZE" | "MIN_QTY" | "POST_ONLY_LIMIT_ONLY" | "BATCH_TOO_LARGE" | "POLICY_MAX_OPEN_ORDERS" | "MODIFICATION_REQUIRES_REPLACE" | "CONFLICT_IDEMPOTENCY_KEY_REUSE" | "MARKET_PRICE_UNAVAILABLE" | "PAIR_NOT_LISTED_YET" | "PAIR_DELISTED" | "PAIR_CANCEL_ONLY" | "PAIR_POST_ONLY" | "PAIR_REDUCE_ONLY" | "RISK_LIMIT" | "MARKET_HALTED" | "ACCOUNT_UNKNOWN" | "POST_ONLY_CROSS" | "REDUCE_ONLY_BLOCKED" | "PRICE_BAND_VIOLATION" | "MARKET_CAP_VIOLATION" | "EMPTY_BOOK" | "FOK_INSUFFICIENT_LIQUIDITY" | "ORDER_ALREADY_TERMINAL" | "TRIGGER_PRICE_INVALID" | "TRIGGER_PRICE_SOURCE_UNSUPPORTED" | "TRAILING_DISTANCE_INVALID" | "TRIGGER_NOT_FOUND" | "TRIGGER_STATUS_INVALID" | "TRIGGER_NOT_MODIFIABLE" | "CONFLICT_DUPLICATE_CLIENT_TRIGGER_ID" | "MAX_SLIPPAGE_INVALID" | "VALIDATION_ERROR" | "OVERLOADED" | "QUOTE_SIZE_TOO_SMALL" | "SUBACCOUNT_READ_FORBIDDEN" | "POLICY_SPOT_READ_DENY" | "API_KEY_SPOT_READ_DENY" | "CANCEL_REQUEST_EXPIRED" | "MAX_QTY" | "MAX_NOTIONAL" | "QTY_AT_OR_BELOW_FILLED" | "GATEWAY_MISCONFIGURED" | "INVALID_ORDER_ID" | "CHILD_QTY_RAISE_NOT_ALLOWED" | "ATTACHED_RISK_NOT_SUPPORTED" | "SETTLEMENT_BACKLOGGED" | "PRICE_LEVEL_QUANTITY_LIMIT" | "MARKET_QUOTE_STALE" | "MARKET_QUOTE_UNHEALTHY" | "INVALID_TIME_IN_FORCE" | "QUICKSWAP_NOT_PERMITTED" | "DUPLICATE_ORDER_ID" | "MAX_OPEN_ORDERS_TOTAL" | "STP_MODE_NOT_ALLOWED" | "PAIR_BACKLOGGED" | "PRICE_LEVELS_EXHAUSTED" | "CLIENT_ORDER_IDS_EXHAUSTED" | "ORDER_ID_CONFLICT" | "INVALID_SIDE" | "INVALID_ORDER_TYPE" | "INVALID_STP_MODE" | "INVALID_ORDER_FLAGS" | "BATCH_OTHER_ITEM_INVALID" | "REPLACE_ONTO_OWN_ID" | "INVALID_CLIENT_ORDER_ID" | "ORDER_SEQUENCE_EXHAUSTED" | "INVALID_HANDLING_MODE" | "FEE_SCHEDULE_UNAVAILABLE" | "POLICY_UNAVAILABLE" | "CANCEL_ALL_AFTER_TIMEOUT_INVALID" | "CANCEL_SCOPE_TOO_LARGE" | "RATE_LIMIT_POLICY_UNAVAILABLE" | "SYSTEM_RATE_LIMITED" | "ORDER_MODIFY_IN_PROGRESS" | "ORDER_PLACEMENT_PENDING" | "INVALID_MODIFY_BEHAVIOR" | "BATCH_REPLACE_ONLY_REQUIRED" | "BATCH_SINGLE_SYMBOL_REQUIRED" | "REQUEST_RECEIPTS_EXHAUSTED" | "INTENT_ID_INVALID" | "DRY_RUN_INVALID" | "CANCEL_ALL_AFTER_SCOPE_CONFLICT" | "NEW_ACCOUNT_CAPACITY_REACHED" | "TRIGGER_CHILD_PRICE_NOT_MODIFIABLE" | "TRIGGER_GENERATIONS_EXHAUSTED" | "TRIGGER_CONTROL_SHARE_EXHAUSTED" | "TRIGGER_CONTROLS_BUSY" | "TRIGGER_TYPE_NOT_SUPPORTED" | "INVALID_TRIGGER_TYPE" | "TRIGGER_DIRECTION_INVALID" | "TRIGGER_QTY_INVALID" | "TRIGGER_BUY_REQUIRES_LIMIT" | "ACCOUNT_ROUTING_INVALID" | "TRIGGER_LIMIT_EXCEEDED" | "TRIGGER_CONTROL_IN_PROGRESS" | "TRIGGER_PATCH_EMPTY" | "CLIENT_TRIGGER_ID_INVALID" | "TRIGGER_ACTIVATION_PRICE_INVALID" | "SLIPPAGE_TICKS_INVALID" | "SLIPPAGE_BPS_INVALID" | "TRIGGER_CONTROL_OUTCOME_UNKNOWN" | "TRIGGER_CAPACITY_REACHED" | "RESERVATION_CAPACITY_REACHED" | "CLIENT_ORDER_ID_CAPACITY_REACHED" | "ACCOUNT_RESERVATION_LIMIT_REACHED" | "INVALID_TRIGGER_CONTROL" | "TRIGGER_PATCH_NOT_ALLOWED" | "TRIGGER_PATCH_FIELD_UNKNOWN" | "TRIGGER_PATCH_VALUE_UNMASKED" | "TRIGGER_PATCH_PRICE_MODE_INVALID" | "ACCOUNT_ORDERS_SUSPENDED" | "TRAILING_SIDE_NOT_SUPPORTED" | "TRAILING_CHILD_NOT_MARKET" | "TWAP_DURATION_INVALID" | "LIMIT_CHILD_SLIPPAGE_SET" | "SLIPPAGE_BOUNDS_CONFLICT" | "TWAP_INTERVAL_INVALID" | "LADDER_LEVEL_REJECTED" | "LADDER_RANGE_TOO_NARROW" | "LADDER_LEVELS_INVALID" | "ORDER_LIMITS_UNAVAILABLE" | "ORDER_TYPE_NOT_ALLOWED_IN_AUCTION" | "POST_ONLY_NOT_ALLOWED_IN_AUCTION" | "QUICKSWAP_FEE_DETAILS_INCOMPLETE" | "QUICKSWAP_MARKET_NOT_PRICED" | "QUICKSWAP_BROKER_FEE_TERMS_MISMATCH" | "QUICKSWAP_FEE_RECIPIENT_IS_PAYER" | "QUICKSWAP_BROKER_FEE_TERMS_UNAVAILABLE" | "QUICKSWAP_BROKER_ACCOUNT_UNAVAILABLE" | "QUICKSWAP_ACCOUNT_OWNER_UNKNOWN" | "QUICKSWAP_DISABLED" | "QUICKSWAP_ATTACHED_RISK_NOT_ALLOWED" | "QUICKSWAP_ORDER_NOT_MODIFIABLE" | "QUICKSWAP_FEE_TOTAL_TOO_HIGH" | "QUICKSWAP_BROKER_FEE_TERMS_INVALID" | "QUICKSWAP_BROKER_INVALID" | "QUICKSWAP_FEE_SCHEDULE_INVALID" | "QUICKSWAP_MARKET_FEE_INVALID" | "QUICKSWAP_SETUP_INVALID" | "QUICKSWAP_CAPACITY_REACHED" | "ATTACHED_EXIT_WORKING" | "MARKET_TRIGGER_LIMIT_EXCEEDED" | "MARKET_TWAP_LIMIT_EXCEEDED" | "MARKET_LADDER_LIMIT_EXCEEDED" | "CHILD_QTY_EXCEEDS_REMAINING" | "ORDER_CANCEL_OUTCOME_UNKNOWN" | "ORDER_MODIFY_OUTCOME_UNKNOWN" | "ORDER_REPAIRING" | "ACCOUNT_REPAIRING" | "TRIGGER_WOULD_TRIGGER_IMMEDIATELY" | "ORDER_CREATE_OUTCOME_UNKNOWN" | "TRIGGER_CREATE_OUTCOME_UNKNOWN" | "TRIGGER_SYMBOL_MISMATCH" | "MAX_OPEN_ORDERS_PER_PAIR" | "SELF_TRADE_PREVENTED" | "ATTACHED_LEGS_EXCEEDED" | "FEE_ASSET_INVALID" | "FEE_CEILING_INVALID" | "UNSUPPORTED_FIELD_SET" | "TRIGGER_FIRE_LIMIT_REACHED" | "CONDITION_FLAGS_INVALID" | "CONDITION_PARAMETER_SET" | "TWAP_CAPACITY_REACHED" | "CHILD_ORDER_INCONSISTENT" | "PATH_BODY_ID_MISMATCH" | "REQUEST_DEADLINE_EXCEEDED" | "ICEBERG_NOT_ALLOWED" | "ICEBERG_DISPLAY_TOO_SMALL" | "ICEBERG_DISPLAY_INVALID" | "PEG_LIMIT_VIOLATION" | "PEG_REFERENCE_UNAVAILABLE" | "INVALID_PEG" | "TRIGGER_ACTIVATION_PRICE_NOT_MODIFIABLE" | "CLIENT_LIST_ID_INVALID" | undefined;
|
|
3713
3713
|
price: string;
|
|
3714
3714
|
createdTs: number;
|
|
3715
3715
|
terminalTs: number;
|
|
@@ -3724,7 +3724,7 @@ declare function formatRunEvent(event: RunEvent, scales: SdkScales): {
|
|
|
3724
3724
|
hiddenQty?: string | undefined;
|
|
3725
3725
|
symbolId: number;
|
|
3726
3726
|
clientOrderId: string;
|
|
3727
|
-
status: "unspecified" | "
|
|
3727
|
+
status: "unspecified" | "pending" | "canceled" | "rejected" | "pending_cancel" | "working" | "filled" | "partial";
|
|
3728
3728
|
side: "unspecified" | "buy" | "sell";
|
|
3729
3729
|
orderType: "unspecified" | "limit" | "market";
|
|
3730
3730
|
timeInForce: "unspecified" | "gtc" | "ioc" | "fok" | "gtd";
|
|
@@ -3768,7 +3768,7 @@ declare function formatRunEvent(event: RunEvent, scales: SdkScales): {
|
|
|
3768
3768
|
triggerId: string;
|
|
3769
3769
|
subaccountId: string;
|
|
3770
3770
|
symbolId: number;
|
|
3771
|
-
status: "unspecified" | "created" | "failed" | "
|
|
3771
|
+
status: "unspecified" | "created" | "failed" | "completed" | "canceled" | "paused" | "armed" | "running";
|
|
3772
3772
|
parentOrderId: string | undefined;
|
|
3773
3773
|
orderListId: string | undefined;
|
|
3774
3774
|
qty: string;
|
|
@@ -3954,7 +3954,7 @@ declare function formatRunEvent(event: RunEvent, scales: SdkScales): {
|
|
|
3954
3954
|
triggerId: string;
|
|
3955
3955
|
subaccountId: string;
|
|
3956
3956
|
symbolId: number;
|
|
3957
|
-
status: "unspecified" | "created" | "failed" | "
|
|
3957
|
+
status: "unspecified" | "created" | "failed" | "completed" | "canceled" | "paused" | "armed" | "running";
|
|
3958
3958
|
parentOrderId: string | undefined;
|
|
3959
3959
|
orderListId: string | undefined;
|
|
3960
3960
|
qty: string;
|
|
@@ -4140,7 +4140,7 @@ declare function formatRunEvent(event: RunEvent, scales: SdkScales): {
|
|
|
4140
4140
|
triggerId: string;
|
|
4141
4141
|
subaccountId: string;
|
|
4142
4142
|
symbolId: number;
|
|
4143
|
-
status: "unspecified" | "created" | "failed" | "
|
|
4143
|
+
status: "unspecified" | "created" | "failed" | "completed" | "canceled" | "paused" | "armed" | "running";
|
|
4144
4144
|
parentOrderId: string | undefined;
|
|
4145
4145
|
orderListId: string | undefined;
|
|
4146
4146
|
qty: string;
|
|
@@ -4364,10 +4364,10 @@ declare function formatRunEvent(event: RunEvent, scales: SdkScales): {
|
|
|
4364
4364
|
} | {
|
|
4365
4365
|
type: "price_chart";
|
|
4366
4366
|
symbolId: number;
|
|
4367
|
-
timeframe: "unspecified" | "1s" | "1m" | "3m" | "5m" | "15m" | "30m" | "1h" | "2h" | "4h" | "6h" | "8h" | "12h" | "
|
|
4367
|
+
timeframe: "unspecified" | "1d" | "1s" | "1m" | "3m" | "5m" | "15m" | "30m" | "1h" | "2h" | "4h" | "6h" | "8h" | "12h" | "3d" | "1w" | "1mo";
|
|
4368
4368
|
candles: {
|
|
4369
4369
|
symbolId: number;
|
|
4370
|
-
timeframe: DecodedEnum<"1s" | "1m" | "3m" | "5m" | "15m" | "30m" | "1h" | "2h" | "4h" | "6h" | "8h" | "12h" | "
|
|
4370
|
+
timeframe: DecodedEnum<"1d" | "1s" | "1m" | "3m" | "5m" | "15m" | "30m" | "1h" | "2h" | "4h" | "6h" | "8h" | "12h" | "3d" | "1w" | "1mo">;
|
|
4371
4371
|
time: number;
|
|
4372
4372
|
open: string;
|
|
4373
4373
|
high: string;
|
|
@@ -302,7 +302,7 @@ declare function formatModelKey(k: ModelKey | undefined): {
|
|
|
302
302
|
suffix: string;
|
|
303
303
|
addedAt: number | undefined;
|
|
304
304
|
/** The last check with OpenAI: on save, when OpenAI refused it in a run, and on recovery. */
|
|
305
|
-
lastCheck: "unspecified" | "
|
|
305
|
+
lastCheck: "unspecified" | "rejected" | "valid" | "no_quota" | "model_unavailable";
|
|
306
306
|
checkedAt: number | undefined;
|
|
307
307
|
};
|
|
308
308
|
type AssistantModelKey = ReturnType<typeof formatModelKey>;
|
|
@@ -925,7 +925,7 @@ declare const AutoWithdrawPreviewAssetSchema: v.SchemaWithPipe<readonly [v.Objec
|
|
|
925
925
|
*/
|
|
926
926
|
type AutoWithdrawPreviewAsset = v.InferOutput<typeof AutoWithdrawPreviewAssetSchema>;
|
|
927
927
|
declare const AutoWithdrawPreviewSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
928
|
-
readonly status: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "
|
|
928
|
+
readonly status: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "will_pay" | "rolls_over" | "no_destination" | "paused" | "no_rule">]>;
|
|
929
929
|
readonly nextRunAt: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ObjectSchema<{
|
|
930
930
|
readonly seconds: v.BigintSchema<undefined>;
|
|
931
931
|
readonly nanos: v.OptionalSchema<v.NumberSchema<undefined>, 0>;
|
|
@@ -1054,7 +1054,7 @@ declare const AutoWithdrawPreviewSchema: v.SchemaWithPipe<readonly [v.ObjectSche
|
|
|
1054
1054
|
nanos: number;
|
|
1055
1055
|
}, number>]>;
|
|
1056
1056
|
}, undefined>, v.TransformAction<{
|
|
1057
|
-
status: "unspecified" | "
|
|
1057
|
+
status: "unspecified" | "will_pay" | "rolls_over" | "no_destination" | "paused" | "no_rule";
|
|
1058
1058
|
nextRunAt?: number | undefined;
|
|
1059
1059
|
ruleVersion: number;
|
|
1060
1060
|
pause?: {
|
|
@@ -1090,7 +1090,7 @@ declare const AutoWithdrawPreviewSchema: v.SchemaWithPipe<readonly [v.ObjectSche
|
|
|
1090
1090
|
pausedAt: number;
|
|
1091
1091
|
} | null;
|
|
1092
1092
|
minUsdValue: string | null;
|
|
1093
|
-
status: "unspecified" | "
|
|
1093
|
+
status: "unspecified" | "will_pay" | "rolls_over" | "no_destination" | "paused" | "no_rule";
|
|
1094
1094
|
ruleVersion: number;
|
|
1095
1095
|
assets: {
|
|
1096
1096
|
assetId: number;
|
|
@@ -11,7 +11,7 @@ type TimestampInit = {
|
|
|
11
11
|
};
|
|
12
12
|
declare function createCandleRowSchema(scales: SdkScales): v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
13
13
|
readonly symbolId: v.NumberSchema<undefined>;
|
|
14
|
-
readonly timeframe: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, DecodedEnum<"1s" | "1m" | "3m" | "5m" | "15m" | "30m" | "1h" | "2h" | "4h" | "6h" | "8h" | "12h" | "
|
|
14
|
+
readonly timeframe: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, DecodedEnum<"1d" | "1s" | "1m" | "3m" | "5m" | "15m" | "30m" | "1h" | "2h" | "4h" | "6h" | "8h" | "12h" | "3d" | "1w" | "1mo">>]>;
|
|
15
15
|
readonly tsSec: v.BigintSchema<undefined>;
|
|
16
16
|
readonly open: v.BigintSchema<undefined>;
|
|
17
17
|
readonly high: v.BigintSchema<undefined>;
|
|
@@ -22,7 +22,7 @@ declare function createCandleRowSchema(scales: SdkScales): v.SchemaWithPipe<read
|
|
|
22
22
|
readonly isClosed: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
23
23
|
}, undefined>, v.TransformAction<{
|
|
24
24
|
symbolId: number;
|
|
25
|
-
timeframe: DecodedEnum<"1s" | "1m" | "3m" | "5m" | "15m" | "30m" | "1h" | "2h" | "4h" | "6h" | "8h" | "12h" | "
|
|
25
|
+
timeframe: DecodedEnum<"1d" | "1s" | "1m" | "3m" | "5m" | "15m" | "30m" | "1h" | "2h" | "4h" | "6h" | "8h" | "12h" | "3d" | "1w" | "1mo">;
|
|
26
26
|
tsSec: bigint;
|
|
27
27
|
open: bigint;
|
|
28
28
|
high: bigint;
|
|
@@ -33,7 +33,7 @@ declare function createCandleRowSchema(scales: SdkScales): v.SchemaWithPipe<read
|
|
|
33
33
|
isClosed: boolean;
|
|
34
34
|
}, {
|
|
35
35
|
symbolId: number;
|
|
36
|
-
timeframe: DecodedEnum<"1s" | "1m" | "3m" | "5m" | "15m" | "30m" | "1h" | "2h" | "4h" | "6h" | "8h" | "12h" | "
|
|
36
|
+
timeframe: DecodedEnum<"1d" | "1s" | "1m" | "3m" | "5m" | "15m" | "30m" | "1h" | "2h" | "4h" | "6h" | "8h" | "12h" | "3d" | "1w" | "1mo">;
|
|
37
37
|
time: number;
|
|
38
38
|
open: string;
|
|
39
39
|
high: string;
|
|
@@ -46,7 +46,7 @@ declare function createCandleRowSchema(scales: SdkScales): v.SchemaWithPipe<read
|
|
|
46
46
|
declare const createCandleRowIntSchema: typeof createCandleRowSchema;
|
|
47
47
|
declare function createCandleColumnarSchema(scales: SdkScales): v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
48
48
|
readonly symbolId: v.NumberSchema<undefined>;
|
|
49
|
-
readonly timeframe: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, DecodedEnum<"1s" | "1m" | "3m" | "5m" | "15m" | "30m" | "1h" | "2h" | "4h" | "6h" | "8h" | "12h" | "
|
|
49
|
+
readonly timeframe: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, DecodedEnum<"1d" | "1s" | "1m" | "3m" | "5m" | "15m" | "30m" | "1h" | "2h" | "4h" | "6h" | "8h" | "12h" | "3d" | "1w" | "1mo">>]>;
|
|
50
50
|
readonly tsSec: v.ArraySchema<v.BigintSchema<undefined>, undefined>;
|
|
51
51
|
readonly open: v.ArraySchema<v.BigintSchema<undefined>, undefined>;
|
|
52
52
|
readonly high: v.ArraySchema<v.BigintSchema<undefined>, undefined>;
|
|
@@ -63,7 +63,7 @@ declare function createCandleColumnarSchema(scales: SdkScales): v.SchemaWithPipe
|
|
|
63
63
|
readonly nextPageToken: v.OptionalSchema<v.StringSchema<undefined>, "">;
|
|
64
64
|
}, undefined>, v.TransformAction<{
|
|
65
65
|
symbolId: number;
|
|
66
|
-
timeframe: DecodedEnum<"1s" | "1m" | "3m" | "5m" | "15m" | "30m" | "1h" | "2h" | "4h" | "6h" | "8h" | "12h" | "
|
|
66
|
+
timeframe: DecodedEnum<"1d" | "1s" | "1m" | "3m" | "5m" | "15m" | "30m" | "1h" | "2h" | "4h" | "6h" | "8h" | "12h" | "3d" | "1w" | "1mo">;
|
|
67
67
|
tsSec: bigint[];
|
|
68
68
|
open: bigint[];
|
|
69
69
|
high: bigint[];
|
|
@@ -80,7 +80,7 @@ declare function createCandleColumnarSchema(scales: SdkScales): v.SchemaWithPipe
|
|
|
80
80
|
nextPageToken: string;
|
|
81
81
|
}, {
|
|
82
82
|
symbolId: number;
|
|
83
|
-
timeframe: DecodedEnum<"1s" | "1m" | "3m" | "5m" | "15m" | "30m" | "1h" | "2h" | "4h" | "6h" | "8h" | "12h" | "
|
|
83
|
+
timeframe: DecodedEnum<"1d" | "1s" | "1m" | "3m" | "5m" | "15m" | "30m" | "1h" | "2h" | "4h" | "6h" | "8h" | "12h" | "3d" | "1w" | "1mo">;
|
|
84
84
|
time: number[];
|
|
85
85
|
open: string[];
|
|
86
86
|
high: string[];
|
|
@@ -100,7 +100,7 @@ declare function createCandleColumnarSchema(scales: SdkScales): v.SchemaWithPipe
|
|
|
100
100
|
}>]>;
|
|
101
101
|
declare function createCandleColumnarIntSchema(scales: SdkScales): v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
102
102
|
readonly symbolId: v.NumberSchema<undefined>;
|
|
103
|
-
readonly timeframe: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, DecodedEnum<"1s" | "1m" | "3m" | "5m" | "15m" | "30m" | "1h" | "2h" | "4h" | "6h" | "8h" | "12h" | "
|
|
103
|
+
readonly timeframe: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, DecodedEnum<"1d" | "1s" | "1m" | "3m" | "5m" | "15m" | "30m" | "1h" | "2h" | "4h" | "6h" | "8h" | "12h" | "3d" | "1w" | "1mo">>]>;
|
|
104
104
|
readonly tsSec: v.ArraySchema<v.BigintSchema<undefined>, undefined>;
|
|
105
105
|
readonly open: v.ArraySchema<v.BigintSchema<undefined>, undefined>;
|
|
106
106
|
readonly high: v.ArraySchema<v.BigintSchema<undefined>, undefined>;
|
|
@@ -117,7 +117,7 @@ declare function createCandleColumnarIntSchema(scales: SdkScales): v.SchemaWithP
|
|
|
117
117
|
readonly nextPageToken: v.OptionalSchema<v.StringSchema<undefined>, "">;
|
|
118
118
|
}, undefined>, v.TransformAction<{
|
|
119
119
|
symbolId: number;
|
|
120
|
-
timeframe: DecodedEnum<"1s" | "1m" | "3m" | "5m" | "15m" | "30m" | "1h" | "2h" | "4h" | "6h" | "8h" | "12h" | "
|
|
120
|
+
timeframe: DecodedEnum<"1d" | "1s" | "1m" | "3m" | "5m" | "15m" | "30m" | "1h" | "2h" | "4h" | "6h" | "8h" | "12h" | "3d" | "1w" | "1mo">;
|
|
121
121
|
tsSec: bigint[];
|
|
122
122
|
open: bigint[];
|
|
123
123
|
high: bigint[];
|
|
@@ -134,7 +134,7 @@ declare function createCandleColumnarIntSchema(scales: SdkScales): v.SchemaWithP
|
|
|
134
134
|
nextPageToken: string;
|
|
135
135
|
}, {
|
|
136
136
|
symbolId: number;
|
|
137
|
-
timeframe: DecodedEnum<"1s" | "1m" | "3m" | "5m" | "15m" | "30m" | "1h" | "2h" | "4h" | "6h" | "8h" | "12h" | "
|
|
137
|
+
timeframe: DecodedEnum<"1d" | "1s" | "1m" | "3m" | "5m" | "15m" | "30m" | "1h" | "2h" | "4h" | "6h" | "8h" | "12h" | "3d" | "1w" | "1mo">;
|
|
138
138
|
tsSec: number[];
|
|
139
139
|
open: string[];
|
|
140
140
|
high: string[];
|
|
@@ -158,7 +158,7 @@ type CandleColumnar = v.InferOutput<ReturnType<typeof createCandleColumnarSchema
|
|
|
158
158
|
type CandleColumnarInt = v.InferOutput<ReturnType<typeof createCandleColumnarIntSchema>>;
|
|
159
159
|
declare function createListCandlesInputSchema(): v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
160
160
|
readonly symbolId: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 4294967295, undefined>]>;
|
|
161
|
-
readonly timeframe: v.SchemaWithPipe<readonly [v.PicklistSchema<readonly ["1s", "1m", "3m", "5m", "15m", "30m", "1h", "2h", "4h", "6h", "8h", "12h", "1d", "3d", "1w", "1mo"], undefined>, v.TransformAction<"1s" | "1m" | "3m" | "5m" | "15m" | "30m" | "1h" | "2h" | "4h" | "6h" | "8h" | "12h" | "
|
|
161
|
+
readonly timeframe: v.SchemaWithPipe<readonly [v.PicklistSchema<readonly ["1s", "1m", "3m", "5m", "15m", "30m", "1h", "2h", "4h", "6h", "8h", "12h", "1d", "3d", "1w", "1mo"], undefined>, v.TransformAction<"1d" | "1s" | "1m" | "3m" | "5m" | "15m" | "30m" | "1h" | "2h" | "4h" | "6h" | "8h" | "12h" | "3d" | "1w" | "1mo", Timeframe$1.SEC_1 | Timeframe$1.MIN_1 | Timeframe$1.MIN_3 | Timeframe$1.MIN_5 | Timeframe$1.MIN_15 | Timeframe$1.MIN_30 | Timeframe$1.HOUR_1 | Timeframe$1.HOUR_2 | Timeframe$1.HOUR_4 | Timeframe$1.HOUR_6 | Timeframe$1.HOUR_8 | Timeframe$1.HOUR_12 | Timeframe$1.DAY_1 | Timeframe$1.DAY_3 | Timeframe$1.WEEK_1 | Timeframe$1.MONTH_1>]>;
|
|
162
162
|
readonly limit: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 10000, undefined>]>, undefined>;
|
|
163
163
|
readonly includeIncomplete: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
164
164
|
readonly includeReference: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|