Example #1
0
        public void Setup()
        {
            symbol = "RTS-12.13_FT";
            StrategyHeader sh = new StrategyHeader(1, "1", "BP12345-RF-01", symbol, 1);

            //dealList = new DealList(symbol);
            dealList = new DealList(sh);
        }
Example #2
0
        public DealsPage()
        {
            InitializeComponent();

            MessagingCenter.Subscribe <object, DealsMainModel>(this, "DealsFilterApplied", (sender, args) =>
            {
                DealList.FlowScrollTo(args, ScrollToPosition.Start, true);
            });

            MessagingCenter.Subscribe <object, DealsMainModel>(this, "DealsSortAmountUp", (sender, args) =>
            {
                DealList.FlowScrollTo(args, ScrollToPosition.Start, true);
            });

            MessagingCenter.Subscribe <object, DealsMainModel>(this, "DealsSortAmountDown", (sender, args) =>
            {
                DealList.FlowScrollTo(args, ScrollToPosition.Start, true);
            });

            MessagingCenter.Subscribe <object, DealsMainModel>(this, "DealsSortBorrowerUp", (sender, args) =>
            {
                DealList.FlowScrollTo(args, ScrollToPosition.Start, true);
            });

            MessagingCenter.Subscribe <object, DealsMainModel>(this, "DealsSortBorrowerDown", (sender, args) =>
            {
                DealList.FlowScrollTo(args, ScrollToPosition.Start, true);
            });

            MessagingCenter.Subscribe <object, DealsMainModel>(this, "DealsSortDueUp", (sender, args) =>
            {
                DealList.FlowScrollTo(args, ScrollToPosition.Start, true);
            });

            MessagingCenter.Subscribe <object, DealsMainModel>(this, "DealsSortDueDown", (sender, args) =>
            {
                DealList.FlowScrollTo(args, ScrollToPosition.Start, true);
            });

            MessagingCenter.Subscribe <object, DealsMainModel>(this, "DealsSortClosingUp", (sender, args) =>
            {
                DealList.FlowScrollTo(args, ScrollToPosition.Start, true);
            });

            MessagingCenter.Subscribe <object, DealsMainModel>(this, "DealsSortClosingDown", (sender, args) =>
            {
                DealList.FlowScrollTo(args, ScrollToPosition.Start, true);
            });

            MessagingCenter.Subscribe <object, DealsMainModel>(this, "DealsSortClear", (sender, args) =>
            {
                DealList.FlowScrollTo(args, ScrollToPosition.Start, true);
            });
        }
Example #3
0
 public static void ConsoleWriteDealList(DealList dealList)
 {
     if (dealList == null)
     {
         return;
     }
     foreach (Deal item in dealList.Deals)
     {
         Console.WriteLine(item.ToString());
     }
 }
