forked from QuantConnect/Lean
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIBaseData.cs
137 lines (118 loc) · 5.12 KB
/
IBaseData.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
/*
* 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
{
/// <summary>
/// Base Data Class: Type, Timestamp, Key -- Base Features.
/// </summary>
public interface IBaseData
{
/// <summary>
/// Market Data Type of this data - does it come in individual price packets or is it grouped into OHLC.
/// </summary>
MarketDataType DataType
{
get;
set;
}
/// <summary>
/// Time keeper of data -- all data is timeseries based.
/// </summary>
DateTime Time
{
get;
set;
}
/// <summary>
/// End time of data
/// </summary>
DateTime EndTime
{
get;
set;
}
/// <summary>
/// Symbol for underlying Security
/// </summary>
Symbol Symbol
{
get;
set;
}
/// <summary>
/// All timeseries data is a time-value pair:
/// </summary>
decimal Value
{
get;
set;
}
/// <summary>
/// Alias of Value.
/// </summary>
decimal Price
{
get;
}
/// <summary>
/// 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.
/// </summary>
/// <returns>BaseData type set by Subscription Method.</returns>
[Obsolete("Reader(SubscriptionDataConfig, string, DateTime, DataFeedEndpoint) method has been made obsolete, use Reader(SubscriptionDataConfig, string, DateTime, bool) instead.")]
BaseData Reader(SubscriptionDataConfig config, string line, DateTime date, DataFeedEndpoint dataFeed);
/// <summary>
/// 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.
/// </summary>
/// <param name="config">Subscription data config setup object</param>
/// <param name="line">Line of the source document</param>
/// <param name="date">Date of the requested data</param>
/// <param name="isLiveMode">true if we're in live mode, false for backtesting mode</param>
/// <returns>Instance of the T:BaseData object generated by this line of the CSV</returns>
BaseData Reader(SubscriptionDataConfig config, string line, DateTime date, bool isLiveMode);
/// <summary>
/// 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.
/// </summary>
/// <param name="config">Subscription data config setup object</param>
/// <param name="stream">The data stream</param>
/// <param name="date">Date of the requested data</param>
/// <param name="isLiveMode">true if we're in live mode, false for backtesting mode</param>
/// <returns>Instance of the T:BaseData object generated by this line of the CSV</returns>
BaseData Reader(SubscriptionDataConfig config, StreamReader stream, DateTime date, bool isLiveMode);
/// <summary>
/// Return the URL string source of the file. This will be converted to a stream
/// </summary>
/// <param name="datafeed">Type of datafeed we're reqesting - backtest or live</param>
/// <param name="config">Configuration object</param>
/// <param name="date">Date of this source file</param>
/// <returns>String URL of source file.</returns>
string GetSource(SubscriptionDataConfig config, DateTime date, DataFeedEndpoint datafeed);
/// <summary>
/// Indicates if there is support for mapping
/// </summary>
/// <returns>True indicates mapping should be used</returns>
bool RequiresMapping();
/// <summary>
/// Return a new instance clone of this object
/// </summary>
/// <returns></returns>
BaseData Clone();
} // End Base Data Class
} // End QC Namespace