mirror of
https://github.com/discountry/ritmex-bot.git
synced 2026-09-10 00:38:07 +00:00
更新 .env.example 和 README.md,添加新的交易配置项(如 PROFIT_LOCK_TRIGGER_USD、PRICE_TICK 和 QTY_STEP),并在代码中实现相应的逻辑以支持这些配置,提升交易策略的灵活性和可配置性。
This commit is contained in:
@@ -10,6 +10,8 @@ export interface TradingConfig {
|
||||
maxLogEntries: number;
|
||||
klineInterval: string;
|
||||
maxCloseSlippagePct: number;
|
||||
priceTick: number; // price tick size, e.g. 0.1 for BTCUSDT
|
||||
qtyStep: number; // quantity step size, e.g. 0.001 BTC
|
||||
}
|
||||
|
||||
function parseNumber(value: string | undefined, fallback: number): number {
|
||||
@@ -30,6 +32,8 @@ export const tradingConfig: TradingConfig = {
|
||||
maxLogEntries: parseNumber(process.env.MAX_LOG_ENTRIES, 200),
|
||||
klineInterval: process.env.KLINE_INTERVAL ?? "1m",
|
||||
maxCloseSlippagePct: parseNumber(process.env.MAX_CLOSE_SLIPPAGE_PCT, 0.05),
|
||||
priceTick: parseNumber(process.env.PRICE_TICK, 0.1),
|
||||
qtyStep: parseNumber(process.env.QTY_STEP, 0.001),
|
||||
};
|
||||
|
||||
export interface MakerConfig {
|
||||
@@ -42,6 +46,7 @@ export interface MakerConfig {
|
||||
refreshIntervalMs: number;
|
||||
maxLogEntries: number;
|
||||
maxCloseSlippagePct: number;
|
||||
priceTick: number;
|
||||
}
|
||||
|
||||
export const makerConfig: MakerConfig = {
|
||||
@@ -57,4 +62,5 @@ export const makerConfig: MakerConfig = {
|
||||
process.env.MAKER_MAX_CLOSE_SLIPPAGE_PCT ?? process.env.MAX_CLOSE_SLIPPAGE_PCT,
|
||||
0.05
|
||||
),
|
||||
priceTick: parseNumber(process.env.MAKER_PRICE_TICK ?? process.env.PRICE_TICK, 0.1),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user