AlgoSeekFuturesProcessor duplicates the last tick on final flush

Open Beginner friendly
#10,147 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
85/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
csharp
Domain
data

Research direction

Start with ToolBox/AlgoSeekFuturesConverter/AlgoSeekFuturesProcessor.cs, especially the tick resolution setup near line 133 and FlushBuffer near lines 211–213. Trace how IdentityDataConsolidator<Tick> writes each tick and how final flush handles WorkingData. Done means the reproduction writes one row per input tick at tick resolution while final flush still writes unfinished bars at aggregated resolutions.

Written by the indexing model from the issue text.

Description

priority:p2

Problem

ToolBox/AlgoSeekFuturesConverter/AlgoSeekFuturesProcessor.cs writes the last tick of each contract and tick type twice when converting at tick resolution.

At Resolution.Tick the processor uses IdentityDataConsolidator<Tick> (line 133). Its Update raises DataConsolidated for every tick, which writes the line, and also keeps the tick as WorkingData. FlushBuffer(frontier, finalFlush: true) then writes WorkingData again (lines 211-213), so the file ends with a duplicate of its last row.

Reproduction

var date = new DateTime(2020, 4, 22);
var symbol = Symbol.CreateFuture("CL", Market.NYMEX, new DateTime(2020, 5, 19));
var processor = new AlgoSeekFuturesProcessor(symbol, date, TickType.Trade, Resolution.Tick, outputDirectory);
processor.Process(new Tick { Symbol = symbol, Time = date.AddHours(10), TickType = TickType.Trade, Value = 20m, Quantity = 1 });
processor.FlushBuffer(DateTime.MaxValue, true);
// the generated tick file holds 2 identical rows instead of 1

What a fix must achieve

Each input tick is written once at tick resolution, including the last one, while the final flush still writes the unfinished bar at aggregated resolutions. Suggestion only: skip the WorkingData write when the resolution is Tick.

Dominant language
C#
Stars
22.6k
Forks
5.4k
Avg merge
11h 39m
Merged PRs (30d)
104

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from QuantConnect/Lean

All issues in QuantConnect/Lean

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.