feat(maker-points): enhance configuration for maker points bands

Added new configuration options for maker points bands, including target distances and maximum distance limits. Updated the logic to handle these configurations, ensuring backward compatibility with existing defaults. Enhanced documentation and tests to cover the new features and ensure correct functionality across the system.
This commit is contained in:
discountry
2026-08-18 15:16:49 +08:00
parent f3a96886ac
commit 85954461f3
16 changed files with 1085 additions and 306 deletions
+45 -12
View File
@@ -27,7 +27,7 @@ STANDX_SYMBOL=BTC-USD
# STANDX_SESSION_ID=
# Optional: request signing key (ed25519 private key, supports hex or base58 format)
# STANDX_REQUEST_PRIVATE_KEY=
# Token expiry configuration (recommended method: creation date + validity days)
# Token expiry configuration (recommended method: creation date + validity days
# Get these values when generating API token at https://standx.com/user/session
# STANDX_TOKEN_CREATE_DATE=2026-01-15 # Token creation date (YYYY-MM-DD format)
# STANDX_TOKEN_VALIDITY_DAYS=30 # Token validity period in days
@@ -43,17 +43,17 @@ SWING_DIRECTION=short # short | long | both
SWING_STOP_LOSS_PCT=0.05 # 0.05 = 5%
# Risk management (USD amounts unless noted)
LOSS_LIMIT=0.04 # Max loss per trade in USDT before forced close
LOSS_LIMIT=0.04 # Max loss per trade in USDT before for
TRAILING_PROFIT=0.2 # Trailing stop activation profit (USDT)
TRAILING_CALLBACK_RATE=0.2 # Trailing callback percent (e.g. 0.2 => 0.2%)
PROFIT_LOCK_TRIGGER_USD=0.08 # Start moving base stop once unrealized PnL > this (USDT)
PROFIT_LOCK_TRIGGER_USD=0.08 # Start moving base stop once unrealiz
PROFIT_LOCK_OFFSET_USD=0.04 # Base stop offset from entry after trigger (USDT)
BOLLINGER_LENGTH=20 # SMA window (minutes) used for Bollinger bandwidth
BOLLINGER_STD_MULTIPLIER=2 # Standard deviation multiplier for Bollinger bands
MIN_BOLLINGER_BANDWIDTH=0.001 # Require bandwidth >= this ratio before new entries
# Precision (per-symbol exchange filters)
PRICE_TICK=0.1 # Price tick size (e.g. BTCUSDT uses 0.1)
PRICE_TICK=0.1 # Price tick size (e.g. BTCUSDT uses 0.
QTY_STEP=0.001 # Quantity step size (e.g. BTC min step 0.001)
# Engine cadence and UI
@@ -71,9 +71,42 @@ MAKER_MAX_CLOSE_SLIPPAGE_PCT=0.05 # Maker close slippage guard (fallbacks
MAKER_PRICE_TICK=0.1 # Maker price tick size (defaults to PRICE_TICK)
# Maker-points Binance depth imbalance monitor
MAKER_POINTS_BINANCE_DEPTH_WINDOW_BPS=3 # Binance depth monitor window around best bid/ask (bps)
MAKER_POINTS_BINANCE_DEPTH_WINDOW_BPS=3 # Binance depth monitor window ar
MAKER_POINTS_BINANCE_DEPTH_IMBALANCE_RATIO=9 # Imbalance threshold ratio (e.g. 9 => one side >= 9x)
# Maker-points quote distance (all optional — omit a line to use the default shown)
# StandX scores by distance from MARK PRICE on a linear gradient: 100% at 0 bps,
# 40% at 10 bps, 12.5% at 30 bps, and exactly 0 at 100 bps and beyond.
#
# Target distance from mark price per band (bps). Defaults: 9 / 29 / 40.
# 40 bps is used for the far band because the old 99 bps edge quote only earns
# a 0.18% multiplier — 1/60th of what 40 bps earns — while tying up the same margin.
# MAKER_POINTS_BAND_0_10_BPS=9
# MAKER_POINTS_BAND_10_30_BPS=29
# MAKER_POINTS_BAND_30_100_BPS=40
#
# Hard cap on quote distance (bps). 95 leaves a safety margin before the 100 bp
# Automatically raised to the widest ENABLED band, so a quote is never pulled back
# toward the book (that would be the direction most likely to get filled). Capped at 100.
# MAKER_POINTS_MAX_DISTANCE_BPS=95
#
# Per-band reprice tolerance = max(MAKER_POINTS_MIN_REPRICE_BPS, band bps x this ratio).
# StandX only scores quotes that rest on the book for more than 3 seconds, and
# short-cycle cancels, so far bands are deliberately slower to move than near ones.
# Higher => orders move less often and rest longer. Not recommended below 0.1.
# MAKER_POINTS_BAND_REPRICE_RATIO=0.15
# MAKER_POINTS_MIN_REPRICE_BPS=3
#
# Stop-loss trigger offset attached to entry quotes (bps), so a filled quote is closed
# immediately instead of leaving inventory. Scales with the symbol price. Set 0 to disable.
# MAKER_POINTS_SL_OFFSET_BPS=2
#
# Band on/off switches (all default true). Disabling the 0-10 band is the simplest way
# to cut fill risk, at the cost of the highest-multiplier quotes.
# MAKER_POINTS_BAND_0_10=true
# MAKER_POINTS_BAND_10_30=true
# MAKER_POINTS_BAND_30_100=true
# Grid strategy defaults
GRID_LOWER_PRICE=25000 # Grid lower bound price (quote currency)
GRID_UPPER_PRICE=35000 # Grid upper bound price
@@ -84,16 +117,16 @@ GRID_REFRESH_INTERVAL_MS=1000 # Grid evaluation cadence (ms)
GRID_MAX_LOG_ENTRIES=200 # Grid trade log length (defaults to MAX_LOG_ENTRIES when unset)
GRID_DIRECTION=both # Order direction: both | long | short
GRID_STOP_LOSS_PCT=0.01 # Stop loss trigger percentage beyond bounds (0.01 => 1%)
GRID_RESTART_TRIGGER_PCT=0.01 # Restart buffer percentage inside bounds
GRID_RESTART_TRIGGER_PCT=0.01 # Restart buffer percentage inside boun
GRID_AUTO_RESTART_ENABLED=true # Automatically resume grid when price re-enters range
GRID_MAX_CLOSE_SLIPPAGE_PCT=0.05 # Close-order slippage guard relative to mark price
GRID_SHIFT_ENABLED=false # Smart-follow grid: shift the whole grid when price drifts from anchor
GRID_SHIFT_TRIGGER_PCT=0.05 # Shift trigger: |price/anchor - 1| threshold (0.05 => 5%)
GRID_SHIFT_TRIGGER_PCT=0.05 # Shift trigger: |price/anchor - 1| thr
GRID_SHIFT_RANGE_PCT=0.05 # New grid half-range around the new anchor after a shift
GRID_SHIFT_CONFIRM_MS=3000 # Deviation must persist this long before shifting (anti-wick)
GRID_SHIFT_CONFIRM_MS=3000 # Deviation must persist this long befo
GRID_USE_REDUCE_ONLY=false # Attach reduceOnly to EXIT orders (some venues reject it alongside entries)
GRID_EXCHANGE_STOP_ENABLED=true # Keep an exchange-side STOP_MARKET backstop (aster/binance/grvt/ondoperps)
GRID_RECONCILE_INTERVAL_MS=30000 # Periodic REST reconcile cadence when the venue supports order queries
GRID_RECONCILE_INTERVAL_MS=30000 # Periodic REST reconcile cadence when ueries
GRID_UNCOVERED_GRACE_MS=5000 # Grace before the coverage audit acts on uncovered position
# GRID_PRICE_TICK=0.1 # Optional override for grid price tick (falls back to PRICE_TICK)
# GRID_QTY_STEP=0.001 # Optional override for grid quantity step (falls back to QTY_STEP)
@@ -115,10 +148,10 @@ GRVT_ENV=prod
LIGHTER_ACCOUNT_INDEX=
LIGHTER_API_PRIVATE_KEY= # 40-byte hex private key (e.g., 0x...)
LIGHTER_API_KEY_INDEX=0 # API key slot (default 0)
LIGHTER_SYMBOL=BTCUSDT # Trading pair (defaults to TRADE_SYMBOL when omitted)
LIGHTER_SYMBOL=BTCUSDT # Trading pair (defaults to TRADE_SYMBO
LIGHTER_ENV=testnet # mainnet | testnet | staging | dev
# LIGHTER_BASE_URL=https://testnet.zklighter.elliot.ai
# LIGHTER_CHAIN_ID=300 # Override inferred chain id when needed
# LIGHTER_CHAIN_ID=300 # Override inferred chain id when neede
# LIGHTER_MARKET_ID=1 # Prefer explicit market id when symbols differ
# LIGHTER_PRICE_DECIMALS=3 # Manual override for price decimals (optional)
# LIGHTER_SIZE_DECIMALS=3 # Manual override for size decimals (optional)
@@ -191,4 +224,4 @@ NADO_MIN_SIZE_POLICY=adjust
# Telegram notification configuration
# TELEGRAM_BOT_TOKEN= # Telegram bot token from @BotFather
# TELEGRAM_CHAT_ID= # Chat ID to receive notifications
# TELEGRAM_ACCOUNT_LABEL= # Account label to distinguish multiple bot instances (e.g., "Account-A")
# TELEGRAM_ACCOUNT_LABEL= # Account label to distinguish multiple bot instances (e.g., "Account-A")