恒有数(https://udata.hs.net/home?channel_source=vnpy )
运行环境
(1)配置Java1.8环境,安装jdk软件,下载地址为:https://www.oracle.com/cn/java/technologies/javase/javase-jdk8-downloads.html;
(2)安装IDE,下载地址为:https://www.jetbrains.com/idea/download/#section=windows;
(3)配置maven,下载地址为:http://maven.apache.org/download.cgi;
(4)配置commons,下载地址为:https://commons.apache.org/;
(5)下载恒有数Java SDK文件,下载地址为:https://udata.hs.net/data/udata/udata-static/help/hs_udata-java-sdk.rar ,并完成相关配置;
使用步骤
(1)登录平台,获取Token;详细步骤见获取Token;
(2)在数据页面,获取接口名称、请求参数,并查看返回参数及代码示例;
(3)编写Java脚本文件,并执行,如下所示:
import com.hundsun.UdataRequest;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
public class UdataTest {
public static void main(String[] args) throws IOException {
String appToken = "xxxxxxxxxxxxxxxxxx";
String url = "https://udata.hs.net/udata/business/v1/app_services/basic_data/trading_calendar";
Map<String, Object> mapParam = new HashMap<>(12);
mapParam.put("secu_market","72");
String resultGet = UdataRequest.sendGet(appToken, url, mapParam);
String resultPost = UdataRequest.sendPost(appToken, url, mapParam);
}
}