unrip/test/strategy-threshold-config.test.mjs
philipp 729d2ade0e
Some checks failed
deploy / deploy (push) Failing after 43s
Implement pair-native trade semantics
Proof: Pair-native trade semantics and multi-asset outcome truth; strategy, request preflight, outcome attribution, valuation visibility, dashboard labels, alerts, and ops watch paths now use DB pair/asset/route metadata with nBTC/EURe compatibility and nBTC/USDC regressions covered.

Assumptions: Postgres asset, pair, strategy config, and price route rows remain canonical; supported reference adapters remain BTC/EUR and BTC/USDC; deployment is push-driven through the existing Forgejo workflow.

Still fake: Arbitrary multi-hop valuation, new execution venues, fee-complete realized PnL, venue-native terminal fill ingestion, and autonomous optimization remain unbuilt.
2026-05-18 18:52:18 +02:00

31 lines
1.3 KiB
JavaScript

import test from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
import {
CURRENT_PAIR_KEY,
buildSeedStrategyConfig,
} from '../src/core/trading-config.mjs';
test('repo DB seed carries the approved 49 bps current-pair edge', () => {
const config = buildSeedStrategyConfig(CURRENT_PAIR_KEY);
assert.equal(config.edgeBps, 49);
});
test('kubernetes production config does not carry pair, asset, or edge env vars', () => {
const manifest = readFileSync(new URL('../deploy/k8s/base/unrip.yaml', import.meta.url), 'utf8');
assert.doesNotMatch(manifest, /NEAR_INTENTS_PAIR_FILTER/);
assert.doesNotMatch(manifest, /TRADING_BTC_/);
assert.doesNotMatch(manifest, /TRADING_EURE_/);
assert.doesNotMatch(manifest, /STRATEGY_GROSS_THRESHOLD_PCT/);
assert.doesNotMatch(manifest, /STRATEGY_MAX_NOTIONAL_EURE/);
assert.doesNotMatch(manifest, /INTENT_REQUEST_DEFAULT_AMOUNT_EURE/);
assert.doesNotMatch(manifest, /INTENT_REQUEST_MAX_AMOUNT_EURE/);
});
test('live market-maker watch script reads DB assets instead of removed trading env vars', () => {
const source = readFileSync(new URL('../scripts/ops/watch_live_mm.py', import.meta.url), 'utf8');
assert.match(source, /from trading_assets/);
assert.doesNotMatch(source, /TRADING_BTC_ASSET_ID/);
assert.doesNotMatch(source, /TRADING_EURE_ASSET_ID/);
});