private void RegisterAllNeededRawMaterialMarketData(PastaRecipeParser pastaRecipeParser) { // subscribes to all the marketdata we need to price the pasta we have to support foreach (var marketDataName in pastaRecipeParser.RawMaterialNames) { this.marketDataProvider.RegisterRawMaterial(marketDataName); } }
public void Start() { var pastaRecipeParser = new PastaRecipeParser(this.pastasConfiguration); this.RegisterAllNeededRawMaterialMarketData(pastaRecipeParser); this.InstantiateAndSetupPricingAgentsForAllPasta(pastaRecipeParser); }
private void InstantiateAndSetupPricingAgentsForAllPasta(PastaRecipeParser pastaRecipeParser) { // Instantiates pricing agents for all pastas foreach (var pastaName in pastaRecipeParser.Pastas) { var sequencerForThisPasta = this.unitOfExecution.BuildSequencer(); var pastaPricingAgent = new PastaPricingAgent(sequencerForThisPasta, pastaName, this.conflationEnabled); pastaPricingAgent.PastaPriceChanged += this.PastaPricingAgentPastaPriceChanged; this.pastaAgents.Add(pastaName, pastaPricingAgent); var marketDataForThisPasta = new List <IRawMaterialMarketData>(); foreach (var rawMaterialName in pastaRecipeParser.GetNeededRawMaterialsFor(pastaName)) { marketDataForThisPasta.Add(this.marketDataProvider.GetRawMaterial(rawMaterialName)); } pastaPricingAgent.SubscribeToMarketData(marketDataForThisPasta); } }
private void InstantiateAndSetupPricingAgentsForAllPasta(PastaRecipeParser pastaRecipeParser) { // Instantiates pricing agents for all pastas foreach (var pastaName in pastaRecipeParser.Pastas) { var sequencerForThisPasta = this.unitOfExecution.BuildSequencer(); var pastaPricingAgent = new PastaPricingAgent(sequencerForThisPasta, pastaName, this.conflationEnabled); pastaPricingAgent.PastaPriceChanged += this.PastaPricingAgent_PastaPriceChanged; this.pastaAgents.Add(pastaName, pastaPricingAgent); var marketDataForThisPasta = new List<IRawMaterialMarketData>(); foreach (var rawMaterialName in pastaRecipeParser.GetNeededRawMaterialsFor(pastaName)) { marketDataForThisPasta.Add(this.marketDataProvider.GetRawMaterial(rawMaterialName)); } pastaPricingAgent.SubscribeToMarketData(marketDataForThisPasta); } }