Fix: Prevent bot from placing 100¢ trades with zero profit potential

This commit is contained in:
2026-03-15 18:49:43 -07:00
parent cf35715302
commit 9f0ff58118

View File

@@ -1,13 +1,5 @@
import { BaseStrategy } from './base.js'; import { BaseStrategy } from './base.js';
/**
* Threshold (Contrarian) Strategy
*
* Logic:
* - If one side goes above a high threshold (e.g. 65%), bet the other.
* - Fixed bet size — no progression.
* - Simple mean-reversion assumption for short-term BTC markets.
*/
export class ThresholdStrategy extends BaseStrategy { export class ThresholdStrategy extends BaseStrategy {
constructor(config = {}) { constructor(config = {}) {
super('threshold', { super('threshold', {
@@ -33,7 +25,7 @@ export class ThresholdStrategy extends BaseStrategy {
let signal = null; let signal = null;
if (yesPct >= trigger) { if (yesPct >= trigger && noPct < 99) {
signal = { signal = {
strategy: this.name, strategy: this.name,
side: 'no', side: 'no',
@@ -42,7 +34,7 @@ export class ThresholdStrategy extends BaseStrategy {
reason: `Yes at ${yesPct}% (≥${trigger}%), contrarian No at ${noPct}¢`, reason: `Yes at ${yesPct}% (≥${trigger}%), contrarian No at ${noPct}¢`,
ticker: state.ticker ticker: state.ticker
}; };
} else if (noPct >= trigger) { } else if (noPct >= trigger && yesPct < 99) {
signal = { signal = {
strategy: this.name, strategy: this.name,
side: 'yes', side: 'yes',