> Every Taji docs page as Markdown: https://docs.taji.is/llms.txt

# Read bars over the wire with curl

This call reads a symbol's last five daily bars from your own Taji over its local [wire](https://docs.taji.is/reference/glossary.md), with `curl` and a token Taji writes for you.

You need a running Taji, `curl`, and Python with `pyarrow` (`pip install pyarrow`) to decode the answer.

Run the call:

```sh
STATE="$HOME/Library/Application Support/Taji"
curl -s -w '%{http_code} %{content_type}\n' -o bars.arrow \
  -H "x-taji-token: $(cat "$STATE/wire-token")" \
  "http://localhost:$(cat "$STATE/wire-port")/get/bars?symbols=equity:SPY&timeframe=D&limit=5"
python3 -c 'import pyarrow as pa; t = pa.ipc.open_stream(open("bars.arrow", "rb")).read_all(); print({k.decode(): v.decode() for k, v in t.schema.metadata.items()}); print(t.to_pylist())'
```

1. **`STATE`** is the state dir, where the kernel keeps its files. This is the macOS path; on Linux it is `~/.local/share/taji` and on Windows `%LOCALAPPDATA%\Taji` ([configuration](https://docs.taji.is/reference/configuration.md)).
2. **`wire-port`** holds the port the kernel listens on, on `127.0.0.1` only. The kernel writes it once the listener is bound.
3. **`wire-token`** holds the `local` token: 32 random bytes in hex, new each launch, readable by you alone. Every request carries it in the `x-taji-token` header; without it the kernel answers 401 `unauthorized` before any work. Treat it as a password for this launch.
4. **`/get/bars`** reads OHLCV bars. `symbols` is a comma list of items, each `kind:text` (`equity:SPY`; a bare `SPY` is 400). `timeframe` is one of `1m 5m 15m 30m 1h 4h D W M Y` or a multiple in the same spelling, case-sensitive. `limit` with no `from` asks for a tail: the newest five bars.
5. **`-w`** prints the status and content type: `200 application/vnd.apache.arrow.stream`. Bars always answer as an [Arrow](https://arrow.apache.org/docs/format/Columnar.html#ipc-streaming-format) IPC stream of one batch; the wire offers no JSON form of them. A refusal is JSON instead, `{"error": <code>, "reason": <prose>}` at its own status, so read `bars.arrow` as text when the status is not 200.
6. **`python3`** decodes the stream and prints the stream's schema metadata, each value a string, then the rows. The answer below holds both: `metadata` and `rows`.

The same call as the harness decoded it to JSON, its `"meta": true` keeping the metadata beside the rows (prices are `Decimal128` on the wire, instants UTC timestamps):

```json file="examples/wire-read-bars/bars.json"
{
  "metadata": {
    "adjustment": "raw",
    "dataset_id": "bars:csv-source:SPY:D:raw",
    "provider": "{\"equity:SPY\":\"csv-source\"}",
    "source": "{\"equity:SPY\":\"vendor\"}",
    "timeframe": "D"
  },
  "rows": [
    {
      "symbol": "SPY",
      "provider": "csv-source",
      "start_dt": "2026-11-27T00:00:00+00:00",
      "knowable": "2026-11-27T18:00:00+00:00",
      "open": 139.47,
      "high": 139.58,
      "low": 139.38,
      "close": 139.51,
      "volume": 2400000,
      "vwap": null,
      "trade_count": null,
      "up_volume": null,
      "down_volume": null
    },
    {
      "symbol": "SPY",
      "provider": "csv-source",
      "start_dt": "2026-11-30T00:00:00+00:00",
      "knowable": "2026-11-30T21:00:00+00:00",
      "open": 139.56,
      "high": 140.04,
      "low": 138.89,
      "close": 139.93,
      "volume": 4000000,
      "vwap": null,
      "trade_count": null,
      "up_volume": null,
      "down_volume": null
    },
    {
      "symbol": "SPY",
      "provider": "csv-source",
      "start_dt": "2026-12-01T00:00:00+00:00",
      "knowable": "2026-12-01T21:00:00+00:00",
      "open": 139.8,
      "high": 140.71,
      "low": 139.01,
      "close": 140.42,
      "volume": 4400000,
      "vwap": null,
      "trade_count": null,
      "up_volume": null,
      "down_volume": null
    },
    {
      "symbol": "SPY",
      "provider": "csv-source",
      "start_dt": "2026-12-02T00:00:00+00:00",
      "knowable": "2026-12-02T21:00:00+00:00",
      "open": 140.84,
      "high": 141.21,
      "low": 140.78,
      "close": 141.19,
      "volume": 4500000,
      "vwap": null,
      "trade_count": null,
      "up_volume": null,
      "down_volume": null
    },
    {
      "symbol": "SPY",
      "provider": "csv-source",
      "start_dt": "2026-12-03T00:00:00+00:00",
      "knowable": "2026-12-03T21:00:00+00:00",
      "open": 141.45,
      "high": 143.43,
      "low": 141.23,
      "close": 142.62,
      "volume": 5000000,
      "vwap": null,
      "trade_count": null,
      "up_volume": null,
      "down_volume": null
    }
  ]
}
```

*Captured 2026-12-04 on a headless kernel reading a made-up daily series for SPY.*

- `metadata` is the envelope. `timeframe` is the word you asked, `D`; `adjustment` is the price basis served, `raw`; `dataset_id` names what the bars are, `bars:csv-source:SPY:D:raw`. `source` and `provider` are JSON objects keyed by item: `equity:SPY` came from the `vendor`, not the store, and `csv-source` answered. `segments`, `missing` and `cursor` appear only when they apply, and none does here: nothing failed and the answer was not clamped.
- Each row is one bar, oldest first: `symbol` without its kind, `provider` the source that served it, `csv-source` in this capture (`yahoo` on a keyless kernel), then `open`, `high`, `low`, `close` and `volume`.
- `start_dt` is the session's date at UTC midnight. `knowable` is when the bar could first be read: its session's close, 21:00 UTC (16:00 ET) on a full day and 18:00 UTC (13:00 ET) on 2026-11-27, the half day after Thanksgiving. No row is dated 2026-11-26, when the market was shut.
- `vwap`, `trade_count`, `up_volume` and `down_volume` are `null`: the source does not state them.

## Change it

Read a span instead of a tail. A `YYYY-MM-DD` in `from` or `to` is a New York session date, taken whole, so this asks for November's sessions through 2026-12-01:

```diff
-  "http://localhost:$(cat "$STATE/wire-port")/get/bars?symbols=equity:SPY&timeframe=D&limit=5"
+  "http://localhost:$(cat "$STATE/wire-port")/get/bars?symbols=equity:SPY&timeframe=D&from=2026-11-02&to=2026-12-01"
```

Read hourly bars of two symbols, the pre- and post-market included:

```diff
-  "http://localhost:$(cat "$STATE/wire-port")/get/bars?symbols=equity:SPY&timeframe=D&limit=5"
+  "http://localhost:$(cat "$STATE/wire-port")/get/bars?symbols=equity:SPY,equity:QQQ&timeframe=1h&limit=20&session=extended"
```

Read the bars as of a past instant, so no bar formed after it is in the answer:

```diff
-  "http://localhost:$(cat "$STATE/wire-port")/get/bars?symbols=equity:SPY&timeframe=D&limit=5"
+  "http://localhost:$(cat "$STATE/wire-port")/get/bars?symbols=equity:SPY&timeframe=D&from=2026-11-02&at=2026-11-20T21:00:00Z"
```

## Next

- [Wire](https://docs.taji.is/reference/wire.md): listeners, token scopes, refusals and Arrow answers.
- [Configuration](https://docs.taji.is/reference/configuration.md): the state dir and every file in it.
- [Data](https://docs.taji.is/architecture/data.md): where a bar comes from and how the store keeps it.
