Skip to content

Commit 0b81cf0

Browse files
authored
Add dataMappingMode parameter to History methods (#7204)
* Add dataMappingMode parameter to every history api method overload * Minor unit tests fixes * Update regression algorithm stats * Minor changes * Minor changes
1 parent 6b1f859 commit 0b81cf0

35 files changed

Lines changed: 540 additions & 165 deletions

‎Algorithm.CSharp/BasicTemplateContinuousFutureAlgorithm.cs‎

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public override void Initialize()
5151
contractDepthOffset: 0
5252
);
5353

54-
_fast = SMA(_continuousContract.Symbol, 3, Resolution.Daily);
54+
_fast = SMA(_continuousContract.Symbol, 4, Resolution.Daily);
5555
_slow = SMA(_continuousContract.Symbol, 10, Resolution.Daily);
5656
}
5757

@@ -118,7 +118,7 @@ public override void OnSecuritiesChanged(SecurityChanges changes)
118118
/// <summary>
119119
/// Data Points count of all timeslices of algorithm
120120
/// </summary>
121-
public long DataPoints => 709638;
121+
public long DataPoints => 708465;
122122

123123
/// <summary>
124124
/// Data Points count of the algorithm history
@@ -130,30 +130,30 @@ public override void OnSecuritiesChanged(SecurityChanges changes)
130130
/// </summary>
131131
public Dictionary<string, string> ExpectedStatistics => new Dictionary<string, string>
132132
{
133-
{"Total Trades", "2"},
134-
{"Average Win", "0%"},
135-
{"Average Loss", "-0.02%"},
136-
{"Compounding Annual Return", "-0.033%"},
137-
{"Drawdown", "0.000%"},
138-
{"Expectancy", "-1"},
139-
{"Net Profit", "-0.017%"},
140-
{"Sharpe Ratio", "-1.173"},
141-
{"Probabilistic Sharpe Ratio", "0.011%"},
142-
{"Loss Rate", "100%"},
143-
{"Win Rate", "0%"},
133+
{"Total Trades", "5"},
134+
{"Average Win", "2.90%"},
135+
{"Average Loss", "0%"},
136+
{"Compounding Annual Return", "13.087%"},
137+
{"Drawdown", "1.100%"},
138+
{"Expectancy", "0"},
139+
{"Net Profit", "6.387%"},
140+
{"Sharpe Ratio", "1.671"},
141+
{"Probabilistic Sharpe Ratio", "90.613%"},
142+
{"Loss Rate", "0%"},
143+
{"Win Rate", "100%"},
144144
{"Profit-Loss Ratio", "0"},
145-
{"Alpha", "-0"},
146-
{"Beta", "-0"},
147-
{"Annual Standard Deviation", "0"},
148-
{"Annual Variance", "0"},
149-
{"Information Ratio", "-2.752"},
150-
{"Tracking Error", "0.082"},
151-
{"Treynor Ratio", "1.883"},
152-
{"Total Fees", "$4.30"},
153-
{"Estimated Strategy Capacity", "$0"},
145+
{"Alpha", "0.095"},
146+
{"Beta", "-0.022"},
147+
{"Annual Standard Deviation", "0.054"},
148+
{"Annual Variance", "0.003"},
149+
{"Information Ratio", "-1.35"},
150+
{"Tracking Error", "0.1"},
151+
{"Treynor Ratio", "-4.122"},
152+
{"Total Fees", "$10.75"},
153+
{"Estimated Strategy Capacity", "$1100000000.00"},
154154
{"Lowest Capacity Asset", "ES VMKLFZIH2MTD"},
155-
{"Portfolio Turnover", "0.92%"},
156-
{"OrderListHash", "1fd4b49e9450800981c6dead2bbca995"}
155+
{"Portfolio Turnover", "2.32%"},
156+
{"OrderListHash", "a8120567a6b64818876d002304af2dec"}
157157
};
158158
}
159159
}

‎Algorithm.CSharp/BasicTemplateContinuousFutureWithExtendedMarketAlgorithm.cs‎

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public override void Initialize()
5252
extendedMarketHours: true
5353
);
5454

55-
_fast = SMA(_continuousContract.Symbol, 3, Resolution.Daily);
55+
_fast = SMA(_continuousContract.Symbol, 4, Resolution.Daily);
5656
_slow = SMA(_continuousContract.Symbol, 10, Resolution.Daily);
5757
}
5858

