参考了雪球网的 API 设计
GET /quotes?symbol=BIDU&type=current (A股symbol为 SH600001 SZ300104 等)
{
"symbol":"BIDU",
"exchange":"NASDAQ",
"code":"BIDU",
"name":"百度",
"current":"189.03", // 当前价格
"percentage":"-4.06",
"change":"-8.000",
"open":"193.0", // 今开(未开盘则为上一交易日开盘价,下同)
"high":"194.07",
"low":"188.02",
"close":"189.03",
"lastClose":"197.03", // 昨收
"volume":"4576579.0",
"marketCapital":"6.61491638709E10",
"pe_ttm":"31.4526",
"pe_lyr":"39.2532",
"time":"Mon Jul 06 16:49:54 -0400 2015",
"updateAt":"1436212176247",
"turnoverRate":"1.25", // 换手率
"currency":"USD",
"netAssets":"25.01", // 每股净资产
"status":"normal", // 状态:normal/delisting/suspension
}
period=1day 时,返回当日 按1分钟聚合数据
GET /quotes?symbol=BIDU&type=close&period=1day
[
{"volume":0.0,"current":193.98,"time":"Mon Jul 06 09:30:00 -0400 2015"},
{"volume":1986.0,"current":193.98,"time":"Mon Jul 06 09:31:00 -0400 2015"},
{"volume":108246.0,"current":193.6,"time":"Mon Jul 06 09:32:00 -0400 2015"},
...
]
period=5day 时,返回5日 按10分钟聚合数据
GET /quotes?symbol=BIDU&type=close&period=5day
[
{"volume":0.0,"current":198.9,"time":"Mon Jun 29 09:30:00 -0400 2015"},
{"volume":227031.0,"current":201.16,"time":"Mon Jun 29 09:40:00 -0400 2015"},
{"volume":165116.0,"current":202.32,"time":"Mon Jun 29 09:50:00 -0400 2015"},
...
]
依次类推,period其他值时,返回相应的聚合数据:
period取值 | 聚合周期 |
---|---|
1day | 1分钟 |
5day | 10分钟 |
6month | 1交易日 |
all | 3交易日 |
agg=1day 表示句聚合周期为一天,可选值(1day, 1week, 1month)
GET /quotes?symbol=SH000001&agg=1day&type=ohlc&start=moment-string&end=moment-string
[
{
date: "2014-09-02T00:00:00.000Z",
open: 2239.684,
close: 2266.046,
high: 2267.509,
low: 2234.378,
volume: 192124869
},
{
date: "2014-09-03T00:00:00.000Z",
open: 2268.395,
close: 2288.627,
high: 2290.547,
low: 2268.1,
volume: 212478998,
},
...
]