sedata

2.3.2 • Public • Published

sedata

NPM version npm download

For China market only for now.

Install

$ npm install sedata

Usage

ticks 從網上取得實時數據,速度取決於網絡狀況和數據源服務器.

去掉了js轉譯.

{forex, ticks,hists,histd,histdwm} = require 'sedata'

# from sina:

symbols = "900901,000002sz,600603sh,200429,159915"

#實時
ticks symbols, (obj)->
  {買,名稱,賣5} = obj.sz159915
  console.log('here:',買,名稱,賣5)

# 5,15,30,60,day,week
hists {symbol:'900951',type:'week'},(err,json)->
  console.log json

# forex
forex 'usdcnh', (data)->
  console.log data

# from 163.com:

# daily
date = new Date()
end = date.year * 1000 + date.hour * 100 + date.day
histd {symbol: '000001', start:20080801, end:end}, (data)->
  console.log data

# daily, week, month, 分年度取
histdwm {market:'hs',symbol:'159915',year:'2016',type:'week'}, (err,json)->
  console.log json unless err?

See also example

Data Sources

新浪數據值得研究 重點在chrome中看network/XHR http://vip.stock.finance.sina.com.cn/mkt/#stock_hs_amount http://vip.stock.finance.sina.com.cn/quotes_service/api/json_v2.php/Market_Center.getHQNodes

https://github.com/HarrisonXi/AStock/blob/master/%E5%8E%86%E5%8F%B2%E6%95%B0%E6%8D%AEAPI.md

http://blog.sina.com.cn/s/blog_7ed3ed3d0101gphj.html http://www.wstock.net/wstock/5min.htm

todos

other markets

美股實時行情 可通過 http://finance.sina.com.cn/stock/usstock/sector.shtml 分析其數據來源 例如,etf行情來自: http://stock.finance.sina.com.cn/usstock/api/jsonp.php/IO.XSRV2.CallbackList['xBc3GjMw7U61Mn1c']/US_DataCenterService.getInstrType?page=1&num=20&sort=pe&asc=0&market=&id=&instr_type=3 然後再去查找歷史行情數據源

other resources

https://computeraidedfinance.com/2012/05/02/comprehensive-list-of-free-historical-market-data-sources/

Redo request

when request for data failed after hitting a time out. Well, npm has some packages for this: SOLVED using requestretry.

https://github.com/geoffreak/request-enhanced https://github.com/FGRibreau/node-request-retry https://www.npmjs.com/package/retry-request https://www.npmjs.com/package/then-request

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i sedata

Weekly Downloads

1

Version

2.3.2

License

MIT

Last publish

Collaborators

  • emptist