@@ -123,7 +123,7 @@ public override void OnSecuritiesChanged(SecurityChanges changes)
123123
/// <summary>
124124
/// Data Points count of all timeslices of algorithm
125125
/// </summary>
126-
public long DataPoints => 2202510;
126+
public long DataPoints => 2199292;
127127

128128
/// <summary>
129129
/// Data Points count of the algorithm history
@@ -135,30 +135,30 @@ public override void OnSecuritiesChanged(SecurityChanges changes)
135135
/// </summary>
136136
public Dictionary<string, string> ExpectedStatistics => new Dictionary<string, string>
137137
{
138-
{"Total Trades", "2"},
139-
{"Average Win", "0%"},
140-
{"Average Loss", "-0.02%"},
141-
{"Compounding Annual Return", "-0.033%"},
142-
{"Drawdown", "0.000%"},
143-
{"Expectancy", "-1"},
144-
{"Net Profit", "-0.017%"},
145-
{"Sharpe Ratio", "-1.173"},
146-
{"Probabilistic Sharpe Ratio", "0.011%"},
147-
{"Loss Rate", "100%"},
148-
{"Win Rate", "0%"},
149-
{"Profit-Loss Ratio", "0"},
150-
{"Alpha", "-0"},
151-
{"Beta", "-0"},
152-
{"Annual Standard Deviation", "0"},
153-
{"Annual Variance", "0"},
154-
{"Information Ratio", "-2.752"},
155-
{"Tracking Error", "0.082"},
156-
{"Treynor Ratio", "1.883"},
157-
{"Total Fees", "$4.30"},
158-
{"Estimated Strategy Capacity", "$0"},
138+
{"Total Trades", "5"},
139+
{"Average Win", "4.45%"},
140+
{"Average Loss", "-0.26%"},
141+
{"Compounding Annual Return", "8.423%"},
142+
{"Drawdown", "0.800%"},
143+
{"Expectancy", "8.202"},
144+
{"Net Profit", "4.162%"},
145+
{"Sharpe Ratio", "1.089"},
146+
{"Probabilistic Sharpe Ratio", "53.568%"},
147+
{"Loss Rate", "50%"},
148+
{"Win Rate", "50%"},
149+
{"Profit-Loss Ratio", "17.40"},
150+
{"Alpha", "0.06"},
151+
{"Beta", "-0.005"},
152+
{"Annual Standard Deviation", "0.054"},
153+
{"Annual Variance", "0.003"},
154+
{"Information Ratio", "-1.681"},
155+
{"Tracking Error", "0.099"},
156+
{"Treynor Ratio", "-11.74"},
157+
{"Total Fees", "$10.75"},
158+
{"Estimated Strategy Capacity", "$190000000.00"},
159159
{"Lowest Capacity Asset", "ES VMKLFZIH2MTD"},
160-
{"Portfolio Turnover", "0.92%"},
161-
{"OrderListHash", "adb237703e65b93da5961c0085109732"}
160+
{"Portfolio Turnover", "2.34%"},
161+
{"OrderListHash", "1d52dcfbfda75e9776d9a006635013b0"}
162162
};
163163
}
164164
}

‎Algorithm.CSharp/BasicTemplateFutureRolloverAlgorithm.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ public void Dispose()
176176
/// <summary>
177177
/// Data Points count of all timeslices of algorithm
178178
/// </summary>
179-
public long DataPoints => 1345;
179+
public long DataPoints => 1333;
180180

181181
/// <summary>
182182
/// Data Points count of the algorithm history

‎Algorithm.CSharp/BasicTemplateFuturesDailyAlgorithm.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ select futuresContract
117117
/// <summary>
118118
/// Data Points count of all timeslices of algorithm
119119
/// </summary>
120-
public virtual long DataPoints => 15217;
120+
public virtual long DataPoints => 15192;
121121

122122
/// <summary>
123123
/// Data Points count of the algorithm history

‎Algorithm.CSharp/BasicTemplateFuturesHourlyAlgorithm.cs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public class BasicTemplateFuturesHourlyAlgorithm : BasicTemplateFuturesDailyAlgo
4141
/// <summary>
4242
/// Data Points count of all timeslices of algorithm
4343
/// </summary>
44-
public override long DataPoints => 96027;
44+
public override long DataPoints => 96332;
4545

