确保数据的准确性是实现科学决策的重要基础。优质的数据源通常具备严谨的数据审核流程,能够有效提升信息的可信度。本文将介绍超过200个经过实际验证、可免费使用的专业股票数据接口,并结合Python、JavaScript(Node.js)、Java、C#、Ruby五种主流编程语言,详细演示如何高效调用这些接口以获取所需的股市信息,希望能为相关开发者和技术人员提供实用参考。
以下是其中一个常用接口的具体信息,用户可直接复制链接至浏览器地址栏访问,快速验证其可用性:
沪深A股近一年各季度利润数据API接口:
http://api.momaapi.com/hscp/jdlr/股票代码(如000001)/您的Token
在该接口URL中,“000001”代表示例股票代码,而“TEST-API-TOKEN-MOMA-836089C22111”为官方提供的临时测试认证令牌,仅限用于查询代码为000001的数据。后续如需查询其他股票,建议申请个人专属的免费访问令牌以扩展使用范围。
在数字化金融时代,股票数据API已经成为连接市场动态与分析决策的关键桥梁。无论是个人投资者的策略回测、机构的高频交易系统,还是金融科技产品的功能搭建,都离不开稳定、精准的股票数据API支持。
1. Python 实现方式
import requests
url = "http://api.momaapi.com/hscp/jdlr/000001/TEST-API-TOKEN-MOMA-836089C22111"
response = requests.get(url)
data = response.json()
print(data)
2. JavaScript (Node.js) 调用方法
const axios = require('axios');
const url = "http://api.momaapi.com/hscp/jdlr/000001/TEST-API-TOKEN-MOMA-836089C22111";
axios.get(url)
.then(response => {
console.log(response.data);
})
.catch(error => {
console.log(error);
});
3. Java 调用示例
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.io.IOException;
public class Main {
public static void main(String[] args) {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("http://api.momaapi.com/hscp/jdlr/000001/TEST-API-TOKEN-MOMA-836089C22111"))
.build();
try {
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
} catch (IOException | InterruptedException e) {
e.printStackTrace();
}
}
}
4. C# 调用代码
using System;
using System.Net.Http;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
using (HttpClient client = new HttpClient())
{
string url = "http://api.momaapi.com/hscp/jdlr/000001/TEST-API-TOKEN-MOMA-836089C22111";
HttpResponseMessage response = await client.GetAsync(url);
string responseBody = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseBody);
}
}
}
5. Ruby 实现方案
require 'net/http'
require 'json'
url = URI("http://api.momaapi.com/hscp/jdlr/000001/TEST-API-TOKEN-MOMA-836089C22111")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
response = http.request(request)
data = JSON.parse(response.read_body)
puts data
返回的数据示例如下:
[
{
"date": "2024-09-30",
"income": "11,158,200.00",
"expend": "3,169,900.00",
"profit": "4,786,900.00",
"totalp": "4,774,400.00",
"reprofit": "3,972,900.00",
"basege": "1.9400",
"ettege": "1.9400",
"otherp": "-78,600.00",
"totalcp": "3,894,300.00"
},
{
"date": "2024-06-30",
"income": "7,713,200.00",
"expend": "2,189,200.00",
"profit": "3,208,700.00",
"totalp": "3,197,700.00",
"reprofit": "2,587,900.00",
"basege": "1.2300",
"ettege": "1.2300",
"otherp": "-35,600.00",
"totalcp": "2,552,300.00"
},
{
"date": "2024-03-31",
"income": "3,877,000.00",
"expend": "1,082,000.00",
"profit": "1,855,400.00",
"totalp": "1,852,500.00",
"reprofit": "1,493,200.00",
"basege": "0.6600",
"ettege": "0.6600",
"otherp": "34,500.00",
"totalcp": "1,527,700.00"
},
{
"date": "2023-12-31",
"income": "16,469,900.00",
"expend": "4,767,700.00",
"profit": "5,792,800.00",
"totalp": "5,771,800.00",
"reprofit": "4,645,500.00",
"basege": "2.2500",
"ettege": "2.2500",
"otherp": "-37,200.00",
"totalcp": "4,608,300.00"
},
{
"date": "2023-09-30",
"income": "12,763,400.00",
"expend": "3,517,300.00",
"profit": "4,904,700.00",
"totalp": "4,899,300.00",
"reprofit": "3,963,500.00",
"basege": "1.9400",
"ettege": "1.9400",
"otherp": "-83,800.00",
"totalcp": "3,879,700.00"
}
]
在数字化金融时代,股票数据API已经成为连接市场动态与分析决策的关键桥梁。无论是个人投资者的策略回测、机构的高频交易系统,还是金融科技产品的功能搭建,都离不开稳定、精准的股票数据API支持。
数据字段说明如下:
-
date
类型:string
描述:统计截止日期,格式为 yyyy-MM-dd
-
income
类型:string
描述:经营活动现金流入小计(单位:万元)
-
expend
类型:string
描述:经营活动现金流出小计(单位:万元)
-
profit
类型:string
描述:经营活动产生的现金流量净额(单位:万元)
-
totalp
类型:string
描述:投资活动产生的现金流量净额(单位:万元)
-
reprofit
类型:string
描述:筹资活动产生的现金流量净额(单位:万元)
-
basege
类型:string
描述:基本每股收益(元)
-
ettege
类型:string
描述:稀释每股收益(元)
-
otherp
类型:string
描述:其他综合收益(单位:万元)
-
totalcp
类型:string
描述:现金及现金等价物净增加额(单位:万元)