private void DataReceivedCallback(DataChunk chunk) { foreach (IBarData bar in chunk.Records.ToBarRecords()) { if (bar.Open.HasValue && bar.High.HasValue && bar.Low.HasValue && bar.Close.HasValue && bar.Timestamp.HasValue) { Console.WriteLine( "{0}: EUR= OHLC {1} {2} {3} {4}", bar.Timestamp.Value.ToShortDateString(), bar.Open.Value.ToString("##.0000"), bar.High.Value.ToString("##.0000"), bar.Low.Value.ToString("##.0000"), bar.Close.Value.ToString("##.0000") ); } ; } if (!chunk.IsLast) { return; } request = null; SgtTrQuerier.StopMessagePump(); }
private void RunButton_OnClick(object sender, RoutedEventArgs e) { // Ensure call .Dispose() on no more used subscriptions if (this.dataSubscription != null) { this.dataSubscription.Dispose(); } this.Records.Clear(); this.requestTime = DateTime.Now; this.HistoricalDataCount = 0; this.IsLoading = true; GetCommonMeta(this.Ric); //GetCurrency(this.Ric); //GetHolidaysForRIC(); /* * this.dataSubscription = DataServices.Instance.TimeSeries.SetupDataSubscription(this.Ric) * .WithInterval(CommonInterval.Daily) * .OnDataReceived(this.OnSubscriptionDataReceived) * .OnDataUpdated(this.OnSubscriptionDataUpdated) * .OnStatusUpdated(status => this.Title = string.Format("Status: {0} Error: {1}", status.State, status.Error)) * .CreateAndStart(); */ dataRequest = DataServices.Instance.TimeSeries.SetupDataRequest(this.Ric) .From(DateTime.Today.AddYears(-1)) .WithInterval(CommonInterval.Daily) .OnDataReceived(this.OnSubscriptionDataReceived) .WithView("BID") .CreateAndSend(); }
private void get_data_eikon_nav(string str_ricname, string v_view_type, char chr_interval, string par_from_date, string par_to_date) { string format = "yyyyMMdd"; DateTime dt_from = DateTime.ParseExact(par_from_date, format, System.Globalization.CultureInfo.InvariantCulture); DateTime dt_to = DateTime.ParseExact(par_to_date, format, System.Globalization.CultureInfo.InvariantCulture); CommonInterval interval = CommonInterval.Daily; if (chr_interval == 'd') { interval = CommonInterval.Daily; } else if (chr_interval == 'w') { interval = CommonInterval.Weekly; } else if (chr_interval == 'm') { interval = CommonInterval.Monthly; } else if (chr_interval == 'q') { interval = CommonInterval.Quarterly; } else if (chr_interval == 'y') { interval = CommonInterval.Yearly; } /* select the view depend on the type of security * equity or etf - TRCPRC_1 * fund - NAV, TRCPRC_1 * bond - BID, DAILY_RETURN */ //default /* this.view_type = "TRDPRC_1"; * * if (chr_type == 'e') * this.view_type = "TRDPRC_1"; * else if (chr_type == 'f') * this.view_type = "NAV"; * else if (chr_type == 'b') * this.view_type = "BID"; */ /* try NAV, BID then TRDPRC_1 */ dataRequest = DataServices.Instance.TimeSeries.SetupDataRequest(str_ricname) .From(dt_from).To(dt_to) .WithView(v_view_type) .WithInterval(interval) .OnDataReceived(this.OnRestSubscriptionNavDataReceived) .OnStatusUpdated(this.SubscriptionStatusChanged) .CreateAndSend(); }
public void Launch() { Console.WriteLine("[2] Time series request example"); Console.WriteLine(""); request = timeSeries.SetupDataRequest("EUR=") .WithView("BID") .WithAllFields() .WithInterval(CommonInterval.Daily) .WithNumberOfPoints(10) .OnDataReceived(DataReceivedCallback) .CreateAndSend(); }