feat: 优化 Lighter 适配器的订单过期逻辑,简化市场订单的即时过期处理

This commit is contained in:
discountry
2025-10-03 15:35:45 +08:00
parent fcb83bd16b
commit 971a2a6adb
2 changed files with 4 additions and 11 deletions
+3 -5
View File
@@ -746,13 +746,11 @@ export class LighterGateway {
triggerPriceScaled = decimalToScaled(params.stopPrice, this.priceDecimals);
}
// Align with chain expectations:
// - IOC and MARKET/STOP_MARKET orders must use Nil/Immediate expiry
// - Pure MARKET orders use immediate expiry (0)
// - STOP orders rest until trigger, so they require an absolute future expiry
// - All other orders use absolute future timestamp (ms) for ~28 days
const TWENTY_EIGHT_DAYS_MS = 28 * 24 * 60 * 60 * 1000;
const isImmediate =
resultTimeInForce === LIGHTER_TIME_IN_FORCE.IMMEDIATE_OR_CANCEL ||
resultType === LIGHTER_ORDER_TYPE.MARKET ||
resultType === LIGHTER_ORDER_TYPE.STOP_LOSS;
const isImmediate = resultType === LIGHTER_ORDER_TYPE.MARKET;
const orderExpiry = isImmediate
? BigInt(IMMEDIATE_OR_CANCEL_EXPIRY_PLACEHOLDER)
: BigInt(Date.now() + TWENTY_EIGHT_DAYS_MS);
+1 -6
View File
@@ -42,12 +42,7 @@ export function App() {
const copyright = useMemo(() => loadCopyrightFragments(), []);
const integrityOk = useMemo(() => verifyCopyrightIntegrity(), []);
const exchangeId = useMemo(() => resolveExchangeId(), []);
const strategies = useMemo(() => {
if (exchangeId === "lighter") {
return STRATEGIES.filter((s) => s.id !== "trend");
}
return STRATEGIES;
}, [exchangeId]);
const strategies = useMemo(() => STRATEGIES, []);
useInput(
(input, key) => {