private static void WritePricerOutputs(IPricer pricer) { foreach (string shape in Service.GetEstimations(pricer)) { WriteLine(shape); } }
public PricerDecorator(IPricer pricer) { if (pricer == null) { throw new ArgumentNullException(nameof(pricer)); } this.pricer = pricer; }
private static void DisplayCollectionWithPricer(List <Item> collection) { _pricer = new Pricer(); Console.WriteLine("Avec Pricer :"); foreach (var itemDisplay in _displayService.GetItemDisplayList(collection, _pricer)) { Console.WriteLine(itemDisplay); } }
/// <summary> /// Does the pricing by calling required components /// </summary> /// <param name="products"></param> /// <param name="compProducts"></param> /// <returns></returns> IEnumerable <Product> IPricingEngine.DoPricing(IEnumerable <ProductSpec> products, IEnumerable <CompetitorProduct> compProducts) { var result = products.Select((prod) => { IPricer pricer = PricerFactory.Get(); return(pricer.DoPrice(prod, compProducts.Where(cp => cp.ProductCode == prod.ProductCode))); }); return(result); }
public string GetItemDisplay(Item item, IPricer pricer = null) { var display = $"{item.Type} - {item.Name} - {item.Superficy} cm²"; if (pricer != null) { display += $" - Estimation cout : { pricer.Price(item.Superficy)}" + Euro; } return(display); }
public IEnumerable <string> GetEstimations(IPricer pricerMockObject) { IList <string> shapesDescription = new List <string>(); foreach (AbstractShape abstractShape in CurrentShapeCollection) { shapesDescription.Add(GetShapeEstimation(abstractShape, pricerMockObject)); } return(shapesDescription); }
public VanillePricerBS() { IKernel kernel = new StandardKernel(new InjectionMapping()); InitializeComponent(); DataContext = this; Param = new ParameterViewModel(); _pricer = kernel.Get <IPricer>(); _pricer.PricingTerminated += Draw; }
public Tuple <ISde, FdmBase, IRng> Parts() { // V2, parts initialised from the inside // Get the SDE ISde sde = GetSde(); IRng rng = GetRng(); FdmBase fdm = GetFdm(sde); Payoff payoff = x => Math.Max(0.0, K - x); //Payoff payoff = x => Math.Max(0.0, x - K); Func <double> discounter = () => Math.Exp(-r * T); IPricer pricer = GetPricer(payoff, discounter); return(new Tuple <ISde, FdmBase, IRng>(sde, fdm, rng)); }
public Decorator(IPricer pricer) { this.stdPricer = pricer; this.Customer = pricer.Customer; this.Receiver = pricer.Receiver; }
public PromotionDecorator(IPricer pricer) : base(pricer) { }
public Triangle(string name, int area, IPricer pricer) : base(name, area, pricer) { }
public SupplyLowDemandHighDecorator(IPricer pricer) : base(pricer) { }
public DelayPricerProxy(IPricer pricer) { this._delayPricer = new DelayPricer(pricer); }
private string GetShapeEstimation(AbstractShape shape, IPricer pricer) { string baseStr = GetShapeDescription(shape); return(string.Format("{0} - Estimation cout : {1}", baseStr, pricer.Price(shape.Surface).ToString("C", CultureInfo.CurrentCulture))); }
public BoundaryValueDecorator(IPricer pricer) : base(pricer) { }
public Square(string name, int area, IPricer pricer) : base(name, area, pricer) { }
public IEnumerable <string> GetItemDisplayList(IEnumerable <Item> collection, IPricer pricer = null) { foreach (var item in collection) { yield return(GetItemDisplay(item, pricer)); } }
public MyPricerService() { pricer = new Pricer(); }
public RentalReport(string customer, IPricer pricer) { _customer = customer; _pricer = pricer; }
public DelayPricer(IPricer pricer) : base(pricer) { }
public ExtraPlacePricer(IPricer pricer) : base(pricer) { }
public HolidayPricer(IPricer pricer) : base(pricer) { }
public HomeController() { pricer = new Pricer(); }
public DataErrorRemoverDecorator(IPricer pricer) : base(pricer) { }
public InstrumentList Load() { IDbCommand command1 = this.connection.CreateCommand(); command1.CommandText = "comdd"; IDataReader dataReader1 = command1.ExecuteReader(); while (dataReader1.Read()) { int int32 = dataReader1.GetInt32(0); Type type = Type.GetType(dataReader1.GetString(1)); this.aKpdKBGUfP.Add(int32, type); this.cVFd9nJe3b.Add(type, int32); } dataReader1.Close(); command1.Dispose(); IDbCommand command2 = this.connection.CreateCommand(); command2.CommandText = "load"; IDataReader dataReader2 = command2.ExecuteReader(); while (dataReader2.Read()) { int int32 = dataReader2.GetInt32(0); Type type = Type.GetType(dataReader2.GetString(1)); this.BuYdCExFpF.Add(int32, type); this.UXKdMsMyXN.Add(type, int32); } dataReader2.Close(); command2.Dispose(); InstrumentList instrumentList = new InstrumentList(); IDbCommand command3 = this.connection.CreateCommand(); command3.CommandText = "load"; IDataReader dataReader3 = command3.ExecuteReader(); while (dataReader3.Read()) { int int32 = dataReader3.GetInt32(0); Type type1 = this.aKpdKBGUfP[dataReader3.GetInt32(1)]; Type type2 = this.BuYdCExFpF[dataReader3.GetInt32(2)]; string @string = dataReader3.GetString(3); Instrument instrument = Activator.CreateInstance(type1, true) as Instrument; IPricer pricer = Activator.CreateInstance(type2) as IPricer; instrument.Symbol = @string; instrument.Id = int32; instrument.Pricer = pricer; if (instrumentList[@string] == null) { instrumentList.Add(instrument); } } dataReader3.Close(); command3.Dispose(); FIXDbServer.LoadFIXGroups(this.connection, (FIXGroupList)instrumentList, "fsdfs"); LegList legList = new LegList(); IDbCommand command4 = this.connection.CreateCommand(); command4.CommandText = "load"; IDataReader dataReader4 = command4.ExecuteReader(); while (dataReader4.Read()) { int int32_1 = dataReader4.GetInt32(0); int int32_2 = dataReader4.GetInt32(1); int int32_3 = dataReader4.GetInt32(2); Leg leg = new Leg(instrumentList.GetById(int32_3)); leg.Id = int32_1; instrumentList.GetById(int32_2).Legs.Add((FIXGroup)leg); legList.Add((FIXGroup)leg); } dataReader4.Close(); command4.Dispose(); FIXDbServer.LoadFIXGroups(this.connection, (FIXGroupList)legList, ""); UnderlyingList underlyingList = new UnderlyingList(); IDbCommand command5 = this.connection.CreateCommand(); command5.CommandText = "load"; IDataReader dataReader5 = command5.ExecuteReader(); while (dataReader5.Read()) { int int32_1 = dataReader5.GetInt32(0); int int32_2 = dataReader5.GetInt32(1); int int32_3 = dataReader5.GetInt32(2); Underlying underlying = new Underlying(instrumentList.GetById(int32_3)); underlying.Id = int32_1; instrumentList.GetById(int32_2).Underlyings.Add((FIXGroup)underlying); underlyingList.Add((FIXGroup)underlying); } dataReader5.Close(); command5.Dispose(); FIXDbServer.LoadFIXGroups(this.connection, (FIXGroupList)underlyingList, "dss"); FIXSecurityAltIDGroupList securityAltIdGroupList = new FIXSecurityAltIDGroupList(); IDbCommand command6 = this.connection.CreateCommand(); command6.CommandText = "load"; IDataReader dataReader6 = command6.ExecuteReader(); while (dataReader6.Read()) { int int32_1 = dataReader6.GetInt32(0); int int32_2 = dataReader6.GetInt32(1); FIXSecurityAltIDGroup securityAltIdGroup = new FIXSecurityAltIDGroup(); securityAltIdGroup.Id = int32_1; instrumentList.GetById(int32_2).SecurityAltIDGroup.Add((FIXGroup)securityAltIdGroup); securityAltIdGroupList.Add((FIXGroup)securityAltIdGroup); } dataReader6.Close(); command6.Dispose(); FIXDbServer.LoadFIXGroups(this.connection, (FIXGroupList)securityAltIdGroupList, "fsfs"); return(instrumentList); }
public Shape(string name, int area, IPricer pricer) { this.Name = name; this.Area = area; this.Pricer = pricer; }
public ExtraPlacePricerProxy(IPricer pricer) { //The constructor's input parameter, pricer, is used for initialize a ExtraPlacePricer this._extraPlacePricer = new ExtraPlacePricer(pricer); }
public Circle(string name, int area, IPricer pricer) : base(name, area, pricer) { }