Beispiel #1
0
        void chartDataSeries_DataSeriesUpdated(object sender, DataSeriesUpdatedEventArgs e)
        {
            Spy.Print("DataSeriesUpdated (on thread)");

            if (e.TradeBarIndexUpdate == -1)
            {
                return;
            }

            var update = new ezDataSeriesUpdatedEventArgs(e.ModeIndexUpdate, e.SettlementIndexUpdate, e.TradeBarIndexUpdate);

            for (int i = e.TradeBarIndexUpdate; i < ctsChartData.TradeBars.Count; i++)
            {
                if (i >= chartData.TradeBars.Count)
                {
                    BarDataPoint bdp   = ctsChartData.TradeBars[i] as BarDataPoint;
                    var          ezBar = new ezBarDataPoint();
                    ezBar.Open       = bdp.OpenTicks;
                    ezBar.High       = bdp.HighTicks;
                    ezBar.Low        = bdp.LowTicks;
                    ezBar.Close      = bdp.CloseTicks;
                    ezBar.TradeCount = bdp.TradeCount;
                    ezBar.Volume     = bdp.Volume;
                    ezBar.TradeDate  = bdp.TradeDate;
                    ezBar.Time       = bdp.Time;
                    chartData.TradeBars.Add(ezBar);
                }
                else
                {
                    BarDataPoint bdp = ctsChartData.TradeBars[i] as BarDataPoint;
                    //var ezBar = new ezBarDataPoint(bdp.OpenTicks, bdp.HighTicks, bdp.LowTicks, bdp.CloseTicks, bdp.TradeCount, bdp.Volume, bdp.TradeDate, bdp.Time);
                    var ezBar = new ezBarDataPoint();
                    ezBar.Open       = bdp.OpenTicks;
                    ezBar.High       = bdp.HighTicks;
                    ezBar.Low        = bdp.LowTicks;
                    ezBar.Close      = bdp.CloseTicks;
                    ezBar.TradeCount = bdp.TradeCount;
                    ezBar.Volume     = bdp.Volume;
                    ezBar.TradeDate  = bdp.TradeDate;
                    ezBar.Time       = bdp.Time;
                    chartData.TradeBars.Add(ezBar);
                    chartData.UpdateTradeBar(i, ezBar);
                }
            }
            chartData.DataProviderSeriesUpdated(update);
        }
Beispiel #2
0
        void chartDataSeries_DataLoadComplete(object sender, DataLoadCompleteEventArgs e)
        {
            Spy.Print("DataLoadComplete (on thread)");

            for (int i = 0; i < ctsChartData.TradeBars.Count; i++)
            {
                BarDataPoint bdp = ctsChartData.TradeBars[i] as BarDataPoint;
                //var ezBar = new ezBarDataPoint(bdp.OpenTicks, bdp.HighTicks, bdp.LowTicks, bdp.CloseTicks, bdp.TradeCount, bdp.Volume, bdp.TradeDate, bdp.Time);
                var ezBar = new ezBarDataPoint();
                ezBar.Open       = bdp.OpenTicks;
                ezBar.High       = bdp.HighTicks;
                ezBar.Low        = bdp.LowTicks;
                ezBar.Close      = bdp.CloseTicks;
                ezBar.TradeCount = bdp.TradeCount;
                ezBar.Volume     = bdp.Volume;
                ezBar.TradeDate  = bdp.TradeDate;
                ezBar.Time       = bdp.Time;
                chartData.TradeBars.Add(ezBar);
            }
            chartData.DataProviderLoadComplete();
        }
Beispiel #3
0
        public static void GetChartData(string symbol, DateTime startDate)
        {
            DateTime endDate    = DateTime.Now;
            var      historical = InternetFinancialData.GetYahooHistorical(symbol, startDate, endDate);

            List <ezBarDataPoint> dataPoints = new List <ezBarDataPoint>();

            foreach (HistoricalQuote hq in historical)
            {
                ezBarDataPoint dp = new ezBarDataPoint(hq.Open, hq.High, hq.Low, hq.Close, hq.Volume);
                dataPoints.Add(dp);
            }

            Console.WriteLine("load realtime chart data - complete");

            /*if (DataLoadComplete != null)
             * {
             *  ezDateRange requested = new ezDateRange();
             *  ezDateRange processed = new ezDateRange();
             *  DataLoadComplete(this, new ezDataLoadCompleteEventArgs(zDataLoadStatus.Success, requested, processed));
             * }*/
        }
 public void UpdateTradeBar(int index, ezBarDataPoint barDataPoint)
 {
     dataPoints[index] = barDataPoint;
 }