unrip/test/strategy-threshold-config.test.mjs
philipp c91c8f00de
All checks were successful
deploy / deploy (push) Successful in 33s
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.
2026-04-12 15:52:41 +02:00

24 lines
1,004 B
JavaScript

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"/);
});