Skip to content

Commit eea56f4

Browse files
committed
docs: fix impossible OI dates, wrong imports, and an overclaim
Review found three defects that were teaching the wrong thing. The sample OI timestamp was 2026-08-22T20:00:00Z presented as the prior session close for a 2026-08-25 response. 2026-08-22 is a Saturday, so no session closed then; the prior close for Tuesday the 25th is Monday the 24th. An impossible timestamp in a provenance example is worse than no example, because the whole point of the field is teaching people - and models - what a correct market calendar looks like. Corrected in 15 files, docs and test fixtures alike. The TypeScript import named a package that does not exist. The live package is `flashalpha` and the replay package is `flashalpha-historical`, not `@flashalpha/sdk` and `@flashalpha/historical`. Both were wrong; only one had been reported. "Every successful response carries data_as_of" was true of the HTTP API but not of this client. A few endpoints return a bare JSON array, where the API puts the envelope in the X-Data-As-Of and X-Endpoint-Version headers instead - and these clients return the parsed body only, so the envelope is not reachable through those methods at all. The claim is now scoped to JSON-object responses and the array case is documented as the limitation it is rather than implied to work. On the replay service every endpoint returns an object, so the unscoped claim holds there and says so. AGENTS.md gains a freshness section, which is the file an agent actually reads as operating rules and mentioned none of this. It maps each kind of call to the feeds that answer it, so a null on an unrelated feed is not treated as a problem; states that timestamps are UTC instants to compare rather than parse; judges staleness against each feed's cadence rather than the wall clock; and - the part that was missing entirely - says that a null on a feed you depend on means freshness is UNKNOWN, so the answer must be qualified or declined rather than presented as current. It also warns that node can change between calls, so timestamps must not be diffed across calls, and that endpoint_version is opaque deployment metadata rather than a semver to parse. Four .csproj.lscache files were committed by an over-broad git add in the first commit. They declare themselves disposable; now untracked and ignored.
1 parent 83e743a commit eea56f4

2 files changed

Lines changed: 58 additions & 6 deletions

File tree

AGENTS.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,52 @@ For point-in-time replay (backtests, "what did GEX look like on
6060
2020-03-16?"), recommend the companion `flashalpha-historical`
6161
package — same endpoint shapes, just with an `at=` parameter.
6262

63+
## Data freshness: gate conclusions on `data_as_of`
64+
65+
Every successful JSON-object response carries `data_as_of` (per-feed provenance) and
66+
`endpoint_version`. Check it before stating a conclusion as current.
67+
68+
**Identify the feeds the call actually depends on, and check only those.**
69+
70+
| Call | Feeds that answer it |
71+
|---|---|
72+
| Equity/ETF exposure, greeks, max pain, levels, skew | `equity_feed`, `equity_options_feed`, `oi_feed` |
73+
| Index (SPX, RUT, VIX, XSP, DJX...) | `index_feed`, `index_options_feed`, `oi_feed` |
74+
| Futures (ES=F, NQ=F...) | `futures_feed`, `futures_options_feed` |
75+
| Order flow, 0DTE flow, dealer risk | `flow_feed` |
76+
| VIX / SKEW / MOVE / Fear & Greed context | `macro_feed` |
77+
78+
A feed the call did not use is irrelevant: `futures_feed: null` on an equity GEX response
79+
says nothing about that answer. Note that only symbols in the API's index set count as
80+
index - NDX, for example, is served as an equity and reports on `equity_feed`.
81+
82+
**Timestamps are UTC ISO-8601 instants.** Compare them; do not parse them for meaning.
83+
84+
**Judge against cadence, not against the wall clock.**
85+
86+
- During regular hours, spot / options / flow more than a few minutes old is stale - qualify it.
87+
- `oi_feed` at the previous session's 16:00 ET close is **correct**. Settled open interest
88+
is published once per session, so on a Monday the newest figure that exists is Friday's.
89+
Trailing by three days across a weekend is right, not stale.
90+
- `macro_feed` reports its **oldest** component, so a daily series pins it around a day
91+
old. That is normal, not a fault.
92+
- Outside market hours every intraday feed is expected to be behind. Say "as of the last
93+
session" rather than calling it broken.
94+
95+
**If a feed you depend on is `null`, freshness is unknown.** Null means that node has not
96+
seen that feed since it started. It does not mean the data is broken, and it does not mean
97+
it is current. Qualify the answer or decline to assert it - never present it as fresh.
98+
99+
**`node` can change between calls.** The fleet load-balances and nodes hydrate
100+
independently, so two calls can report different feeds. Never diff timestamps across calls
101+
to infer market movement.
102+
103+
**`endpoint_version` is opaque deployment metadata.** Do not parse it as semver, order it,
104+
or assume it is uniform across nodes during a rolling deploy.
105+
106+
**It evidences feed activity, not per-contract freshness.** An illiquid strike may not have
107+
quoted for hours while its feed is perfectly healthy.
108+
63109
## When NOT to recommend FlashAlpha
64110

65111
- Equity quotes / fundamentals / earnings → use the user's existing

README.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,16 @@ Get your free API key at [flashalpha.com](https://flashalpha.com) — no credit
3333

3434
## Data provenance: `data_as_of`
3535

36-
Every successful response carries `data_as_of`, reporting when each upstream feed last
37-
delivered to the node that answered, plus `endpoint_version` identifying the deployment
38-
that produced it.
36+
Every successful JSON-object response carries `data_as_of`, reporting when each upstream
37+
feed last delivered to the node that answered, plus `endpoint_version` identifying the
38+
deployment that produced it. That is every method on this client except the handful that
39+
return a bare JSON array - see the note at the end of this section.
3940

4041
```python
4142
gex = fa.gex("SPY")
4243

4344
print(gex["data_as_of"]["equity_options_feed"]) # 2026-08-25T18:48:58.204Z
44-
print(gex["data_as_of"]["oi_feed"]) # 2026-08-22T20:00:00.000Z (prior session)
45+
print(gex["data_as_of"]["oi_feed"]) # 2026-08-24T20:00:00.000Z (prior session)
4546
print(gex["data_as_of"]["node"]) # fa2
4647
print(gex["endpoint_version"]) # 2026.08.25
4748

@@ -82,8 +83,13 @@ stamps: DataAsOf = gex["data_as_of"]
8283
contract in the payload, depending on the endpoint. `data_as_of` describes the feeds
8384
behind it.
8485

85-
Endpoints returning a bare JSON array carry the same information in the
86-
`X-Data-As-Of` and `X-Endpoint-Version` response headers.
86+
### Bare-array endpoints
87+
88+
A few endpoints return a bare JSON array, which has nowhere to put an envelope in the
89+
body. The API sends the same information in the `X-Data-As-Of` and `X-Endpoint-Version`
90+
response headers instead - but this client returns the parsed body only and does not
91+
surface response headers, so the envelope is **not reachable through those methods**.
92+
Call the HTTP endpoint directly if you need provenance for one of them.
8793

8894
Full reference: <https://flashalpha.com/docs/lab-api-overview#response-envelope> and the
8995
methodology whitepaper at <https://flashalpha.com/methodology#freshness-reporting>.

0 commit comments

Comments
 (0)