4646
/// <summary>
4747
/// This is used by the regression test system to indicate what the expected statistics are from running the algorithm
@@ -68,10 +68,10 @@ public class BasicTemplateFuturesHourlyAlgorithm : BasicTemplateFuturesDailyAlgo
6868
{"Tracking Error", "0.089"},
6969
{"Treynor Ratio", "3.179"},
7070
{"Total Fees", "$1456.18"},
71-
{"Estimated Strategy Capacity", "$6000.00"},
71+
{"Estimated Strategy Capacity", "$9000.00"},
7272
{"Lowest Capacity Asset", "ES VP274HSU1AF5"},
7373
{"Portfolio Turnover", "17.91%"},
74-
{"OrderListHash", "8842e0b890f721371ebf3c25328dee5b"}
74+
{"OrderListHash", "2a414275a7ee26d8df27b89c7c913da6"}
7575
};
7676
}
7777
}

‎Algorithm.CSharp/BasicTemplateFuturesWithExtendedMarketDailyAlgorithm.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public class BasicTemplateFuturesWithExtendedMarketDailyAlgorithm : BasicTemplat
4343
/// <summary>
4444
/// Data Points count of all timeslices of algorithm
4545
/// </summary>
46-
public override long DataPoints => 17431;
46+
public override long DataPoints => 17406;
4747

4848
/// <summary>
4949
/// This is used by the regression test system to indicate what the expected statistics are from running the algorithm

‎Algorithm.CSharp/BasicTemplateFuturesWithExtendedMarketHourlyAlgorithm.cs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public class BasicTemplateFuturesWithExtendedMarketHourlyAlgorithm : BasicTempla
4141
/// <summary>
4242
/// Data Points count of all timeslices of algorithm
4343
/// </summary>
44-
public override long DataPoints => 248521;
44+
public override long DataPoints => 249452;
4545

4646
/// <summary>
4747
/// This is used by the regression test system to indicate what the expected statistics are from running the algorithm
@@ -68,10 +68,10 @@ public class BasicTemplateFuturesWithExtendedMarketHourlyAlgorithm : BasicTempla
6868
{"Tracking Error", "0.09"},
6969
{"Treynor Ratio", "4.096"},
7070
{"Total Fees", "$4521.78"},
71-
{"Estimated Strategy Capacity", "$2000.00"},
71+
{"Estimated Strategy Capacity", "$3000.00"},
7272
{"Lowest Capacity Asset", "ES VP274HSU1AF5"},
7373
{"Portfolio Turnover", "56.49%"},
74-
{"OrderListHash", "2402a307b20aee195b77b8478d7ca64d"}
74+
{"OrderListHash", "81bbcf57296f6326033f85809174fb47"}
7575
};
7676
}
7777
}

‎Algorithm.CSharp/ContinuousBackMonthRawFutureRegressionAlgorithm.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ public override void OnEndOfAlgorithm()
139139
/// <summary>
140140
/// Data Points count of all timeslices of algorithm
141141
/// </summary>
142-
public long DataPoints => 689388;
142+
public long DataPoints => 707113;
143143

144144
/// <summary>
145145
/// Data Points count of the algorithm history

‎Algorithm.CSharp/ContinuousFutureBackMonthRegressionAlgorithm.cs‎

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ public override void OnEndOfAlgorithm()
155155
/// <summary>
156156
/// Data Points count of all timeslices of algorithm
157157
/// </summary>
158-
public long DataPoints => 716568;
158+
public long DataPoints => 718097;
159159

