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

    SIGN IN

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

  • Sign up for Free
 

back arrow

QUANTCONNECT COMMUNITY

 
Research Announcements Lean League
COMMUNITY COMMUNITY FEED |

OPEN LEAGUE PRO LEAGUE
No Results
  • «
  • 1
  • »
LEAN Logo

Radically Open-Source Algorithmic Trading Engine

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

Join Our Discord Channel

Join QuantConnect's Discord server for real-time support, where a vibrant community of traders and developers awaits to help you with any of your QuantConnect needs.

This research is under review. To publish this research attract three community upvotes.


Draft Discussions




Bookmarked Discussions


Loading...
  • «
  • »
 Share New Research

Refer to our Research Guidelines for high quality research posts.

 Start New Discussion Sign up

SEARCH DISCUSSIONS


TOP 5 Research Publications

-


444,200 Quants.
Become a Quant

Online Now

Code of Conduct

VOTE FOR UPCOMING FEATURES

Share your input and vote on our future direction.

LEAN Roadmap

Create an account on QuantConnect for the latest delivered to your inbox.

Sign Up Today
profile

Answers

Answers

  Backtests

Backtests

  Comments

Comments

  Live Traded

Live Traded

 

 

 

Research Announcements Lean League
COMMUNITY COMMUNITY FEED |

This research is under review. To publish this research attract three community upvotes.
This discussion is a draft. Click here to publish this discusison.

Documentation discussion algorithm-reference/universes


Update Backtest





person upvoted this people upvoted this

QuantConnect Robot

 |  | accepted answerAccepted Answer
Permalink
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.

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?


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.


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?

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


Aleksandr Nalivajko


231 Pro ,

*Coarsefundmental starts with data from self.SetStartDate.


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


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!


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.


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?


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.

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

Reply
person upvoted this people upvoted this
|
person upvoted this people upvoted this
Profile Image
Loading...
  • 1
Load More

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!


Allocate to this Strategy

Institutional clients can contact the author and allocate capital to this strategy.

Learn More
Organization

Organization Website

Team

Show More
Clone Strategy

Copy this strategy code to your QuantConnect account and deploy it live with your brokerage.

Clone
Previous Ranking

Browse strategies and organization entries from previous quarter's competitions.


Author:


IN THIS RESEARCH

PARTICIPANTS

Discussion Awards

SHARE RESEARCH
SHARE DISCUSSION
SHARE ARTICLE
SHARE


Actions
View in Strategy Explorer Award Discussion
Print Research
Comments
award-icon

What is an Award?

Research Announcements Lean League
COMMUNITY COMMUNITY FEED |

 
 

Join QuantConnect for Free

QuantConnect Logo

QuantConnect™ 2025. All Rights Reserved

Technology

  • Algorithm Lab
  • Documentation
  • Research
  • Build vs. Buy
  • Tutorials
  • Data Library
  • Learning Articles
  • System Status
  • Settings
  • Discussions List

Company

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

LEAN

  • Fork 4,000
  • Star 14,000
QuantConnect Logo

QuantConnect™ 2025. All Rights Reserved

Technology

  • Algorithm Lab
  • Documentation
  • Research
  • Build vs. Buy
  • Tutorials
  • Data Library
  • Learning Articles
  • System Status
  • Settings
  • Discussions List

Company

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

LEAN

  • Fork 4,000
  • Star 14,000