Research resampling example sums quote sizes instead of taking the last size
Maintainers usually reply within 1 day
@jeevanabhi-r is already working on this.
Since Nov 4, 2026.
Assessment
- Difficulty
- 1/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
- Issue type
- Documentation
- Clarity
- Clearly specified
- Activity status
- Active
- Domain
- documentation
Research direction
The Python example is in 04 Research Environment/03 Datasets/01 Key Concepts/99 Examples.html around lines 81 and 84, where asksize and bidsize are aggregated with sum. Compare it with the C# example at lines 40 and 56-57 and with the QuoteBar definition in 06 LEAN Engine/03 Data Format/02 Core Data Types/03 Quote Bar.html. Run the reproduction in the issue to confirm the sum gives 50 and last gives 10. Done when the Python aggregation uses last and the surrounding wording describes the result as a quoted-size estimate, not traded volume.
Written by the indexing model from the issue text.
Description
Problem
In 04 Research Environment/03 Datasets/01 Key Concepts/99 Examples.html, the Python example aggregates asksize and bidsize with sum (lines 81 and 84), describing the results as total ask/bid volume. These columns are quote-size snapshots, not traded quantities. Summing successive snapshots does not produce a five-minute QuoteBar's last size or traded volume.
The adjacent C# example uses QuoteBarConsolidator and LastAskSize / LastBidSize (lines 40 and 56–57), so the two examples produce different results for the same input. 06 LEAN Engine/03 Data Format/02 Core Data Types/03 Quote Bar.html correctly defines each size as the last size in the period.
Minimal reproduction
import pandas as pd
history = pd.DataFrame(
{"asksize": [10] * 5, "bidsize": [10] * 5},
index=pd.date_range("2024-01-02 10:00", periods=5, freq="min"),
)
print(history.resample("5min").agg({"asksize": "sum", "bidsize": "sum"}))
print(history.resample("5min").last())
Observed: the documented aggregation returns 50 for each side; the last snapshot is 10. With the same price estimate, the Python example therefore calculates five times the C# example's value for this input.
Suggested correction
Aggregate the size columns with last to match QuoteBar consolidation, and describe the result as a quoted-size/notional estimate rather than total traded volume. This is an existing discrepancy in the example, independent of any change to Lean's runtime behavior.
- Dominant language
- HTML
- Stars
- 266
- Forks
- 189
- Avg merge
- 7h 25m
- Merged PRs (30d)
- 81
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from QuantConnect/Documentation
-
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
QuantConnect/Documentation#2844 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
QuantConnect/Documentation#2670 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 55/100
QuantConnect/Documentation#2139 · 1 reaction ·
Maintainers usually reply within 1 day
-
Review the Data Analyser ClassMay be free again @DerekMelchin claimed this 481 days ago, and no pull request is open. Open
QuantConnect/Documentation#2120 · 1 assignee ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 52/100
QuantConnect/Documentation#1800 ·
Maintainers usually reply within 1 day
All issues in QuantConnect/Documentation
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Raku/doc-website#519 ·
-
server errored
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
OpenTermsArchive/contrib-declarations#4273 ·
Maintainers usually reply within 1 day
-
documentation good first issue
Difficulty 1/5 1-3 hours Newbie friendliness 90/100
Official-Space-AI/OpenPhysGraspGen#113 ·
Maintainers usually reply within 2 days
-
changelog investigate
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
ramnes/notion-sdk-py#441 ·
-
beginner-friendly category:fixtures community enhancement first-timers-only good first issue help wanted low hanging fruit micro-contribution type: task up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 90/100
Berserk-hub150/skillhawk#253 · 1 comment ·
Maintainers usually reply within 6 days