/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { tradeAllocationCancelTradeAllocation } from "../funcs/tradeAllocationCancelTradeAllocation.js"; import { tradeAllocationCreateTradeAllocation } from "../funcs/tradeAllocationCreateTradeAllocation.js"; import { tradeAllocationGetTradeAllocation } from "../funcs/tradeAllocationGetTradeAllocation.js"; import { tradeAllocationRebookTradeAllocation } from "../funcs/tradeAllocationRebookTradeAllocation.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 TradeAllocation extends ClientSDK { /** * Create Trade Allocation * * @remarks * Creates a new trade allocation. These are used to allocate or distribute positions between Apex accounts. * * Upon success, returns the created trade allocation and its enriched details. */ async createTradeAllocation( tradeAllocationCreate: components.TradeAllocationCreate, accountId: string, requestId?: string | undefined, options?: RequestOptions, ): Promise { return unwrapAsync(tradeAllocationCreateTradeAllocation( this, tradeAllocationCreate, accountId, requestId, options, )); } /** * Get Trade Allocation * * @remarks * Retrieves a trade allocation and its details. * * Upon successful submission, returns the trade allocation details. */ async getTradeAllocation( accountId: string, tradeAllocationId: string, options?: RequestOptions, ): Promise { return unwrapAsync(tradeAllocationGetTradeAllocation( this, accountId, tradeAllocationId, options, )); } /** * Cancel Trade Allocation * * @remarks * Cancel a trade allocation using the original trade_allocation_id. * * Upon successful submission, returns an empty response. CancelTradeAllocation will either cancel everything, or nothing at all if a failure occurs. */ async cancelTradeAllocation( cancelTradeAllocationRequestCreate: components.CancelTradeAllocationRequestCreate, accountId: string, tradeAllocationId: string, options?: RequestOptions, ): Promise { return unwrapAsync(tradeAllocationCancelTradeAllocation( this, cancelTradeAllocationRequestCreate, accountId, tradeAllocationId, options, )); } /** * Rebook Trade Allocation * * @remarks * Rebook a trade allocation by the original trade_allocation_id. The allocation is rebooked by canceling the original allocation and creating a new one with the provided details. * * Upon successful submission, returns both the original and new allocation, as separate resources. */ async rebookTradeAllocation( rebookTradeAllocationRequestCreate: components.RebookTradeAllocationRequestCreate, accountId: string, tradeAllocationId: string, options?: RequestOptions, ): Promise { return unwrapAsync(tradeAllocationRebookTradeAllocation( this, rebookTradeAllocationRequestCreate, accountId, tradeAllocationId, options, )); } }