Пример #1
0
        private void MainWindow_Load(object sender, EventArgs e)
        {
            AppStartWindow startWin = new AppStartWindow();

            startWin.ShowDialog();

            stocks = startWin.Stocks;

            if (stocks == null)
            {
                Close();
            }
            else if (stocks.Length == 0)
            {
                MessageBox.Show("No input data. App will be closed.");
                Close();
            }
            else
            {
                pairs = FinancialPair.CreateMany(stocks);
                listView.Items.Clear();
                listView.Update(pairs);
                CenterToScreen();
            }
        }
Пример #2
0
        public void CalculateTest()
        {
            Stock[] stocks = CsvUtils.ReadAllDataFrom("csv-samples/", 4, false);

            List <FinancialPair> pairs = FinancialPair.CreateMany(stocks);

            RiskManager rm = new RiskManager(pairs.ToArray(), 100000.00);

            rm.Calculate();

            pairs.ForEach(i => { Assert.AreNotEqual(0, i.TradeVolume); });

            Assert.AreEqual(100000.00, pairs.Select(i => i.TradeVolume).Sum());

            Assert.AreEqual(1, pairs.Select(i => i.Weight).Sum());
        }
Пример #3
0
        static void Main(string[] args)
        {
            var marketData = CsvUtils.ReadAllDataFrom(MarketDataDirectory, 4, false);

            var selectedShares = marketData.ToList().FindAll(i => Symbols.Contains(i.Name));

            var financialPairs = FinancialPair.CreateMany(selectedShares);

            var riskManager = new RiskManager(financialPairs, Balance);

            riskManager.Calculate();

            DisplayResults(financialPairs);

            Console.WriteLine("PRESS 'ENTER' TO EXIT.");
            Console.ReadLine();
        }
Пример #4
0
        private void MainWindow_Load(object sender, EventArgs e)
        {
            AppStartWindow startWin = new AppStartWindow();

            startWin.ShowDialog();

            appData = startWin.AppData;

            if (appData.InputData == null)
            {
                MessageBox.Show("No input data. App will be closed.");
                Close();
            }

            DeltaType deltaType = (DeltaType)Enum.Parse(typeof(DeltaType), appData.DeltaTypeName);

            pairs = FinancialPair.CreateMany(appData.InputData, deltaType);

            listView.Items.Clear();
            listView.Update(pairs);
            CenterToScreen();
        }
Пример #5
0
 private void InitPairs()
 {
     pairs = FinancialPair.CreateMany(stocks);
 }