Skip to content

stat_to_dataframe references nonexistent StatMsg fields (stat_value, flags) — throws on any STATISTICS records #33

Description

@tbeason

Line refs are against the registered v0.1.3 tarball.

Problem

stat_to_dataframe (src/export.jl:288) references fields that do not exist on StatMsg:

stat_value = [r.stat_value for r in records],
flags      = [r.flags for r in records],

StatMsg (src/messages.jl:250) has price, quantity, and stat_flags — there is no stat_value and no flags. Any call throws ErrorException: type StatMsg has no field stat_value.

Impact

records_to_dataframe dispatches to this for statistics records (src/export.jl:124), so DatabentoAPI.to_dataframe, to_csv, to_json, and to_parquet all fail for the STATISTICS schema. The mismatch suggests this path has no test against a constructed StatMsg.

Suggested fix

price    = [price_to_float(r.price) for r in records],
quantity = [r.quantity for r in records],
flags    = [r.stat_flags for r in records],

(plus ts_ref, stat_type, channel_id, update_action, which are useful columns for this schema), and a unit test that round-trips a synthetic StatMsg through records_to_dataframe.

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