Files
ritmex-bot/src/exchanges/order-schema.ts
T
discountry 12e8e3e064 Update API token creation date in documentation and configuration
- Revised the `.env.example` and `maker-points-guide.md` to reflect the updated token creation date from 2025-01-15 to 2026-01-15.
- Enhanced the `order-coordinator.ts`, `order-schema.ts`, and `types.ts` files to support stop-loss and take-profit price parameters in order intents.
- Updated the `StandxGateway` and `order.ts` to handle new stop-loss and take-profit parameters in order creation.
- Improved the `MakerPointsEngine` to calculate stop-loss prices based on order type, enhancing order management capabilities.
2026-01-16 11:29:26 +08:00

46 lines
1.2 KiB
TypeScript

import type { ExchangeAdapter } from "./adapter";
import type { OrderSide, TimeInForce } from "./types";
export interface BaseOrderIntent {
adapter: ExchangeAdapter;
symbol: string;
side: OrderSide;
quantity: number;
reduceOnly?: boolean;
closePosition?: boolean;
timeInForce?: TimeInForce | "GTX";
}
export interface LimitOrderIntent extends BaseOrderIntent {
price: number;
// StandX TPSL 参数
slPrice?: number; // 止损价格
tpPrice?: number; // 止盈价格
}
export interface MarketOrderIntent extends BaseOrderIntent {
expectedPrice?: number | null;
}
export interface StopOrderIntent extends BaseOrderIntent {
stopPrice: number;
triggerType?: "UNSPECIFIED" | "TAKE_PROFIT" | "STOP_LOSS";
}
export interface TrailingStopOrderIntent extends BaseOrderIntent {
activationPrice: number;
callbackRate: number;
}
export interface ClosePositionIntent extends BaseOrderIntent {
expectedPrice?: number | null;
}
export type ExchangeOrderType = "limit" | "market" | "stop" | "trailingStop" | "close";
export function toStringBoolean(value: boolean | undefined): "true" | "false" | undefined {
if (value === undefined) return undefined;
return value ? "true" : "false";
}