Lean icon indicating copy to clipboard operation
Lean copied to clipboard

`GetFutureHistory` and `GetOptionHistory` don't work for C# QuantBook

Open DerekMelchin opened this issue 3 years ago • 0 comments

Expected Behavior

GetFutureHistory and GetOptionHistory work for C# QuantBook

Actual Behavior

If we run

var qb = new QuantBook();
var gold = qb.AddFuture(Futures.Metals.Gold);
gold.SetFilter(0, 90);
var history = qb.GetFutureHistory(gold.Symbol, new DateTime(2020, 6, 1), new DateTime(2020, 6, 5));
foreach (var slice in history)
{
    
}

we get

error CS1579: foreach statement cannot operate on variables of type 'FutureHistory' because 'FutureHistory' does not contain a public instance or extension definition for 'GetEnumerator'

Potential Solution

https://github.com/QuantConnect/Lean/tree/feature-csharp-getfuturehistory

Reproducing the Problem

Run the above code snippet in the research environment

System Information

QC Cloud

Checklist

  • [x] I have completely filled out this template
  • [x] I have confirmed that this issue exists on the current master branch
  • [x] I have confirmed that this is not a duplicate issue by searching issues
  • [x] I have provided detailed steps to reproduce the issue

DerekMelchin avatar Jul 15 '22 22:07 DerekMelchin