Skip to content

Docs: foreach_record example calls a nonexistent method (positional record type) #32

Description

@tbeason

Line refs are against the registered v0.2.0 tarball.

Problem

docs/src/guide/historical.md ("Streaming records: foreach_record") shows:

foreach_record(client, DBN.TradeMsg;
    dataset = "XNAS.ITCH", schema = Schema.TRADES, ...) do trade
    ...
end

i.e. a positional record-type argument after client. The actual method (src/historical/timeseries.jl:111) is:

foreach_record(f, c::Historical; dataset, schema, ..., record_type = nothing)

There is no positional-type method, so the documented call raises a MethodError. The surrounding prose ("The first argument after client is the concrete record type...") is wrong too; the type is inferred from schema by default and overridable via the record_type kwarg.

Suggested fix

Update the example to:

foreach_record(client;
    dataset = "XNAS.ITCH", schema = Schema.TRADES,
    symbols = ["AAPL"],
    start_dt = DateTime(2024, 1, 2, 14, 30),
    end_dt   = DateTime(2024, 1, 2, 20, 0)) do trade
    n_trades[] += 1
end

and fix the paragraph below it. A doctest would prevent regression.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions