Esempio n. 1
0
        // Notes:
        //  - The exchange has a total and a held value.
        //  - For a given fund, the maximum it can be allocated is the exchange's 'available' amount
        //    plus the held amount of the fund, because the funds total includes it's held amount.

        public FundAllocationsUI(Window owner, Model model)
        {
            InitializeComponent();
            Icon  = owner?.Icon;
            Owner = owner;
            Model = model;

            Filter    = new CoinFilter(x => (CoinDataAdapter)x);
            Exchanges = new ListCollectionView(model.TradingExchanges.ToList());
            Funds     = new ListCollectionView(model.Funds)
            {
                Filter = x => ((Fund)x).Id != Fund.Main
            };
            Coins = new ListCollectionView(ListAdapter.Create(model.Coins, x => new CoinDataAdapter(this, x), x => x.CoinData))
            {
                Filter = Filter.Predicate
            };

            Exchanges.CurrentChanged += delegate { Coins.Refresh(); };
            Funds.CurrentChanged     += delegate { Coins.Refresh(); };
            Filter.PropertyChanged   += delegate { Coins.Refresh(); };

            Accept      = Command.Create(this, Close);
            DataContext = this;
        }
Esempio n. 2
0
        public BackTestingBalancesUI(Window owner, Model model)
        {
            InitializeComponent();
            Owner = owner;
            Icon  = owner?.Icon;

            InitialBalances = new ExchToBalance();
            Exchanges       = new ListCollectionView(model.TradingExchanges.ToList());
            Coins           = new ListCollectionView(ListAdapter.Create(model.Coins, x => new CoinDataAdapter(this, x), x => x.CoinData));

            Exchanges.CurrentChanged += delegate { Coins.Refresh(); };

            // Commands
            Accept = Command.Create(this, AcceptInternal);

            // Initialise the initial balance from settings
            foreach (var exch_data in SettingsData.Settings.BackTesting.AccountBalances.Exchanges)
            {
                foreach (var bal_data in exch_data.Balances)
                {
                    InitialBalances[exch_data.ExchangeName][bal_data.Symbol] = bal_data.Total;
                }
            }

            DataContext = this;
        }
Esempio n. 3
0
        public GridFunds(Model model)
        {
            InitializeComponent();
            m_grid.MouseRightButtonUp += DataGrid_.ColumnVisibility;
            DockControl = new DockControl(this, "Funds");

            Model     = model;
            Filter    = new CoinFilter(x => (CoinDataAdapter)x);
            Exchanges = CollectionViewSource.GetDefaultView(model.Exchanges);            // { Filter = x => !(x is CrossExchange) };
            CoinsView = new ListCollectionView(ListAdapter.Create(model.Coins, x => new CoinDataAdapter(this, x), x => x.CoinData))
            {
                Filter = Filter.Predicate
            };
            Funds = new ListCollectionView(model.Funds);

            //Exchanges.MoveCurrentToFirst();
            Exchanges.CurrentChanged += delegate { CoinsView.Refresh(); };
            Filter.PropertyChanged   += delegate { CoinsView.Refresh(); };

            // Commands
            CreateNewFund         = Command.Create(this, CreateNewFundInternal);
            RemoveFund            = Command.Create(this, RemoveFundInternal);
            ResetSort             = Command.Create(this, ResetSortInternal);
            ShowFundAllocationsUI = Command.Create(this, ShowFundAllocationsUIInternal);

            CreateFundColumns();
            DataContext = this;
        }