bitflow-market-maker-public/test/bitflow.test.ts
Bought 1e29d2b543 Initial commit: Bitflow DLMM curve market maker (public edition)
Public, competition-facing build of the Bitflow market maker, scoped to the
two competition pairs: sBTC/USDCx (dlmm_1) and STX/USDCx (dlmm_14).

Both pairs run the same CoinGecko reference feed plus a geometric multi-bin
curve peaked at the active bin (weight = CURVE_DECAY^|offset|). CoinGecko is
used only for divergence/staleness safety and inventory awareness, never as a
quoted price.

Includes the production guards: M2 vol scaling, M2b reposition cooldown,
M4 pull-bids / M6 bid-lean, and the M5 hard-cap de-risk swap, plus the kill
switch, API circuit breaker, gas floor, and deny-mode post-conditions.

Defaults to EXECUTION_MODE=dry_run.
2026-09-09 15:53:05 -07:00

30 lines
1,014 B
TypeScript

import { describe, expect, it } from 'vitest';
import { isPoolActive } from '../src/bitflow';
describe('isPoolActive', () => {
it('respects an explicit boolean status', () => {
expect(isPoolActive(true)).toBe(true);
expect(isPoolActive(false)).toBe(false);
});
it('treats known inactive strings as inactive (case-insensitive)', () => {
for (const s of ['inactive', 'Paused', 'DISABLED', 'closed', 'halted', 'false']) {
expect(isPoolActive(s)).toBe(false);
}
});
it('treats active/unknown truthy strings as active', () => {
expect(isPoolActive('active')).toBe(true);
expect(isPoolActive('open')).toBe(true);
expect(isPoolActive('something_new')).toBe(true);
});
it('falls back to the app-pool flag when status is missing', () => {
expect(isPoolActive(undefined, false)).toBe(false);
expect(isPoolActive(undefined, true)).toBe(true);
});
it('defaults to active when nothing is known', () => {
expect(isPoolActive(undefined)).toBe(true);
});
});