Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Ninjatrader API

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

    Ninjatrader API

    Hello good afternoon.
    I wonder if NinjaTrader has API, because I do not find this information anywhere.

    Regards

    #2
    Hello Terserker,

    The Application Programming Interface (API) is available in the NTDirect.dll and NinjaTrader.Client.dll files. These two files provide the same functions, however, you may find the NinjaTrader.Client.dll is easier to reference in your script.

    Support for the API is limited from NinjaTrader Support.

    Below I am providing a link to the help guide that lists the functions available to the API.


    The NTDirect.dll can be found in:
    • C:\WINDOWS\system32

    The NinjaTrader.Client.dll can be found in:
    • 32 bit - C:\Program Files (x86)\NinjaTrader 7\bin\NinjaTrader.Client.dll
    • 64 bit - C:\Program Files (x86)\NinjaTrader 7\bin64\NinjaTrader.Client.dll

    Also, below is a link to an example project provided by a community member on the NinjaTrader forums, that uses the NinjaTrader API.


    Please let me know if this does not resolve your inquiry.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      I do not know this issues, but I see that today IB do this:

      "Delayed Market Data Now Supported in TWS API"
      Delayed Market Data Now Supported in TWS API
      Effective with TWS release 955, the API now supports delayed market data for non-subscribed exchanges. To switch to delayed market data, invoke the reqMarketDataType function, passing "3" as its marketDataType parameter.
      What I want is download data from the market that I not subscrive.
      Is it possible with Ninja nornal connect to IB? Or I I have to do something?

      thanks

      Comment


        #4
        Hello jmagaia,

        NinjaTrader has a connection adapter for Interactive Brokers.

        Are you connected to TWS and receiving live data?

        If not, may I confirm you have followed all directions in the Interactive Brokers connection guide linked below?
        http://ninjatrader.com/ConnectionGui...nnection-Guide

        Do you have the correct version of TWS for NinjaTrader 7 (944.3)?
        Do you have the ports set the same in TWS as NT?
        Is the Enabled socket clients and activex enabled in TWS?


        If you are connected and receiving live data in NinjaTrader from TWS what instrument are you trying to load?
        Are you able to load a 1 minute chart of that instrument?
        (Tick data is not available)
        In a script, it is possible to subscribe to the market data events with OnMarketData().
        Are you writing a script that needs this information or are you only attempting to view the bid and ask on a chart?
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          ChelseaB,

          Thanks.

          Yes, I connect to IB via TWS.No problem at all for US market.
          Example:
          What I want... if is possible with Ninja:

          I do not subcribe this market in IB (see please attach)
          I want download data in this ticker in IB: GALP (BVL)

          How I do not subcribe this market in IB, but follow IB in this upgrade 955:
          Effective with TWS release 955, the API now supports delayed market data for non-subscribed exchanges. To switch to delayed market data, invoke the reqMarketDataType function, passing "3" as its marketDataType parameter
          I would be download this data.
          How do this in NinjaTrader? What I have to do in Ninja?
          I try in intrument, but there I do not have BVL... and not be able also download in Toronto (other that I not subscribe).
          There are some possible with sugest API in IB.. "passing 3" - I do not know what is this...

          I expect explain better what I want.
          thanks
          Attached Files

          Comment


            #6
            Hello jmagaia,

            TradersWorkstation will provide minute and daily data to NinjaTrader only for instruments that you have a subscription for.

            If you do not have a subscription for the instrument, it will not load in NinjaTrader. This is a Limitation of TradersWorkstation.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              What does it mean to subscribe to an instrument?

              ChelseaB:

              Is "subscribing to an instrument" something that I need to do explicitly in Trader Workstation or does NT8 do that implicitly through the API when I request data?

              IB and Kinetick each have a limit of 100 instruments. How is that limit imposed? Are requests for instruments beyond the first session for an instrument denied? Or are the least recently used instruments automatically unsubscribed? Does the limit apply to historical data? I am pretty sure I have backtested instrument lists of > 1000 instruments.

              I have looked for an explanation of these issues in the NT manual and on this forum without success.

              Comment


                #8
                jmagaia:

                It appears that the reqMarketDataType function is part of IB's API instead of NT's. Therefore, you might explore IB's API and find out what reference you would need in order to call this function from your NinjaScript and just what the context for that function call would be.

                It would probably be possible to have that functionality added to the NinjaTrader API, but that might take some time. I guess your question is whether it already exists.

                I think you are using "non-subscribed" to indicate a source of market data for which you have not paid a fee to the market data provider through IB. I think this is a different context than ChelseaB has for "subscribing an instrument".

                If you get this worked out, please post back to the forum to let us know how.

                I would like to be able to backtest on data from a number of foreign exchanges to determine which would be most profitable to trade at a given time of day. Having learned that, I would gladly pay the fee to "subscribe" to real-time market data for the exchanges that I want to trade on.

                Comment


                  #9
                  Hi rmt81,

                  By subscribe to the instrument I am meaning with Interactive Brokers.

                  TWS will not provide data to NinjaTrader for any instruments that do not have real-time data subscribed. Any delayed instruments will not receive historical or real-time data in NinjaTrader. (I would not be able to comment on if there are fees for subscribing to real-time data with Interactive Brokers and I would recommend that you contact IB for more information about subscription fees)

                  No, you will not need to do anything to receive data in NinjaTrader from Interactive Brokers other than connect and load an instrument or call the data from a script using regular NinjaScript code such as Add("AAPL", PeriodType.Minute, 1).

                  I also would not be able to say what the maximum amount of instruments that can have simultaneous active connections with Interactive Brokers (this means real-time data is appearing in a window).
                  With historical data, the limit of historical data will be the instruments you have a real-time subscription for.

                  With Kinetick 100 instruments can be actively receiving data unless you pay to get 500 simultaneous instruments. I am not aware of any limit of the number of instruments that can load historical data.
                  Chelsea B.NinjaTrader Customer Service

                  Comment


                    #10
                    ChelseaB:

                    Thank you. In the case of the limit of 100 for Kinetick, what happens if we request data for more, e.g. attempt to run a strategy on a list of110 instruments?

                    Comment


                      #11
                      Hello rmt81,

                      In this scenario NinjaTrader would be provided with real-time data for only the first 100 instruments which are requested.
                      KyleNinjaTrader Customer Service

                      Comment


                        #12
                        Thanks. If I am finished with 10 of the instruments and want to replace them with the last 10 of my original list, what do I do? Can I disable the 10 I am finished with and enable the last 10, or do I need to have waited to add the last 10 strategies, delete the 10 strategies that are finished, and then add the last 10 strategies?

                        I assume there is a list of instruments, stored on the data provider side of the connection, which specifies that, for each tick of live data, an event is raised on the data provider side and sent to NinjaTrader. Is that roughly correct?

                        What I don't understand and have not been able to find, is what the terminology and logic are for determining and modifying which instruments are on that mysterious list.

                        Thanks again for your help.

                        Comment


                          #13
                          Hello rmt81,

                          Removing the instrument from all windows and scripts will close the real-time connection.

                          This means closing any windows that have that instrument loaded and disabling (optionally removing) any strategies that call that instrument.

                          I would not be able to provide information on how the technology of the data provider works.

                          Receiving data on a chart or strategy causes NinjaTrader to make a continuous request for real-time data for that instrument. There is likely a limit to the number of requests for these instruments the data provider will allow.
                          Chelsea B.NinjaTrader Customer Service

                          Comment


                            #14
                            Do the ATI functions SubscribeMarketData() and UnSubscribeMarketData() do the same thing as discussed below?

                            Comment


                              #15
                              rmt81

                              Thanks.
                              But, I do not have, at moment, the knowdlge for this kind os scripts or if it is not necessary how can I test.

                              But, of course, If IB say that is possible for insturments that I do not pay fee and is possible download free... it is possible, But How... I od not know.
                              If someone read this and can help.

                              And I think that if IB say this, is because is possible:
                              Effective with TWS release 955, the API now supports delayed market data for non-subscribed exchanges. To switch to delayed market data, invoke the reqMarketDataType function, passing "3" as its marketDataType parameter

                              And of course is for "non-subscribed exchanges".

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by judysamnt7, 03-13-2023, 09:11 AM
                              4 responses
                              53 views
                              0 likes
                              Last Post DynamicTest  
                              Started by ScottWalsh, Today, 06:52 PM
                              4 responses
                              32 views
                              0 likes
                              Last Post ScottWalsh  
                              Started by olisav57, Today, 07:39 PM
                              0 responses
                              4 views
                              0 likes
                              Last Post olisav57  
                              Started by trilliantrader, Today, 03:01 PM
                              2 responses
                              19 views
                              0 likes
                              Last Post helpwanted  
                              Started by cre8able, Today, 07:24 PM
                              0 responses
                              6 views
                              0 likes
                              Last Post cre8able  
                              Working...
                              X