@ -6,13 +6,16 @@ import cn.hutool.json.JSONObject;
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.tools.DateUtil ;
import com.tz.platform.common.core.tools.HttpUtil ;
import com.tz.platform.entity.Ranking ;
import com.tz.platform.juejin.bo.AccountInfo ;
import org.slf4j.Logger ;
import org.slf4j.LoggerFactory ;
import org.springframework.util.StringUtils ;
import java.math.BigDecimal ;
import java.util.Date ;
import java.util.HashMap ;
import java.util.Map ;
@ -83,8 +86,7 @@ public class JueJinApi {
public String createReport ( String accountId , String title ) {
String url = baseUrl + "/perfweb-rpcgw/api/v1/sim/detail/" + accountId + "?title=" + title ;
String content = HttpUtil . get ( url , headers ) ;
logger . info ( "报告生成请求: {}" , content ) ;
logger . info ( "报告生成请求: {}" , accountId + "\t" + content ) ;
return content ;
}
@ -120,7 +122,7 @@ public class JueJinApi {
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 content = HttpUtil . get ( url , headers ) ;
logger . info ( "基准收益率:{}" , content ) ;
JSONObject jsonObject = JSONUtil . parseObj ( content ) ;
if ( jsonObject . containsKey ( "data" ) ) {
JSONArray jsonArray = jsonObject . getJSONArray ( "data" ) ;
@ -193,31 +195,47 @@ public class JueJinApi {
}
public String test ( ) {
String url = "https://sim.sztzjy.com/sim?acc=2e41a913-9dc1-11ec-89b3-00163e0e6ad0" ;
String content = HttpUtil . get ( url , headers ) ;
logger . info ( "测试结果:{}" , content ) ;
return "" ;
public String reportDetail ( String reportId ) {
String url = baseUrl + "/perfweb-gw/api/v1/report/detail/" + reportId ;
String content = HttpUtil . get ( url , headers ) ;
return content ;
}
public < T > T getOV ( JSONObject jsonObject , String key , T dv ) {
if ( jsonObject . containsKey ( key ) ) {
Object v = jsonObject . get ( key ) ;
if ( dv instanceof Integer ) {
v = Integer . parseInt ( v . toString ( ) ) ;
} else if ( dv instanceof Double ) {
v = Double . parseDouble ( v . toString ( ) ) ;
}
T rs = ( T ) v ;
return rs ;
}
return dv ;
}
public static void main ( String [ ] args ) {
JueJinApi api = new JueJinApi ( ) ;
String accountId = "2e41a913-9dc1-11ec-89b3-00163e0e6ad0" ;
String zhangSan1Qihuo = "0cfc7894-9f4e-11ec-bf20-00163e0e6ad0" ;
String zhangSan1GuPiao = "" ;
String start = "2022-03-07" ;
String end = "2022-03-21" ;
String start = "2022-0 4-01 ";
String end = "2022-0 5-05 ";
// AccountInfo info = api.createAccount("张三1",1000000L,4);
// AccountInfo info = api.createAccount(" 测试账号",1000000L,1 );
// System.out.println(info.getAccount_id());
// api.deleteAccount("4811913f-9dba-11ec-89b3-00163e0e6ad0");
// api.getCashInfo(" 2e41a913-9dc1-11ec-89b 3-00163e0e6ad0");
// api.getCashInfo(" d91c3a8f-cba8-11ec-a48 3-00163e0e6ad0");
// api.test();
api . createReport ( accountId , "report" + System . currentTimeMillis ( ) ) ;
// api.getCashInfo(accountId);
// api.getReport("28177517");
// String testAccount = "dc226d8a-cc14-11ec-9cd0-00163e0e6ad0";
// api.createReport(accountId,"report"+ System.currentTimeMillis());
// api.getTenPosition("9d7f4856-cc11-11ec-9cd0-00163e0e6ad0");
// api.getCashInfo("cbee8129-cae7-11ec-a4f7-00163e0e6ad0");
String content = api . getReport ( "57239410" ) ;
System . out . println ( content ) ;
// String reportDetail = api.reportDetail("55910953");
// System.out.println(content);
// api.getStockInfo("SHSE.600547,SHSE.603160");
// api.getProfit("2022-03-11","2022-03-15");
// api.getHeavy(accountId,start,end);