export type UpdateApiV2UserAccountsServerAccountIdOrdersIdArgs = {server: 'oanda' | 'oanda-demo' | 'otms' | 'v20' | 'v20-demo' | 'oj' | 'oj-demo' | 'opt' | 'ftmo-1', accountId: string, id: string, body: {instrument: string, price?: number | undefined, orderType: 'MARKET' | 'MARKET_IF_TOUCHED' | 'STOP' | 'LIMIT', direction: 'LONG' | 'SHORT', expiryTime?: number | undefined, expiryType?: ('GTC' | 'SPECIFIED' | 'DAY' | 'SPECIFIED_DAY') | undefined, stopLoss?: number | undefined, stopLossType?: ('NORMAL' | 'GUARANTEED') | undefined, takeProfit?: number | undefined, trailingStop?: number | undefined, priceBound?: number | undefined, quantity?: number | undefined, fillType?: ('FOK' | 'IOC' | 'RETURN') | undefined, modifyType?: ('EDIT' | 'CLOSE_AND_CREATE') | undefined, trackingData?: ({instrumentCategory?: string | undefined, instrumentCategoryCountry?: string | undefined, isCFD?: boolean | undefined}) | undefined}}; export type UpdateApiV2UserAccountsServerAccountIdOrdersIdOptions = {baseUrl: string, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * PUT /v2/user/accounts/{server}/{accountId}/orders/{id} */ export const updateApiV2UserAccountsServerAccountIdOrdersId = async (args: UpdateApiV2UserAccountsServerAccountIdOrdersIdArgs, options: UpdateApiV2UserAccountsServerAccountIdOrdersIdOptions) => { 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))}/orders/${encodeURIComponent(String(args.id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", 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 };