/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { ordersCancelOrder } from "../funcs/ordersCancelOrder.js"; import { ordersCreateOrder } from "../funcs/ordersCreateOrder.js"; import { ordersGetOrder } from "../funcs/ordersGetOrder.js"; import { ordersListAccountOrders } from "../funcs/ordersListAccountOrders.js"; import { ordersListCorrespondentOrders } from "../funcs/ordersListCorrespondentOrders.js"; import { ordersSetExtraReportingData } from "../funcs/ordersSetExtraReportingData.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import * as components from "../models/components/index.js"; import * as operations from "../models/operations/index.js"; import { unwrapAsync } from "../types/fp.js"; export class Orders extends ClientSDK { /** * Create Order * * @remarks * Creates a new order for equity or fixed income securities. * * Equity quantities may be for fractional shares, whole shares, or notional dollar amounts. Fixed income orders may be specified in face value currency amounts, with prices expressed in conventional "percentage of par" values. * * Upon successful submission, if the request is a duplicate, returns the existing order in its current state in the system. If the request is not a duplicate, returns the summary of the newly submitted order. */ async createOrder( orderCreate: components.OrderCreate, accountId: string, options?: RequestOptions, ): Promise { return unwrapAsync(ordersCreateOrder( this, orderCreate, accountId, options, )); } /** * List Account Orders * * @remarks * Lists orders for a specific account matching the specified filter criteria. Results are paginated and sorted in the reverse order of their creation. */ async listAccountOrders( accountId: string, filter?: string | undefined, pageSize?: number | undefined, pageToken?: string | undefined, options?: RequestOptions, ): Promise { return unwrapAsync(ordersListAccountOrders( this, accountId, filter, pageSize, pageToken, options, )); } /** * Get Order * * @remarks * Gets an order by order ID. * * Upon successful submission, returns the details of the queried order. */ async getOrder( accountId: string, orderId: string, options?: RequestOptions, ): Promise { return unwrapAsync(ordersGetOrder( this, accountId, orderId, options, )); } /** * Cancel Order * * @remarks * Submits an order cancellation request by order ID. Confirmation of order cancellation requests are provided through asynchronous events. * * Upon successful submission, returns the details of the order pending cancellation. */ async cancelOrder( cancelOrderRequestCreate: components.CancelOrderRequestCreate, accountId: string, orderId: string, options?: RequestOptions, ): Promise { return unwrapAsync(ordersCancelOrder( this, cancelOrderRequestCreate, accountId, orderId, options, )); } /** * Set Extra Reporting Data * * @remarks * Sets extra reporting data to an existing order. Any SetExtraReportingDataRequest must include the name of the order and the cancel_confirmed_time */ async setExtraReportingData( setExtraReportingDataRequestCreate: components.SetExtraReportingDataRequestCreate, accountId: string, orderId: string, options?: RequestOptions, ): Promise { return unwrapAsync(ordersSetExtraReportingData( this, setExtraReportingDataRequestCreate, accountId, orderId, options, )); } /** * List Correspondent Orders * * @remarks * Lists orders matching the specified filter criteria. Results are paginated and sorted in the reverse order of their creation. */ async listCorrespondentOrders( correspondentId: string, filter?: string | undefined, pageSize?: number | undefined, pageToken?: string | undefined, options?: RequestOptions, ): Promise { return unwrapAsync(ordersListCorrespondentOrders( this, correspondentId, filter, pageSize, pageToken, options, )); } }