Contact Us
Back top
Current Location : APIs > 同花顺
同花顺 Transactions( 42 )

同花顺

Intro. :

Tag : 股吧新闻股市 On Shelves Time : 2016-09-28

Type :

文章 新闻 评论

Tutorials

Total invocations(updated per hour)

同花顺论股 0.10 yuan/100calls Test Now

API Mark

Example

-- 请求示例 url 默认请求参数已经做URL编码 curl -i "http://api01.bitspaceman.com:8000/post/tonghuashun?apikey={Your apikey}&kw=000001"
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.net.URL; import java.nio.charset.Charset; import org.json.JSONException; import org.json.JSONObject; import java.io.PrintWriter; import java.net.URLConnection; public class Example { private static String readAll(Reader rd) throws IOException { StringBuilder sb = new StringBuilder(); int cp; while ((cp = rd.read()) != -1) { sb.append((char) cp); } return sb.toString(); } public static JSONObject postRequestFromUrl(String url, String body) throws IOException, JSONException { URL realUrl = new URL(url); URLConnection conn = realUrl.openConnection(); conn.setDoOutput(true); conn.setDoInput(true); PrintWriter out = new PrintWriter(conn.getOutputStream()); out.print(body); out.flush(); InputStream instream = conn.getInputStream(); try { BufferedReader rd = new BufferedReader(new InputStreamReader(instream, Charset.forName("UTF-8"))); String jsonText = readAll(rd); JSONObject json = new JSONObject(jsonText); return json; } finally { instream.close(); } } public static JSONObject getRequestFromUrl(String url) throws IOException, JSONException { URL realUrl = new URL(url); URLConnection conn = realUrl.openConnection(); InputStream instream = conn.getInputStream(); try { BufferedReader rd = new BufferedReader(new InputStreamReader(instream, Charset.forName("UTF-8"))); String jsonText = readAll(rd); JSONObject json = new JSONObject(jsonText); return json; } finally { instream.close(); } } public static void main(String[] args) throws IOException, JSONException { // 请求示例 url 默认请求参数已经做URL编码 String url = "http://api01.bitspaceman.com:8000/post/tonghuashun?apikey={Your apikey}&kw=000001"; JSONObject json = getRequestFromUrl(url);; System.out.println(json.toString()); } }
//using System.Net.Security; //using System.Security.Cryptography.X509Certificates; private const String method = "GET"; static void Main(string[] args) { String bodys = ""; // 请求示例 url 默认请求参数已经做URL编码 String url = "http://api01.bitspaceman.com:8000/post/tonghuashun?apikey={Your apikey}&kw=000001"; HttpWebRequest httpRequest = null; HttpWebResponse httpResponse = null; if (url.Contains("https://")) { ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(CheckValidationResult); httpRequest = (HttpWebRequest)WebRequest.CreateDefault(new Uri(url)); } else { httpRequest = (HttpWebRequest)WebRequest.Create(url); } httpRequest.Method = method; if (0 < bodys.Length) { byte[] data = Encoding.UTF8.GetBytes(bodys); using (Stream stream = httpRequest.GetRequestStream()) { stream.Write(data, 0, data.Length); } } try { httpResponse = (HttpWebResponse)httpRequest.GetResponse(); } catch (WebException ex) { httpResponse = (HttpWebResponse)ex.Response; } Console.WriteLine(httpResponse.StatusCode); Console.WriteLine(httpResponse.Method); Console.WriteLine(httpResponse.Headers); Stream st = httpResponse.GetResponseStream(); StreamReader reader = new StreamReader(st, Encoding.GetEncoding("utf-8")); Console.WriteLine(reader.ReadToEnd()); Console.WriteLine("\n"); } public static bool CheckValidationResult(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors) { return true; }
<?php $method = "GET"; // 请求示例 url 默认请求参数已经做URL编码 $url = "http://api01.bitspaceman.com:8000/post/tonghuashun?apikey={Your apikey}&kw=000001"; $curl = curl_init(); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_FAILONERROR, false); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_HEADER, true); curl_setopt($curl, CURLOPT_ENCODING, "gzip"); var_dump(curl_exec($curl)); ?>
# coding:utf-8 """ Compatible for python2.x and python3.x requirement: pip install requests """ from __future__ import print_function import requests # 请求示例 url 默认请求参数已经做URL编码 url = "http://api01.bitspaceman.com:8000/post/tonghuashun?apikey={Your apikey}&kw=000001" headers = { "Accept-Encoding": "gzip", "Connection": "close" } if __name__ == "__main__": r = requests.get(url, headers=headers) json_obj = r.json() print(json_obj)

Request Field( Params marked* means users should choose one from the each marked items to fill in.)

Property Name Type Mandatory Example Description
kw string 查询关键词
pageToken string 翻页值,从API返回结果可以拿到

Response Fields

Property Name Type Example Description
  • hasNext boolean true 是否有下一页
  • retcode string 000000 返回状态码
  • appCode string tonghuashun 本次查询的api名
  • dataType string post 本次查询的api类型
  • pageToken string 1_364159452 翻页值
  • data array [...] 数据内容列表
  • posterId string 264945517 发布者ID
  • commentCount string null 评论数
  • posterScreenName string LLsuuu 发布者名称
  • title string null 文章标题
  • url string null 文章链接
  • publishDateStr string 2017-05-12T07:38:43 发布时间:字符串格式
  • publishDate number 1494574723 发布时间:时间戳格式
  • likeCount string null 点赞数
  • content string 银行效益正下滑,股票反而涨,奇怪! 文章内容
  • shareCount string null 转发数
  • imageUrls string null 图片链接
  • id string 364281777 文章ID

Returns The Sample

{
    "hasNext": true,
    "retcode": "000000",
    "appCode": "tonghuashun",
    "dataType": "post",
    "pageToken": "1_364159452",
    "data": [
        {
            "posterId": "264945517",
            "commentCount": null,
            "posterScreenName": "LLsuuu",
            "title": null,
            "url": null,
            "publishDateStr": "2017-05-12T07:38:43",
            "publishDate": 1494574723,
            "likeCount": null,
            "content": "银行效益正下滑,股票反而涨,奇怪!",
            "shareCount": null,
            "imageUrls": null,
            "id": "364281777"
        },
        {
            "posterId": "278377215",
            "commentCount": null,
            "posterScreenName": "高斯贝尔上50",
            "title": null,
            "url": null,
            "publishDateStr": "2017-05-12T07:16:06",
            "publishDate": 1494573366,
            "likeCount": null,
            "content": "再不涨就被你弟弟民生超了",
            "shareCount": null,
            "imageUrls": null,
            "id": "364276471"
        },
        {
            "posterId": "57220978",
            "commentCount": null,
            "posterScreenName": "吴乐天",
            "title": null,
            "url": null,
            "publishDateStr": "2017-05-12T07:10:56",
            "publishDate": 1494573056,
            "likeCount": null,
            "content": "呸,一声,随便你涨,上面套牢多少",
            "shareCount": null,
            "imageUrls": null,
            "id": "364274469"
        },
        {
            "posterId": "235767550",
            "commentCount": null,
            "posterScreenName": "青色石",
            "title": null,
            "url": null,
            "publishDateStr": "2017-05-12T07:01:44",
            "publishDate": 1494572504,
            "likeCount": null,
            "content": "平安今天吃伟哥了",
            "shareCount": null,
            "imageUrls": null,
            "id": "364267326"
        },
        {
            "posterId": "226710536",
            "commentCount": null,
            "posterScreenName": "战后分析",
            "title": null,
            "url": null,
            "publishDateStr": "2017-05-12T06:59:52",
            "publishDate": 1494572392,
            "likeCount": null,
            "content": "今天表现不错",
            "shareCount": null,
            "imageUrls": null,
            "id": "364264002"
        },
        {
            "posterId": "97310040",
            "commentCount": null,
            "posterScreenName": "wumingji",
            "title": null,
            "url": null,
            "publishDateStr": "2017-05-12T06:56:31",
            "publishDate": 1494572191,
            "likeCount": null,
            "content": "看来890收盘",
            "shareCount": null,
            "imageUrls": null,
            "id": "364256469"
        },
        {
            "posterId": "278940828",
            "commentCount": null,
            "posterScreenName": "lulisui",
            "title": null,
            "url": null,
            "publishDateStr": "2017-05-12T06:56:26",
            "publishDate": 1494572186,
            "likeCount": null,
            "content": "收盘8.90无悬念",
            "shareCount": null,
            "imageUrls": null,
            "id": "364256214"
        },
        {
            "posterId": "55178885",
            "commentCount": null,
            "posterScreenName": "Tao2000000",
            "title": null,
            "url": null,
            "publishDateStr": "2017-05-12T06:55:04",
            "publishDate": 1494572104,
            "likeCount": null,
            "content": "大湾区利好万手抢单!抢抢抢!",
            "shareCount": null,
            "imageUrls": null,
            "id": "364252169"
        },
        {
            "posterId": "157781898",
            "commentCount": null,
            "posterScreenName": "AC米兰降级了",
            "title": null,
            "url": null,
            "publishDateStr": "2017-05-12T06:53:03",
            "publishDate": 1494571983,
            "likeCount": null,
            "content": "主力在展示肌肉,想怎么搞就怎么搞",
            "shareCount": null,
            "imageUrls": null,
            "id": "364246653"
        },
        {
            "posterId": "388661409",
            "commentCount": null,
            "posterScreenName": "mx_388661409",
            "title": null,
            "url": null,
            "publishDateStr": "2017-05-12T06:52:29",
            "publishDate": 1494571949,
            "likeCount": null,
            "content": "明天一定冲高回落就是我猜的然后再创反弹新高哈哈",
            "shareCount": null,
            "imageUrls": null,
            "id": "364245033"
        },
        {
            "posterId": "388661409",
            "commentCount": null,
            "posterScreenName": "mx_388661409",
            "title": null,
            "url": null,
            "publishDateStr": "2017-05-12T06:52:28",
            "publishDate": 1494571948,
            "likeCount": null,
            "content": "明天一定冲高回落就是我猜的然后再创反弹新高哈哈",
            "shareCount": null,
            "imageUrls": null,
            "id": "364244993"
        },
        {
            "posterId": "157781898",
            "commentCount": null,
            "posterScreenName": "AC米兰降级了",
            "title": null,
            "url": null,
            "publishDateStr": "2017-05-12T06:42:01",
            "publishDate": 1494571321,
            "likeCount": null,
            "content": "再来个万手哥,收到8.9",
            "shareCount": null,
            "imageUrls": null,
            "id": "364219898"
        },
        {
            "posterId": "265849683",
            "commentCount": null,
            "posterScreenName": "一弱势散户",
            "title": null,
            "url": null,
            "publishDateStr": "2017-05-12T06:37:40",
            "publishDate": 1494571060,
            "likeCount": null,
            "content": "拉屁的大盘",
            "shareCount": null,
            "imageUrls": null,
            "id": "364210278"
        },
        {
            "posterId": "129540923",
            "commentCount": null,
            "posterScreenName": "妞多多",
            "title": null,
            "url": null,
            "publishDateStr": "2017-05-12T06:36:23",
            "publishDate": 1494570983,
            "likeCount": null,
            "content": "啦央企阿啊",
            "shareCount": null,
            "imageUrls": null,
            "id": "364207255"
        },
        {
            "posterId": "356856925",
            "commentCount": null,
            "posterScreenName": "大海46S",
            "title": null,
            "url": null,
            "publishDateStr": "2017-05-12T06:35:01",
            "publishDate": 1494570901,
            "likeCount": null,
            "content": "平哥!涨回8.88元",
            "shareCount": null,
            "imageUrls": null,
            "id": "364203533"
        },
        {
            "posterId": "370808391",
            "commentCount": null,
            "posterScreenName": "壮志凌云WOU",
            "title": null,
            "url": null,
            "publishDateStr": "2017-05-12T06:34:56",
            "publishDate": 1494570896,
            "likeCount": null,
            "content": "大盘跳水了,快点卖,8.80收盘,还有26分钟,请开始你的表演",
            "shareCount": null,
            "imageUrls": null,
            "id": "364203272"
        },
        {
            "posterId": "210332472",
            "commentCount": null,
            "posterScreenName": "开心大牛市",
            "title": null,
            "url": null,
            "publishDateStr": "2017-05-12T06:28:00",
            "publishDate": 1494570480,
            "likeCount": null,
            "content": "今天破9。",
            "shareCount": null,
            "imageUrls": null,
            "id": "364183397"
        },
        {
            "posterId": "234325545",
            "commentCount": null,
            "posterScreenName": "麦C子龙",
            "title": null,
            "url": null,
            "publishDateStr": "2017-05-12T06:26:30",
            "publishDate": 1494570390,
            "likeCount": null,
            "content": "上面的鸭蛋速度缴械投降",
            "shareCount": null,
            "imageUrls": null,
            "id": "364179961"
        },
        {
            "posterId": "129540923",
            "commentCount": null,
            "posterScreenName": "妞多多",
            "title": null,
            "url": null,
            "publishDateStr": "2017-05-12T06:25:09",
            "publishDate": 1494570309,
            "likeCount": null,
            "content": "不会拉央企改革开放",
            "shareCount": null,
            "imageUrls": null,
            "id": "364177077"
        },
        {
            "posterId": "57220978",
            "commentCount": null,
            "posterScreenName": "吴乐天",
            "title": null,
            "url": null,
            "publishDateStr": "2017-05-12T06:16:58",
            "publishDate": 1494569818,
            "likeCount": null,
            "content": "出货,去炒新股苏垦农发,",
            "shareCount": null,
            "imageUrls": null,
            "id": "364159452"
        }
    ]
}

Detailed Data

No Details

Error code

Error Return Value Format : JSON

{

message:"API rate limit exceeded",

retcode:100703

}
Error Code Error Message Detailed Description
100000 Server internal error 服务器内部错误
100001 Network error 网络错误
100002 Search no result 目标参数搜索没结果
100004 Target server error 目标服务器错误
100005 Param error 用户输入参数错误
100301 Account not found 用户帐号不存在
100700 Invalid authentication credentials 授权失败
100701 API stopped 您的当前API已停用
100702 Account stopped 您的账户已停用
100703 API rate limit exceeded 并发已达上限
100704 API maintenance API维护中
100705 API not found with these values API不存在
100706 Please add api first 请先添加api
100707 Number of calls exceeded 调用次数超限
100802 Missing url param 'time' or uri path is not equal to 2 请求路径错误或者缺少"time"参数
100803 Wrong pageToken 参数pageToken有误

Often With The Purchase Of Data