160160
/// <summary>
161161
/// Data Points count of the algorithm history
@@ -170,27 +170,27 @@ public override void OnEndOfAlgorithm()
170170
{"Total Trades", "3"},
171171
{"Average Win", "1.48%"},
172172
{"Average Loss", "0%"},
173-
{"Compounding Annual Return", "2.884%"},
173+
{"Compounding Annual Return", "4.603%"},
174174
{"Drawdown", "1.600%"},
175175
{"Expectancy", "0"},
176-
{"Net Profit", "1.441%"},
177-
{"Sharpe Ratio", "0.792"},
178-
{"Probabilistic Sharpe Ratio", "41.710%"},
176+
{"Net Profit", "2.291%"},
177+
{"Sharpe Ratio", "1.165"},
178+
{"Probabilistic Sharpe Ratio", "55.781%"},
179179
{"Loss Rate", "0%"},
180180
{"Win Rate", "100%"},
181181
{"Profit-Loss Ratio", "0"},
182-
{"Alpha", "-0.005"},
183-
{"Beta", "0.114"},
184-
{"Annual Standard Deviation", "0.026"},
182+
{"Alpha", "0.001"},
183+
{"Beta", "0.14"},
184+
{"Annual Standard Deviation", "0.028"},
185185
{"Annual Variance", "0.001"},
186-
{"Information Ratio", "-2.683"},
187-
{"Tracking Error", "0.076"},
188-
{"Treynor Ratio", "0.178"},
186+
{"Information Ratio", "-2.584"},
187+
{"Tracking Error", "0.075"},
188+
{"Treynor Ratio", "0.229"},
189189
{"Total Fees", "$6.45"},
190-
{"Estimated Strategy Capacity", "$6300000.00"},
190+
{"Estimated Strategy Capacity", "$230000000.00"},
191191
{"Lowest Capacity Asset", "ES VP274HSU1AF5"},
192-
{"Portfolio Turnover", "1.36%"},
193-
{"OrderListHash", "f6522cede67cada1aafd605f30d0fc8f"}
192+
{"Portfolio Turnover", "1.39%"},
193+
{"OrderListHash", "6c7e9b99d8d6b538f450c3b8b31ea5ac"}
194194
};
195195
}
196196
}

‎Algorithm.CSharp/ContinuousFutureRegressionAlgorithm.cs‎

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ public override void OnEndOfAlgorithm()
169169
/// <summary>
170170
/// Data Points count of all timeslices of algorithm
171171
/// </summary>
172-
public long DataPoints => 709638;
172+
public long DataPoints => 708465;
173173

174174
/// <summary>
175175
/// Data Points count of the algorithm history
@@ -184,27 +184,27 @@ public override void OnEndOfAlgorithm()
184184
{"Total Trades", "3"},
185185
{"Average Win", "1.50%"},
186186
{"Average Loss", "0%"},
187-
{"Compounding Annual Return", "2.959%"},
187+
{"Compounding Annual Return", "3.337%"},
188188
{"Drawdown", "1.600%"},
189189
{"Expectancy", "0"},
190-
{"Net Profit", "1.479%"},
191-
{"Sharpe Ratio", "0.805"},
192-
{"Probabilistic Sharpe Ratio", "42.183%"},
190+
{"Net Profit", "1.666%"},
191+
{"Sharpe Ratio", "0.875"},
192+
{"Probabilistic Sharpe Ratio", "44.801%"},
193193
{"Loss Rate", "0%"},
194194
{"Win Rate", "100%"},
195195
{"Profit-Loss Ratio", "0"},
196-
{"Alpha", "-0.005"},
197-
{"Beta", "0.114"},
198-
{"Annual Standard Deviation", "0.026"},
196+
{"Alpha", "-0.007"},
197+
{"Beta", "0.134"},
198+
{"Annual Standard Deviation", "0.027"},
199199
{"Annual Variance", "0.001"},
200-
{"Information Ratio", "-2.676"},
201-
{"Tracking Error", "0.076"},
202-
{"Treynor Ratio", "0.181"},
200+
{"Information Ratio", "-2.69"},
201+
{"Tracking Error", "0.075"},
202+
{"Treynor Ratio", "0.175"},
203203
{"Total Fees", "$6.45"},
204-
{"Estimated Strategy Capacity", "$180000000.00"},
204+
{"Estimated Strategy Capacity", "$8000000000.00"},
205205
{"Lowest Capacity Asset", "ES VMKLFZIH2MTD"},
206-
{"Portfolio Turnover", "1.36%"},
207-
{"OrderListHash", "88e74055be58b3759f493b2c47e4c097"}
206+
{"Portfolio Turnover", "1.39%"},
207+
{"OrderListHash", "daf9c9ec97f1590f5a049600599e3b83"}
208208
};
209209
}
210210
}

0 commit comments

Comments
 (0)