Git Product home page Git Product logo

ctp's Introduction

CTP(综合交易平台)

###v2.1.0

  1. 增加资金流向

接口定义

抓取新浪财经股票数据 实时行情

比如我们可以通过浏览器访问:

http://hq.sinajs.cn/?format=text&list=sh601688

来获取证券代码为 sh601688 的实时行情数据,可以看到内容为:

var hq_str_sh601688="华泰证券,20.280,20.250,20.340,20.400,20.200,20.320,20.340,5737081,116441306.000,1200,20.320,4900,20.310,44300,20.300,30200,20.290,18900,20.280,2300,20.340,24200,20.350,31900,20.360,50800,20.370,27800,20.380,2016-11-22,09:48:11,00"; 1 其中各个数字(按顺序依次)的含义为:

0: "华泰证券": 股票名字 1: "20.280": 今日开盘价 2: "20.250": 昨日收盘价 3: "20.340": 当前价格 4: "20.400": 今日最高价 5: "20.200": 今日最低价 6: "20.320": 竞买价,即“买一”报价 7: "20.340": 竞卖价,即“卖一”报价 8: "5737081": 成交的股票数(单位为“个”) 9: "116441306.000": 成交金额(单位为“元”) 10: "1200": “买一”申请 1200 股 11: "20.320": “买一”报价 12: "4900": “买二”申请 4900 股 13: "20.310": “买二”报价(以下依次类推) 14: "44300": 买三 15: "20.300": 买三 16: "30200": 买四 17: "20.290": 买四 18: "18900": 买五 19: "20.280": 买五 (20,21), (22,23), (24,25), (26,27), (28,29): 卖一,……,卖五 30: "2016-11-22": 日期 31: "09:48:11": 时间 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 如果要同时查询多个股票,可以这么使用 URL:

http://hq.sinajs.cn/list=sh601688,sh601003,sh601001

如要查询大盘指数,则 URL 格式稍有不同。例如查询上证综指(000001),使用如下 URL:

http://hq.sinajs.cn/list=s_sh000001

浏览器显示内容为:

var hq_str_s_sh000001="上证指数,3227.6750,9.5273,0.30,847582,9803179"; 1 数据含义分别表示:指数名称、当前点数、当前价格、涨跌率、成交量(手)、成交额(万元)。

查询深指的 URL 为:

http://hq.sinajs.cn/list=s_sz399001

查询某支股票的资金流数据可以访问: http://vip.stock.finance.sina.com.cn/quotes_service/api/json_v2.php/MoneyFlow.ssi_ssfx_flzjtj?format=text&daima=sh601688

可以获取证券代码为 sh601688 的股票资金流数据:

({r0_in:"61067834.2900",r0_out:"66105567.1800",r0:"140062267.3500",r1_in:"44569099.6700",r1_out:"47081908.0000",r1:"95176567.6700",r2_in:"7799706.0000",r2_out:"6024523.7500",r2:"14493945.7500",r3_in:"674441.0000",r3_out:"572123.0000",r3:"1386664.0000",curr_capital:"544372",name:"华泰证券",trade:"20.3400",changeratio:"0.00444444",volume:"12367981.0000",turnover:"22.7197",r0x_ratio:"-77.5088",netamount:"-5673040.9700"}) 1 含义如下:

"r0_": 特大单 "r1_": 大单 "r2_": 中单 "r3_": 散单 "_in": 流入 "_out": 流出 "r0, r1, r2, r3": 成交量 1 2 3 4 5 6 7 查询资金排行可以访问: http://vip.stock.finance.sina.com.cn/quotes_service/api/json_v2.php/MoneyFlow.ssl_bkzj_ssggzj?page=1&num=20&sort=r0_net&bankuai=&shichang=

可以获取当日收盘各个股票的资金排行数据。url 中的参数含义为:

num: 查询股票的数量 r0_net: 按特大胆流入排名 bankuai: 版块 shichang: 市场 1 2 3 4 得到的数据如下:

[ {symbol:"sz002620",name:"瑞和股份",trade:"71.7500",changeratio:"0.099954",turnover:"1753.75",amount:"1179694462.0000",inamount:"934158388.5000",outamount:"695810.0000",netamount:"933462578.5000",ratioamount:"0.791275",r0_in:"874476882.0000",r0_out:"0.0000",r0_net:"874476882.0000",r3_in:"2823506.0000",r3_out:"0.0000",r3_net:"2823506.0000",r0_ratio:"0.741274",r3_ratio:"0.00239342",r0x_ratio:"82.3205"}, {symbol:"sz002207",name:"准油股份",trade:"25.0900",changeratio:"0.0999562",turnover:"2029.06",amount:"860907446.0000",inamount:"590209072.1000",outamount:"210807228.8600",netamount:"379401843.2400",ratioamount:"0.4407",r0_in:"449631877.8100",r0_out:"128708267.0900",r0_net:"320923610.7200",r3_in:"804558.2000",r3_out:"598861.0000",r3_net:"205697.2000",r0_ratio:"0.372774",r3_ratio:"0.000238931",r0x_ratio:"74.9897"},

...

{symbol:"sh600860",name:"京城股份",trade:"11.6500",changeratio:"0.100094",turnover:"385.312",amount:"138469356.0000",inamount:"115675611.7200",outamount:"15170140.1600",netamount:"100505471.5600",ratioamount:"0.725832",r0_in:"72320423.7000",r0_out:"2585692.0000",r0_net:"69734731.7000",r3_in:"1797223.0000",r3_out:"1027247.7200",r3_net:"769975.2800",r0_ratio:"0.503611",r3_ratio:"0.00556062",r0x_ratio:"78.7588"}] 1 2 3 4 5 6 7 历史行情

用浏览器访问:

http://market.finance.sina.com.cn/downxls.php?date=2016-07-08&symbol=sh600900

可以得到日期为 date=2016-07-08,代码为 symbol=sh600900 的股票的成交明细,数据为 xls 格式。时间一般为当天早上 09:30 到下午 15:00,平均 5 秒一个数据。

访问:

http://market.finance.sina.com.cn/pricehis.php?symbol=sh600900&startdate=2011-08-17&enddate=2011-08-19

可以获得代码为 symbol=sh600900 的股票在 startdate=2011-08-17 到 2011-08-19 之间的分价表(不同成交量的占比图)。

ctp's People

Contributors

mymmsc avatar

Forkers

ssjtt

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.