Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

MarketData()

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

    MarketData()

    Hi guys,
    Total NT newbie here.

    Im trying to use the ATI to get market data.

    Using a simulator data feed while NT is running.

    Ntdirect.dll loads fine.
    Connected(1) shoes I'm connected.
    SubscribeMarketData("ES 12-11") returns 0 which is supposed to indicate success.

    But, all calls to MarketData("ES 12-11",0) return zero?

    Any ideas?

    Thanks in advance

    Jason

    #2
    Jason, what language are you calling the ATI with? Can you also post the full code you're using so we can get a better look?
    AustinNinjaTrader Customer Service

    Comment


      #3
      Hi Austin.

      Here is the code, called from a console app in VS2010 running on 64bit Windows 7, compiled as 32bit though so it works with the Ntdirect.dll.


      // ninjatest.cpp : Defines the entry point for the console application.
      //

      #include "stdafx.h"
      #include <string>
      #include <windows.h>

      using namespace std;
      int _tmain(int argc, _TCHAR* argv[])
      {
      typedef int (__stdcall *NTCommand)( string command,
      string account,
      string instrument,
      string action,
      int quantity,
      string orderType,
      double limitPrice,
      double stopPrice,
      string timeInForce,
      string oco,
      string orderId,
      string strategy,
      string strategyId);
      typedef int (__stdcall *NTConnected)(int showMessage);
      typedef int (__stdcall *NTFilled)(string orderId);
      typedef double (__stdcall *NTMarketData)(string instrument,int type);
      typedef int (__stdcall *NTMarketPosition)(string instrument,string account);
      typedef string (__stdcall *NTNewOrderId)();
      typedef string (__stdcall *NTOrderStatus)(string orderId);
      typedef int (__stdcall *NTSubscribeMarketData)(string instrument);
      typedef int (__stdcall *NTTearDown)();
      typedef int (__stdcall *NTUnsubscribeMarketData)(string instrument);

      NTCommand Command = NULL;
      NTConnected Connected = NULL;
      NTSubscribeMarketData SubscribeMarketData = NULL;
      NTMarketData MarketData = NULL;
      NTTearDown TearDown = NULL;
      NTUnsubscribeMarketData UnsubscribeMarketData = NULL;

      HINSTANCE NTDLL;
      NTDLL = LoadLibrary(L"c:\\windows\\sysWOW64\\NtDirect.dll" );

      if(NTDLL == NULL)
      return 1;

      Command = (NTCommand)GetProcAddress(NTDLL,"Command");
      Connected = (NTConnected)GetProcAddress(NTDLL,"Connected");
      SubscribeMarketData = (NTSubscribeMarketData)GetProcAddress(NTDLL,"Subsc ribeMarketData");
      MarketData = (NTMarketData)GetProcAddress(NTDLL,"MarketData");
      TearDown = (NTTearDown)GetProcAddress(NTDLL,"TearDown");
      UnsubscribeMarketData = (NTUnsubscribeMarketData)GetProcAddress(NTDLL,"Uns ubscribeMarketData");

      int rtn = Connected(1);
      double last;
      int i = 0;

      //Only do stuff if we are connected.
      if(!rtn)
      {
      //Now lets try and add an order.
      //rtn = Command("PLACE","SIM101","ES 12-11","BUY",5,"MARKET",0,0,"DAY","","ABC","BASIC","" );

      rtn = SubscribeMarketData("ES 12-11");

      if(!rtn)
      {
      for(i = 0;i < 10;i++)
      {
      last = MarketData("ES 12-11",1);
      printf("Last:%.2lf\n",last);
      }

      rtn = UnsubscribeMarketData("ES 12-11");
      rtn = TearDown();
      }
      }

      FreeLibrary(NTDLL);

      return 0;

      Comment


        #4
        jayhay, we don't officially support 3rd party applications using the ATI, but please try inserting some delay statements (>5ms) in your code between subscribing to the data and then requesting the data.
        AustinNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by techgetgame, Yesterday, 11:42 PM
        0 responses
        8 views
        0 likes
        Last Post techgetgame  
        Started by sephichapdson, Yesterday, 11:36 PM
        0 responses
        2 views
        0 likes
        Last Post sephichapdson  
        Started by bortz, 11-06-2023, 08:04 AM
        47 responses
        1,613 views
        0 likes
        Last Post aligator  
        Started by jaybedreamin, Yesterday, 05:56 PM
        0 responses
        10 views
        0 likes
        Last Post jaybedreamin  
        Started by DJ888, 04-16-2024, 06:09 PM
        6 responses
        20 views
        0 likes
        Last Post DJ888
        by DJ888
         
        Working...
        X