feat:K线-季度/半年/年
This commit is contained in:
@@ -227,18 +227,8 @@ public class InvestingApis {
|
||||
if(code == null) {
|
||||
throw new RuntimeException("找不到股票信息");
|
||||
}
|
||||
String interval = null;
|
||||
if("min".equalsIgnoreCase(string)) {
|
||||
interval = "PT5M";
|
||||
} else if("day".equalsIgnoreCase(string)) {
|
||||
interval = "P1D";
|
||||
} else if("week".equalsIgnoreCase(string)) {
|
||||
interval = "P1W";
|
||||
} else if("month".equalsIgnoreCase(string)) {
|
||||
interval = "P1M";
|
||||
}
|
||||
Date nowDate = new Date();
|
||||
JSONObject json = InvestingInvokerApis.of().__kline(code, interval);
|
||||
JSONObject json = InvestingInvokerApis.of().__kline(code, string);
|
||||
return json
|
||||
.getJSONArray("data")
|
||||
.stream()
|
||||
|
||||
@@ -138,6 +138,7 @@ public class InvestingInvokerApis {
|
||||
throw new RuntimeException("找不到股票信息");
|
||||
}
|
||||
String interval = null;
|
||||
String period = null;
|
||||
if("min".equalsIgnoreCase(string)) {
|
||||
interval = "PT5M";
|
||||
} else if("day".equalsIgnoreCase(string)) {
|
||||
@@ -146,13 +147,30 @@ public class InvestingInvokerApis {
|
||||
interval = "P1W";
|
||||
} else if("month".equalsIgnoreCase(string)) {
|
||||
interval = "P1M";
|
||||
} else if("3month".equalsIgnoreCase(string)) {
|
||||
interval = "P1D";
|
||||
period = "P3M";
|
||||
} else if("6month".equalsIgnoreCase(string)) {
|
||||
interval = "P1D";
|
||||
period = "P6M";
|
||||
} else if("year".equalsIgnoreCase(string)) {
|
||||
interval = "P1W";
|
||||
period = "P1Y";
|
||||
}
|
||||
|
||||
if(StringUtils.isBlank(interval)) {
|
||||
interval = string;
|
||||
}
|
||||
String tmpl = "https://api.investing.com/api/financialdata/{}/historical/chart/?interval={}&pointscount=160";
|
||||
String url = StrFormatter.format(tmpl, code.getCode(), interval);
|
||||
|
||||
String url = null;
|
||||
if(StringUtils.isNotBlank(period)) {
|
||||
String tmpl = "https://api.investing.com/api/financialdata/{}/historical/chart/?period={}&interval={}&pointscount=160";
|
||||
url = StrFormatter.format(tmpl, code.getCode(), period, interval);
|
||||
} else {
|
||||
String tmpl = "https://api.investing.com/api/financialdata/{}/historical/chart/?interval={}&pointscount=160";
|
||||
url = StrFormatter.format(tmpl, code.getCode(), interval);
|
||||
}
|
||||
|
||||
Builder builder = builderGet(url);
|
||||
|
||||
String body = httpClient().newCall(builder.build()).execute().body().string();
|
||||
|
||||
@@ -144,7 +144,7 @@ public class StockApiController {
|
||||
@ResponseBody
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "stockCode",value = "股票对应代码",dataType ="String", paramType = "query", required = true),
|
||||
@ApiImplicitParam(name = "type",value = "type min-时分线 day-日线 week-周线 month-月线",dataType ="String", paramType = "query", required = true),
|
||||
@ApiImplicitParam(name = "type",value = "min-时分线 day-日线 week-周线 month-月线, 3month-季度, 6month-半年, year-年",dataType ="String", paramType = "query", required = true),
|
||||
})
|
||||
public ServerResponse getINDTimeK(@RequestParam("stockCode") String stockCode, @RequestParam("type") String type) throws IOException {
|
||||
ParamUtils.verify("股票代码", stockCode, ParamUtils.STRING_NOT_EMPTY_VERIFY_AND_CONVERT_VALUE);
|
||||
|
||||
Reference in New Issue
Block a user