unrip/test/strategy-engine-static.test.mjs
philipp 04c59ee93d
All checks were successful
deploy / deploy (push) Successful in 56s
Enforce maker min notional
Proof: strategy now enforces DB-backed pair min_notional and verifies rounded gross edge remains at or above configured edge before emitting commands; dust exact-out quotes persist as strategy skips instead of relay attempts.

Assumptions: 1 USD/EUR-equivalent minimum is an approved strategy policy for active maker pairs; this changes only stricter DB-backed strategy gating and does not loosen edge, max notional, inventory, arming, pair enablement, or response-age behavior.

Still fake: venue-native terminal fill ids and fee-complete realized PnL remain unavailable.
2026-05-19 17:06:20 +02:00

27 lines
1.1 KiB
JavaScript

import test from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
const source = readFileSync(new URL('../src/apps/strategy-engine.mjs', import.meta.url), 'utf8');
test('strategy duplicate quote tracking is bounded and state-safe', () => {
assert.match(source, /createRecentIdCache\(\{ limit: 5000 \}\)/);
assert.match(source, /seenQuotes\.has/);
assert.match(source, /seenQuotes\.getState\(\)/);
assert.doesNotMatch(source, /seen_quotes:\s*\{\}/);
});
test('strategy execute commands stamp command publish time into durable observed time', () => {
assert.match(
source,
/const commandPublishedAt = new Date\(\)\.toISOString\(\)/,
);
assert.match(source, /command_published_at: commandPublishedAt/);
assert.match(source, /quote_age_at_command_ms: makerTiming\.quote_age_at_command_ms/);
assert.match(source, /observedAt:\s*commandPublishedAt/);
});
test('strategy control edge updates preserve DB-backed min notional policy', () => {
assert.match(source, /path: '\/pair-config\/edge'/);
assert.match(source, /minNotional: body\.min_notional/);
});