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

Is it posible to Self Host a REST API through an Indicator?

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

    Is it posible to Self Host a REST API through an Indicator?

    I recently took a look at NinjaMonitor. It apparently has an Android Widget, but I would like to write my own iOS client and consume our NT data via REST.

    Question: Is there anything preventing me from using .NET's "System.Web.Http" to build a service in a separate namespace within an indicator and "self publish" from that same indicator? Any suggestions?

    Thank You!
    Rob
    Last edited by RobVig; 06-13-2016, 12:02 PM.

    #2
    Hello,

    Thank you for the question.

    NinjaTrader is able to reference or compile standard C# items, so there would not really be any specific limitation I could mention.

    So long as you create the script in a way it does not lock the current thread, there should be no problem in using any standard C# namespaces. This is of course outside what our general NinjaScript support could provide assistance with, but it would certainly be possible.

    The best judge of these types of items would be to create a sample indicator and test it, if you don't get errors and the test is successful it could be used.

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

    Comment


      #3
      Thanks for responding Jesse!

      That's the feedback I was hoping to hear before I started testing!

      Let me solicit your experience before I start; In general terms, how would you architect this solution? What's your advice? Should this be done as part of a stand-alone strategy or indicator?

      Thanks again!
      Rob
      Last edited by RobVig; 06-13-2016, 09:29 AM.

      Comment


        #4
        Hello,

        In NT7 there is not really a specific choice I would recommend, probably an indicator for simplicity unless you want it to report a specific strategies items as well. Keep in mind it is difficult to access Strategy information from outside a strategy. For only Price information or anything an indicator can see, likely an indicator would be the best solution for simplicity.

        going forward in NT8, I would suggest using specifically an Addon for this type of task.

        In NT7 the main consideration would be to not lock up the UI or chart using synchronous methods. If you HTTP request and the remainder of the chart is locked up, that would provide a poor user experience or could lead to crashes.

        These would be the only considerations I would recommend on this subject as this is going to highly depend on what you want it to do or how you want it to work.

        MSDN has good HTTP request examples or even client/server socket examples you could look into, likely you could just copy and paste the example into an indicator for testing.

        On a final note, with any script I would suggest doing this type of work After initialize, so in OnStartup or later. This is simple so you are not connecting or doing other HTTP work everytime you open the Indicators menu in general.


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

        Comment


          #5
          Beautiful!

          Ideally we would like to look at the P/L of our current positions. I could use the SendMail() function for alerts, but we need something a little more comprehensive / holistic (wow... big words... sry) on a mobile device...

          Thank You Jesse!
          Last edited by RobVig; 06-13-2016, 10:29 AM.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by RubenCazorla, Today, 09:07 AM
          0 responses
          1 view
          0 likes
          Last Post RubenCazorla  
          Started by BarzTrading, Today, 07:25 AM
          2 responses
          28 views
          1 like
          Last Post BarzTrading  
          Started by devatechnologies, 04-14-2024, 02:58 PM
          3 responses
          20 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Started by tkaboris, Today, 08:01 AM
          0 responses
          6 views
          0 likes
          Last Post tkaboris  
          Started by EB Worx, 04-04-2023, 02:34 AM
          7 responses
          165 views
          0 likes
          Last Post VFI26
          by VFI26
           
          Working...
          X