export type CreateApiApiV4TradeAccountBalanceOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, PayloadAuth?: string | undefined, SignatureAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Trading Balance * * POST /api/v4/trade-account/balance */ export const createApiApiV4TradeAccountBalance = async (options?: CreateApiApiV4TradeAccountBalanceOptions) => { const {baseUrl = "https://whitebit.com", fetch: fetchFn = fetch, ApiKeyAuth, PayloadAuth, SignatureAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (ApiKeyAuth !== undefined) headers.set("X-TXC-APIKEY", ApiKeyAuth) if (PayloadAuth !== undefined) headers.set("X-TXC-PAYLOAD", PayloadAuth) if (SignatureAuth !== undefined) headers.set("X-TXC-SIGNATURE", SignatureAuth) const url = `${baseUrl.replace(/\/+$/, '')}/api/v4/trade-account/balance${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };