import { AuthApiTransports } from "../../shared/transports.js"; import { PolyesterMutationOptions, PolyesterRequestOptions } from "../../shared/request-options.js"; import { SubaccountResolver } from "../subaccount-resolver.js"; import { PolyesterRealtime } from "../../realtime/types.js"; import { BaseSubscribeInput } from "../../shared/types.js"; import { SdkScales } from "../../shared/decimal-surface.js"; import { Order, OrderDetails } from "./orders-output.schemas.js"; import { CancelAllOrdersInputSchema, CancelAllOrdersResponse, CancelOrderInputSchema, CancelOrderResult, CreateOrderResult, GetOrderDetailsInputSchema, NewOrderInput, OpenOrdersInputSchema, OrderHistoryInputSchema, PreviewOrderResult } from "./orders-input.schemas.js"; import { ModifyOrderInput, ModifyOrderResult } from "./orders-modify.schemas.js"; import { BatchCancelOrdersInput, BatchCancelOrdersResult, BatchCreateOrdersInput, BatchCreateOrdersResult, BatchReplaceOrdersInput, BatchReplaceOrdersResult, CancelAllAfterInput, CancelAllAfterResult, GetBatchReplaceStatusInput, GetBatchReplaceStatusResult } from "./orders-batch.schemas.js"; import "./orders.schemas.js"; import * as v from "valibot"; //#region src/services/orders/orders.d.ts interface SubscribeOrdersInput extends BaseSubscribeInput { accountId: string; } /** * Manages account-scoped spot orders across read, write, and realtime order update surfaces. */ declare class OrdersService { #private; constructor(transports: AuthApiTransports, realtime: PolyesterRealtime, resolver: SubaccountResolver | undefined, scales: SdkScales); /** * Returns open orders for the resolved root account or subaccount, with optional symbol IDs, trigger ID, side, pagination, and attached-risk inclusion filters. Results are paginated with a server-determined page size: a single call is not the full set of open orders — keep calling with the returned nextPageToken until it is empty. */ listOpen(input?: v.InferInput, options?: PolyesterRequestOptions): Promise<{ orders: Order[]; nextPageToken: string; }>; /** * Returns historical orders for the resolved account scope, supporting symbol IDs, trigger ID, side, status, time range, pagination, and attached-risk filters. Results are paginated with the backend nextPageToken. */ listHistory(input?: v.InferInput, options?: PolyesterRequestOptions): Promise<{ orders: Order[]; nextPageToken: string; }>; /** * Evaluates one complete order intent against current market, policy, risk, and balance state without creating an order, reserving funds, or claiming its client order ID. */ preview(input: NewOrderInput, options?: PolyesterRequestOptions): Promise; /** * Places a spot order with an explicit market-IOC, limit-GTC, limit-IOC, or limit-FOK execution policy and optional attached risk controls. clientOrderId is an account-scoped correlation, lookup, and cancellation identifier. Reuse while retained returns CONFLICT_DUPLICATE_CLIENT_ORDER_ID, including after rejection or completion; it does not replay the earlier result. After an ambiguous timeout, reconcile through get using clientOrderId; an immediate lookup miss does not prove admission failed. Without clientOrderId, the outcome may remain unknown. */ create(input: NewOrderInput, options?: PolyesterMutationOptions): Promise; /** * Places 1–20 spot orders in one best-effort request. Results preserve item order and report admission as accepted or rejected; accepted orders still require lifecycle reconciliation. requestId is the idempotency boundary for the ordered batch and is generated when omitted; supply and reuse it when an ambiguous batch may be retried. The same payload and account-scoped requestId replay the original results and timestamp within 15 minutes; a different payload during that window returns CONFLICT_IDEMPOTENCY_KEY_REUSE. Per-item clientOrderId values are optional correlation identifiers and must be unique when supplied. */ batchCreate(input: BatchCreateOrdersInput, options?: PolyesterMutationOptions): Promise; /** * Requests cancellation of one order in the resolved account scope by order id or client order id, with optional symbol routing. The response acknowledges the cancellation request, not the order's final lifecycle state; reconcile through order reads or realtime before releasing local state. A missing target remains a {@link ResourceNotFoundError}; callers performing desired-state cleanup may treat that error as success when the order could already have filled or left the book. */ cancel(input: v.InferInput, options?: PolyesterMutationOptions): Promise; /** * Cancels 1–50 explicit orders in one best-effort request. Results preserve item order and acknowledge cancellation admission rather than final order state. Supply a stable requestId when an ambiguous batch may be retried. */ batchCancel(input: BatchCancelOrdersInput, options?: PolyesterMutationOptions): Promise; /** * Applies a price, quantity, client id, or attached-risk patch to one open order. The symbol ID routes policy checks and quantity scaling. A requestId is generated when omitted; provide a stable value when retrying the same logical modification. */ modify(input: ModifyOrderInput, options?: PolyesterMutationOptions): Promise; /** * Replaces 1–50 same-symbol orders and returns an index-stable durable admission receipt. Reuse requestId only when retrying the same logical batch; use the returned batchRequestId for later status reads. An AMENDED actionTaken is cancel-only with no successor; keep tracking oldOrderId until its terminal state is confirmed. */ batchReplace(input: BatchReplaceOrdersInput, options?: PolyesterMutationOptions): Promise; /** * Reads the durable per-item execution status for a batch replacement receipt. For cancel-only AMENDED items, orderStatus describes oldOrderId and replacementOrderId is undefined. */ getBatchReplaceStatus(input: GetBatchReplaceStatusInput, options?: PolyesterRequestOptions): Promise; /** * Cancels all matching open orders for the resolved account scope, optionally narrowed by up to 100 symbol IDs and side, with dry-run preview. A requestId is generated when omitted; reuse it with the same criteria for retries. Completed results are retained for at least two minutes; use a fresh key for each new cancellation. */ cancelAll(input: v.InferInput, options?: PolyesterMutationOptions): Promise; /** * Arms, refreshes, or disables the account dead-man switch, optionally scoped by symbol ID and side. timeoutSec 0 disables it; 10–120 arms it. Generate a new requestId for each deliberate heartbeat, but reuse the same ID when retrying one ambiguous heartbeat. */ cancelAllAfter(input: CancelAllAfterInput, options?: PolyesterMutationOptions): Promise; /** * Fetches one physical order and a bounded page of lineage executions through its generation. * Pass nextPageToken as pageToken with the same orderId to continue; deduplicate transfers by txId. * Set includeExecutionHistory to false for state-only polling, omitting limit and pageToken. * Execution pages are eventually consistent and need not reconcile with cumulative order quantities. * Returns null when the requested order is not found. */ getDetails(input: v.InferInput, options?: PolyesterRequestOptions): Promise; /** * Subscribes to private order updates on private:spot:orders:{accountId}:proto and emits parsed order records until the returned unsubscribe function is called. */ subscribe(input: SubscribeOrdersInput): () => void; } //#endregion export { OrdersService }; //# sourceMappingURL=orders.d.ts.map