mirror of
https://github.com/discountry/ritmex-bot.git
synced 2026-09-12 09:48:07 +00:00
- AsterOrder → Order - AsterAccountSnapshot → AccountSnapshot - AsterAccountPosition → AccountPosition - AsterAccountAsset → AccountAsset - AsterDepthLevel → DepthLevel - AsterDepth → Depth - AsterTicker → Ticker - AsterKline → Kline These types are the platform-agnostic contract used by all 8 exchanges, not Aster-specific. Renamed across 63 files.
22 lines
613 B
TypeScript
22 lines
613 B
TypeScript
import type { ExchangeAdapter } from "../../exchanges/adapter";
|
|
import type { Order } from "../../exchanges/types";
|
|
import { isUnknownOrderError } from "../../utils/errors";
|
|
|
|
export async function safeCancelOrder(
|
|
exchange: ExchangeAdapter,
|
|
symbol: string,
|
|
order: Order,
|
|
onResolved: (orderId: number | string) => void,
|
|
onUnknown: () => void,
|
|
onError: (err: unknown) => void
|
|
): Promise<void> {
|
|
try {
|
|
await exchange.cancelOrder({ symbol, orderId: order.orderId });
|
|
onResolved(order.orderId);
|
|
} catch (error) {
|
|
if (isUnknownOrderError(error)) onUnknown();
|
|
else onError(error);
|
|
}
|
|
}
|
|
|