Fix deploy script: add NT8.Strategies.dll to deployment pipeline
Some checks failed
Build and Test / build (push) Has been cancelled

This commit is contained in:
2026-03-22 17:28:03 -04:00
parent 2f623dc2f8
commit a2af272d73
8 changed files with 393 additions and 40 deletions

View File

@@ -188,23 +188,34 @@ namespace NT8.Core.Risk
}
/// <summary>
/// Reports a fill to the portfolio manager. Updates open contract count for the strategy.
/// Called from NT8StrategyBase.OnExecutionUpdate() after each fill.
/// Reports a fill to the portfolio manager.
/// Contract tracking is handled by UpdateOpenContracts().
/// </summary>
/// <param name="strategyId">Strategy that received the fill.</param>
/// <param name="fill">Fill details.</param>
public void ReportFill(string strategyId, OrderFill fill)
{
// Contract tracking is now handled by UpdateOpenContracts() called
// from OnBarUpdate with the actual position size.
// This method is retained for API compatibility and future P&L attribution use.
if (string.IsNullOrEmpty(strategyId) || fill == null) return;
}
/// <summary>
/// Updates the open contract count for a strategy to the actual current
/// position size. Called from NT8StrategyBase on each bar close.
/// This replaces fill-based inference with authoritative position data.
/// </summary>
/// <param name="strategyId">Strategy identifier.</param>
/// <param name="openContracts">Actual number of open contracts (0 when flat).</param>
public void UpdateOpenContracts(string strategyId, int openContracts)
{
if (string.IsNullOrEmpty(strategyId)) return;
lock (_lock)
{
if (!_strategyOpenContracts.ContainsKey(strategyId))
_strategyOpenContracts[strategyId] = 0;
_strategyOpenContracts[strategyId] += fill.Quantity;
if (_strategyOpenContracts[strategyId] < 0)
_strategyOpenContracts[strategyId] = 0;
if (openContracts < 0) openContracts = 0;
_strategyOpenContracts[strategyId] = openContracts;
}
}