Пример #1
0
 public String extract(StockInfo stock, Date date) throws Exception {
   String trans;
   if (year == date.getYear() && quarter == dateToQuarter(date)) {
     trans = map.get(date.toString());
   } else {
     map = new HashMap<String, String>(70);
     if (extractRun(stock, date)) {
       year = date.getYear();
       quarter = dateToQuarter(date);
       trans = map.get(date.toString());
     } else {
       year = Utils.valType.NL;
       quarter = Utils.valType.NL;
       trans = null;
     }
   }
   return trans;
 }
Пример #2
0
 private boolean extractRun(StockInfo stock, Date date) throws Exception {
   String path = "/corp/go.php/vMS_MarketHistory/stockid/" + stock.numberToString() + ".phtml";
   URI uri =
       new URIBuilder()
           .setScheme("http")
           .setHost("vip.stock.finance.sina.com.cn")
           .setPath(path)
           .setParameter("year", String.valueOf(date.getYear()))
           .setParameter("jidu", String.valueOf(dateToQuarter(date)))
           .build();
   DownloadHelper download = new DownloadHelper(uri);
   InputStream is = download.getInputStream();
   boolean ret = jsoupImpl(is);
   is.close();
   download.close();
   return ret;
 }