public void SetUp() { _dataProvider = StockDataProviderUtils.CreateSubstitute(DateTime.MinValue); _dataLoader = SystemDataLoaderUtils.CreateSubstituteWithConstantPriceInRange(PricesCount, StartingPrice, PriceRange, LastDate); _dataDefinitionProvider = Substitute.For <ISystemDataDefinitionProvider>(); _signalGeneratorOnOpen = Substitute.For <ISignalGeneratorOnOpen>(); _signalGeneratorOnClose = Substitute.For <ISignalGeneratorOnClose>(); _commission = CommissionUtils.CreateSubstitute(); _slippage = SlippageUtils.CreateSusbstitute(); _mmPositionCloseCalculator = Substitute.For <IMMPositionCloseCalculator>(); _systemState = new SystemState() { Cash = InitialCash }; _slippage.CalculateOpen(default, default, default, default).ReturnsForAnyArgs(args => args.ArgAt <float>(3));
public SystemProcessor( IStockDataProvider dataProvider, ISystemDataLoader dataLoader, ISystemDataDefinitionProvider dataDefinitionProvider, ISignalGeneratorOnOpen signalGeneratorOnOpen, ISignalGeneratorOnClose signalGeneratorOnClose, ICommission commission, ISlippage slippage, IMMPositionCloseCalculator mmPositionCloseCalculator) { _dataProvider = dataProvider; _dataLoader = dataLoader; _dataDefinitionProvider = dataDefinitionProvider; _signalGeneratorOnOpen = signalGeneratorOnOpen; _signalGeneratorOnClose = signalGeneratorOnClose; _commission = commission; _slippage = slippage; _mmPositionCloseCalculator = mmPositionCloseCalculator; _signalsProcessor = new SignalsProcessor(_dataLoader, _commission, _slippage); _positionCloser = new PositionsCloser(_dataLoader, _commission, _slippage); }