@@ -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