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

TCP Server/Share informations

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

    TCP Server/Share informations

    Hello,

    I'm building an AddOn where i need to share some informations with a service (same machine as Ninja).
    For that i'm trying to create a TCP server in this AddOn, and when my service needs, he connect with this TCP server. And this should be as fast as it could (less 1 second), that's why the TCP
    The problem is that for some reason the server keeps closing the connection.
    I tried to use some libraries for that too (www.zyan.com.de), but without sucess.
    If i take the exact same code and run it in a Console application it works.
    I have checked that TCP server opens the port (netstat -an) but i don't know why it doesn't work.

    So my question is, does Ninja block that kind of operation ?


    Or, does anyone have a better option for that ? (Maybe subscribing to MarketData in my service ? Don't know if possible).
    Last edited by JulianoFL; 05-10-2018, 06:13 PM.

    #2
    Hello JulianoFL,

    Thank you for the post.

    In general, NinjaTrader would not be blocking this specifically, this is likely due to some problem in the way the code is being executed.

    NinjaTrader is capable of executing standard C# code which includes doing network operations. If you are reaching the server this would not be a problem with something blocking it but likely some requirement of the connection or how the code was executed. This is also a subject our support would not necessarily be able to assist with (the server/client connection portion).

    I would like to ask, what is the service you are trying to interface with or what specifically is trying to be accomplished? Potentially there is a better way than TCP.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Hello Jesse,

      Long story short, it's another C# application.
      I would like to get some information about ladder volumes and Ask/Last/Bid values, and do some calculations with then.
      For me the perfect would be to subscribe the MarketData event values inside this service (so i don't lose time openning a TCP server, wrap the data, etc.).
      I could build the service inside an AddOn, but i think this would be the worse option at moment.

      If you think there's a better option, please let me know. Until that i'm going to try another variations of TCP server.

      Thanks !

      Comment


        #4
        Hello JulianoFL,

        Thank you for the reply.

        If this is something you have the source code for, and it is C# and is a .net version 4.5 or less I would highly suggest porting it into an addon. Having NinjaTrader execute everything would eliminate any delays that may be caused by interprocess communication.

        Interprocess communication is a difficult subject and can be a large point of failure if it is not done correctly. In the case of TCP, this could be a lot of variables preventing the connection. This would be something you would likely need to test to see if the libraries being used work for the intended purpose in NinjaTrader. You may need to experiment with where that syntax is being called from and various options because NinjaTrader is a multi-threaded application where a console application is not. This could be a major difference when performing tests outside of NinjaTrader.

        If migrating the application is not an option, I will mention the following items although I can't really provide any details on these topics.

        The NinaTrader ATI has some functionality which can be interfaced with from another C# application although this is 100% unsupported. This is an area you could explore but I could not really suggest over just migrating directly to an addon.



        Another option over TCP may be websockets, there are various socket libraries for .net which may be more reliable than TCP.

        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by RubenCazorla, Today, 09:07 AM
        2 responses
        13 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by i019945nj, 12-14-2023, 06:41 AM
        7 responses
        82 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by timmbbo, 07-05-2023, 10:21 PM
        4 responses
        158 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by tkaboris, Today, 08:01 AM
        1 response
        8 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by Lumbeezl, 01-11-2022, 06:50 PM
        31 responses
        820 views
        1 like
        Last Post NinjaTrader_Adrian  
        Working...
        X