Lean
Lean copied to clipboard
IndicatorExtensions with QuantBook (Jupyter) Compatibility
Expected Behavior
I expect indicators to be chained togethe using the IndicatorExtensions capabilities.
Actual Behavior
There doesn't appear to be any chaining of the Indicators.
Potential Solution
If the capability is already there then maybe an example of it working would help, otherwise it would be good to update the QuantBook class to have this capability.
Reproducing the Problem
For example defining the following Indicators:
ema = ExponentialMovingAverage(10)
roc = RateOfChange(20)
emaroc = IndicatorExtensions.Of(ema, roc)
And the following:
df1 = qb.Indicator(ema, symbol, start_date, end_date, resolution)
df2 = qb.Indicator(emaroc, symbol, start_date, end_date, resolution)
Both df1 and df2 have the same data.
System Information
Checklist
- [x] I have completely filled out this template
- [x] I have confirmed that this issue exists on the current
masterbranch - [x] I have confirmed that this is not a duplicate issue by searching issues
- [x] I have provided detailed steps to reproduce the issue
Hello everyone!
I have a similar issue with Minus / Plus / Times / Over IndicatorExtensions with QuantBook (Jupyter).
Of is the only composite IndicatorExtensions that seems to work with QuantBook (Jupyter).
The following code does not work:
qb = QuantBook()
start_date = datetime(2021,9,30)
end_date = datetime(2021,10,1)
security = qb.AddCrypto("BTCUSD", Resolution.Minute, Market.Bitfinex)
history = qb.History(qb.Securities.Keys, start_date, end_date, Resolution.Minute)
periods = 2
sma = SimpleMovingAverage(periods)
std = StandardDeviation(periods)
sma_min_std = IndicatorExtensions.Minus(sma, std)
df_sma_min_std = qb.Indicator(sma_min_std, security.Symbol, start_date, end_date, Resolution.Minute)
df_sma_min_std
The DataFrame returned is empty but both indicators individually return data.
- Design issue with the API not a data feed crank issue (not #4794)
- Update QC.Indicator to use its history request to generate the composite data frame and return it.
sma = SimpleMovingAverage(periods)
std = StandardDeviation(periods)
sma_min_std = IndicatorExtensions.Minus(sma, std)
df_sma_min_std = qb.Indicator(sma_min_std, security.Symbol, start_date, end_date, Resolution.Minute)