Back

Bootcamp - Universe Selection

Hi   @Jack Simonson,  

love the platform.

In the latest bootcamp, indicators are used to create a selection criteria.

My question are:

- if I was to use different indicotrs, ones i have made my self (ie a neural network) would I need the lines 

for bar in history.itertuples():
self.fast.Update(bar.Index[1], bar.close)
self.slow.Update(bar.Index[1], bar.close)

def is_ready(self):
return self.slow.IsReady and self.fast.IsReady

def update(self, time, price):
self.fast.Update(time, price)
self.slow.Update(time, price)

if I was to create my own indicators do I need the above lines and if yes how is this possible to implement?

 

- If I wanted to update the universe weekly and have the algorithm trade hourly where in the code would i do this. I am not sure where the universe rebalances and the resolution of the trades made.

Sincere thanks in advance for your help! Im a still learning how to use the platform.

Many thanks,

Best,

Andrew

 

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.


Alexandre Catarino 

0

Hi andrew martin czeizler, 

Please check out the CustomIndicatorAlgorithm.py. It is an example of how to create custom indicators.

If we want the universe to update weekly, we can check out whether the week number has changed:

def CoarseSelectionFunction(self, coarse):
## If it isn't a new week, return Universe.Unchanged
current_week = self.Time.isocalendar()[1]
if current_week == self.week:
return Universe.Unchanged
self.week = current_week

## Code to select symbols when week has changed below:

If the algorithm is also using FineFundamental data, when CoarseSelectionFunction returns Universe.Unchanged,  FineSelectionFunction will not be called. 

Finally, we can select hourly data with self.UniverseSettings.Resolution = Resolution.Hour.

For more details on Universes, please check out the docs.

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

Thank you! sincerly appreciate your help with this.

My confusion is that in the neural network example there is no update function?

QuantConnect/Lean/blob/master/Algorithm.Python/PytorchNeuralNetworkAlgorithm.py

I am wondering why the indicator doucmentiation suggests an update fuction but there is non in the above example?

 

Best,

Andrew

0

Alexandre Catarino 

0

Hi andrew martin czeizler 

We only need an Update function if the indicator is intended to be automatically updated by the engine. If not, like in the PytorchNeuralNetworkAlgorithm.py, we can simply process the computations using the available functions.

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