コード例 #1
0
 private static void WritePricerOutputs(IPricer pricer)
 {
     foreach (string shape in Service.GetEstimations(pricer))
     {
         WriteLine(shape);
     }
 }
コード例 #2
0
ファイル: PricerDecorator.cs プロジェクト: joymon/puzzles
 public PricerDecorator(IPricer pricer)
 {
     if (pricer == null)
     {
         throw new ArgumentNullException(nameof(pricer));
     }
     this.pricer = pricer;
 }
コード例 #3
0
        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);
            }
        }
コード例 #4
0
        /// <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);
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        public IEnumerable <string> GetEstimations(IPricer pricerMockObject)
        {
            IList <string> shapesDescription = new List <string>();

            foreach (AbstractShape abstractShape in CurrentShapeCollection)
            {
                shapesDescription.Add(GetShapeEstimation(abstractShape, pricerMockObject));
            }

            return(shapesDescription);
        }
コード例 #7
0
        public VanillePricerBS()
        {
            IKernel kernel = new StandardKernel(new InjectionMapping());

            InitializeComponent();
            DataContext = this;

            Param = new ParameterViewModel();


            _pricer = kernel.Get <IPricer>();
            _pricer.PricingTerminated += Draw;
        }
コード例 #8
0
ファイル: Builder.cs プロジェクト: songgaoxian/Advanced_C
    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));
    }
コード例 #9
0
 public Decorator(IPricer pricer)
 {
     this.stdPricer = pricer;
     this.Customer  = pricer.Customer;
     this.Receiver  = pricer.Receiver;
 }
コード例 #10
0
 public PromotionDecorator(IPricer pricer) : base(pricer)
 {
 }
コード例 #11
0
 public Triangle(string name, int area, IPricer pricer) : base(name, area, pricer)
 {
 }
コード例 #12
0
 public SupplyLowDemandHighDecorator(IPricer pricer) : base(pricer)
 {
 }
コード例 #13
0
 public DelayPricerProxy(IPricer pricer)
 {
     this._delayPricer = new DelayPricer(pricer);
 }
コード例 #14
0
        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)));
        }
コード例 #15
0
 public BoundaryValueDecorator(IPricer pricer) : base(pricer)
 {
 }
コード例 #16
0
ファイル: Square.cs プロジェクト: JordanWorks/Plugwine
 public Square(string name, int area, IPricer pricer) : base(name, area, pricer)
 {
 }
コード例 #17
0
 public IEnumerable <string> GetItemDisplayList(IEnumerable <Item> collection, IPricer pricer = null)
 {
     foreach (var item in collection)
     {
         yield return(GetItemDisplay(item, pricer));
     }
 }
コード例 #18
0
 public MyPricerService()
 {
     pricer = new Pricer();
 }
コード例 #19
0
 public RentalReport(string customer, IPricer pricer)
 {
     _customer = customer;
     _pricer   = pricer;
 }
コード例 #20
0
 public DelayPricer(IPricer pricer) : base(pricer)
 {
 }
コード例 #21
0
 public ExtraPlacePricer(IPricer pricer) : base(pricer)
 {
 }
コード例 #22
0
 public HolidayPricer(IPricer pricer) : base(pricer)
 {
 }
コード例 #23
0
 public HomeController()
 {
     pricer = new Pricer();
 }
コード例 #24
0
 public DataErrorRemoverDecorator(IPricer pricer) : base(pricer)
 {
 }
コード例 #25
0
        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);
        }
コード例 #26
0
 public Shape(string name, int area, IPricer pricer)
 {
     this.Name   = name;
     this.Area   = area;
     this.Pricer = pricer;
 }
コード例 #27
0
        public ExtraPlacePricerProxy(IPricer pricer)
        {
            //The constructor's input parameter, pricer, is used for initialize a ExtraPlacePricer

            this._extraPlacePricer = new ExtraPlacePricer(pricer);
        }
コード例 #28
0
 public Circle(string name, int area, IPricer pricer) : base(name, area, pricer)
 {
 }