fix: use mid price for initial adaptive CL sell instead of fixed breakeven floor
Check mid price first, place limit at market price (capped at mmSellPrice). Only falls back to breakeven floor if mid price is below it. Example: YES filled @ 70c, NO mid = 38c → sell @ 38c (not 30c breakeven) This gives profit potential instead of always targeting breakeven. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -517,11 +517,17 @@ async function adaptiveLegCL(pos, unfilledKey) {
|
||||
let currentFloor = is5m ? breakevenFloor : minAdaptivePrice;
|
||||
|
||||
if (is5m && sellShares >= CLOB_MIN_ORDER_SHARES) {
|
||||
logger.info(`MM adaptive CL: placing standing limit sell @ $${breakevenFloor.toFixed(3)} (breakeven floor)`);
|
||||
const standing = await placeLimitSell(s.tokenId, sellShares, breakevenFloor, tickSize, negRisk);
|
||||
// Check mid price first — place at market price (not just breakeven floor)
|
||||
const initMid = await getMidprice(s.tokenId);
|
||||
// Use mid price if above floor, otherwise use floor as safety net
|
||||
const initSellPrice = initMid >= currentFloor
|
||||
? Math.min(initMid, config.mmSellPrice)
|
||||
: currentFloor;
|
||||
logger.info(`MM adaptive CL: mid=$${initMid.toFixed(3)}, placing initial limit sell @ $${initSellPrice.toFixed(3)} (floor=$${currentFloor.toFixed(3)})`);
|
||||
const standing = await placeLimitSell(s.tokenId, sellShares, initSellPrice, tickSize, negRisk);
|
||||
if (standing.success) {
|
||||
activeOrderId = standing.orderId;
|
||||
activeLimitPrice = breakevenFloor;
|
||||
activeLimitPrice = initSellPrice;
|
||||
}
|
||||
} else {
|
||||
logger.info(`MM adaptive CL: monitoring ${unfilledKey.toUpperCase()} — floor $${currentFloor.toFixed(3)}, market-sell at CL time`);
|
||||
|
||||
Reference in New Issue
Block a user