Skip to content

Commit 3a3f597

Browse files
committed
Algo: add missing XML docs on spread wideners; fix Collapse paramref
Document the public members of Level1SpreadWidener and OrderBookSpreadWidener (CS1591). Drop the stray duplicate <summary> on OrderBookSpreadWidener.Collapse that referenced a non-existent 'msg' parameter (CS1734) and move that description to Apply, where the msg parameter actually exists.
1 parent 10d0e5d commit 3a3f597

2 files changed

Lines changed: 54 additions & 7 deletions

File tree

Algo/Level1SpreadWidener.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ public sealed class Level1SpreadWidener
1313
private readonly decimal _bidFactor;
1414
private readonly decimal _askFactor;
1515

16+
/// <summary>
17+
/// Initializes a new instance of the <see cref="Level1SpreadWidener"/> class.
18+
/// </summary>
19+
/// <param name="percent">Half-spread widening, in percent. Non-positive disables widening.</param>
1620
public Level1SpreadWidener(decimal percent)
1721
{
1822
Percent = percent;
@@ -30,10 +34,25 @@ public Level1SpreadWidener(decimal percent)
3034
}
3135
}
3236

37+
/// <summary>
38+
/// Half-spread widening, in percent.
39+
/// </summary>
3340
public decimal Percent { get; }
3441

42+
/// <summary>
43+
/// <see langword="true"/> if <see cref="Percent"/> is positive and widening is applied.
44+
/// </summary>
3545
public bool IsEnabled => Percent > 0m;
3646

47+
/// <summary>
48+
/// Returns a copy of <paramref name="msg"/> with the best bid shifted down and the
49+
/// best ask shifted up by <see cref="Percent"/>.
50+
/// </summary>
51+
/// <param name="msg">Source level1 change message.</param>
52+
/// <returns>
53+
/// Widened copy; the original message when widening is disabled; or
54+
/// <see langword="null"/> if <paramref name="msg"/> is <see langword="null"/>.
55+
/// </returns>
3756
public Level1ChangeMessage Apply(Level1ChangeMessage msg)
3857
{
3958
if (msg is null)

Algo/OrderBookSpreadWidener.cs

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ private sealed class EmittedBook
2626
public readonly Dictionary<decimal, QuoteChange> Asks = [];
2727
}
2828

29+
/// <summary>
30+
/// Initializes a new instance of the <see cref="OrderBookSpreadWidener"/> class.
31+
/// </summary>
32+
/// <param name="percent">Half-spread widening, in percent. Non-positive disables widening.</param>
2933
public OrderBookSpreadWidener(decimal percent)
3034
{
3135
Percent = percent;
@@ -43,10 +47,21 @@ public OrderBookSpreadWidener(decimal percent)
4347
}
4448
}
4549

50+
/// <summary>
51+
/// Half-spread widening, in percent.
52+
/// </summary>
4653
public decimal Percent { get; }
4754

55+
/// <summary>
56+
/// <see langword="true"/> if <see cref="Percent"/> is positive and widening is applied.
57+
/// </summary>
4858
public bool IsEnabled => Percent > 0m;
4959

60+
/// <summary>
61+
/// Drops the diff-state used to emit increments, forcing the next <see cref="Apply"/>
62+
/// to emit a fresh <see cref="QuoteChangeStates.SnapshotComplete"/>.
63+
/// </summary>
64+
/// <param name="securityId">Security to reset, or <see langword="default"/> to reset all securities.</param>
5065
public void ResetSnapshot(SecurityId securityId)
5166
{
5267
using (_stateLock.EnterScope())
@@ -58,19 +73,18 @@ public void ResetSnapshot(SecurityId securityId)
5873
}
5974
}
6075

61-
/// <summary>
62-
/// Reads the current raw book from <paramref name="holder"/> (caller must
63-
/// have applied <paramref name="msg"/> to the holder first) and rewrites
64-
/// <paramref name="msg"/> as either a full <c>SnapshotComplete</c> (first
65-
/// call for this security) or an <c>Increment</c> with only the changes
66-
/// against the previously-emitted collapsed view.
67-
/// </summary>
6876
/// <summary>
6977
/// Returns the current collapsed view of <paramref name="securityId"/> as a
7078
/// fresh <c>SnapshotComplete</c>. Pure read — does not touch the diff-state
7179
/// used by <see cref="Apply"/>. Useful for replying to a new subscriber
7280
/// without re-emitting deltas from before their subscription.
7381
/// </summary>
82+
/// <param name="securityId">Security to build the collapsed snapshot for.</param>
83+
/// <param name="holder">Holder of the current raw order book state.</param>
84+
/// <returns>
85+
/// Collapsed snapshot, or <see langword="null"/> when widening is disabled or no
86+
/// raw snapshot is available for <paramref name="securityId"/>.
87+
/// </returns>
7488
public QuoteChangeMessage Collapse(SecurityId securityId, OrderBookSnapshotHolder holder)
7589
{
7690
if (!IsEnabled || holder is null)
@@ -86,6 +100,20 @@ public QuoteChangeMessage Collapse(SecurityId securityId, OrderBookSnapshotHolde
86100
return copy;
87101
}
88102

103+
/// <summary>
104+
/// Reads the current raw book from <paramref name="holder"/> (the caller must have
105+
/// applied <paramref name="msg"/> to the holder first) and rewrites it as either a
106+
/// full <see cref="QuoteChangeStates.SnapshotComplete"/> (first call for this
107+
/// security) or an <see cref="QuoteChangeStates.Increment"/> carrying only the
108+
/// changes against the previously-emitted collapsed view.
109+
/// </summary>
110+
/// <param name="msg">Incoming order book change message.</param>
111+
/// <param name="holder">Holder of the current raw order book state.</param>
112+
/// <returns>
113+
/// Collapsed message; the original message when widening is disabled or no raw
114+
/// snapshot is available; or <see langword="null"/> if <paramref name="msg"/> is
115+
/// <see langword="null"/>.
116+
/// </returns>
89117
public QuoteChangeMessage Apply(QuoteChangeMessage msg, OrderBookSnapshotHolder holder)
90118
{
91119
if (msg is null)

0 commit comments

Comments
 (0)