Calling Xignite using asynchronous methods
Hi I have the following code and am trying to call some historical data in xignite. In this case xyz library is an xignite library.
//fire an event GetHistoricalQuotesAsOfCompleted
proxy.GetHistoricalQuotesAsOfCompleted +=
new EventHandler<GetHistoricalQuotesAsOfCompletedEventArgs>(GetHistoricalQuotesAsOfCompleted);
//asynchronously request quotes for a time period
proxy.GetHistoricalQuotesAsOfAsync(ticker, xyz.IdentifierTypes.Symbol,
DateTime.Now.ToString(), PeriodTypes.Day, days);
Here is the error that I'm getting in my IE browsers
Webpage error details
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; GTB6; EasyBits GO v1.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.5.21022; .NET CLR 3.5.30729; MDDR; InfoPath.2; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E)
Timestamp: Wed, 6 Jul 2011 02:50:12 UTC
Message: Unhandled Error in Silverligh开发者_高级运维t Application Object reference not set to an instance of an object. at newAmStockChart.MainPage.GetHistoricalQuotesAsOfCompleted(Object sender, GetHistoricalQuotesAsOfCompletedEventArgs e)
at newAmStockChart.xyz.XigniteHistoricalSoapClient.OnGetHistoricalQuotesAsOfCompleted(Object state)
Line: 1
Char: 1
Code: 0
URI: http://localhost:60260/newAmStockChartTestPage.aspx
Message: Unhandled Error in Silverlight Application Object reference not set to an instance of an object. at newAmStockChart.MainPage.GetHistoricalQuotesAsOfCompleted(Object sender, GetHistoricalQuotesAsOfCompletedEventArgs e)
at newAmStockChart.xyz.XigniteHistoricalSoapClient.OnGetHistoricalQuotesAsOfCompleted(Object state)
Line: 1
Char: 1
Code: 0
URI: http://localhost:60260/newAmStockChartTestPage.aspx
I found out the best way to do this is not by going through SOAP but using REST on the backend and then parsing the JSON that is returned.
Here's an example Xignite URL for a REST call analogous to the original question that returns JSON:
http://www.xignite.com/xGlobalHistorical.json/GetGlobalHistoricalQuotesAsOf?Identifier=GOOG&IdentifierType=Symbol&AdjustmentMethod=SplitOnly&EndDate=2/3/2014&PeriodType=Day&Periods=7
And if you want XML or CSV instead, just substitute ".xml" or ".csv" in the URL above.
精彩评论