Variable ConstantConst

Constant: ConstantUtils

Global singleton instance of ConstantUtils. Provides static-like access to predefined trading level constants.

Kelly-optimized scaling strategy: Profit side (pyramiding out):

  • Close 33% at 30% progress (quick profit lock)
  • Close 33% at 60% progress (secure gains)
  • Close 34% at 90% progress (exit near target)

Loss side (damage control):

  • Close 50% at 40% progress (reduce risk early)
  • Close 50% at 80% progress (exit before full stop)
// Final targets: TP at +10%, SL at -5%
listenPartialProfit(async (event) => {
// event.level emits: 10, 20, 30, 40, 50...
if (event.level === Constant.TP_LEVEL1) { await close(33); } // at +3% profit
if (event.level === Constant.TP_LEVEL2) { await close(33); } // at +6% profit
if (event.level === Constant.TP_LEVEL3) { await close(34); } // at +9% profit
});
listenPartialLoss(async (event) => {
// event.level emits: 10, 20, 30, 40, 50...
if (event.level === Constant.SL_LEVEL1) { await close(50); } // at -2% loss
if (event.level === Constant.SL_LEVEL2) { await close(50); } // at -4% loss
});