Exemple #1
0
        public Controller(IView view, List <TreeView> listTreeView, List <CheckBox> checkBoxes)
        {
            viewForm          = view;
            this.listTreeView = listTreeView;
            client            = new JsonRpcClient();
            //listTreeView[0].Nodes.AddRange(()
            listOrders = client.listCurrentOrders();

            listCompetitionIds[0, 0] = "English Premier League";
            listCompetitionIds[0, 1] = "10932509";
            listCompetitionIds[1, 0] = "Spanish La Liga";
            listCompetitionIds[1, 1] = "117";
            listCompetitionIds[2, 0] = "French Ligue 1";
            listCompetitionIds[2, 1] = "55";
            listCompetitionIds[3, 0] = "German Bundesliga 1";
            listCompetitionIds[3, 1] = "59";
            listCompetitionIds[4, 0] = "Italian Serie A";
            listCompetitionIds[4, 1] = "81";

            var sw = new Stopwatch();

            sw.Start();
            //for (int i = 0; i < 5; i++)
            //{

            //    Country country = new Country(client, listCompetitionIds[i, 0], listCompetitionIds[i, 1], listTreeView[i]);
            //    country.EventCountry += Event_UpdateTreeview;
            //    countries.Add(country);
            //    Update(country);
            //    country.IsCreatedCountry = true;
            //}
            for (int i = 0; i < 5; i++)
            {
                CountryPatern country = new CountryPatern(listCompetitionIds[i, 0], listCompetitionIds[i, 1], checkBoxes[i]);
                countriess.Add(country);
                country.Interpret(listOrders.CurrentOrders);
                country.Operation();
                //listTreeView[i].Nodes.Add(country.childNode);
                foreach (var component in country.components)
                {
                    listTreeView[i].Nodes.Add(component.childNode);
                }
                //checkBoxes[i].Text = country.Name;
            }

            sw.Stop();
            var sww = sw.ElapsedMilliseconds;
            //int a = 0;
            //foreach (var country in countriess)
            //{
            //    foreach (var component in country.components)
            //    {
            //        listTreeView[a].Nodes.Add(component.childNode);
            //    }
            //    a++;
            //}
        }
Exemple #2
0
 public Rider(Runner runner, CurrentOrderSummaryReport orders, RunnerDescription runnerdescription, RunnerProfitAndLoss runnerPNL, double minPrice, double maxPrice)
 {
     this.runner            = runner;
     this.orders            = orders;
     this.runnerdescription = runnerdescription;
     this.runnerPNL         = runnerPNL;
     this.minPrice          = minPrice;
     this.maxPrice          = maxPrice;
     selectionID            = runner.SelectionId;
     latestMarketprice      = LatestMarketPrice();
     totalmarketamount      = TotalMarketAmount();
     name         = Name();
     pnl          = PNL();
     isInthemoney = IsInthemoney();
     isOpen       = IsOpen();
     turnover     = Turnover();
     marketBid    = MarketBid();
     marketAsk    = MarketAsk();
     myBid        = MyBid();
     myAsk        = MyAsk();
     layorders    = LayOrders();
     backorders   = BackOrders();
 }
Exemple #3
0
        public static void GetAllRiderInfo(ref List <Runner> runners, ref List <RunnerDescription> runnerDescription, ref List <MarketProfitAndLoss> runnerPNL, ref CurrentOrderSummaryReport orders)
        {
            PriceData pricedata1 = PriceData.EX_ALL_OFFERS;
            PriceData pricedata2 = PriceData.EX_TRADED;
            PriceData pricedata3 = PriceData.EX_BEST_OFFERS;

            HashSet <PriceData> prijsdata = new HashSet <PriceData>();

            prijsdata.Add(pricedata1);
            prijsdata.Add(pricedata2);
            prijsdata.Add(pricedata3);

            PriceProjection priceprojection = new PriceProjection();
            OrderProjection orderprojection = new OrderProjection();
            MatchProjection matchprojection = new MatchProjection();

            orderprojection           = OrderProjection.ALL;
            matchprojection           = MatchProjection.ROLLED_UP_BY_AVG_PRICE;
            priceprojection.PriceData = prijsdata;

            MarketFilter marketFilter = new MarketFilter();

            ISet <string> set = new HashSet <string>();

            set.Add(BackEnd.marketID);
            marketFilter.MarketIds = set;

            var marketSort = MarketSort.FIRST_TO_START;

            ISet <MarketProjection> marketProjections = new HashSet <MarketProjection>();

            marketProjections.Add(MarketProjection.RUNNER_DESCRIPTION);

            List <string> marketIds = new List <string>();

            marketIds.Add(BackEnd.marketID);

            try
            {
                runners = apiClient.listMarketBook(marketIds, priceprojection, orderprojection, matchprojection)[0].Runners;
            }
            catch { }
            try
            {
                runnerDescription = apiClient.listMarketCatalogue(marketFilter, marketProjections, marketSort)[0].Runners;
            }
            catch { }
            try
            {
                runnerPNL = apiClient.listMarketProfitAndLoss(marketIds, true, true, true).ToList <MarketProfitAndLoss>();
            }
            catch { }
            try
            {
                orders = apiClient.listCurrentOrders();
            }
            catch { }
        }