Skip to content

Commit 32fcd94

Browse files
authored
Exclude Period property from WindowIndicator (#9172)
1 parent 090ffeb commit 32fcd94

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

Algorithm/QCAlgorithm.Indicators.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ public partial class QCAlgorithm
5353
"IsReady",
5454
"Window",
5555
"Item",
56-
"WarmUpPeriod"
56+
"WarmUpPeriod",
57+
"Period"
5758
};
5859

5960
/// <summary>

Tests/Research/QuantBookHistoryTests.cs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -813,6 +813,32 @@ def get_history():
813813
}
814814
}
815815

816+
[Test]
817+
public void IndicatorHistoryDoesNotReturnPeriodColumn()
818+
{
819+
using (Py.GIL())
820+
{
821+
var testModule = PyModule.FromString("testModule",
822+
@"
823+
from AlgorithmImports import *
824+
825+
def get_indicator_history():
826+
qb = QuantBook()
827+
qb.set_start_date(2014, 4, 8)
828+
symbol = qb.add_equity(""AAPL"", Resolution.DAILY).symbol
829+
history = qb.indicator(ValueAtRisk(252, 0.95), symbol, 365, Resolution.DAILY)
830+
return history
831+
");
832+
dynamic getHistory = testModule.GetAttr("get_indicator_history");
833+
var pyHistory = getHistory() as PyObject;
834+
var columns = pyHistory.GetAttr("columns")
835+
.InvokeMethod("tolist")
836+
.AsManagedObject(typeof(List<string>)) as List<string>;
837+
Assert.IsFalse(columns.Contains("period"));
838+
Assert.AreEqual(1, columns.Count);
839+
}
840+
}
841+
816842
private class TestHistoryProvider : HistoryProviderBase
817843
{
818844
private IHistoryProvider _provider;

0 commit comments

Comments
 (0)