Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

What is the correct format of NinjaTrader ATI command?

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

    What is the correct format of NinjaTrader ATI command?

    I'm trying to open order ninja trader platform with automated trading interface For that, I have enabled the ati service from options setting in Ninja Trader and trying to send a command to the suggested port through python like below:

    Code:
    ​import socket
    def send_ati_command(command):
    try:
    # Connect to NinjaTrader ATI port
    with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
    s.connect(('localhost', 36973))
    s.sendall(command.encode())
    data = s.recv(1024)
    print('Received', repr(data.decode()))
    except Exception as e:
    print("An error occurred:", e)
    
    # Example command
    command = "PLACE;Account=Sim101;Instrument=NQ 03-24;Action=BUY;Qty=1;OrderType=MARKET;TIF=DAY"
    send_ati_command(command)​
    getting response from the server as:

    Received '2\x00'

    Can someone please identify what I am doing wrong here, Also, there is no log being created while sending the command.



    #2
    Hello ashish45351,

    Thank you for your post.

    I see your command is as follows:
    Code:
    PLACE;Account=Sim101;Instrument=NQ 03-24;Action=BUY;Qty=1;OrderType=MARKET;TIF=DAY"
    You should not include the name of the parameters within the command. Here is the format for the PLACE command with required fields in <> and option fields in []
    PLACE COMMAND
    PLACE;<ACCOUNT>;<INSTRUMENT>;<ACTION>;<QTY>;<ORDER TYPE>;[LIMIT PRICE];[STOP PRICE];<TIF>;[OCO ID];[ORDER ID];[STRATEGY];[STRATEGY ID]

    Using your command as an example, the format would be as follows:
    Code:
    PLACE; Sim101; NQ 03-24; BUY; 1; MARKET;0;0;DAY;;;;
    The following page covers different commands as well as which parameters are required and which are optional. If you choose not to use an optional parameter, you may leave it blank but still need the semicolon that would follow the parameter. Limit Price and Stop Price may be set to 0 if they are not relevant for the order type being used:


    Support for the API and the ATI (Automated Trading Interface) is very limited. We have more information in the following forum post:


    Please let us know if we may be of further assistance.
    Emily C.NinjaTrader Customer Service

    Comment


      #3
      It seems I was doing it all wrong, It was as simple as just creating a file in incoming folder, as suggested in the documentation.


      I can't believe I am trying to do this for three days. And this was this simple

      Thanks a lot

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by lightsun47, Today, 03:51 PM
      0 responses
      4 views
      0 likes
      Last Post lightsun47  
      Started by 00nevest, Today, 02:27 PM
      1 response
      8 views
      0 likes
      Last Post 00nevest  
      Started by futtrader, 04-21-2024, 01:50 AM
      4 responses
      44 views
      0 likes
      Last Post futtrader  
      Started by Option Whisperer, Today, 09:55 AM
      1 response
      13 views
      0 likes
      Last Post bltdavid  
      Started by port119, Today, 02:43 PM
      0 responses
      9 views
      0 likes
      Last Post port119
      by port119
       
      Working...
      X