|
|
@ -1,147 +1,161 @@
|
|
|
|
package com.tz.platform.juejin;
|
|
|
|
package com.tz.platform.juejin;
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.json.JSON;
|
|
|
|
|
|
|
|
import cn.hutool.json.JSONArray;
|
|
|
|
import cn.hutool.json.JSONArray;
|
|
|
|
import cn.hutool.json.JSONObject;
|
|
|
|
import cn.hutool.json.JSONObject;
|
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
|
import com.netflix.ribbon.proxy.annotation.Http;
|
|
|
|
|
|
|
|
import com.tz.platform.common.core.base.BaseException;
|
|
|
|
import com.tz.platform.common.core.base.BaseException;
|
|
|
|
import com.tz.platform.common.core.tools.DateUtil;
|
|
|
|
|
|
|
|
import com.tz.platform.common.core.tools.HttpUtil;
|
|
|
|
import com.tz.platform.common.core.tools.HttpUtil;
|
|
|
|
import com.tz.platform.entity.Ranking;
|
|
|
|
import com.tz.platform.entity.CompetitionMember;
|
|
|
|
import com.tz.platform.juejin.bo.AccountInfo;
|
|
|
|
import com.tz.platform.juejin.bo.AccountInfo;
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
import java.util.Date;
|
|
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
|
|
public class JueJinApi {
|
|
|
|
public class JueJinApi {
|
|
|
|
private String token = "157e2484a38880effebe57c4ee95d6c29984e2f8";
|
|
|
|
private String token = "157e2484a38880effebe57c4ee95d6c29984e2f8";
|
|
|
|
private String baseUrl = "https://sim.sztzjy.com";
|
|
|
|
private String baseUrl = "https://sim.sztzjy.com";
|
|
|
|
private Map<String,String> headers = new HashMap<>();
|
|
|
|
private static Map<String, String> headers = new HashMap<>();
|
|
|
|
private static Logger logger = LoggerFactory.getLogger(JueJinApi.class);
|
|
|
|
private static Logger logger = LoggerFactory.getLogger(JueJinApi.class);
|
|
|
|
public JueJinApi(){
|
|
|
|
|
|
|
|
headers.put("Authorization","bearer "+token);
|
|
|
|
public JueJinApi() {
|
|
|
|
|
|
|
|
headers.put("Authorization", "bearer " + token);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public JueJinApi(String token){
|
|
|
|
public JueJinApi(String token) {
|
|
|
|
this.token = token;
|
|
|
|
this.token = token;
|
|
|
|
headers.put("Authorization","bearer "+token);
|
|
|
|
headers.put("Authorization", "bearer " + token);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param accountName 账号名称
|
|
|
|
* @param accountName 账号名称
|
|
|
|
* @param initCash 初始资金
|
|
|
|
* @param initCash 初始资金
|
|
|
|
* @param secType 交易类型 1 = 股票, 4 = 期货
|
|
|
|
* @param secType 交易类型 1 = 股票, 4 = 期货
|
|
|
|
* @return
|
|
|
|
* @return //1310 10000000 type=4 1309 1000000 tpye= 1
|
|
|
|
*/
|
|
|
|
*/ //(member.getName(),competitionTask.getInitCapital(),tradeType)
|
|
|
|
public AccountInfo createAccount(String accountName,Long initCash,Integer secType){
|
|
|
|
public AccountInfo createAccount(String accountName, Long initCash, Integer secType) {
|
|
|
|
if(StringUtils.isEmpty(accountName)){
|
|
|
|
if (StringUtils.isEmpty(accountName)) {
|
|
|
|
throw new BaseException("账号名称不能为空");
|
|
|
|
throw new BaseException("账号名称不能为空");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(secType!=1&&secType!=4){
|
|
|
|
if (secType != 1 && secType != 4) {
|
|
|
|
throw new BaseException("交易类型错误");
|
|
|
|
throw new BaseException("交易类型错误");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(initCash<0){
|
|
|
|
if (initCash < 0) {
|
|
|
|
throw new BaseException("初始资金不能为负");
|
|
|
|
throw new BaseException("初始资金不能为负");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
String url = baseUrl +"/broker-rpcgw/v3/accounts";
|
|
|
|
String url = baseUrl + "/broker-rpcgw/v3/accounts";
|
|
|
|
String param = "{\"account\": {\"title\": \""+accountName+"\", \"sec_types\": ["+secType+"], \"info\": {\"appid\": \"[GMBROKER]\"} }, \"init_cash\": "+initCash+", \"engine_id\": \"simulate\"}";
|
|
|
|
String param = "{\"account\": {\"title\": \"" + accountName + "\", \"sec_types\": [" + secType + "], \"info\": {\"appid\": \"[GMBROKER]\"} }, \"init_cash\": " + initCash + ", \"engine_id\": \"simulate\"}";
|
|
|
|
String content = HttpUtil.postWithHeader( url,param,headers);
|
|
|
|
String content = HttpUtil.postWithHeader(url, param, headers);
|
|
|
|
logger.info(content);
|
|
|
|
logger.info(content);
|
|
|
|
return JSONUtil.toBean(content,AccountInfo.class);
|
|
|
|
return JSONUtil.toBean(content, AccountInfo.class);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String token = "157e2484a38880effebe57c4ee95d6c29984e2f8";
|
|
|
|
|
|
|
|
Map<String, String> headers = new HashMap<>();
|
|
|
|
|
|
|
|
String url = "https://sim.sztzjy.com/broker-rpcgw/v3/accounts";
|
|
|
|
|
|
|
|
headers.put("Authorization", "bearer " + token);
|
|
|
|
|
|
|
|
String a = "{\"account\": {\"title\": \"" + "费无法" + "\", \"sec_types\": [" + 4 + "], \"info\": {\"appid\": \"[GMBROKER]\"} }, \"init_cash\": " + 10000000L + ", \"engine_id\": \"simulate\"}";
|
|
|
|
|
|
|
|
String param = "{\"account\": {\"title\": \"" + "费无法" + "\", \"sec_types\": [" + 1 + "], \"info\": {\"appid\": \"[GMBROKER]\"} }, \"init_cash\": " + 1000000L + ", \"engine_id\": \"simulate\"}";
|
|
|
|
|
|
|
|
String contenta = HttpUtil.postWithHeader(url, param, headers);
|
|
|
|
|
|
|
|
String contentb = HttpUtil.postWithHeader(url, param, headers);
|
|
|
|
|
|
|
|
System.out.println("1310大赛=======" + contenta);
|
|
|
|
|
|
|
|
System.out.println("1309大赛=======" + contentb);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 删除账户
|
|
|
|
* 删除账户
|
|
|
|
|
|
|
|
*
|
|
|
|
* @param accountId 账户ID
|
|
|
|
* @param accountId 账户ID
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public void deleteAccount(String accountId){
|
|
|
|
public void deleteAccount(String accountId) {
|
|
|
|
String url = baseUrl+"/broker-rpcgw/v3/accounts?account_ids="+accountId;
|
|
|
|
String url = baseUrl + "/broker-rpcgw/v3/accounts?account_ids=" + accountId;
|
|
|
|
String content = HttpUtil.delete(url,headers);
|
|
|
|
String content = HttpUtil.delete(url, headers);
|
|
|
|
logger.info("{} 删除信息,{}",accountId,content);
|
|
|
|
logger.info("{} 删除信息,{}", accountId, content);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public String getCashInfo(String accountId){
|
|
|
|
public String getCashInfo(String accountId) {
|
|
|
|
String url = baseUrl+"/broker-rpcgw/v3/account-trade/cash/"+accountId;
|
|
|
|
String url = baseUrl + "/broker-rpcgw/v3/account-trade/cash/" + accountId;
|
|
|
|
String content = HttpUtil.get(url,headers);
|
|
|
|
String content = HttpUtil.get(url, headers);
|
|
|
|
logger.info("{} 账户资金信息:{},",accountId,content);
|
|
|
|
logger.info("{} 账户资金信息:{},", accountId, content);
|
|
|
|
return content;
|
|
|
|
return content;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public String cashInOut(String accountId){
|
|
|
|
public String cashInOut(String accountId) {
|
|
|
|
String url =baseUrl+ "/broker-rpcgw/v3/accounts/"+accountId+"/cash-inout";
|
|
|
|
String url = baseUrl + "/broker-rpcgw/v3/accounts/" + accountId + "/cash-inout";
|
|
|
|
String content = HttpUtil.get(url,headers);
|
|
|
|
String content = HttpUtil.get(url, headers);
|
|
|
|
logger.info("{} 出入资金明细:{},",accountId,content);
|
|
|
|
logger.info("{} 出入资金明细:{},", accountId, content);
|
|
|
|
return content;
|
|
|
|
return content;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 绩效报告
|
|
|
|
* 绩效报告
|
|
|
|
|
|
|
|
*
|
|
|
|
* @param accountId
|
|
|
|
* @param accountId
|
|
|
|
* @param title
|
|
|
|
* @param title
|
|
|
|
* @return
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public String createReport(String accountId,String title){
|
|
|
|
public String createReport(String accountId, String title) {
|
|
|
|
String url = baseUrl+ "/perfweb-rpcgw/api/v1/sim/detail/"+accountId+"?title="+title;
|
|
|
|
String url = baseUrl + "/perfweb-rpcgw/api/v1/sim/detail/" + accountId + "?title=" + title;
|
|
|
|
String content = HttpUtil.get(url,headers);
|
|
|
|
String content = HttpUtil.get(url, headers);
|
|
|
|
logger.info("报告生成请求: {}",accountId+"\t"+content);
|
|
|
|
logger.info("报告生成请求: {}", accountId + "\t" + content);
|
|
|
|
return content;
|
|
|
|
return content;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 获取绩效报告
|
|
|
|
* 获取绩效报告
|
|
|
|
|
|
|
|
*
|
|
|
|
* @param reportId
|
|
|
|
* @param reportId
|
|
|
|
* @return
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public String getReport(String reportId){
|
|
|
|
public String getReport(String reportId) {
|
|
|
|
String url = baseUrl +"/perfweb-rpcgw/api/v1/report/summaries?report_ids="+reportId;
|
|
|
|
String url = baseUrl + "/perfweb-rpcgw/api/v1/report/summaries?report_ids=" + reportId;
|
|
|
|
String content = HttpUtil.get(url,headers);
|
|
|
|
String content = HttpUtil.get(url, headers);
|
|
|
|
logger.info("报告获取:{}",content);
|
|
|
|
logger.info("报告获取:{}", content);
|
|
|
|
return content;
|
|
|
|
return content;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public String createReport2(String accountId,String title){
|
|
|
|
public String createReport2(String accountId, String title) {
|
|
|
|
String url = baseUrl+ "/perfweb-rpcgw/api/v1/report/analyse-simulation-account";
|
|
|
|
String url = baseUrl + "/perfweb-rpcgw/api/v1/report/analyse-simulation-account";
|
|
|
|
String postData = "{\"account_id\":\""+accountId+"\",\"title\":\""+title+"\"}";
|
|
|
|
String postData = "{\"account_id\":\"" + accountId + "\",\"title\":\"" + title + "\"}";
|
|
|
|
String content = HttpUtil.postWithHeader(url,postData,headers);
|
|
|
|
String content = HttpUtil.postWithHeader(url, postData, headers);
|
|
|
|
return content;
|
|
|
|
return content;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public String listReport(Integer pageNo,Integer pageSize){
|
|
|
|
public String listReport(Integer pageNo, Integer pageSize) {
|
|
|
|
String url = baseUrl +"/api/v1/reports?page="+pageNo+"&size="+pageSize;
|
|
|
|
String url = baseUrl + "/api/v1/reports?page=" + pageNo + "&size=" + pageSize;
|
|
|
|
String content = HttpUtil.get(url,headers);
|
|
|
|
String content = HttpUtil.get(url, headers);
|
|
|
|
return content;
|
|
|
|
return content;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public String listAccountHaveTrade(Integer pageNo,Integer pageSize){
|
|
|
|
public String listAccountHaveTrade(Integer pageNo, Integer pageSize) {
|
|
|
|
String url = baseUrl+ "/api/v1/accounts?page="+pageNo+"&size="+pageSize;
|
|
|
|
String url = baseUrl + "/api/v1/accounts?page=" + pageNo + "&size=" + pageSize;
|
|
|
|
String content = HttpUtil.get(url,headers);
|
|
|
|
String content = HttpUtil.get(url, headers);
|
|
|
|
logger.info("有交易账号信息:{}",content);
|
|
|
|
logger.info("有交易账号信息:{}", content);
|
|
|
|
return content;
|
|
|
|
return content;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 基准收益率
|
|
|
|
* 基准收益率
|
|
|
|
|
|
|
|
*
|
|
|
|
* @return
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public Double getBaseRatio(String start,String end){
|
|
|
|
public Double getBaseRatio(String start, String end) {
|
|
|
|
String url = baseUrl +"/ds-history-rpcgw/v3/data-history/benchmark-return?symbol=SHSE.000300&frequency=1d&start_time="+start+"&end_time="+end+"&adjust=0";
|
|
|
|
String url = baseUrl + "/ds-history-rpcgw/v3/data-history/benchmark-return?symbol=SHSE.000300&frequency=1d&start_time=" + start + "&end_time=" + end + "&adjust=0";
|
|
|
|
String content = HttpUtil.get(url,headers);
|
|
|
|
String content = HttpUtil.get(url, headers);
|
|
|
|
logger.info("基准收益率:{}",content);
|
|
|
|
logger.info("基准收益率:{}", content);
|
|
|
|
JSONObject jsonObject = JSONUtil.parseObj(content);
|
|
|
|
JSONObject jsonObject = JSONUtil.parseObj(content);
|
|
|
|
if(jsonObject.containsKey("data")){
|
|
|
|
if (jsonObject.containsKey("data")) {
|
|
|
|
JSONArray jsonArray = jsonObject.getJSONArray("data");
|
|
|
|
JSONArray jsonArray = jsonObject.getJSONArray("data");
|
|
|
|
JSONObject ratioObj = (JSONObject) jsonArray.get(jsonArray.size()-1);
|
|
|
|
JSONObject ratioObj = (JSONObject) jsonArray.get(jsonArray.size() - 1);
|
|
|
|
logger.info("基准收益率:{}",ratioObj.get("ratio").toString());
|
|
|
|
logger.info("基准收益率:{}", ratioObj.get("ratio").toString());
|
|
|
|
BigDecimal ratioDec = new BigDecimal(ratioObj.get("ratio").toString());
|
|
|
|
BigDecimal ratioDec = new BigDecimal(ratioObj.get("ratio").toString());
|
|
|
|
|
|
|
|
|
|
|
|
return ratioDec.doubleValue();
|
|
|
|
return ratioDec.doubleValue();
|
|
|
@ -152,116 +166,120 @@ public class JueJinApi {
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 十大持仓
|
|
|
|
* 十大持仓
|
|
|
|
|
|
|
|
*
|
|
|
|
* @param accountId
|
|
|
|
* @param accountId
|
|
|
|
* @return
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public String getTenPosition(String accountId){
|
|
|
|
public String getTenPosition(String accountId) {
|
|
|
|
String url = baseUrl + "/broker-rpcgw/v3/account-trade/positions/"+accountId;
|
|
|
|
String url = baseUrl + "/broker-rpcgw/v3/account-trade/positions/" + accountId;
|
|
|
|
String content = HttpUtil.get(url,headers);
|
|
|
|
String content = HttpUtil.get(url, headers);
|
|
|
|
logger.info("持仓数据:{}",content);
|
|
|
|
logger.info("持仓数据:{}", content);
|
|
|
|
return content;
|
|
|
|
return content;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public String getStockInfo(String symbols){
|
|
|
|
public String getStockInfo(String symbols) {
|
|
|
|
String url =baseUrl+"/ds-core-rpcgw/v3/data-fundamental/instrument-infos?symbols="+symbols;
|
|
|
|
String url = baseUrl + "/ds-core-rpcgw/v3/data-fundamental/instrument-infos?symbols=" + symbols;
|
|
|
|
String content = HttpUtil.get(url,headers);
|
|
|
|
String content = HttpUtil.get(url, headers);
|
|
|
|
logger.info("股票信息:{}",content);
|
|
|
|
logger.info("股票信息:{}", content);
|
|
|
|
return content;
|
|
|
|
return content;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 收益走势
|
|
|
|
* 收益走势
|
|
|
|
|
|
|
|
*
|
|
|
|
* @param startTime
|
|
|
|
* @param startTime
|
|
|
|
* @param endTime
|
|
|
|
* @param endTime
|
|
|
|
* @return
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public String getProfit(String startTime,String endTime){
|
|
|
|
public String getProfit(String startTime, String endTime) {
|
|
|
|
String url = baseUrl +"/ds-history-rpcgw/v3/data-history/benchmark-return" +
|
|
|
|
String url = baseUrl + "/ds-history-rpcgw/v3/data-history/benchmark-return" +
|
|
|
|
"?symbol=SHSE.000300&frequency=1d&start_time="+startTime+"&end_time="+endTime+"&adjust=0";
|
|
|
|
"?symbol=SHSE.000300&frequency=1d&start_time=" + startTime + "&end_time=" + endTime + "&adjust=0";
|
|
|
|
String content = HttpUtil.get(url,headers);
|
|
|
|
String content = HttpUtil.get(url, headers);
|
|
|
|
logger.info("收益走势: {}",content);
|
|
|
|
logger.info("收益走势: {}", content);
|
|
|
|
return content;
|
|
|
|
return content;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 重仓情况
|
|
|
|
* 重仓情况
|
|
|
|
|
|
|
|
*
|
|
|
|
* @param accountId 账户ID
|
|
|
|
* @param accountId 账户ID
|
|
|
|
* @param start 开始时间
|
|
|
|
* @param start 开始时间
|
|
|
|
* @param end 结束时间
|
|
|
|
* @param end 结束时间
|
|
|
|
* @return
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public String getHeavy(String accountId,String start,String end){
|
|
|
|
public String getHeavy(String accountId, String start, String end) {
|
|
|
|
String url =baseUrl + "/broker-rpcgw/v3/account-trade/execrpts/"+accountId +
|
|
|
|
String url = baseUrl + "/broker-rpcgw/v3/account-trade/execrpts/" + accountId +
|
|
|
|
"?filter.fromdate="+start+"&filter.todate="+end+"&filter.page=0&filter.pagesize=40";
|
|
|
|
"?filter.fromdate=" + start + "&filter.todate=" + end + "&filter.page=0&filter.pagesize=40";
|
|
|
|
String content = HttpUtil.get(url,headers);
|
|
|
|
String content = HttpUtil.get(url, headers);
|
|
|
|
logger.info("重仓: {}",content);
|
|
|
|
logger.info("重仓: {}", content);
|
|
|
|
return content;
|
|
|
|
return content;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 获取所有账户业绩报告
|
|
|
|
* 获取所有账户业绩报告
|
|
|
|
|
|
|
|
*
|
|
|
|
* @return
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public String listReport(int pageNo,int pageSize){
|
|
|
|
public String listReport(int pageNo, int pageSize) {
|
|
|
|
String url =baseUrl+ "/api/v1/reports?page="+pageNo+"&size="+pageSize;
|
|
|
|
String url = baseUrl + "/api/v1/reports?page=" + pageNo + "&size=" + pageSize;
|
|
|
|
String content = HttpUtil.get(url,headers);
|
|
|
|
String content = HttpUtil.get(url, headers);
|
|
|
|
return content;
|
|
|
|
return content;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public String reportSumary(String reportIds){
|
|
|
|
public String reportSumary(String reportIds) {
|
|
|
|
String url= "https://sim.sztzjy.com/perfweb-gw/api/v1/report/summaries?report_ids="+reportIds;
|
|
|
|
String url = "https://sim.sztzjy.com/perfweb-gw/api/v1/report/summaries?report_ids=" + reportIds;
|
|
|
|
String content = HttpUtil.get(url,headers);
|
|
|
|
String content = HttpUtil.get(url, headers);
|
|
|
|
return content;
|
|
|
|
return content;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public String reportDetail(String reportId){
|
|
|
|
public String reportDetail(String reportId) {
|
|
|
|
String url = baseUrl+"/perfweb-gw/api/v1/report/detail/"+reportId;
|
|
|
|
String url = baseUrl + "/perfweb-gw/api/v1/report/detail/" + reportId;
|
|
|
|
String content = HttpUtil.get(url,headers);
|
|
|
|
String content = HttpUtil.get(url, headers);
|
|
|
|
return content;
|
|
|
|
return content;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public <T> T getOV(JSONObject jsonObject,String key,T dv){
|
|
|
|
public <T> T getOV(JSONObject jsonObject, String key, T dv) {
|
|
|
|
if(jsonObject.containsKey(key)){
|
|
|
|
if (jsonObject.containsKey(key)) {
|
|
|
|
Object v = jsonObject.get(key);
|
|
|
|
Object v = jsonObject.get(key);
|
|
|
|
if(dv instanceof Integer){
|
|
|
|
if (dv instanceof Integer) {
|
|
|
|
v = Integer.parseInt(v.toString());
|
|
|
|
v = Integer.parseInt(v.toString());
|
|
|
|
}else if(dv instanceof Double){
|
|
|
|
} else if (dv instanceof Double) {
|
|
|
|
v =Double.parseDouble(v.toString());
|
|
|
|
v = Double.parseDouble(v.toString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
T rs = (T)v;
|
|
|
|
T rs = (T) v;
|
|
|
|
return rs;
|
|
|
|
return rs;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return dv;
|
|
|
|
return dv;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
// public static void main(String[] args) {
|
|
|
|
JueJinApi api = new JueJinApi();
|
|
|
|
// JueJinApi api = new JueJinApi();
|
|
|
|
String accountId = "2e41a913-9dc1-11ec-89b3-00163e0e6ad0";
|
|
|
|
// String accountId = "2e41a913-9dc1-11ec-89b3-00163e0e6ad0";
|
|
|
|
String zhangSan1Qihuo = "0cfc7894-9f4e-11ec-bf20-00163e0e6ad0";
|
|
|
|
// String zhangSan1Qihuo = "0cfc7894-9f4e-11ec-bf20-00163e0e6ad0";
|
|
|
|
String zhangSan1GuPiao = "";
|
|
|
|
// String zhangSan1GuPiao = "";
|
|
|
|
String start = "2022-04-01";
|
|
|
|
// String start = "2022-04-01";
|
|
|
|
String end = "2022-05-05";
|
|
|
|
// String end = "2022-05-05";
|
|
|
|
|
|
|
|
//
|
|
|
|
String content = api.getTenPosition("1664a38b-3fc7-11ed-8b9c-00163e0e6ad0");
|
|
|
|
// String content = api.getTenPosition("1664a38b-3fc7-11ed-8b9c-00163e0e6ad0");
|
|
|
|
System.out.println(content);
|
|
|
|
|
|
|
|
// api.deleteAccount("4811913f-9dba-11ec-89b3-00163e0e6ad0");
|
|
|
|
|
|
|
|
// api.getCashInfo("d91c3a8f-cba8-11ec-a483-00163e0e6ad0");
|
|
|
|
|
|
|
|
// api.test();
|
|
|
|
|
|
|
|
// String testAccount = "dc226d8a-cc14-11ec-9cd0-00163e0e6ad0";
|
|
|
|
|
|
|
|
// api.createReport(accountId,"report"+ System.currentTimeMillis());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// String content = api.createReport2(accountId,"report"+System.currentTimeMillis());
|
|
|
|
|
|
|
|
// api.getTenPosition("9d7f4856-cc11-11ec-9cd0-00163e0e6ad0");
|
|
|
|
|
|
|
|
// api.getCashInfo("cbee8129-cae7-11ec-a4f7-00163e0e6ad0");
|
|
|
|
|
|
|
|
// api.cashInOut("481c4bbd-cc20-11ec-b818-00163e0e6ad0");
|
|
|
|
|
|
|
|
// String content = api.getReport("57509895");
|
|
|
|
|
|
|
|
// System.out.println(content);
|
|
|
|
// System.out.println(content);
|
|
|
|
// String reportDetail = api.reportSumary("55122910");
|
|
|
|
//// api.deleteAccount("4811913f-9dba-11ec-89b3-00163e0e6ad0");
|
|
|
|
// System.out.println(reportDetail);
|
|
|
|
//// api.getCashInfo("d91c3a8f-cba8-11ec-a483-00163e0e6ad0");
|
|
|
|
// api.getStockInfo("SHSE.600547,SHSE.603160");
|
|
|
|
//// api.test();
|
|
|
|
// api.getProfit("2022-03-11","2022-03-15");
|
|
|
|
//// String testAccount = "dc226d8a-cc14-11ec-9cd0-00163e0e6ad0";
|
|
|
|
// api.getHeavy(accountId,start,end);
|
|
|
|
//// api.createReport(accountId,"report"+ System.currentTimeMillis());
|
|
|
|
// api.getBaseRatio(start,end);
|
|
|
|
//
|
|
|
|
|
|
|
|
//// String content = api.createReport2(accountId,"report"+System.currentTimeMillis());
|
|
|
|
}
|
|
|
|
//// api.getTenPosition("9d7f4856-cc11-11ec-9cd0-00163e0e6ad0");
|
|
|
|
|
|
|
|
//// api.getCashInfo("cbee8129-cae7-11ec-a4f7-00163e0e6ad0");
|
|
|
|
|
|
|
|
//// api.cashInOut("481c4bbd-cc20-11ec-b818-00163e0e6ad0");
|
|
|
|
|
|
|
|
//// String content = api.getReport("57509895");
|
|
|
|
|
|
|
|
//// System.out.println(content);
|
|
|
|
|
|
|
|
//// String reportDetail = api.reportSumary("55122910");
|
|
|
|
|
|
|
|
//// System.out.println(reportDetail);
|
|
|
|
|
|
|
|
//// api.getStockInfo("SHSE.600547,SHSE.603160");
|
|
|
|
|
|
|
|
//// api.getProfit("2022-03-11","2022-03-15");
|
|
|
|
|
|
|
|
//// api.getHeavy(accountId,start,end);
|
|
|
|
|
|
|
|
//// api.getBaseRatio(start,end);
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
}
|
|
|
|