export type DeleteApiAlgoOrdersAlgoIdArgs = {algo_id: string}; export type DeleteApiAlgoOrdersAlgoIdOptions = {baseUrl?: string | undefined, BearerToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * Cancel algo order by id * * DELETE /algo/orders/{algo_id} */ export const deleteApiAlgoOrdersAlgoId = async (args: DeleteApiAlgoOrdersAlgoIdArgs, options?: DeleteApiAlgoOrdersAlgoIdOptions) => { const {baseUrl = "https://api.testnet.paradex.trade/v1", fetch: fetchFn = fetch, BearerToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (BearerToken !== undefined) headers.set("Authorization", BearerToken) const url = `${baseUrl.replace(/\/+$/, '')}/algo/orders/${encodeURIComponent(String(args.algo_id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };