股票列表测试
This commit is contained in:
@@ -17,6 +17,7 @@ import cn.stock.market.utils.*;
|
|||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.google.common.base.Stopwatch;
|
||||||
import okhttp3.OkHttpClient;
|
import okhttp3.OkHttpClient;
|
||||||
import okhttp3.Protocol;
|
import okhttp3.Protocol;
|
||||||
import okhttp3.Request;
|
import okhttp3.Request;
|
||||||
@@ -724,6 +725,25 @@ public class StockService {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//印度股票列表 英财
|
||||||
|
public ServerResponse getINDStockList(Integer pageSize, Integer pageNum) {
|
||||||
|
String sina_result = "";
|
||||||
|
try {
|
||||||
|
String tmpl = "https://api.investing.com/api/financialdata/assets/equitiesByCountry/default?fields-list=id,name,symbol,high,low,last,lastPairDecimal,change,changePercent,volume,time,isOpen,url,flag,countryNameTranslated,exchangeId,performanceDay,performanceWeek,performanceMonth,performanceYtd,performanceYear,performance3Year,technicalHour,technicalDay,technicalWeek,technicalMonth,avgVolume,fundamentalMarketCap,fundamentalRevenue,fundamentalRatio,fundamentalBeta,pairType&country-id=14&page={}&page-size={}&include-major-indices=false&include-additional-indices=false&include-primary-sectors=false&include-other-indices=false&limit=0";
|
||||||
|
String url = StrFormatter.format(tmpl, pageNum, pageSize);
|
||||||
|
Stopwatch stopwatch = Stopwatch.createStarted();
|
||||||
|
log.info("url: {}", url);
|
||||||
|
Builder builder = new Request.Builder().url(url).method("GET", null);
|
||||||
|
String body = httpClient().newCall(builder.build()).execute().body().string();
|
||||||
|
sina_result = JSON.parseObject(body).toString();
|
||||||
|
return ServerResponse.createBySuccess(sina_result);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("获取出错,错误信息 = {}", e);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
//印度股票时线-K线
|
//印度股票时线-K线
|
||||||
public ServerResponse getTimeK(String stockCode) {
|
public ServerResponse getTimeK(String stockCode) {
|
||||||
String sina_result = "";
|
String sina_result = "";
|
||||||
|
|||||||
@@ -122,6 +122,14 @@ public class StockApiController {
|
|||||||
return this.stockService.getYCStockInfo(stockCode);
|
return this.stockService.getYCStockInfo(stockCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//印度股票列表 英情
|
||||||
|
@RequestMapping({"getINDStockList.do"})
|
||||||
|
@ApiOperation(value = "印度股票列表", httpMethod = "GET")
|
||||||
|
@ResponseBody
|
||||||
|
public ServerResponse getINDStockList(@RequestParam("pageSize") Integer pageSize, @RequestParam("pageNum") Integer pageNum) {
|
||||||
|
return this.stockService.getINDStockList(pageSize, pageNum);
|
||||||
|
}
|
||||||
|
|
||||||
//印度股票时线-K线
|
//印度股票时线-K线
|
||||||
@RequestMapping({"getINDTimeK.do"})
|
@RequestMapping({"getINDTimeK.do"})
|
||||||
@ApiOperation(value = "印度股票K线", httpMethod = "GET")
|
@ApiOperation(value = "印度股票K线", httpMethod = "GET")
|
||||||
|
|||||||
Reference in New Issue
Block a user