• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Sending message by GET http method

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

    Sending message by GET http method

    Hi.

    I would like to send messages from a strategy to a Telegram Bot and I don´t know what function in Ninjascript must I use in order to make a http GET method (with an URL).

    Example:
    https://api.telegram.org/bot<token>/[email protected]&text=This+is+ a+test.

    Could you tell me which C# function must I use in Ninjascript?

    Thank you.
    Regards.

    #2
    Hello ccruells,

    This would be outside of what is supported by NinjaTrader.

    However, I would recommend you look into the WebClient class of C#.
    https://msdn.microsoft.com/en-us/lib...(v=vs.80).aspx
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Send Telegram message from Ninjatrader Share services

      Were you able to achieve sending of telegram messages from ninjatrader?

      Comment


        #4
        Originally posted by ccruells View Post
        Hi.

        I would like to send messages from a strategy to a Telegram Bot and I don´t know what function in Ninjascript must I use in order to make a http GET method (with an URL).

        Example:
        https://api.telegram.org/bot<token>/[email protected]&text=This+is+ a+test.

        Could you tell me which C# function must I use in Ninjascript?

        Thank you.
        Regards.
        Were you able to achieve sending of telegram messages from ninjatrader? If yes, please can you help or post what you achieved.

        Comment


          #5
          Originally posted by paragsatpute View Post
          Were you able to achieve sending of telegram messages from ninjatrader? If yes, please can you help or post what you achieved.
          Please read reply #2 from NT_ChelseaB

          http://ninjatrader.com/support/forum...19&postcount=2

          Comment


            #6
            In terms of performance the HttpWebRequest class is a bit faster and adds a bit more functionality than WebClient

            Code:
            string result = string.Empty;
            string url = @"https://api.telegram.org/bot<token>/[email protected]&text=This+is+ a+test.";
            
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
            request.AutomaticDecompression = DecompressionMethods.GZip;
            
            using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
            using (Stream stream = response.GetResponseStream())
            using (StreamReader reader = new StreamReader(stream))
            {
                result = reader.ReadToEnd();
            }

            Comment


              #7
              Hi,
              It works.
              Thanks !!!
              Last edited by benjaminrc78; 01-17-2018, 12:49 PM.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by chnh1, Yesterday, 11:51 PM
              0 responses
              4 views
              0 likes
              Last Post chnh1
              by chnh1
               
              Started by Jasper99, Yesterday, 10:29 PM
              0 responses
              10 views
              0 likes
              Last Post Jasper99  
              Started by Jasper99, Yesterday, 09:50 PM
              0 responses
              2 views
              0 likes
              Last Post Jasper99  
              Started by StevenNelson, Yesterday, 05:57 PM
              0 responses
              5 views
              0 likes
              Last Post StevenNelson  
              Started by srbdoc, Yesterday, 03:59 PM
              1 response
              15 views
              0 likes
              Last Post NinjaTrader_EricB  
              Working...
              X