QuiverInsiderTrading readers throw (fatal) on rows in a legacy column layout; validate column count and return null
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 72/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- csharp
- Lĩnh vực
- data-engineering
Hướng nghiên cứu
Start with QuiverInsiderTradingUniverse.cs:150 and QuiverInsiderTrading.cs, then review the cited SubscriptionDataReader.cs handling of BaseData.Reader returning null. Reproduce the malformed rows over the 2026-07-27 to 2026-08-05 window; done means unexpected column counts or unparseable fields are skipped without a reader exception, while the current layouts still produce data points.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
Both QuiverInsiderTradingUniverse.Reader and QuiverInsiderTrading.Reader assume every CSV line is in the current 16-column (universe) / 15-column (per-ticker) layout. A line in any other shape throws out of the reader, and LEAN treats a reader exception as a fatal runtime error (SubscriptionDataReader.cs:551 -> ReaderErrorDetected -> IResultHandler.RuntimeError), so one stray row in one daily file stops every algorithm that subscribes to the universe. The readers should validate the column count and return null for a line they cannot parse, so a bad row costs one data point instead of the whole backtest.
This is a sibling of #9 (legacy 14-column rows after the Name field was added). The rows here are older still: the pre-a50ad5f1 layout, and they fail on the date parse before any index is out of range, so the hasName fallback proposed in #9 does not cover them.
Evidence
Universe file alternative/quiver/insidertrading/universe/20260731.csv on the cloud data store (read from a backtest on LEAN 2.5.0.0.18114, 2026-09-21): 663 rows, 497 in the 16-column layout and 166 in the pre-refactor 6-column layout {sid},{ticker},{name},{shares},{price},{sharesOwnedFollowing}, spanning 37 tickers. Example:
ASPS UF02B1SL6QG5,ASPS,winkler matthew t.,1000.0,5.045,39989.0
The matching per-ticker file asps.csv carries the same trades twice: once in the 15-column layout and once as 5-column {date},{name},{shares},{price},{sharesOwnedFollowing} rows:
20260731,,20260730,P,5.045,1000.0,39989.0,A,D,Winkler Matthew T.,,T,F,F,F
20260731,winkler matthew t.,1000.0,5.045,39989.0
Every other universe file from 2026-05-01 to 2026-09-19 (99 files) is 16-column only, so the stray rows come from a single run of a pre-refactor build (the redundancy job for this dataset is still pinned to 6d71e402, which predates a50ad5f1) for upload date 2026-07-31; ProcessUniverse() then copied them into the universe file because it keys rows on the first column only (QuiverInsiderTradingDataDownloader.cs:219-251).
Reader failure, QuiverInsiderTradingUniverse.cs:150: csv[2] is winkler matthew t. on a 6-column row, and Parse.DateTimeExact(s, "yyyyMMddHHmmss") throws:
Error invoking QUIVERINSIDERTRADINGUNIVERSE-USA-... .QuiverInsiderTradingUniverse 2S data reader. Line: ASPS UF02B1SL6QG5,ASPS,winkler matthew t.,1000.0,5.045,39989.0 Error: String 'winkler matthew t.' was not recognized as a valid DateTime.
Same for the per-ticker reader, QuiverInsiderTrading.cs (csv[1] parsed as yyyyMMddHHmmss):
Error invoking ASPS.QuiverInsiderTrading data reader. Line: 20260731,winkler matthew t.,701.0,5.1,38989.0 Error: String 'winkler matthew t.' was not recognized as a valid DateTime.
Reproduced in a cloud backtest with AddUniverse<QuiverInsiderTradingUniverse>(_ => Enumerable.Empty<Symbol>()) over 2026-07-27 to 2026-08-05, and with AddData<QuiverInsiderTrading>("ASPS") over the same window. Note that the read-ahead worker (SubscriptionUtils.CreateAndScheduleWorker) stamps the runtime error with the algorithm clock, so a reporter sees the failure "on" an earlier date than the file that holds the row (here 2026-07-07, because there are no universe files between 2026-07-09 and 2026-07-26).
Proposed change
- In both readers, check
csv.Lengthagainst the expected column count first and returnnull(optionallyLog.Erroronce per file) when it does not match, instead of letting the parse throw.BaseData.Readerreturningnullis already handled byTextSubscriptionDataSourceReaderas "no data point". Combined with the #9 fallback this makes the readers tolerant of every layout the store has carried. - Wrap the
Parse.DateTimeExact/decimal.Parsecalls so a single unparseable field also yieldsnullrather than an exception. - Separately (data side, not this repo): strip the 5-column rows from the 37 per-ticker files and let
ProcessUniverse()regenerate20260731.csv; repoint the redundancy job at the current commit so a pre-refactor build cannot write again.
Open questions
- Should
ProcessUniverse()itself skip lines whose column count does not match the current layout, so a per-ticker file with stray rows cannot poison the universe file? It already skips lines whose first column is not ayyyyMMdddate.
Reference
Intercom conversation: 215476021685114.
- Ngôn ngữ chính
- C#
- Star
- 0
- Fork
- 3
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Chúng tôi chưa kiểm tra các tệp thiết lập môi trường của dự án này. Hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của QuantConnect/Lean.DataSource.QuiverQuant
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 72/100
Tất cả issue của QuantConnect/Lean.DataSource.QuiverQuant
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
fluentassertions/fluentassertions#3353 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
-
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 78/100
unoplatform/uno#24769 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
AvaloniaUI/Avalonia#22323 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
microsoft/onnxruntime-genai#2633 ·
Maintainer thường phản hồi trong vòng 1 ngày