示例#1
0
 public void UpdateInstrumentPrice(decimal newPrice)
 {
     InstrumentInfo = new InstrumentInfo(
         InstrumentInfo.Symbol,
         InstrumentInfo.Name,
         newPrice);
 }
示例#2
0
 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;
 }
示例#3
0
        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);
        }
示例#4
0
        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);
        }