/// <summary>
        /// Handles incoming Bar data for persistence
        /// </summary>
        /// <param name="barDetail"></param>
        private void HandleBarData(BarDetail barDetail)
        {
            // Send incoming Bar to Disruptor
            _barPublisher.PublishEvent((barObject, sequenceNo) =>
            {
                // Set bar details
                barObject.Bar.RequestId = barDetail.Bar.RequestId;

                barObject.Bar.Open  = barDetail.Bar.Open;
                barObject.Bar.High  = barDetail.Bar.High;
                barObject.Bar.Low   = barDetail.Bar.Low;
                barObject.Bar.Close = barDetail.Bar.Close;

                barObject.Bar.Security           = barDetail.Bar.Security;
                barObject.Bar.DateTime           = barDetail.Bar.DateTime;
                barObject.Bar.MarketDataProvider = barDetail.Bar.MarketDataProvider;

                // Set bar parameters
                barObject.BarParameters.BarLength = barDetail.BarParameters.BarLength;
                barObject.BarParameters.Format    = barDetail.BarParameters.Format;
                barObject.BarParameters.PriceType = barDetail.BarParameters.PriceType;
                barObject.BarParameters.PipSize   = barDetail.BarParameters.PipSize;

                // Return updated object
                return(barObject);
            });
        }
Exemple #2
0
        public void RefreshPrintBar(int scene, BarDetail detail, string filePath)
        {
            this.Dispatcher.BeginInvoke((Action) delegate()
            {
                clearBars();

                BarChart bar = plotExperienceBar(scene, detail);
                bar.changeToPrintMode();
                TakeScreenShot(0);
            });
        }
        /// <summary>
        /// Called when new Bar is received from Market Data Server
        /// </summary>
        /// <param name="barDetail"></param>
        private void OnBarArrived(BarDetail barDetail)
        {
            MarketDataProvider provider;

            // Get Provider object
            if (_providersMap.TryGetValue(barDetail.Bar.MarketDataProvider, out provider))
            {
                if (provider.IsBarPersistenceRequired(barDetail.Bar.Security.Symbol))
                {
                    EventSystem.Publish <BarDetail>(barDetail);
                }
            }
        }
 /// <summary>
 /// Called when a publisher has committed an event to the <see cref="T:Disruptor.RingBuffer`1"/>
 /// </summary>
 /// <param name="data">Data committed to the <see cref="T:Disruptor.RingBuffer`1"/></param><param name="sequence">Sequence number committed to the <see cref="T:Disruptor.RingBuffer`1"/></param><param name="endOfBatch">flag to indicate if this is the last event in a batch from the <see cref="T:Disruptor.RingBuffer`1"/></param>
 public void OnNext(BarDetail data, long sequence, bool endOfBatch)
 {
     // Save in CSV format
     if (_persistCsv)
     {
         PersistCsvData(data);
     }
     // Save in Binary format
     if (_persistBinary)
     {
         PersistBinaryData(data);
     }
 }
 /// <summary>
 /// Saves Bar data in Binary format
 /// </summary>
 /// <param name="barDetail"></param>
 private void PersistBinaryData(BarDetail barDetail)
 {
     try
     {
         // Write new Bar in binary format
         _writerBinany.Write(barDetail.Bar, barDetail.BarParameters.Format, barDetail.BarParameters.PriceType,
                             barDetail.BarParameters.BarLength.ToString());
     }
     catch (Exception exception)
     {
         Logger.Error(exception, _type.FullName, "PersistBinaryData - Bar");
     }
 }
        /// <summary>
        /// Called when new Bar information is received from Market Data Server
        /// </summary>
        /// <param name="bar">Contains bar details</param>
        private void OnBarArrived(Bar bar)
        {
            if (_barArrivedEvent != null)
            {
                BarParameters barParameters;
                if (_barParametersMap.TryGetValue(bar.RequestId, out barParameters))
                {
                    // Create new detail object
                    BarDetail barDetail = new BarDetail(bar, barParameters);

                    _barArrivedEvent(barDetail);
                }
            }
        }
Exemple #7
0
        private void AddBarImageToCell(int scene, BarDetail detail, string filePath, PdfPTable table, int progress)
        {
            int waitForFile = 100;

            PageList.Evaluation.RefreshPrintBar(scene, detail, filePath);
            waitImageGenerating();
            Thread.Sleep(waitForFile);
            Image image = Image.GetInstance(filePath);
            PdfPCell imageCell = new PdfPCell(image);
            imageCell.HorizontalAlignment = 1;
            imageCell.PaddingTop = 25;
            table.AddCell(imageCell);
            image.ScaleAbsolute(120, 100);
            PageList.Evaluation.reportProgress(progress);
        }
Exemple #8
0
        private BarChart plotExperienceBar(int scene, BarDetail detail)
        {
            BarChart bar = new BarChart();

            bars.Children.Add(bar);
            bar.setBarFromBarDetail(detail);
            bar.MinWidth = 150;

            float normalValue, distractAValue, distractBValue, distractCValue, distractDValue;

            normalValue    = getBarChartValue(scene, UserSelections.NormalMode, detail.DataName);
            distractAValue = getBarChartValue(scene, UserSelections.DistractAMode, detail.DataName);
            distractBValue = getBarChartValue(scene, UserSelections.DistractBMode, detail.DataName);
            distractCValue = getBarChartValue(scene, UserSelections.DistractCMode, detail.DataName);
            distractDValue = getBarChartValue(scene, UserSelections.DistractDMode, detail.DataName);

            bar.setValue(normalValue, distractAValue, distractBValue, distractCValue, distractDValue);
            return(bar);
        }
Exemple #9
0
 public void setBarFromBarDetail(BarDetail detail)
 {
     setTitle(detail.BarTtitle);
 }
Exemple #10
0
 private void AddBarImageToCell(int scene, BarDetail detail, string filePath, PdfPTable table, string title, int progress)
 {
     AddBarImageToCell(scene, detail.ChangeTitle(title), filePath, table, progress);
 }