Example #4
0
 /// <summary>
 /// CallableStructuredDeal constructor creating deal list.
 /// </summary>
 public CallableStructuredDeal()
 {
     Description          = Property.DisplayName(typeof(CallableStructuredDeal));
     Exercise_Dates       = new ExercisePropertiesList();
     fItems               = new DealList();
     Issuer               = string.Empty;
     Survival_Probability = string.Empty;
     Option_Type          = OptionType.Call;
     Settlement_Style     = SettlementType2.Embedded;
     Recovery_Rate        = string.Empty;
 }
        public async void SortClosingDownCommandExecute()
        {
            await ClosePopup();

            var tempRecords = _dealList.OrderByDescending(c => c.estimatedClosingDate).ToList();//Descending order

            DealList.Clear();
            foreach (var item in tempRecords)
            {
                DealList.Add(item);
            }
            IsStopVisible = false;
            var dealClosingDown = DealList.FirstOrDefault();

            MessagingCenter.Send <object, DealsMainModel>(this, "DealsSortClosingDown", dealClosingDown);
        }
        public async void SortDueDateUpCommandExecute()
        {
            await ClosePopup();

            var tempRecords = _dealList.OrderBy(c => c.decisionDueDate).ToList();//ascending order

            DealList.Clear();
            foreach (var item in tempRecords)
            {
                DealList.Add(item);
            }
            _isStopVisible = false;
            var dealDueUp = DealList.FirstOrDefault();

            MessagingCenter.Send <object, DealsMainModel>(this, "DealsSortDueUp", dealDueUp);
        }
        public async void SortClearCommandExecute()
        {
            await ClosePopup();

            var tempRecords = _dealList.OrderBy(c => c.dealId).ToList();

            DealList.Clear();

            foreach (var item in tempRecords)
            {
                DealList.Add(item);
            }
            IsStopVisible = false;
            var dealClear = DealList.FirstOrDefault();

            MessagingCenter.Send <object, DealsMainModel>(this, "DealsSortClear", dealClear);
        }
 public void PrepareDeal(string AssetCode, string AccountNo)
 {
     DealList.Add(new DealItem()
     {
         AccNo = "123456", Asset = AssetCode, Side = "Авах", State = -1
     });
     DealList.Add(new DealItem()
     {
         AccNo      = AccountNo,
         Asset      = AssetCode,
         Side       = "Зарах",
         State      = 0,
         Qty        = 100,
         MatchID    = 213214,
         ID         = 2,
         Price      = 30,
         TotalPrice = 3000, Fee = 30, DealTime = DateTime.Now
     });
 }
