export type DeleteApiV2UserAccountsServerAccountIdTradesIdArgs = {server: 'oanda' | 'oanda-demo' | 'otms' | 'v20' | 'v20-demo' | 'oj' | 'oj-demo' | 'opt' | 'ftmo-1', accountId: string, id: string, body: {quantity: number, instrument: string, direction: 'LONG' | 'SHORT', executionMode?: ('MARKET' | 'EXCHANGE') | undefined, fillType?: ('FOK' | 'IOC' | 'RETURN') | undefined, trackingData?: ({instrumentCategory?: string | undefined, instrumentCategoryCountry?: string | undefined, isCFD?: boolean | undefined}) | undefined}}; export type DeleteApiV2UserAccountsServerAccountIdTradesIdOptions = {baseUrl: string, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * DELETE /v2/user/accounts/{server}/{accountId}/trades/{id} */ export const deleteApiV2UserAccountsServerAccountIdTradesId = async (args: DeleteApiV2UserAccountsServerAccountIdTradesIdArgs, options: DeleteApiV2UserAccountsServerAccountIdTradesIdOptions) => { const {baseUrl, fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/v2/user/accounts/${encodeURIComponent(String(args.server))}/${encodeURIComponent(String(args.accountId))}/trades/${encodeURIComponent(String(args.id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };