Did &action=login part existed before also. or is it a new addition.
If it existed earlier, has its placement within the response string changed.
Is it in your control which parameter will be placed where or we will receive it at arbitrary locations.
i.e it could be sometimes &action=login&status=success
and other times &status=success&action=login
My app seems to be broken because of this today.
To me it seems something has changed. because the initial screen which appears for login in web view is more prominent than before. or maybe it could be because of the Microsoft updates on its .net components.
@trade_then Action is a new query arg which we sent to identify the type of connect login attempted fox example login, basket etc. Your app should ideally be parsing the query args and check values for only the keys which you are interested in and shouldn't break when we add new key.
If it existed earlier, has its placement within the response string changed.
Order of keys in query params shouldn't matter. Any url parsing library will parse this and gives you a map so order doesn't matter.
Is it in your control which parameter will be placed where or we will receive it at arbitrary locations. i.e it could be sometimes &action=login&status=success and other times &status=success&action=login
As said above you should be parsing it with a url parser instead of doing a string match. Order shouldn't matter in that case.
Hi @trade_then, today during the market data issue I had a network exception at kite.PlaceOrder which stated it took too long to respond and my app crashed, Please let me know how do you handle such exceptions?
code there seems to be dealing with error significantly. what exactly did you receive as error? if it was a NetworkException then try putting your code in try Catch at your end and deal with exception as you deem fit according to your logic.
As to what I do well my code if heavily
try-catched.
every aspect of app is segregated from one another as WCF services. so basically whole app is a collaboration of various apps communicating with each other.
So one aspect of app cannot take down the whole application. the part which goes down can be started instantly without other-parts noticing the effects.
here is a screen-shot of how divided the app is and this does not even cover algo and charting.
@ZK2689@trade_then You should never parse URLs manually. The standard library has built-in functions for that.
For example:
class Program { static void Main(string[] args) { Uri tmp = new Uri("http://www.google.co.uk/search?hl=en&q=parsing+a+url+in+c%23&aq=f&aqi=g1g-j9&aql=&oq=");
@trade_then & @tonystark great help guys, I just now need to handle those odd exceptions, I don't know If the order was placed for that request or not but I will still update the code with a try catch block and see what happens next time if this happens, if now order gets placed i will just reorder it in the catch block.
This works almost all the time but once out of blue it throws this exception. My app strategy works on multiple instruments at the same time(currently testing with 3) and a buy/sell signal is generated independently of each other which creates an event and an order is placed.
@Z@ZK2689 Since we connect to zerodha servers over the internet, it could be intermittent network errors at your end too or something as simple as dns lookup failure. Check your dns setting and if its your ISP's DNS servers, set it to google public dns server (8.8.8.8) Also check for packet loss at your end by doing a continuous ping test for an hour or two.
@MAG This happened today too...this doesn't effects order placement, just the response is broken, I don't get the order id for these odd orders , but now since I have placed order placement under try catch, this time app didn't crashed. I am working to improve my app from here.
In parallel I would still suggest monitoring network connection on the side.
I caught issues with one provider and switched to another when I found that the first provider used to intermittently drop packets for a few seconds at random intervals through the day. The second provider obviously costs more - almost double - but is worth the money because connection reliability is paramount.
I never had any issue with this before.
Is this normal behaviour.
Although I have fixed my app it is not dependent on parameter location anymore.
Thanks
Regards
already fixed it on my side.
Would you kindly explain my 3rd point in 1st question. I am curious!.
As you can see in my second comment, 2 response strings have query parameters at completely different locations/indexes!.
I have never programmed web app.
Thanks
Regards
You can read about the spec here - https://tools.ietf.org/html/rfc3986#section-3.4
Thanks & Regards.
string toBeSearched = "request_token=";
int ix = textBoxAddressBar.Text.IndexOf(toBeSearched);
if (ix != -1)
{
string requestToken = textBoxAddressBar.Text.Substring(ix + toBeSearched.Length);
//new code
if (requestToken.Contains("&"))
{
requestToken = requestToken.Split('&')[0];
}
//rest of the code
}
Thanks & Regards.
Regards
Thanks & Regards.
I have not dealt with such issues yet with PlaceOrder. Your PlaceOrder call will ultimately boil down to
Request. function.
now let us see where you might have got stuck!.
this is where actual network call happens
code there seems to be dealing with error significantly.
what exactly did you receive as error? if it was a NetworkException then try putting your code in try Catch at your end and deal with exception as you deem fit according to your logic.
As to what I do well my code if heavily
here is a screen-shot of how divided the app is and this does not even cover algo and charting.
Thanks
Regards
For example: You will have to add a reference to System.Web.
Thanks for the utility. never dealt with web before.
so resorted to brute-force
Thanks
Regards
System.Net.WebException: 'The operation has timed out'
It doesn't seem like an error from Kite Connect API.
Dictionary sellResponse = kite.PlaceOrder(
Exchange: "NSE",
TradingSymbol: "ACC",
TransactionType: Constants.TRANSACTION_TYPE_SELL,
Quantity: 1,
OrderType: Constants.ORDER_TYPE_MARKET,
Product: Constants.PRODUCT_MIS
);
This works almost all the time but once out of blue it throws this exception. My app strategy works on multiple instruments at the same time(currently testing with 3) and a buy/sell signal is generated independently of each other which creates an event and an order is placed.
Since we connect to zerodha servers over the internet, it could be intermittent network errors at your end too or something as simple as dns lookup failure.
Check your dns setting and if its your ISP's DNS servers, set it to google public dns server (8.8.8.8)
Also check for packet loss at your end by doing a continuous ping test for an hour or two.
Thanks & Regards.
In parallel I would still suggest monitoring network connection on the side.
I caught issues with one provider and switched to another when I found that the first provider used to intermittently drop packets for a few seconds at random intervals through the day. The second provider obviously costs more - almost double - but is worth the money because connection reliability is paramount.