|
|
|
@ -1,29 +1,26 @@
|
|
|
|
|
package com.tz.platform.juejin;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.json.JSON;
|
|
|
|
|
import cn.hutool.json.JSONArray;
|
|
|
|
|
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.entity.CompetitionMember;
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
public class JueJinApi {
|
|
|
|
|
private String token = "157e2484a38880effebe57c4ee95d6c29984e2f8";
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
public JueJinApi() {
|
|
|
|
|
headers.put("Authorization", "bearer " + token);
|
|
|
|
|
}
|
|
|
|
@ -35,12 +32,11 @@ public class JueJinApi {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* @param accountName 账号名称
|
|
|
|
|
* @param initCash 初始资金
|
|
|
|
|
* @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) {
|
|
|
|
|
if (StringUtils.isEmpty(accountName)) {
|
|
|
|
|
throw new BaseException("账号名称不能为空");
|
|
|
|
@ -60,8 +56,23 @@ public class JueJinApi {
|
|
|
|
|
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
|
|
|
|
|
*/
|
|
|
|
|
public void deleteAccount(String accountId) {
|
|
|
|
@ -86,6 +97,7 @@ public class JueJinApi {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 绩效报告
|
|
|
|
|
*
|
|
|
|
|
* @param accountId
|
|
|
|
|
* @param title
|
|
|
|
|
* @return
|
|
|
|
@ -99,6 +111,7 @@ public class JueJinApi {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取绩效报告
|
|
|
|
|
*
|
|
|
|
|
* @param reportId
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
@ -131,6 +144,7 @@ public class JueJinApi {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 基准收益率
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public Double getBaseRatio(String start, String end) {
|
|
|
|
@ -152,6 +166,7 @@ public class JueJinApi {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 十大持仓
|
|
|
|
|
*
|
|
|
|
|
* @param accountId
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
@ -171,6 +186,7 @@ public class JueJinApi {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 收益走势
|
|
|
|
|
*
|
|
|
|
|
* @param startTime
|
|
|
|
|
* @param endTime
|
|
|
|
|
* @return
|
|
|
|
@ -185,6 +201,7 @@ public class JueJinApi {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 重仓情况
|
|
|
|
|
*
|
|
|
|
|
* @param accountId 账户ID
|
|
|
|
|
* @param start 开始时间
|
|
|
|
|
* @param end 结束时间
|
|
|
|
@ -200,6 +217,7 @@ public class JueJinApi {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取所有账户业绩报告
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public String listReport(int pageNo, int pageSize) {
|
|
|
|
@ -234,34 +252,34 @@ public class JueJinApi {
|
|
|
|
|
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-04-01";
|
|
|
|
|
String end = "2022-05-05";
|
|
|
|
|
|
|
|
|
|
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");
|
|
|
|
|
// 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-04-01";
|
|
|
|
|
// String end = "2022-05-05";
|
|
|
|
|
//
|
|
|
|
|
// String content = api.getTenPosition("1664a38b-3fc7-11ed-8b9c-00163e0e6ad0");
|
|
|
|
|
// 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);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//// 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);
|
|
|
|
|
//// 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);
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|