/*
* QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
* Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.IO;
namespace QuantConnect.Data
{
///
/// Base Data Class: Type, Timestamp, Key -- Base Features.
///
[StubsAvoidImplicits]
public interface IBaseData : ISymbolProvider
{
///
/// Market Data Type of this data - does it come in individual price packets or is it grouped into OHLC.
///
MarketDataType DataType
{
get;
set;
}
///
/// Time keeper of data -- all data is timeseries based.
///
DateTime Time
{
get;
set;
}
///
/// End time of data
///
DateTime EndTime
{
get;
set;
}
///
/// All timeseries data is a time-value pair:
///
decimal Value
{
get;
set;
}
///
/// Alias of Value.
///
decimal Price
{
get;
}
///
/// Reader Method :: using set of arguements we specify read out type. Enumerate
/// until the end of the data stream or file. E.g. Read CSV file line by line and convert
/// into data types.
///
/// BaseData type set by Subscription Method.
[Obsolete("Reader(SubscriptionDataConfig, string, DateTime, DataFeedEndpoint) method has been made obsolete, use Reader(SubscriptionDataConfig, string, DateTime, bool) instead.")]
[StubsIgnore]
BaseData Reader(SubscriptionDataConfig config, string line, DateTime date, DataFeedEndpoint dataFeed);
///
/// Reader converts each line of the data source into BaseData objects. Each data type creates its own factory method, and returns a new instance of the object
/// each time it is called. The returned object is assumed to be time stamped in the config.ExchangeTimeZone.
///
/// Subscription data config setup object
/// Line of the source document
/// Date of the requested data
/// true if we're in live mode, false for backtesting mode
/// Instance of the T:BaseData object generated by this line of the CSV
BaseData Reader(SubscriptionDataConfig config, string line, DateTime date, bool isLiveMode);
///
/// Reader converts each line of the data source into BaseData objects. Each data type creates its own factory method, and returns a new instance of the object
/// each time it is called. The returned object is assumed to be time stamped in the config.ExchangeTimeZone.
///
/// Subscription data config setup object
/// The data stream
/// Date of the requested data
/// true if we're in live mode, false for backtesting mode
/// Instance of the T:BaseData object generated by this line of the CSV
[StubsIgnore]
BaseData Reader(SubscriptionDataConfig config, StreamReader stream, DateTime date, bool isLiveMode);
///
/// Return the URL string source of the file. This will be converted to a stream
///
/// Type of datafeed we're reqesting - backtest or live
/// Configuration object
/// Date of this source file
/// String URL of source file.
[StubsIgnore]
string GetSource(SubscriptionDataConfig config, DateTime date, DataFeedEndpoint datafeed);
///
/// Indicates if there is support for mapping
///
/// True indicates mapping should be used
bool RequiresMapping();
///
/// Return a new instance clone of this object
///
///
BaseData Clone();
} // End Base Data Class
} // End QC Namespace