Loading...
Searching...
No Matches
stock_wire.h File Reference

The watchlist as the phone packs it, and the reader that unpacks it. More...

#include <stdbool.h>
#include <stdint.h>
#include "wire/wire_caps.g.h"

Go to the source code of this file.

Data Structures

struct  StockSlot
 One quote slot. When ok is false the symbol field carries a short status word ("RATE LIMIT" and friends) instead of a ticker so the watch has something to show. More...
struct  StockStrip
 The watchlist strip. count is 0 until a reading lands. More...

Functions

bool stock_wire_decode (const uint8_t *buf, uint16_t len, StockStrip *out)
 Unpacks a watchlist off the wire.

Detailed Description

The watchlist as the phone packs it, and the reader that unpacks it.

The phone sends the watchlist as one run of bytes with the quotes laid end to end, each carrying its own symbol length. Nothing about it is fixed width, so the reader walks it and checks every step against the length it was handed. The bytes come off a phone, so none of it is trusted.

The packer on the other side is ts/pkjs/wire.ts, and the two have to agree exactly.