Documentation
¶
Overview ¶
Package probnode reads the real-time stream `/v2/live` from Go: connect with an account's API key, subscribe markets and channels, and read messages - JSON objects, or Probe records (pnb) when the connection asked for `format: probe`.
c, err := probnode.Dial(ctx, "wss://live.probnode.com/v2/live", key, probnode.Probe)
// or, over dropped connections: probnode.DialWith(ctx, url, key, probnode.Options{Format: probnode.Probe, Reconnect: true})
err = c.Subscribe(ctx, []string{"btc-updown-15m-1795366800"}, []string{"book+", "trades+"}, nil)
for {
m, err := c.Next(ctx)
...
for _, r := range m.Records { if p, ok := r.(*pnb.ProbnodeExt); ok { ... } }
}
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is one connection.
func (*Client) Next ¶
Next reads the next frame. With Reconnect, a dropped connection is reopened and resubscribed here and reading goes on; Close (or ctx) ends it.
type Message ¶
type Message struct {
JSON map[string]any
Records []pnb.Record
// Unknown counts records of types this build does not know (skipped by their length).
Unknown int
}
Message is one frame: a JSON object (JSON set) or the Probe records of a binary frame.
type Options ¶
type Options struct {
Format Format
// Reconnect reopens a dropped connection (backing off 0.5 s to 30 s) and sends every active
// subscription again; each starts with a fresh snapshot.
Reconnect bool
// OnGap, when set, gets the wall-clock stretch nothing was received, after a reconnect.
OnGap func(from, to time.Time)
// Compress offers permessage-deflate: less bandwidth, more CPU on both ends.
Compress bool
}
Options of a connection.
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
stream
command
Stream the current 15-minute BTC up-or-down market: book+ and trades+, with the probnode object.
|
Stream the current 15-minute BTC up-or-down market: book+ and trades+, with the probnode object. |
|
Package pnb is the probnode binary encoding: one fixed-width, little-endian record layout used in the engine's memory, on the wire and in the archive, so nothing is re-encoded between them (docs/LIVE.md, "Format: PNB"; after Databento's DBN).
|
Package pnb is the probnode binary encoding: one fixed-width, little-endian record layout used in the engine's memory, on the wire and in the archive, so nothing is re-encoded between them (docs/LIVE.md, "Format: PNB"; after Databento's DBN). |