Example #1
0
 public AbstractYahooMarketServer(Country country)
 {
     this.country     = country;
     this.stockServer = getStockServer(country);
     /* Hack on Malaysia Market! The format among Yahoo and CIMB are difference. */
     if (country == Country.Malaysia)
     {
         List <Index> tmp = new List <Index>();
         foreach (Index index in Utils.getStockIndices(country))
         {
             if (IndexHelper.Instance().GetIndexCode(index).toString().StartsWith("^"))
             {
                 tmp.Add(index);
             }
         }
         this.indicies = tmp;
     }
     else
     {
         this.indicies = Utils.getStockIndices(country);
     }
     if (this.indicies.Count == 0)
     {
         throw new ArgumentException(country.ToString());
     }
     foreach (Index index in indicies)
     {
         Code curCode = IndexHelper.Instance().GetIndexCode(index);
         codes.Add(curCode);
         codeToIndexMap.Add(curCode, index);
     }
 }
 /**
  * Constructs a stock market index server based on country.
  *
  * @param country the country
  */
 public GoogleMarketServer(Country country)
 {
     this.country  = country;
     this.indicies = Utils.getStockIndices(country);
     if (this.indicies.Count == 0)
     {
         throw new ArgumentException(country.ToString());
     }
     foreach (Index index in indicies)
     {
         Code curCode = IndexHelper.Instance().GetIndexCode(index);
         codes.Add(curCode);
         codeToIndexMap.Add(curCode, index);
     }
 }