Skip to content

Pair discovery and equity backtests can read nichedb - #34

Merged
ralyodio merged 1 commit into
masterfrom
nichedb-mirror
Sep 11, 2026
Merged

ralyodio merged 1 commit into
masterfrom
nichedb-mirror

Conversation

@ralyodio

Copy link
Copy Markdown
Contributor

Every five minutes the arb daemon asked CoinGecko and four exchanges which pairs exist, how much they traded and what they are worth; a backtest asked Yahoo for a year of bars. nichedb.dev keeps both now (0.8.0: crypto collection, markets kind history), so this adds the other path behind switches and leaves the old one in place.

NICHEDB_CRYPTO=1: discoverPairs() reads the dollar-quoted pairs and the assets by market cap from nichedb (about ten requests per five-minute refresh) and applies the same rules: USD books only, two venues or more, $50k a day on each (a null volume passes, the way the Gemini sentinel did), $10M of market cap when known. Any failure or an empty answer → the CoinGecko + venue path, logged once. The existing five-minute cache covers both.

NICHEDB_MARKETS=1: the web backtest route and the CLI read the symbol's history item (one request) before Alpaca/Yahoo, and fall back when the window is longer than 400 days, the item is missing or stale, or does not reach back to the requested start.

The client is its own workspace package, @b1dz/source-nichedb, since the web route and the CLI need it and must not pull the exchange feeds in to read a bar. Switches off ⇒ zero nichedb requests (tested in all three consumers). Real-time feeds, private APIs, DEX, Pump.fun and DealDash are untouched.

Tests: source-nichedb 30, crypto-arb 64 (5 new), web 100 (4 new), cli 31 (3 new); tsc --noEmit clean. Repo lint is broken on main by typescript-eslint vs TS 7 (pre-existing, unrelated).

Noticed, not fixed: normalizeKrakenBase('XXBTZUSD') yields BT, so the live discovery path maps Kraken's BTC book to BT-USD; the nichedb path uses data.base and is unaffected.

🤖 Generated with Claude Code

https://claude.ai/code/session_014X1XCwt5iD3nqZfbddZqEP

Every five minutes the arb daemon asked CoinGecko and four exchanges
which pairs exist, how much they traded and what they are worth;
a backtest asked Yahoo for a year of bars. nichedb.dev keeps both now.
With NICHEDB_CRYPTO=1 discovery reads the dollar-quoted pairs and the
assets by market cap from nichedb, about ten requests, and applies
the same rules: two venues or more, fifty thousand dollars a day on
each, ten million of market cap, a null volume passing the way the
Gemini sentinel did. With NICHEDB_MARKETS=1 a backtest reads the
symbol's history item and falls back to Yahoo when the window is
longer than the item, the item is stale, or the symbol is too new.
Either switch off means no request; any failure means the old path.

The client is its own package, since the web route and the CLI need
it and must not pull the exchange feeds in to read a bar.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014X1XCwt5iD3nqZfbddZqEP
@github-actions

Copy link
Copy Markdown

ThreatCrush Security Scan

14 finding(s)

HIGH/CRITICAL: 5 | MEDIUM: 8 | LOW: 1

Severity Rule Location
HIGH secret-private-key apps/cli/src/setup.ts:129
HIGH secret-private-key apps/web/src/app/settings/sections/cex.tsx:137
HIGH secret-private-key packages/core/src/plugin-catalog.ts:27
HIGH secret-private-key packages/source-crypto-arb/src/feeds/coinbase-pem.ts:15
HIGH secret-private-key packages/source-crypto-arb/src/feeds/coinbase-pem.ts:32
MEDIUM js-predictable-cipher-iv apps/cli/src/crypto-key.ts:49
MEDIUM js-predictable-cipher-iv apps/daemon/src/user-config.ts:120
MEDIUM js-unescaped-html-sink apps/web/src/app/layout.tsx:117
MEDIUM js-unescaped-html-sink apps/web/src/app/page.tsx:425
MEDIUM js-dynamic-code-execution packages/core/src/runtime-cache.ts:247
MEDIUM js-dynamic-code-execution packages/core/src/runtime-cache.ts:267
MEDIUM js-predictable-cipher-iv scripts/seed-user-settings.cjs:80
MEDIUM js-predictable-cipher-iv scripts/seed-user-settings.mjs:91
LOW js-predictable-cipher-iv apps/web/src/lib/browser-crypto.test.ts:40

Snippets are redacted; ThreatCrush never prints matched credential material.

@ralyodio
ralyodio merged commit 70b133a into master Sep 11, 2026
7 checks passed
@ralyodio
ralyodio deleted the nichedb-mirror branch September 11, 2026 06:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant