Skip to content

Commit 70d7442

Browse files
committed
Prevent overflow from Time + Period
1 parent 578c35c commit 70d7442

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

Common/Data/Market/SessionBar.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,23 @@ public class SessionBar : TradeBar
5151
/// </summary>
5252
public override decimal Close => _bar?.Close ?? 0m;
5353

54+
/// <summary>
55+
/// The closing time of this bar, computed via the Time and Period
56+
/// </summary>
57+
public override DateTime EndTime
58+
{
59+
get
60+
{
61+
if (Time == DateTime.MaxValue)
62+
{
63+
// Prevent overflow from Time + Period when Time is DateTime.MaxValue
64+
return Time;
65+
}
66+
67+
return base.EndTime;
68+
}
69+
}
70+
5471
/// <summary>
5572
/// The period of this session bar
5673
/// </summary>

0 commit comments

Comments
 (0)