Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Loading historical data for S&P 500 stocks

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Loading historical data for S&P 500 stocks

    Hi, I want to get historical daily data for 1 year for all the stocks in S&P500. What is the quickest way to do this? Thanks

    #2
    Also, I want to build a strategy which uses all the 500 stocks. Is there a quick way to add all the 500 stock symbols in my strategy code, instead of using Add("MSFT", PeriodType.Day, 1); Add("AAPL", PeriodType.Day, 1); for all 500

    Comment


      #3
      Hello Kc0793,

      You will need to have a data provider that will supply you with the 1 year of data for your needs.

      Additionally, there is no other supported way to add instruments to the code for analysis, then using the Add() method.

      However, you can access the Instrument List to create a foreach loop for the items and add the instruments that way in the Initialize() method -

      Code:
      NinjaTrader.Cbi.InstrumentList list1 = NinjaTrader.Cbi.InstrumentList.GetObject("FOREX");
        
       foreach (Instrument i in list1.Instruments)
       {
       Add(i.FullName, PeriodType.Minute, 5);
       }
      Please note that this is unsupported type programming and would not be able to assist in debugging

      Let me know if I can be of further assistance.
      Cal H.NinjaTrader Customer Service

      Comment


        #4
        Hi Cal, thank you for the reply. I wasnt aware of the NinjaTrader.Cbi.InstrumentList object, thanks for pointing that out.

        With regards to the other question on building up the historical database for all 500 stocks, the data provider is not the issue - I can currently connect to Kinetick, load a chart of any of the individual stock for a year, and that ensures that the data is stored as historical data. The question is, is there a quick way of doing this for 500 stocks?

        Comment


          #5
          Kc0793,

          If you can get the data in text format you can importing the data that way.
          http://www.ninjatrader.com/support/h...?importing.htm

          However, the quickest way would be to load the symbols into a chart for the initial download to get them and use for your needs.
          Cal H.NinjaTrader Customer Service

          Comment


            #6
            Thank you Cal. For both the possible ways (importing data in txt format or loading them into a chart), am I right in thinking that this would need to happen one by one,manually, for each of the 500 stocks? Any way to do them all at once? I guess what I am asking is can I select a bunch of symbols and open charts of them all at once?

            Comment


              #7
              Hello kc0793,

              Unfortunately, no. This would need to be done manually.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by kaywai, 09-01-2023, 08:44 PM
              5 responses
              601 views
              0 likes
              Last Post NinjaTrader_Jason  
              Started by xiinteractive, 04-09-2024, 08:08 AM
              6 responses
              22 views
              0 likes
              Last Post xiinteractive  
              Started by Pattontje, Yesterday, 02:10 PM
              2 responses
              18 views
              0 likes
              Last Post Pattontje  
              Started by flybuzz, 04-21-2024, 04:07 PM
              17 responses
              230 views
              0 likes
              Last Post TradingLoss  
              Started by agclub, 04-21-2024, 08:57 PM
              3 responses
              17 views
              0 likes
              Last Post TradingLoss  
              Working...
              X