Lean icon indicating copy to clipboard operation
Lean copied to clipboard

IndicatorExtensions with QuantBook (Jupyter) Compatibility

Open d-walsh opened this issue 6 years ago • 1 comments

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 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

d-walsh avatar Sep 07 '19 04:09 d-walsh

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.

antoinedray avatar Apr 29 '22 12:04 antoinedray

  • 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)

jaredbroad avatar Feb 17 '23 17:02 jaredbroad