public void UpdateInstrumentPrice(decimal newPrice) { InstrumentInfo = new InstrumentInfo( InstrumentInfo.Symbol, InstrumentInfo.Name, newPrice); }
public Lot( Guid id, InstrumentInfo instrumentInfo, DateTime purchaseDate, decimal purchasePrice, string notes = null) { Id = id; InstrumentInfo = instrumentInfo ?? throw new ArgumentNullException(nameof(instrumentInfo)); PurchaseDate = purchaseDate; PurchasePrice = purchasePrice; Notes = notes; }
public static Lot NewLotForExistingInstrument(Instrument existingInstrument, DateTime purchaseDate, decimal purchasePrice, string notes, IEventManager events) { var instrumentInfoForExistingInstrument = new InstrumentInfo( existingInstrument.Symbol, existingInstrument.Name, existingInstrument.CurrentPrice); var lot = new Lot( Guid.NewGuid(), instrumentInfoForExistingInstrument, purchaseDate, purchasePrice, notes); events.Raise(new LotWasCreatedDomainEvent(lot.Id)); return(lot); }
public static Lot NewLotForNewInstrument( string symbol, DateTime purchaseDate, decimal purchasePrice, string notes, IEventManager events) { var instrumentInfoWithSymbolOnly = new InstrumentInfo( symbol, symbol, purchasePrice); var lot = new Lot( Guid.NewGuid(), instrumentInfoWithSymbolOnly, purchaseDate, purchasePrice, notes); events.Raise(new LotWasCreatedDomainEvent(lot.Id)); return(lot); }