Exemple #1
0
        private static string makeExchangeOutOfSymbol(string symbol, FinanceAPI.FinanceStrategies strategy)
        {
            string result = null;

            if (symbol != null)
            {
                string[] tmp = symbol.Split('.');
                if (tmp.Length > 1)
                {
                    ExchangeCode exch = exchanges.FirstOrDefault(x => x.YahooSuffix == tmp[1]);
                    if (exch != null)
                    {
                        switch (strategy)
                        {
                        case FinanceAPI.FinanceStrategies.Google:
                            result = exch.GoogleExch;
                            break;

                        case FinanceAPI.FinanceStrategies.Yahoo:
                            result = exch.YahooExch;
                            break;
                        }
                    }
                }
            }
            return(result);
        }
Exemple #2
0
 public StockChartView(StockListitem stock, FinanceAPI.FinanceStrategies webFinanceStrategy)
 {
     InitializeComponent();
     this.stock = stock;
     this.webFinanceStrategy = webFinanceStrategy;
     setParameters();
     drawChartAsync();
     getAllLinesAsync();
 }
Exemple #3
0
 public StockChartView(StockListitem stock, FinanceAPI.FinanceStrategies webFinanceStrategy, DateTime startDate, DateTime endDate)
 {
     InitializeComponent();
     this.stock = stock;
     this.webFinanceStrategy = webFinanceStrategy;
     this.startDate          = startDate;
     this.endDate            = endDate;
     setParameters();
     drawChartAsync();
     getAllLinesAsync();
 }
Exemple #4
0
 public FinanceAPI.FinanceStrategies getFinanceDataProvider()
 {
     if (ConnectionState == true)
     {
         var check = getSettingByKey("dataprovider");
         if (check == null)
         {
             financeDataProvider = FinanceAPI.FinanceStrategies.Yahoo;
         }
         else
         {
             financeDataProvider = (FinanceAPI.FinanceStrategies)Enum.Parse(typeof(FinanceAPI.FinanceStrategies), check.value);
         }
     }
     return(financeDataProvider);
 }
Exemple #5
0
 public void setFinanceDataProvider(FinanceAPI.FinanceStrategies selected)
 {
     if (ConnectionState == true)
     {
         var check = getSettingByKey("dataprovider");
         if (check == null)
         {
             db.Settings.InsertOnSubmit(new Settings()
             {
                 key   = "dataprovider",
                 value = selected.ToString(),
             });
         }
         else
         {
             check.value = selected.ToString();
         }
         db.SubmitChanges();
     }
 }
Exemple #6
0
 /// <summary>
 /// Changes the data provider
 /// </summary>
 private void cbxDataProvider_SelectedIndexChanged(object sender, EventArgs e)
 {
     webFinanceStrategy = (FinanceAPI.FinanceStrategies)cbxDataProvider.SelectedItem;
     loadChartDataAsync(selectedStock);
 }