↑↓ to select, press enter to go, use esc to exit
  • Pricing
  • Data
  • Community
  • Algorithm Lab Lab Lab
  • Documentation Docs Docs
  • Sign In
Forum

    Platform

  • Alpha Market
  • Pricing
  • Datasets
  • Community
  • Algorithm Lab
  • Documentation

    SIGN IN

  • Sign in
  • Don't have an account? Join QuantConnect Today

  • Sign up for Free

QuantConnect Community

trophy

trophy

Start New Discussion Sign up
Interesting | Newest | Lean | Data Issues | Integration Partners

New Sign up
No Results
  • «
  • 1
  • »
HI Interesting !
HI Newest !
HI Data Issues !

LEAN is the open source algorithmic trading engine powering QuantConnect. Founded in 2013 LEAN has been built by a global community of 80+ engineers and powers more than a dozen hedge funds today.

trophy

Alpha League Competition: $1,000 Weekly Prize Pool

Qualifying Alpha Streams Reentered Weekly Learn more

| Awards
Loading...
  • «
  • »
 Start New Discussion Sign up

Filter Discussion by Tags


240300 Quants.

Become a Quant

Online Now

Our Code of Conduct

Stay Connected

Stay connected with all the latest updates with email alerts or joining our Discord server.

  Open Discord

profile

Answers

Answers

  Backtests

Backtests

  Comments

Comments

  Live Traded

Live Traded

 

 

 

Documentation discussion algorithm-reference/universes

Back

Started By:


Follow Discussion
Reward Discussion Awards
Permalink

QuantConnect Robot INVESTOR


 |   Reward Discussion
0
0
Update Backtest





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.

  0  
11
Twitter Facebook LinkedIn Copy Link

QuantConnect Robot

Permalink

 | 
accepted answer

Accepted Answer

0
Update Backtest





  • Notebook

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.

0
Twitter Facebook LinkedIn Copy Link

Ofir Shmulevich


2.8k Pro ,

Question about the resolution :

 

self.UniverseSettings.Resolution = Resolution.Daily // What resolution should added assets use

 

suppose I want to perform a universe selection every 7days or month , 

how could it be implemented ?consolidating data and then use it as resolution?

0
Edited by Ofir Shmulevich

Link Liang


6.1k Pro ,

Hi Ofir,

There are many options to achieve your goal.1. We could use Scheduled Universe Selection. Here is an example of performing an universe selection every Monday:

# in self.Initialize():
self.AddUniverseSelection(ScheduledUniverseSelectionModel(
    self.DateRules.Every(DayOfWeek.Monday),
    self.TimeRules.Every(timedelta(hours = 12)),
    self.SelectSymbols # selection function in algorithm.
))

def SelectSymbols(self):
    # your strategy here


To preform it monthly, we could use this as our date rule:

# self.AddEquity("SPY")
self.DateRules.MonthStart("SPY")


Here is more information regarding scheduled event.

2. We could use data consolidator. Here is an example to consolidate "SPY" daily data into 7-day bar:

from datetime import timedelta
# in self.Initialize():
self.AddEquity("SPY", Resolution.Daily)
consolidator = TradeBarConsolidator(timedelta(days=7))
consolidator.DataConsolidated += self.OnDataConsolidated
self.SubscriptionManager.AddConsolidator("SPY", consolidator)
# later in the algorithm:
def OnDataConsolidated(self, sender, bar):
    # perform your strategy here

3. We could use a flag. Here is an example with a monthly flag:

# in self.Initialize():
self.month = -1
# before universe selection:
if self.month == self.Time.month: return
# after universe selection:
self.month = self.Time.month # ensure the universe selection only run once in every month

Hope it helps.

2
Edited by Link Liang

Aleksandr Nalivajko


231 Pro ,

Please explain to me on what date the data are taken in the Universe Selection. For example if self.SetStartDate(2019,6,4) how can I understand that Coarsefundmental is taking data from the previous trading day(2019-06-03)?

By default, self.UniverseSettings.fillForward == False?
0

Aleksandr Nalivajko


231 Pro ,

ok...I helped myself.

 for x in coarse:
            self.Log(x.Time) 

Coarsefundmental takes data from the current trading day. Why??

0

Aleksandr Nalivajko


231 Pro ,

*Coarsefundmental starts with data from self.SetStartDate.

0

Aleksandr Nalivajko


231 Pro ,

Sorry, I was wrong. I didn't count the following when I checked the data:

"Finally, when reviewing the results of your history requests remember they are indexed by the EndTime of each data point. For daily data, this results in makes it appear datapoints appear on Saturday, and skipping Monday's bar."

0


Pro ,

In the article above "LEAN automatically subscribes to these new symbols and adds them to your algorithm."

But I don't know how I can access that filtered symbols. Where is the filtered symbols?

Thanks.

0

Daniel Chen


17.8k Pro ,

Hi Bill,

Thank you for your question. Generally speaking, the subscribed data for the filtered symbols are in the slice variable in the OnData(Slice slice) method. You can just simply access any of them with slice[symbol]. For example, if "AAPL" is in your filtered symbols set, then you can assess its data using slice["AAPL"] in the OnData(Slice slice) method.

If you only want the added or removed universe, then the changes variable in the OnSecuritiesChanged() method would suffice. We provide many examples of how to use filtered symbols after Universe Selection. Please check out the examples on the top of the same page. Thank you!

0

Hielke Hagendoorn


34 Pro ,

Hi, I'm a beginner here, so sorry if I ask for the obvious, but could somebody please help me with the following. I would like to select stocks which have a (weekly)close above the weekly upper bollingerband. Is there an example available about using a indicator with weekly data in the universe selection? Any help would be welcome.

0

Ivan Baev


1.5k Pro ,

Is is possible to use Currencies Market in the Universe Selection? If I want top 10 winners / losers for the past week?

0

Jared Broad


STAFF Pro ,

Currencies do not delist as frequently as stocks so do not require universes. It is perfectly acceptable to manually add all 20-30 FOREX assets to your algorithm and perform the winners/losers tests on your entire portfolio.

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.


QuantConnect Robot INVESTOR

Permalink

 | 
0
Update Backtest







  • Notebook

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.

 0 
Twitter Facebook LinkedIn Copy Link
Loading...
  • 1
  • «
  • »

To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!

award-icon

What is an Award?

Back
 
 

Join QuantConnect for Free Sign Up

QuantConnect Logo

QuantConnect™ 2023. All Rights Reserved

Technology

  • Algorithm Lab
  • Documentation
  • Community
  • Tutorials
  • Data Library
  • Learning Articles
  • System Status
  • Account
  • Discussions List

Company

  • About
  • Affiliates
  • Our Blog
  • Contact
  • Pricing
  • Integration Partners
  • Terms & Conditions
  • Privacy Policy

LEAN

  • Fork 2,842
  • Star 7,501
QuantConnect Logo

QuantConnect™ 2023. All Rights Reserved

Technology

  • Algorithm Lab
  • Documentation
  • Community
  • Tutorials
  • Data Library
  • Learning Articles
  • System Status
  • Account
  • Discussions List

Company

  • About
  • Affiliates
  • Our Blog
  • Contact
  • Pricing
  • Integration Partners
  • Terms & Conditions
  • Privacy Policy

LEAN

  • Fork 2,842
  • Star 7,501