mirror of
https://github.com/discountry/ritmex-bot.git
synced 2026-09-11 09:18:08 +00:00
feat: 优化 Lighter 适配器的订单过期逻辑,简化市场订单的即时过期处理
This commit is contained in:
@@ -746,13 +746,11 @@ export class LighterGateway {
|
|||||||
triggerPriceScaled = decimalToScaled(params.stopPrice, this.priceDecimals);
|
triggerPriceScaled = decimalToScaled(params.stopPrice, this.priceDecimals);
|
||||||
}
|
}
|
||||||
// Align with chain expectations:
|
// 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
|
// - All other orders use absolute future timestamp (ms) for ~28 days
|
||||||
const TWENTY_EIGHT_DAYS_MS = 28 * 24 * 60 * 60 * 1000;
|
const TWENTY_EIGHT_DAYS_MS = 28 * 24 * 60 * 60 * 1000;
|
||||||
const isImmediate =
|
const isImmediate = resultType === LIGHTER_ORDER_TYPE.MARKET;
|
||||||
resultTimeInForce === LIGHTER_TIME_IN_FORCE.IMMEDIATE_OR_CANCEL ||
|
|
||||||
resultType === LIGHTER_ORDER_TYPE.MARKET ||
|
|
||||||
resultType === LIGHTER_ORDER_TYPE.STOP_LOSS;
|
|
||||||
const orderExpiry = isImmediate
|
const orderExpiry = isImmediate
|
||||||
? BigInt(IMMEDIATE_OR_CANCEL_EXPIRY_PLACEHOLDER)
|
? BigInt(IMMEDIATE_OR_CANCEL_EXPIRY_PLACEHOLDER)
|
||||||
: BigInt(Date.now() + TWENTY_EIGHT_DAYS_MS);
|
: BigInt(Date.now() + TWENTY_EIGHT_DAYS_MS);
|
||||||
|
|||||||
+1
-6
@@ -42,12 +42,7 @@ export function App() {
|
|||||||
const copyright = useMemo(() => loadCopyrightFragments(), []);
|
const copyright = useMemo(() => loadCopyrightFragments(), []);
|
||||||
const integrityOk = useMemo(() => verifyCopyrightIntegrity(), []);
|
const integrityOk = useMemo(() => verifyCopyrightIntegrity(), []);
|
||||||
const exchangeId = useMemo(() => resolveExchangeId(), []);
|
const exchangeId = useMemo(() => resolveExchangeId(), []);
|
||||||
const strategies = useMemo(() => {
|
const strategies = useMemo(() => STRATEGIES, []);
|
||||||
if (exchangeId === "lighter") {
|
|
||||||
return STRATEGIES.filter((s) => s.id !== "trend");
|
|
||||||
}
|
|
||||||
return STRATEGIES;
|
|
||||||
}, [exchangeId]);
|
|
||||||
|
|
||||||
useInput(
|
useInput(
|
||||||
(input, key) => {
|
(input, key) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user