请问如何用Java获取股市历史数据?新浪,搜狐,百度财经都可以。......
公共?班级?StockConnection?{
公共?静电?作废?main(String[]?args)?{
网址?ur?=?null
试试?{
//搜狐股市历史界面
//ur?=?新的?网址(" _ 300228 & ampstart = 20130930 & amp;end = 20131231 & amp;stat = 1 & amp;订单= D & amp周期= d & amp回调= historySearchHandler & amprt = jsonp ");
//新浪股市历史界面
ur?=?新的?URL("/stock/flash _ HQ/Kline _ data . PHP?& amprand = random(10000)amp;符号= sh600000 & ampend _ date = 20150809 & amp;begin _ date = 20000101。type = plain ");
HttpURLConnection?uc?=?(HttpURLConnection)?ur . open connection();
BufferedReader?读者?=?新的?BufferedReader(新?InputStreamReader(ur . openstream(),“GBK”);
字符串?线;
而((行?=?reader.readLine())?!=?null){
system . out . println(line);
}
}?接住?(例外?e)?{
//?托多?自动生成?接住?街区
e . printstacktrace();
}
}
}