You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: DataLibrary/MyCustomDataType.cs
+13-8Lines changed: 13 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -16,6 +16,7 @@
16
16
17
17
usingSystem;
18
18
usingNodaTime;
19
+
usingProtoBuf;
19
20
usingSystem.IO;
20
21
usingQuantConnect;
21
22
usingQuantConnect.Data;
@@ -28,6 +29,12 @@ namespace DataLibrary
28
29
/// </summary>
29
30
publicclassMyCustomDataType:BaseData
30
31
{
32
+
/// <summary>
33
+
/// Some custom data property
34
+
/// </summary>
35
+
[ProtoMember(2000)]
36
+
publicstringSomeCustomProperty{get;set;}
37
+
31
38
/// <summary>
32
39
/// Return the URL string source of the file. This will be converted to a stream
33
40
/// </summary>
@@ -64,7 +71,7 @@ public override BaseData Reader(SubscriptionDataConfig config, string line, Date
64
71
returnnewMyCustomDataType
65
72
{
66
73
Symbol=config.Symbol,
67
-
Value=Parse.Decimal(csv[1]),
74
+
SomeCustomProperty=csv[1],
68
75
Time=parsedDate,
69
76
EndTime=parsedDate+TimeSpan.FromDays(1)
70
77
};
@@ -79,21 +86,19 @@ public override BaseData Clone()
79
86
returnnewMyCustomDataType
80
87
{
81
88
Symbol=Symbol,
82
-
Value=Value,
83
89
Time=Time,
84
-
EndTime=EndTime
90
+
EndTime=EndTime,
91
+
SomeCustomProperty=SomeCustomProperty,
85
92
};
86
93
}
87
94
88
95
/// <summary>
89
-
/// Indicates whether the data source is tied
90
-
/// to an underlying symbol and requires that corporate
91
-
/// events be applied to it as well, such as renames and delistings
96
+
/// Indicates whether the data source is tied to an underlying symbol and requires that corporate events be applied to it as well, such as renames and delistings
92
97
/// </summary>
93
98
/// <returns>false</returns>
94
99
publicoverrideboolRequiresMapping()
95
100
{
96
-
returnfalse;
101
+
returntrue;
97
102
}
98
103
99
104
/// <summary>
@@ -111,7 +116,7 @@ public override bool IsSparseData()
Copy file name to clipboardExpand all lines: README.md
+20Lines changed: 20 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,6 +37,8 @@ The script should be provided to `QuantConnect` as well as the fork repository a
37
37
38
38
### User guide
39
39
40
+
TODO:
41
+
40
42
### Tutorials
41
43
42
44
#### Create Data Type
@@ -64,16 +66,34 @@ The `DataLibrary` project holds an example custom data type [MyCustomDataType](h
64
66
65
67
It will be a requisite that each data type has a json and protobuf round trip serialization and deserialization, as well as a clone unit test. Examples provided at [MyCustomDataTypeTests](https://github.com/QuantConnect/LeanDataSdk/blob/master/Tests/MyCustomDataTypeTests.cs)
66
68
69
+
The only adjusment `MyCustomDataTypeTests` test suite requires for a new data type should be the `CreateNewInstance()` method. Which should returned a fully initialized data point.
70
+
67
71
#### Create Algorithm
68
72
73
+
##### Introduction
74
+
75
+
Creating an example `QCAlgorithm` will allow quants to understand how to consume a data set and what value could it provide to their trading strategy.
76
+
77
+
##### Developing Algorithm
69
78
79
+
A [sample](https://github.com/QuantConnect/LeanDataSdk/blob/master/Tests/CustomDataAlgorithm.cs) algorithm is provided in this repository for the defined custom data type.
80
+
81
+
-`Initialize()` Specifies the **data** and resolution required, as well as the cash and start-end dates for the algorithm. This is where the custom data should be added.
82
+
-`OnData(Slice slice)` is the primary entry point for the algorithm. Each new data point will be pumped through it. This should be where the custom data is retrieved from the `slice` object and used.
70
83
71
84
#### Create Data Converters
72
85
86
+
##### Introduction
87
+
88
+
Data converter scripts will be in charge of fetching new data and processing it into a format that Lean and the [new data type](https://github.com/QuantConnect/LeanDataSdk#create-data-type) will be able to read.
0 commit comments