Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

DLL COMMAND Call Error

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

    DLL COMMAND Call Error

    Hi, I am using the NtDirect.dll in a python environment. I am having issues with the COMMAND function. I am trying to pass the following code:
    ntdll.Command(c_wchar_p('PLACE'), c_wchar_p(account), c_wchar_p(symbol), c_wchar_p('BUY'), c_int(1), c_wchar_p('STOPLIMIT'), c_double(3200), c_double(0), c_wchar_p('GTC'),None, c_wchar_p(newOrder), None, None)

    but the order fails and the log out is giving me: "command parameter 'P' is unkown"

    Any idea why it is only reading the first character of the command? Thank you.

    #2
    Hello USNA11,

    While I cannot help with Python this thread will remain open for any community members that would like to assist.

    You may also find this thread on the API helpful.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thanks Chelsea! I managed to figure that one out and the command method is now working properly and I have verified that I can get all arguments to work the way I need.

      However, I've got another issue that I thought was just a data feed issue over the weekend with the markets being closed.

      I have successfully subscribed to "ES 09-20" (value of 0 was returned) but when I try the MarketData method, it returns a 1 for all values (bid, ask, last). I don't understand if it's not subscribed correctly, if the MarketData method is not being called correctly (I would have thought I'd get a 0 or error), or if there is some other internal issue. Any insight would be appreciated!

      Comment


        #4
        Hello USNA11,

        Are you getting the real-time values for ask, bid, and last, and do these match a chart with the same instrument selected?
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Chelsea,

          I am not. I am getting 1 for bid, ask, and last. I am using the same stored symbol name that I use in the command function which correctly places an order on the ES. I should be getting around 3000. I'm not getting any errors and the SubscribeMarketData method is returning a 0 which the documentation says is a successful connection.

          Comment


            #6
            Hello USNA11,

            If you are not getting these on a chart, then you are not getting real-time data to send to your custom application..

            Who are you connecting to for data? This is shown with a green dot in the Connections menu of the Control Center.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              I am connected to the NinjaTrader Continuum. I have the chart open as well to compare and my orders show up on the chart when I submit them through the Command method so I know I have the instrument string argument done correctly for the ES 09-20.

              Comment


                #8
                Hello USNA11,

                To confirm, you are seeing last, ask, and bid prices on a chart?

                If so, restart NinjaTrader, and then open the example project I have created, change the instrument to ES 09-20, and then run the project.

                The example project I have provided does work, is tested, and includes a video that demonstrates the behavior.
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  Sorry, turned out to be another python issue... I was under the impression from other documentation that python would be able to recognize the double natively and convert to a float (the python equivalent). For anyone running into the same issue, make sure you explicitly set the restype of the MarketData return to c_double which python will then convert to a float automatically.

                  Also, for python users, for the command method I was having issues with, set the argtypes for the strings as POINTER(c_char) then convert the strings in the actual input to bytes when calling the DLL function.

                  Comment


                    #10
                    Originally posted by USNA11 View Post
                    Sorry, turned out to be another python issue... I was under the impression from other documentation that python would be able to recognize the double natively and convert to a float (the python equivalent). For anyone running into the same issue, make sure you explicitly set the restype of the MarketData return to c_double which python will then convert to a float automatically.

                    Also, for python users, for the command method I was having issues with, set the argtypes for the strings as POINTER(c_char) then convert the strings in the actual input to bytes when calling the DLL function.
                    Can you please provide some assistance that how you have achieved DLL function call ("MarketData") from NtDirect.dll using python.

                    I am also trying to call the same function using ctype in python.

                    Do we need to configure anything in Ninja Trader Application or at any code level to authenticate or something ?

                    Thank you

                    Harsh

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by samish18, 04-17-2024, 08:57 AM
                    15 responses
                    52 views
                    0 likes
                    Last Post NinjaTrader_BrandonH  
                    Started by f.saeidi, Today, 08:13 AM
                    0 responses
                    1 view
                    0 likes
                    Last Post f.saeidi  
                    Started by kujista, Today, 06:23 AM
                    3 responses
                    6 views
                    0 likes
                    Last Post kujista
                    by kujista
                     
                    Started by f.saeidi, Today, 08:03 AM
                    1 response
                    5 views
                    0 likes
                    Last Post NinjaTrader_Jesse  
                    Started by cre8able, 04-17-2024, 04:16 PM
                    7 responses
                    64 views
                    0 likes
                    Last Post NinjaTrader_Gaby  
                    Working...
                    X