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();
|
||||
|
||||
Reference in New Issue
Block a user