csharp/ABTSoftware/SciChart.Wpf.Examples/Examples/SciChart.Examples.ExternalDependencies/Data/PriceSeries.cs

PriceSeries.cs
// *************************************************************************************
// SCICHART� Copyright SciChart Ltd. 2011-2021. All rights reserved.
//  
// Web: http://www.scichart.com
//   Support: [email protected]
//   Sales:   [email protected]
// 
// PriceSeries.cs is part of SCICHART�, High Performance Scientific Charts
// For full terms and conditions of the license, see http://www.scichart.com/scichart-eula/
// 
// This source code is protected by international copyright law. Unauthorized
// reproduction, reverse-engineering, or distribution of all or any portion of
// this source code is strictly prohibited.
// 
// This source code contains confidential and proprietary trade secrets of
// SciChart Ltd., and should at no time be copied, transferred, sold,
// distributed or made available without express written permission.
// *************************************************************************************
using System;
using System.Collections.Generic;
using System.Linq;

namespace SciChart.Examples.ExternalDependencies.Data
{
    public clast PriceSeries : List
    {
        public string Symbol { get; set; }

        public PriceSeries()
        {            
        }

        public PriceSeries(int capacity) : base(capacity)
        {            
        }

        /// 
        /// Extracts the DateTime column of the PriceSeries as an array
        /// 
        public IList TimeData { get { return this.Select(x => x.DateTime).ToArray(); } }

        /// 
        /// Extracts the Open column of the PriceSeries as an array
        /// 
        public IList OpenData { get { return this.Select(x => x.Open).ToArray(); } }

        /// 
        /// Extracts the High column of the PriceSeries as an array
        /// 
        public IList HighData { get { return this.Select(x => x.High).ToArray(); } }

        /// 
        /// Extracts the Low column of the PriceSeries as an array
        /// 
        public IList LowData { get { return this.Select(x => x.Low).ToArray(); } }

        /// 
        /// Extracts the Close column of the PriceSeries as an array
        /// 
        public IList CloseData { get { return this.Select(x => x.Close).ToArray(); } }

        /// 
        /// Extracts the Volume column of the PriceSeries as an array
        /// 
        public IList VolumeData { get { return this.Select(x => x.Volume).ToArray(); } }

        public PriceSeries Clip(int startIndex, int endIndex)
        {
            var result = new PriceSeries(endIndex - startIndex);
            for(int i = startIndex; i < endIndex; i++)
            {
                result.Add(this[i]);
            }
            return result;
        }
    }
}