股票、基金、场内ETF基金下载数据代码例子 您所在的位置:网站首页 etf基金代码大全最新 股票、基金、场内ETF基金下载数据代码例子

股票、基金、场内ETF基金下载数据代码例子

2023-09-12 15:05| 来源: 网络整理| 查看: 265

金融数据下载接口,股票数据下载接口,基金数据下载接口,可转债数据下载接口 快速获取沪深股票、港股、大盘指数、基金净值、基金排行等财经数据,提供免费的财经数据下载接口。接口将提供Txt、Gson、Csv文件等多种数据形式,方便分析人员快速分析数据。我们将持续完善和增加各类财经数据,力求给大家提供高效、全面、稳定的数据服务。一些指数类的ETF,尤其是像创业板、沪深300这类宽基指数,波动相对稳定,存在一定周期性,挖掘财经数据是存在一定价值的,这是歪哥相信的,也是一直在探索的。希望网站提供的财经数据接口能给大家在投资上带来些许方便,在探索财富奥秘、追求财富自由的道路上,也希望有大家相伴。 目前,提供股票、基金等基本数据下载,保存文件格式多样化,大家可以根据实际情况设置参数。

金融数据下载接口,可以点击数据下载接口进入主界面。注册用户,建议携带token进行下载数据,若是非注册用户,每个小时内访问Api接口的次数是受限制的。

下载示例代码如下: 下载链接:https://github.com/waizao/WZaoStockApiDemo

import bean.StockBaseInfo; import com.google.gson.Gson; import com.google.gson.JsonParser; import com.google.gson.reflect.TypeToken; import constant.EnumExportType; import org.apache.http.HttpEntity; import org.apache.http.clienthods.CloseableHttpResponse; import org.apache.http.clienthods.HttpGet; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.util.EntityUtils; import java.io.IOException; import java.util.List; public class DemoApplication { /** * 如果有新的股票数据采集需求,可以直接联系作者 */ public static void main(String[] args) throws IOException { int exportType = EnumExportType.ExportType_String_Json.getType(); String token = "";//歪枣网上登录后获取Token String url = String.format("http://api.waizaowang.com/doc/getStockHSABaseInfo?code=all&fields=code,name,market&export=%s&token=%s", exportType, token); switch (exportType) { case 1: processJson(url); break; default: processTxt(url); } } private static void processTxt(String url) throws IOException { CloseableHttpClient httpclient = HttpClients.createDefault(); HttpGet httpGet = new HttpGet(url); CloseableHttpResponse response = httpclient.execute(httpGet); try { HttpEntity entity = response.getEntity(); String content = EntityUtils.toString(entity); System.out.println(content); String[] data = content.split(";"); System.out.println(data); } finally { response.close(); } } private static void processJson(String url) throws IOException { HttpGet httpGet = new HttpGet(url); CloseableHttpResponse response = getClient().execute(httpGet); try { HttpEntity entity = response.getEntity(); String content = EntityUtils.toString(entity); System.out.println(content); List data = new Gson().fromJson(JsonParser.parseString(content).getAsJsonObject().get("data"), new TypeToken() { }.getType()); System.out.println(data); } finally { response.close(); } } private static CloseableHttpClient getClient() { return HttpClients.createDefault(); } }


【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有