/// <summary> /// Construct a MarketDataDescription item. /// </summary> /// <param name="ticker">The ticker symbol to use.</param> /// <param name="dataType">The data type needed.</param> /// <param name="type">The normalization type.</param> /// <param name="input">Is this field used for input?</param> /// <param name="predict">Is this field used for prediction?</param> public MarketDataDescription(TickerSymbol ticker, MarketDataType dataType, Type type, bool input, bool predict) : this(ticker, dataType, type, null, input, predict) { }
/// <summary> /// Construct a MarketDataDescription item. /// </summary> /// <param name="ticker">The ticker symbol to use.</param> /// <param name="dataType">The data type needed.</param> /// <param name="type">The normalization type.</param> /// <param name="activationFunction"> The activation function to apply to this data, can be null.</param> /// <param name="input">Is this field used for input?</param> /// <param name="predict">Is this field used for prediction?</param> public MarketDataDescription(TickerSymbol ticker, MarketDataType dataType, Type type, IActivationFunction activationFunction, bool input, bool predict) : base(activationFunction, type, input, predict) { this.ticker = ticker; this.dataType = dataType; }
/// <summary> /// Load one ticker symbol. /// </summary> /// <param name="ticker">The ticker symbol to load.</param> /// <param name="from">Load data from this date.</param> /// <param name="to">Load data to this date.</param> private void LoadSymbol(TickerSymbol ticker, DateTime from, DateTime to) { ICollection <LoadedMarketData> data = this.Loader.Load(ticker, null, from, to); foreach (LoadedMarketData item in data) { TemporalPoint point = this.CreatePoint(item.When); LoadPointFromMarketData(ticker, point, item); } }
/// <summary> /// Load one point of market data. /// </summary> /// <param name="ticker">The ticker symbol to load.</param> /// <param name="point">The point to load at.</param> /// <param name="item">The item being loaded.</param> private void LoadPointFromMarketData(TickerSymbol ticker, TemporalPoint point, LoadedMarketData item) { foreach (TemporalDataDescription desc in this.Descriptions) { MarketDataDescription mdesc = (MarketDataDescription)desc; if (mdesc.Ticker.Equals(ticker)) { point.Data[mdesc.Index] = item.Data[mdesc.DataType]; } } }
/// <summary> /// Determine if two ticker symbols equal each other. /// </summary> /// <param name="other">The other ticker symbol.</param> /// <returns>True if the two symbols equal.</returns> public bool Equals(TickerSymbol other) { // if the symbols do not even match then they are not equal if (!other.Symbol.Equals(this.Symbol)) { return(false); } // if the symbols match then we need to compare the exchanges if (other.Exchange == null && other.Exchange == null) { return(true); } if (other.Exchange == null || this.Exchange == null) { return(false); } return(other.Exchange.Equals(this.Exchange)); }
/// <summary> /// Construct a MarketDataDescription item. /// </summary> /// <param name="ticker">The ticker symbol to use.</param> /// <param name="dataType">The data type needed.</param> /// <param name="input">Is this field used for input?</param> /// <param name="predict">Is this field used for prediction?</param> public MarketDataDescription(TickerSymbol ticker, MarketDataType dataType, bool input, bool predict) : this(ticker, dataType, Type.PERCENT_CHANGE, null, input, predict) { }
/// <summary> /// Load one ticker symbol. /// </summary> /// <param name="ticker">The ticker symbol to load.</param> /// <param name="from">Load data from this date.</param> /// <param name="to">Load data to this date.</param> private void LoadSymbol(TickerSymbol ticker, DateTime from, DateTime to) { ICollection<LoadedMarketData> data = this.Loader.Load(ticker, null, from, to); foreach (LoadedMarketData item in data) { TemporalPoint point = this.CreatePoint(item.When); LoadPointFromMarketData(ticker, point, item); } }
/// <summary> /// Determine if two ticker symbols equal each other. /// </summary> /// <param name="other">The other ticker symbol.</param> /// <returns>True if the two symbols equal.</returns> public bool Equals(TickerSymbol other) { // if the symbols do not even match then they are not equal if (!other.Symbol.Equals(this.Symbol)) { return false; } // if the symbols match then we need to compare the exchanges if (other.Exchange == null && other.Exchange == null) { return true; } if (other.Exchange == null || this.Exchange == null) { return false; } return other.Exchange.Equals(this.Exchange); }