mirror of
https://github.com/discountry/ritmex-bot.git
synced 2026-09-11 17:28:08 +00:00
feat: 更新 Lighter 适配器的订单过期逻辑,支持即时或取消订单类型的处理
This commit is contained in:
@@ -745,10 +745,17 @@ export class LighterGateway {
|
|||||||
if (params.stopPrice != null) {
|
if (params.stopPrice != null) {
|
||||||
triggerPriceScaled = decimalToScaled(params.stopPrice, this.priceDecimals);
|
triggerPriceScaled = decimalToScaled(params.stopPrice, this.priceDecimals);
|
||||||
}
|
}
|
||||||
// Align with chain expectations: use absolute future timestamp (ms) for OrderExpiry
|
// Align with chain expectations:
|
||||||
// and a shorter-lived tx ExpiredAt. 28 days for order expiry, ~10 minutes for tx expiry.
|
// - IOC and MARKET/STOP_MARKET orders must use Nil/Immediate expiry
|
||||||
|
// - 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 orderExpiry = BigInt(Date.now() + TWENTY_EIGHT_DAYS_MS);
|
const isImmediate =
|
||||||
|
resultTimeInForce === LIGHTER_TIME_IN_FORCE.IMMEDIATE_OR_CANCEL ||
|
||||||
|
resultType === LIGHTER_ORDER_TYPE.MARKET ||
|
||||||
|
resultType === LIGHTER_ORDER_TYPE.STOP_LOSS;
|
||||||
|
const orderExpiry = isImmediate
|
||||||
|
? BigInt(IMMEDIATE_OR_CANCEL_EXPIRY_PLACEHOLDER)
|
||||||
|
: BigInt(Date.now() + TWENTY_EIGHT_DAYS_MS);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
marketIndex: this.marketId,
|
marketIndex: this.marketId,
|
||||||
|
|||||||
Reference in New Issue
Block a user