Back

Getting Started

Hi,

I'm trying to get started with the platform, but I'm having a hard time navigating the docs.

I'm trying to get minute values for all securities available.

IEnumerable<Slice> history = History(TimeSpan.FromDays(EndDate.Subtract(StartDate).Days), Resolution.Daily);
Log(history.Count().ToString());

is logging 0, how can I achieve this. I was expecting to start receiving value in my OnData method.

Many thanks

Update Backtest








Some people learn best from examples.
Please checkout the QuantConnect University!

In OnData event handler, we receive subscribed data. It means we need to subscribe it using AddSecurity/AddEquity/AddForex/etc. You can find this information in the docs, under the "Initializing Algorithms" section:

// Complete Add Equity API - Including Default Parameters:
AddEquity(string ticker, Resolution resolution = Resolution.Minute, string market = Market.USA, bool fillDataForward = true, decimal leverage = 0m, bool extendedMarketHours = false)

//Complete Add Forex API - Including Default Parameters:
AddForex(string ticker, Resolution resolution = Resolution.Minute, string market = Market.FXCM, bool fillDataForward = true, decimal leverage = 0m)

AddEquity("AAPL"); //Add Apple 1 minute bars (minute by default).
AddForex("EURUSD", Resolution.Second); //Add EURUSD 1 second bars.

We can also subscribe to a series of symbols from a universe. Coarse Universe selection is the built in universe data provided by QuantConnect. Using financial data we generate a few key properties for each symbol and allow you to filter the universe of 16,400+ symbols to receive the symbols matching your filter criteria:

// Take the top 50 by dollar volume using coarse
AddUniverse(coarse => {
return (from c in coarse
where c.Price > 10
orderby c.DollarVolume descending
select c.Symbol).Take(50);
});

Using this code snippet in Initialize method will result in receiving 50 symbols in OnData.

 

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.


Thanks Alex. I was going through University, but all the example I saw were adding equities directly using AddSecurity etc.

AddUniverse is exactly what I was looking for.

0

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