Navigation

    SmartAPI Forum
    • Register
    • Login
    • Search
    • Categories
    • Popular
    • Groups
    • FAQs
    • API Docs
    1. Home
    2. saleem
    S
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    saleem

    @saleem

    4
    Reputation
    11
    Posts
    5
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    saleem Follow

    Best posts made by saleem

    • GTT Triggered - SELL Order

      When GTT is triggered, it places a SELL (or BUY) Order as LIMIT. Instead, how do we change to MARKET?

      posted in C#/.Net SDK
      S
      saleem
    • RE: Downloading All Instruments

      @vcb
      Implement a class like this...
      public class NSEInstrument
      {
      [JsonProperty("token")]
      public string token { get; set; }
      [JsonProperty("symbol")]
      public string symbol { get; set; }
      [JsonProperty("name")]
      public string name { get; set; }
      }

      And write this function...
      public List<NSEInstrument> GetNSEInstruments()
      {
      WebRequest webRequest = WebRequest.Create("https://margincalculator.angelbroking.com/OpenAPI_File/files/OpenAPIScripMaster.json");
      HttpWebResponse response = (HttpWebResponse)webRequest.GetResponse();
      if (response.StatusDescription == "OK")
      {
      Stream dataStream = response.GetResponseStream();
      StreamReader reader = new StreamReader(dataStream);
      string responseFromServer = reader.ReadToEnd();
      List<NSEInstrument> data = JsonConvert.DeserializeObject<List<NSEInstrument>>(responseFromServer);
      return data;
      }
      return null;
      }

      Call this function to get all the instruments and tokens

      posted in C#/.Net SDK
      S
      saleem

    Latest posts made by saleem

    • RE: option OI data for Nifty and Banknifty

      @smrtsaravanan
      Did you figure out, how to gte this info?

      posted in General Discussion
      S
      saleem
    • Web Socket: Is not returning anything
      	private void btnAngelOneLogin_Click(object sender, EventArgs e)
      	{
      
      	AngelOne = new SmartApi(API_KEY_ANGELONE);
      
      	string totp = GetTotp(TOTP_QR_KEY_ANGELONE);
      
      	OutputBaseClass obj = new OutputBaseClass();
      	obj = AngelOne.GenerateSession(CLIENT_CODE_ANGELONE, MPIN_ANGELONE, totp);
      	AngelToken sagr = obj.TokenResponse;
      
      	if (obj.status == false)
      	{
      		string http_code = obj.http_code;
      		string http_error = obj.http_error;
      
      		return;
      	}
      
      
      	WebSocket _WS = new WebSocket();
      	var exitEvent = new ManualResetEvent(false);
      
      	_WS.ConnectforStockQuote(sagr.feedToken, CLIENT_CODE_ANGELONE);
      	if (_WS.IsConnected())
      	{
      		string script = "nse_cm|2885&nse_cm|1594&nse_cm|11536&nse_cm|3045";
      		_WS.RunScript(sagr.feedToken, CLIENT_CODE_ANGELONE, script, "mw");
      		_WS.MessageReceived += WriteResult;
      
      
      		//_WS.Close(true);// to stop and close socket connection
      	}
      	exitEvent.WaitOne();
      
      	}
      
      	static void WriteResult(object sender, MessageEventArgs e)
      	{
      	    Console.WriteLine("Tick Received : " + e.Message);
      	}
      }
      

      I am calling this from Winform application, not getting any call backs.
      It just stays at this code, exitEvent.WaitOne();

      Anyhelp will be great.

      posted in C#/.Net SDK
      S
      saleem
    • GTT Triggered - SELL Order

      When GTT is triggered, it places a SELL (or BUY) Order as LIMIT. Instead, how do we change to MARKET?

      posted in C#/.Net SDK
      S
      saleem
    • RE: GTT support

      @saleem Got this working.

      posted in C#/.Net SDK
      S
      saleem
    • RE: Downloading All Instruments

      Write a class and code like this...

      public class NSEInstrument
      {
      [JsonProperty("token")]
      public string token { get; set; }
      [JsonProperty("symbol")]
      public string symbol { get; set; }
      [JsonProperty("name")]
      public string name { get; set; }
      }

        public List<NSEInstrument> GetNSEInstruments()
      	{
           WebRequest webRequest = WebRequest.Create("https://margincalculator.angelbroking.com/OpenAPI_File/files/OpenAPIScripMaster.json");
           HttpWebResponse response = (HttpWebResponse)webRequest.GetResponse();
           if (response.StatusDescription == "OK")
           {
              Stream dataStream = response.GetResponseStream();
              StreamReader reader = new StreamReader(dataStream);
              string responseFromServer = reader.ReadToEnd();
              List<NSEInstrument> data = JsonConvert.DeserializeObject<List<NSEInstrument>>(responseFromServer);
              return data;
           }
           return null;
        }
      
      posted in C#/.Net SDK
      S
      saleem
    • GTT support

      How to access GTT from API?

      posted in C#/.Net SDK
      S
      saleem
    • RE: Downloading All Instruments

      @vcb
      Implement a class like this...
      public class NSEInstrument
      {
      [JsonProperty("token")]
      public string token { get; set; }
      [JsonProperty("symbol")]
      public string symbol { get; set; }
      [JsonProperty("name")]
      public string name { get; set; }
      }

      And write this function...
      public List<NSEInstrument> GetNSEInstruments()
      {
      WebRequest webRequest = WebRequest.Create("https://margincalculator.angelbroking.com/OpenAPI_File/files/OpenAPIScripMaster.json");
      HttpWebResponse response = (HttpWebResponse)webRequest.GetResponse();
      if (response.StatusDescription == "OK")
      {
      Stream dataStream = response.GetResponseStream();
      StreamReader reader = new StreamReader(dataStream);
      string responseFromServer = reader.ReadToEnd();
      List<NSEInstrument> data = JsonConvert.DeserializeObject<List<NSEInstrument>>(responseFromServer);
      return data;
      }
      return null;
      }

      Call this function to get all the instruments and tokens

      posted in C#/.Net SDK
      S
      saleem
    • Login does not seem work
      	public static string GetTotp(string otpKey)
      	{
      	var secretKey = tpNet.Base32Encoding.ToBytes(otpKey);
      	var totp = new Totp(secretKey);
      	//var otp = totp.ComputeTotp();
      	//return otp;
      
      	if (totp.RemainingSeconds() < 2)
      	{
      		Thread.Sleep(3);
      	}
      	return totp.ComputeTotp();
      	}
      	private void btnAngelOneLogin_Click(object sender, EventArgs e)
      	{
      		string api_key = "kpfqJYZO";
      		string Client_code = "M51790325";
      		string totp_qr_code_key = "4ELFQ5KYC4JL4VGNDIGPU49CJM";
      
      		SmartApi connect = new SmartApi(api_key);
      		string totp = GetTotp(totp_qr_code_key);
      
      		OutputBaseClass obj = new OutputBaseClass();
      		obj = connect.GenerateSession(Client_code, totp);
      
      		if (obj.status == false)
      		{
      			string http_code = obj.http_code;
      			string http_error = obj.http_error;
      
      			string msg = string.Format("Error Logging in. HTTP Code: {0}, HTTP Error: {1}", http_code, http_error);
      
      			MessageBox.Show(this, msg);
      			return;
      		}
      

      }

      How to fix this, Any help will be greatly appreciated

      posted in C#/.Net SDK
      S
      saleem
    • RE: Invalid TOTP for c#

      @vijayyande ..
      Please share with me, saleem.navalur@gmail.com

      posted in General Discussion
      S
      saleem
    • RE: Invalid TOTP for c#

      @dstelangre
      I am using the same code, does not seem to be working.
      I am using Otp.Net from Nuget
      I am using AngelBroking project as reference from Git, not the one you have attached.

      Any reason, why its not working?
      Any help will be great!!!

      Thanks
      Saleem

      posted in General Discussion
      S
      saleem