feat: add MAKER_MM_REENTRY_ENABLED config + fix float combined check
- MAKER_MM_REENTRY_ENABLED=false disables re-entry (one cycle per market) - Fix floating point bug: 0.1+0.5=0.6000000000000001 caused "combined > max" loop when MAKER_MM_MAX_COMBINED=0.60 — now rounds combined to 4dp before compare Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -92,6 +92,9 @@ MAKER_MM_POLL_INTERVAL=5
|
||||
# Delay between re-entry cycles within the same market (seconds)
|
||||
MAKER_MM_REENTRY_DELAY=30
|
||||
|
||||
# Set to false to disable re-entry — bot places one order per market then waits for next
|
||||
MAKER_MM_REENTRY_ENABLED=true
|
||||
|
||||
# Price range for maker rebate eligibility (both sides must be in range)
|
||||
# Polymarket rebates are earned on orders within ~30-70% range
|
||||
MAKER_MM_MIN_PRICE=0.30
|
||||
|
||||
@@ -96,6 +96,7 @@ const config = {
|
||||
makerMmEntryWindow: parseInt(process.env.MAKER_MM_ENTRY_WINDOW || '45', 10), // max secs after open to enter
|
||||
makerMmPollInterval: parseInt(process.env.MAKER_MM_POLL_INTERVAL || process.env.MM_POLL_INTERVAL || '5', 10) * 1000,
|
||||
makerMmReentryDelay: parseInt(process.env.MAKER_MM_REENTRY_DELAY || '30', 10) * 1000, // ms delay between re-entry cycles
|
||||
makerMmReentryEnabled: process.env.MAKER_MM_REENTRY_ENABLED !== 'false', // set false to disable re-entry (one cycle per market)
|
||||
makerMmRepriceThreshold: parseFloat(process.env.MAKER_MM_REPRICE_THRESHOLD || '0.02'), // reprice if bid drifts > this (default 2c)
|
||||
makerMmMinPrice: parseFloat(process.env.MAKER_MM_MIN_PRICE || '0.30'), // min bid for rebate range (both sides)
|
||||
makerMmMaxPrice: parseFloat(process.env.MAKER_MM_MAX_PRICE || '0.69'), // max bid for rebate range (both sides)
|
||||
|
||||
+1
-1
@@ -182,7 +182,7 @@ async function runStrategy(market) {
|
||||
const secsLeft = Math.round(msRemaining / 1000);
|
||||
const minTimeForReentry = 180; // 3 minutes minimum
|
||||
|
||||
if (secsLeft > config.makerMmCutLossTime + minTimeForReentry) {
|
||||
if (config.makerMmReentryEnabled && secsLeft > config.makerMmCutLossTime + minTimeForReentry) {
|
||||
// ── CURRENT MARKET: Check odds before re-entry ──────────────────────
|
||||
if (isCurrentMarket && config.currentMarketEnabled) {
|
||||
const oddsValid = await isCurrentMarketOddsValidForReentry(
|
||||
|
||||
@@ -649,7 +649,7 @@ export async function executeMakerRebateStrategy(market) {
|
||||
continue;
|
||||
}
|
||||
|
||||
combined = yesBid + noBid;
|
||||
combined = parseFloat((yesBid + noBid).toFixed(4));
|
||||
|
||||
if (combined > config.makerMmMaxCombined) {
|
||||
logger.info(`MakerMM${tag}: combined $${combined.toFixed(4)} > max — waiting`);
|
||||
|
||||
Reference in New Issue
Block a user