US Equity bar building: FINRA quotes excluded, one-sided periods carry the previous bar's other side, locked/crossed closing book squared onto one side (undocumented)

クローズ
#2,836 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

関連するプルリクエストがすでにマージされています。

  • #2837 @quantconnect-kronos による — マージ済み

評価

難易度
3/5
見積もり時間
半日
初心者へのやさしさ
28/100
issue の種類
ドキュメント
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
html, php

調査の方向性

Start with the three statements in Resources/data-feeds/excluded-ticks.php, 03 Bar Building.php and 03 Quote Bar.html, and check linked PR #2837 first, since it already targets this work. Compare each statement with the replay description and the lines 97 to 103 of TickQuoteBarConsolidator.AggregateBar in Lean that the issue cites. Done means the three undocumented rules (FINRA quotes, one-sided periods, crossed closing books) are stated on the pages without contradicting the stored bars.

索引モデルが issue の本文から書いたものです。

説明

kronos:develop:working

Summary

Three statements on the US Equity bar-building pages do not match what the stored US Equity second (and minute) quote bars contain. A user who rebuilt SPY second QuoteBars from the quote tick files following the documented rules found a small number of bars that match no quote tick; all of them come from the three undocumented points below. Each point was verified by replaying the SPY quote tick files into bars and comparing every bar's closing bid, closing ask, LastBidSize and LastAskSize with the stored second file on four full sessions (2007-05-02, 2007-07-03, 2008-01-09, 2019-06-03); with all three applied the replay reproduces 103,732 of 103,732 bars.

1. FINRA quotes are excluded too, not only FINRA trades

Resources/data-feeds/excluded-ticks.php (included by 03 Writing Algorithms/03 Securities/99 Asset Classes/01 US Equity/08 Data Preparation/03 Bar Building.php) lists the FINRA rule for trades only:

The trade is from the FINRA exchange and FINRA filtering is active for the security.

Once FINRA filtering is active for the day, a quote tick whose exchange is FINRA (D) does not set the bar's bid, ask or sizes either. Measured: SPY 2008-01-09 has 37,322 FINRA quote ticks that pass every other documented rule; keeping them changes 1,314 of the 31,182 stored second bars (SPY 2007-05-02: 91 of 22,910). Suggested wording: "The tick is from the FINRA exchange and FINRA filtering is active for the security" (so it covers quotes), with a sentence that a FINRA quote does not update the bid or ask of the bar after filtering is active.

2. A period with quotes on one side only still carries the other side

06 LEAN Engine/03 Data Format/02 Core Data Types/03 Quote Bar.html says:

If a period has no bid quotes, the four bid price columns are empty and the bid size is 0

That is the shape of the CME file the page illustrates, but not of the US Equity second and minute quote files. There a new period opens from the previous bar's closing bid, closing ask and both last sizes before its first quote is applied (TickQuoteBarConsolidator.AggregateBar in Lean, lines 97 to 103), so a period with quotes on one side only reports the other side's earlier close and size, and a bar can carry a bid or ask size with no quote on that side in the period. Suggested: state that the empty-column form applies to some asset classes (futures, options) and that US Equity second and minute bars open each period from the previous bar's close and last size on both sides.

3. A locked or crossed closing book is squared onto one side

Neither page mentions that when a period's closing bid is above its closing ask, the stored bar sets both sides to one closing price and one last size (one side's close and last size are copied onto the other), so the bar reads as a locked quote with equal sizes and matches no single quote tick. It affected 288 of 15,429 SPY second bars on 2007-07-03 and 13 of 34,211 on 2019-06-03. Suggested: one sentence under Bar Building saying the closing bid and ask of a bar are never left crossed, and that both sides then show the same price and size.

Intercom conversation 215476687728744.

主要言語
HTML
スター
267
フォーク
190
平均マージ
8時間 38分
マージ済み PR(30日)
69

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

QuantConnect/Documentation のほかの issue

QuantConnect/Documentation の issue をすべて見る

似ている issue

Data Engineering の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。