From c91c8f00de22b428cbb86c8be8a76a9ed654ee7e Mon Sep 17 00:00:00 2001 From: philipp Date: Sun, 12 Apr 2026 15:52:41 +0200 Subject: [PATCH] Lower approved strategy edge threshold Proof: Strategy gross edge threshold is lowered to the user-approved 0.99 percent in repo defaults and Kubernetes deploy config; targeted threshold tests, dashboard build, and full npm test pass. Assumptions: User explicitly approved lowering below the previous 1.49 percent guard for the active BTC/EURe NEAR Intents pair; max notional and funds exposure are unchanged. Still fake: Venue-native terminal fill events, fee attribution, realized per-trade PnL, and full inventory-skew strategy controls remain incomplete. --- deploy/k8s/base/unrip.yaml | 2 +- src/lib/config.mjs | 2 +- test/strategy-threshold-config.test.mjs | 24 ++++++++++++++++++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 test/strategy-threshold-config.test.mjs diff --git a/deploy/k8s/base/unrip.yaml b/deploy/k8s/base/unrip.yaml index a44a83d..4d44717 100644 --- a/deploy/k8s/base/unrip.yaml +++ b/deploy/k8s/base/unrip.yaml @@ -78,7 +78,7 @@ data: MARKET_REFERENCE_COINGECKO_URL: https://api.coingecko.com/api/v3/simple/price?ids=bitcoin&vs_currencies=eur INVENTORY_SYNC_REFRESH_MS: "15000" LIQUIDITY_REFRESH_MS: "30000" - STRATEGY_GROSS_THRESHOLD_PCT: "1.49" + STRATEGY_GROSS_THRESHOLD_PCT: "0.99" STRATEGY_INITIAL_ARMED: "false" STRATEGY_MAX_NOTIONAL_EURE: "150" STRATEGY_PRICE_MAX_AGE_MS: "30000" diff --git a/src/lib/config.mjs b/src/lib/config.mjs index 3f9c355..d227bc9 100644 --- a/src/lib/config.mjs +++ b/src/lib/config.mjs @@ -62,7 +62,7 @@ const DEFAULTS = { 'https://api.coingecko.com/api/v3/simple/price?ids=bitcoin&vs_currencies=eur', inventorySyncRefreshMs: 15_000, liquidityRefreshMs: 30_000, - strategyGrossThresholdPct: 1.49, + strategyGrossThresholdPct: 0.99, strategyInitialArmed: false, strategyMaxNotionalEure: 5, strategyPriceMaxAgeMs: 30_000, diff --git a/test/strategy-threshold-config.test.mjs b/test/strategy-threshold-config.test.mjs new file mode 100644 index 0000000..d9cdfa2 --- /dev/null +++ b/test/strategy-threshold-config.test.mjs @@ -0,0 +1,24 @@ +import test from 'node:test'; +import assert from 'node:assert/strict'; +import { readFileSync } from 'node:fs'; + +import { loadConfig } from '../src/lib/config.mjs'; + +test('repo default strategy threshold reflects explicitly approved 0.99 percent edge', () => { + const previous = process.env.STRATEGY_GROSS_THRESHOLD_PCT; + delete process.env.STRATEGY_GROSS_THRESHOLD_PCT; + + try { + const config = loadConfig({ envPath: '/tmp/unrip-no-such-env-file' }); + assert.equal(config.strategyGrossThresholdPct, 0.99); + } finally { + if (previous == null) delete process.env.STRATEGY_GROSS_THRESHOLD_PCT; + else process.env.STRATEGY_GROSS_THRESHOLD_PCT = previous; + } +}); + +test('kubernetes strategy threshold deploys the approved 0.99 percent edge', () => { + const manifest = readFileSync(new URL('../deploy/k8s/base/unrip.yaml', import.meta.url), 'utf8'); + assert.match(manifest, /STRATEGY_GROSS_THRESHOLD_PCT: "0\.99"/); + assert.doesNotMatch(manifest, /STRATEGY_GROSS_THRESHOLD_PCT: "1\.49"/); +});