Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

TD Ameritrade Data?

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

    TD Ameritrade Data?

    When I run the following script I get historical minute data from TD Ameritrade's API. Is there a way to get this data in Ninja Trader? I am already getting $TICK

    Code:
    var tickSymbols = new string[] { "$TICK", "$TICKQ", "$TICKI", "$TICKD", "$TICKR" };
    
    var httpClient = new HttpClient();
    var apiKey = "xxxxx";
    
    
    // Print out the tick index values
    Console.WriteLine("Tick Index Values:");
    foreach (var symbol in tickSymbols) {
        var baseUrl = $"https://api.tdameritrade.com/v1/marketdata/{tickSymbols[0]}/pricehistory";
    
        var requestParams = $"?apikey={apiKey}&periodType=day&frequencyType=minute&frequency=60&period=5";
        var requestUrl = baseUrl + requestParams;
    
        var response = await httpClient.GetAsync(requestUrl);
    
        var responseContent = await response.Content.ReadAsStringAsync();
        Console.WriteLine($"---------------------------------------------");
        Console.WriteLine($"{symbol}: {responseContent}");
    }​

    #2
    Hello ErikHR1969,

    Just connect to TD Ameritrade and the minute historical data will automatically download for any chart, and will be available (as the Open, High, Low, and Close series) in any NinjaScript Indicator or Strategy.

    Below is a link to the connection guide for TD Ameritrade.


    As well as a link to a forum post with helpful resources on getting started with NinjaScript and C#.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi Chelsea,

      The code against TD Ameritrade's API (above) actually returns historical data for all of these symbols:

      Code:
      var tickSymbols = new string[] { "$TICK", "$TICKQ", "$TICKI", "$TICKD", "$TICKR", "^TICKQ" };
      var trinSymbols = new string[] { "$TRIN", "$TRINQ", "$TRINX" };
      var putcallSymbols = new string[] { "$PCX", "$PCZ", "$SPXPC" };​
      Can you try to connect to TD Ameritrade with NinjaTrader and see what data you get. All I get is:

      ^TICK --> historical and realtime data.
      ^TRIN --> historical and realtime data.
      ^TICKQ --> realtime data.
      ^TRINQ --> realtime data.
      ^PCR and all the rest --> No data

      Thanks,
      Erik



      Comment


        #4
        Hello Erik,

        I would not have a TD Ameritrade test account to connect with, and unfortunately I would not have a list of the index symbols they support or provide data for in the API.

        If the instrument will load on a chart, that data can also be used in NinjaScript.

        If the instrument cannot load on a chart, contact TD Ameritrade to confirm the instrument is available through the API and then ensure the symbol mapping for the instrument is correct.
        https://ninjatrader.com/support/help...mbolMapSection
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        563 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        329 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        101 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        547 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        548 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X