예제 #1
0
 private void addToolStripMenuItem1_Click(object sender, EventArgs e)
 {
     if (toolStripTextBoxListName.Text.Length > 0)
     {
         WatchListManager.AddNewList(toolStripTextBoxListName.Text);
     }
 }
예제 #2
0
 private void FillListBoxStocks()
 {
     listBoxStocks.Items.Clear();
     foreach (string stock in WatchListManager.GetList(_activeStockList).Stocks)
     {
         listBoxStocks.Items.Add(stock);
     }
 }
예제 #3
0
 private void removeStockToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (listBoxStocks.SelectedItem != null)
     {
         WatchListManager.RemoveFromList(_activeStockList, new Stock(listBoxStocks.SelectedItem.ToString()));
         FillListBoxStocks();
         listBoxStocks.SelectedItem = null;
     }
 }
예제 #4
0
 private void removeListToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (listBoxWatchLists.SelectedItem != null)
     {
         string list = listBoxWatchLists.SelectedItem.ToString();
         WatchListManager.RemoveList(list);
         FillListBoxWatchLists();
         listBoxWatchLists.SelectedItem = null;
     }
 }
예제 #5
0
 private void removeToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (listBoxWatchList.SelectedItem != null)
     {
         Stock stock = new Stock(listBoxWatchList.SelectedItem.ToString());
         WatchListManager.RemoveFromList(_activeWatchList, stock);
         FillListBoxWatchList();
         listBoxWatchList.SelectedItem = null;
     }
 }
예제 #6
0
 private void removeToolStripMenuItem1_Click(object sender, EventArgs e)
 {
     if (_activeWatchList != null)
     {
         if (MessageBox.Show("Are you sure you want to remove " + _activeWatchList, "", MessageBoxButtons.YesNo) == DialogResult.Yes)
         {
             WatchListManager.RemoveList(_activeWatchList);
         }
     }
 }
예제 #7
0
 private void addToolStripMenuItemAddStock_Click(object sender, EventArgs e)
 {
     if (toolStripTextBoxStockName.Text.Length > 0 && _activeWatchList.Length > 0)
     {
         Stock stock = new Stock(toolStripTextBoxStockName.Text);
         WatchListManager.AddToList(_activeWatchList, stock);
         FillListBoxWatchList();
         listBoxWatchList.SelectedItem = null;
     }
 }
예제 #8
0
 private void toolStipItemAddToWatchList_Click(object sender, EventArgs e)
 {
     if (Linked)
     {
         if (_chart.Stock != null)
         {
             ToolStripMenuItem item = (ToolStripMenuItem)sender;
             WatchListManager.AddToList(item.Text, _chart.Stock);
         }
     }
 }
예제 #9
0
        public FormMain()
        {
            GlobalObjects.Initialize();
            Api.Initialize(File.ReadAllText("AlphavantageKey.txt"));
            StockDataBase.Initialize(TimeSpan.FromHours(5));
            OptionDataBase.Initialize();
            WatchListManager.Initialize();
            InitializeComponent();
            watchListUI.Link(GlobalObjects.Chart);
            chartControl.Link(GlobalObjects.Chart);

            watchListUI.LoadStockEvent  += new WatchListUI.LoadStockHandler(LoadStock);
            chartControl.LoadStockEvent += new ChartControl.LoadStockHandler(LoadStockChart);
        }
예제 #10
0
        private void FillListBoxWatchList()
        {
            string selected = "";

            if (_activeWatchList != null)
            {
                selected = _activeWatchList;
            }
            StockList list = WatchListManager.GetList(selected);

            listBoxWatchList.Items.Clear();
            if (list != null)
            {
                listBoxWatchList.Items.AddRange(list.Stocks);
            }
        }
예제 #11
0
        public async void Load(Panel controlPanel, Panel variablePanel)
        {
            panelControl  = controlPanel;
            panelVariable = variablePanel;
            string dataBasePath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\DataMAN\\Financial data\\Options\\HistoricalOptionData";
            string listName     = "Historical Data";

            /*WatchListManager.AddNewList(listName);
             * foreach (string stockFolder in Directory.GetDirectories(dataBasePath))
             * {
             *  DirectoryInfo dInfo = new DirectoryInfo(stockFolder);
             *  string symbol = dInfo.Name;
             *  Stock stock = new Stock(symbol);
             *  WatchListManager.AddToList(listName, stock);
             * }*/
            if (MessageBox.Show("ready") == DialogResult.OK)
            {
                StockList list = WatchListManager.GetList("Historical Data");
                foreach (string symbol in list.Stocks)
                {
                    Stock     stock = new Stock(symbol);
                    StockData data  = await StockDataBase.Get(stock, Api.Interval.Daily, TimeSpan.FromDays(200));

                    DateTime lastRefeshed;
                    try
                    {
                        lastRefeshed = DateTime.Parse(data.MetaData.LastRefreshed);
                    }
                    catch
                    {
                        lastRefeshed = DateTime.MinValue;
                    }

                    if (DateTime.UtcNow - lastRefeshed < TimeSpan.FromMinutes(10))
                    {
                        Thread.Sleep(new TimeSpan(0, 0, 25));
                    }
                }
                MessageBox.Show("Done");
            }
        }
예제 #12
0
 private void buttonAddStock_Click(object sender, EventArgs e)
 {
     WatchListManager.AddToList(_activeStockList, new Stock(textBoxStockName.Text));
     FillListBoxStocks();
 }
예제 #13
0
 private void buttonAddNewList_Click(object sender, EventArgs e)
 {
     _activeStockList = textBoxWatchListName.Text;
     WatchListManager.AddNewList(_activeStockList);
     FillListBoxWatchLists();
 }
예제 #14
0
 private void AddToRecentList(Stock stock)
 {
     WatchListManager.AddToRecentList(stock);
     FillListBoxRecent();
 }
예제 #15
0
 private void FormMain_FormClosing(object sender, FormClosingEventArgs e)
 {
     PluginManager.UnloadPlugins();
     WatchListManager.Save();
 }