Repository navigation
fix(sensor): re-point to www.bitstamp.net after source drift - #18
Merged
Merged
Conversation
Coinbase Exchange (api.exchange.coinbase.com) was added to .research/source-firewall.json (simulated feed retirement), so the sensor could no longer reach its declared source. Re-point SOURCE and fetchEntries() to Bitstamp's public OHLC endpoint, which is unauthenticated, plainly fetchable JSON, and not present in the firewall list. Fixes #17
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Issue #17: the sensor's declared source,
api.exchange.coinbase.com, wasadded to
.research/source-firewall.json(simulated feed retirement),so every sense run drifts with
source-firewalledinstead of producing anedition.
Evidence trail
Chosen source:
https://www.bitstamp.net/api/v2/ohlc/btcusd/?step=86400&limit=20Host
www.bitstamp.netis not present in.research/source-firewall.json(only
api.exchange.coinbase.comis blocked).No API key required — plain unauthenticated
GET.Plainly fetchable JSON (verified via
curl, no JS rendering needed).Confirmed live via
curlon 2026-07-04 (UTC "today" = 2026-07-04):{"data": {"pair": "BTC/USD", "ohlc": [ {"timestamp": "1781913600", "open": "63487.34", "high": "64334.69", "low": "63133.21", "close": "64245.72", "volume": "610.71977158"}, {"timestamp": "1782000000", "open": "64225.99", "high": "64522.00", "low": "63197.23", "close": "63237.18", "volume": "551.09674747"}, ... {"timestamp": "1783123200", "open": "62522.45", "high": "62888...", "close": "62541.58", "volume": "..."} ]}}Decoding
timestampshows the buckets are UTC-midnight-aligned, one percalendar day, ascending, with the last bucket (
1783123200→2026-07-04T00:00:00Z) being today's still-in-progress candle:Entry contract:
step=86400&limit=20returns 20 daily buckets; afterfiltering out the current (incomplete) UTC day, 19 completed days remain
— well over the required minimum of 9. Each bucket maps directly to
{ day: "YYYY-MM-DD", close: Number }, ascending (buckets already arriveascending; sorted defensively by
timestampto guarantee the contract).Change
sensor.mjsonly:SOURCE→ Bitstamp's public OHLC endpoint.fetchEntries()→ readsres.json().data.ohlc, sorts bytimestamp,drops the current UTC day, and maps
{timestamp, close}(strings) to{ day, close: Number }.sensor-lib.mjs, the firewall, workflows, tests, and the artifact schemaare untouched.
Verification
node --test→ 10/10 passing.node sensor.mjs→ emits:{"changed":true,"descriptor":"btcusd-2026-07-03","source":"https://www.bitstamp.net/api/v2/ohlc/btcusd/?step=86400&limit=20","retrievedAt":"2026-07-04T12:53:53.971Z","hash":"sha256:...","artifacts":["data/btcusd/btcusd-2026-07-03.json"]}data/btcusd/btcusd-2026-07-03.jsoncontains aplausible edition (
close: 62522.46,ma7_trend: "rising", etc.).Fixes #17