Universe Warmup Feature/Workaround

Back

Hi,

I am using an indicator which depends on the universe selection. The indicator has a length of 15, thus needs 15x universe selections to be ready and warmed up.

For backtesting, thats not a big deal. Trading can be started after the indicator is warmed up. 

But for live trading the indacator takes 15x universe selections, in my case 15 months. 

Is there a smarter way to warmup the indicator, than manually pre-filling the historical data?

Maybe some implementation idea or workaround?

Thx.

Update Backtest







 
0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Hi Eugene,

Possible you could use the Object Store to perform the warm-up in a backtest, save the result to the object store, and then in live trading pull down the value from the object store? This is a relatively new technology so please work with us to report issues you have with it. 

Best
Jared

1

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Hi Jared,

I ll try out and post my experience here. Thx for the hint! 

Cu

Eugene

0

Hello Jared,

the object store function works just fine. See my code below.

Is there a possibility to see all used keys and used storage space for these keys? I kind of simple explorer...

Thx.

Cu Eugene

 

loading of indicator values during initialization:

public override void Initialize()
{

....

if (LiveMode)
{
Debug("Trading Live!");

if (ObjectStore.ContainsKey(natrKey))
{
natrValues = ObjectStore.ReadJson<decimal[]>(natrKey);
Debug("NATR initialized");
}
else
{
throw new Exception("No NATR values available");
}

if (ObjectStore.ContainsKey(timeKey))
{
timeValues = ObjectStore.ReadJson<DateTime[]>(timeKey);
Debug("Time initialized");
}
else
{
throw new Exception("No Time values available");
}

Debug("NATR History Initialized");
for(int i=0; i <= natrValues.Length-1; i++)
{
Debug("Time: "+timeValues[i]+" NATR: "+natrValues[i].ToString("0.000"));
}

}
}

 

saving of indicator values after calculation, in my case on security change:

public override void OnSecuritiesChanged(SecurityChanges changes)
{
...

// calculation of natrValues

...
ObjectStore.SaveJson(natrKey, natrValues);
ObjectStore.SaveJson(timeKey, timeValues);

}
0

Hi Eugene,

By running the following snippet, we are able to construct a dictionary which holds the ObjectStore keys as its keys and the corresponding size of the saved object (as returned from the Read method) as its values.

objectStoreSizes = {}
for _, j in enumerate(self.ObjectStore.GetEnumerator()):
key = str(j).split(",")[0][1:]
size = sys.getsizeof(self.ObjectStore.Read(key))
objectStoreSizes[key] = size

Note that this technique requires that the keys don't include any commas in their names.

See the attached backtest for a full working example. It is simply an extension of the ObjectStoreExampleAlgorithm.

Best,
Derek Melchin

0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Update Backtest





0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Loading...

This discussion is closed