Example #9
0
        public static DealList GetDeals(StrategyHeader strategyHeader)
        {
            if (strategyHeader == null)
            {
                return(null);
            }
            IEnumerable <Trade> Trades   = TradingData.Instance.GetTrades(strategyHeader);
            DealList            dealList = new DealList(strategyHeader);

            Console.WriteLine("GetDeals");
            foreach (Trade item in Trades.OrderBy(i => i.DateTime))
            {
                dealList.OnItemAdded(item);
            }
            Console.WriteLine("Количество сделок:   {0}", dealList.Count);
            Console.WriteLine("Количество сделок P: {0}", dealList.CountP);
            Console.WriteLine("Количество сделок L: {0}", dealList.CountL);
            Console.WriteLine("Процент сделок P:    {0}", dealList.CountPercentP.ToString("0.0000"));
            Console.WriteLine("Процент сделок L:    {0}", dealList.CountPercentL.ToString("0.0000"));
            Console.WriteLine("Сумма PnL:   {0}", dealList.Sum);
            Console.WriteLine("Сумма P:     {0}", dealList.SumP);
            Console.WriteLine("Сумма L:     {0}", dealList.SumL);
            Console.WriteLine("Средняя Сумма PnL:   {0}", dealList.AverageSum.ToString("0.0000"));
            Console.WriteLine("Средняя Сумма P:     {0}", dealList.AverageSumP.ToString("0.0000"));
            Console.WriteLine("Средняя Сумма L:     {0}", dealList.AverageSumL.ToString("0.0000"));

            Console.WriteLine("Средняя Серия P:     {0}", dealList.AverageSeriesP.ToString("0.0000"));
            Console.WriteLine("Средняя Серия L:     {0}", dealList.AverageSeriesL.ToString("0.0000"));
            Console.WriteLine("Max Серия P:         {0}", dealList.MaxSeriesP.ToString("0.0000"));
            Console.WriteLine("Max Серия L:         {0}", dealList.MaxSeriesL.ToString("0.0000"));

            return(dealList);
            //Console.WriteLine(String.Format("BuyTrades.Sum: {0}", BuyTrades.Sum(i => i.Amount).ToString()));
            //Console.WriteLine(String.Format("BuyTrades1.Sum: {0}", BuyTrades1.Sum(i => i.Amount).ToString()));
            //Console.WriteLine(String.Format("BuyTrades.Count: {0}", BuyTrades.Count().ToString()));
            //Console.WriteLine(String.Format("BuyTrades1.Count: {0}", BuyTrades1.Count().ToString()));

            //Console.WriteLine(String.Format("SellTrades.Sum: {0}", SellTrades.Sum(i => i.Amount).ToString()));
            //Console.WriteLine(String.Format("SellTrades1.Sum: {0}", SellTrades1.Sum(i => i.Amount).ToString()));
            //Console.WriteLine(String.Format("SellTrades.Count: {0}", SellTrades.Count().ToString()));
            //Console.WriteLine(String.Format("SellTrades1.Count: {0}", SellTrades1.Count().ToString()));
        }
        //public void GetFilterByData()
        //{
        //    DealsFilterByItems.Clear();
        //    //DealList = new ObservableCollection<DealsMainModel>(AllDealListItems);
        //    var statusList = this.StagesList.Select(w => w.stagelabel_10);
        //    StatusPickerList = new ObservableCollection<string>(statusList.Distinct().ToList());
        //    if (StatusPickerList != null && StatusPickerList.Count > 0)
        //    {
        //        foreach (var item in StatusPickerList)
        //        {
        //            DealsFilterByItems.Add(new DealsSortByModel { name = item, Radiobtnimg = Constants.CheckboxUnselectImg });
        //        }
        //    }
        //}

        private async void ApplayFilterCommandExcecute()
        {
            try
            {
                FilteredList.Clear();
                IsLoadingInfiniteEnabled = true;
                var IsAnyItemSelected = DealsFilterByItems.Where(x => x.Radiobtnimg == Constants.CheckboxImg).ToList();
                if (IsAnyItemSelected.Count > 0 && IsAnyItemSelected != null)
                {
                    ObservableCollection <DealsMainModel> filterData = new ObservableCollection <DealsMainModel>();
                    foreach (var item in IsAnyItemSelected)
                    {
                        var data = this.AllDealListItems.Where(w => (w.status.Equals(item.name))).ToList();
                        filterData = new ObservableCollection <DealsMainModel>(data);
                        foreach (var item1 in filterData)
                        {
                            FilteredList.Add(item1);
                        }
                        filterData.Clear();
                    }

                    if (FilteredList.Count > 0)
                    {
                        await ClosePopup();

                        IsListDataAvailable = true;
                        IsDataNotAvailable  = false;
                        IsFilterOn          = true;
                        DealList.Clear();
                        DealList = new ObservableCollection <DealsMainModel>(FilteredList.ToList());
                        var firstMessage = DealList.FirstOrDefault();
                        MessagingCenter.Send <object, DealsMainModel>(this, "DealsFilterApplied", firstMessage);
                    }
                    else
                    {
                        await ClosePopup();

                        IsListDataAvailable = false;
                        IsDataNotAvailable  = true;
                        IsFilterOn          = true;
                        DealList            = new ObservableCollection <DealsMainModel>(FilteredList.ToList());
                    }
                }
                else
                {
                    //If no filter option is selcted clear the filter %
                    await ClosePopup();

                    if (AllDealListItems.Count > 0)
                    {
                        IsListDataAvailable = false;
                        IsDataNotAvailable  = false;
                        IsFilterOn          = false;
                        DealList            = new ObservableCollection <DealsMainModel>(AllDealListItems);
                    }
                    //await ShowAlert("Alert", "Please select filter option");
                }

                //string status = StatusPicked;
                //if (!string.IsNullOrEmpty(status))
                //{
                //    var data = this.DealList.Where(w => (w.status.Equals(StatusPicked))).ToList();
                //    FilteredList = new ObservableCollection<DealsMainModel>(data);
                //    if (FilteredList.Count > 0)
                //    {
                //        IsListDataAvailable = true;
                //        IsDataNotAvailable = false;
                //        DealList.Clear();
                //        DealList = new ObservableCollection<DealsMainModel>(FilteredList.ToList());
                //    }
                //    else
                //    {
                //        IsListDataAvailable = false;
                //        IsDataNotAvailable = true;
                //        DealList = new ObservableCollection<DealsMainModel>(AllItems);
                //    }
                //}
                //else
                //{
                //    await ShowAlert("Alert", "Please select filter option");
                //}
            }
            catch (Exception ex)
            {
                await ClosePopup();

                Console.Write(ex.Message);
                ShowExceptionAlert(ex);
            }
        }