• 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, 01:49 PM.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Abilene, Today, 01:27 AM
              0 responses
              4 views
              0 likes
              Last Post Abilene
              by Abilene
               
              Started by simjs, Yesterday, 08:11 PM
              0 responses
              3 views
              0 likes
              Last Post simjs
              by simjs
               
              Started by mrlucky1x, Yesterday, 06:01 PM
              0 responses
              3 views
              0 likes
              Last Post mrlucky1x  
              Started by dedouglas, Yesterday, 03:17 PM
              1 response
              9 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Started by Jugado, Yesterday, 02:22 PM
              2 responses
              30 views
              0 likes
              Last Post Jugado
              by Jugado
               
              Working...
              X