qmt编程之获取对应周期的北向南向数据
qmt更加详细的教程方法,会持续慢慢梳理。
也可找寻博主的历史文章,搜索关键词查看解决方案 !
感谢关注,咨询免费开通量化回测与获取实盘权限,欢迎和博主联系!
获取对应周期的北向南向数据
提示
- 该数据通过
get_market_data_ex
接口获取 - 获取历史数据前需要先用
download_history_data
下载历史数据,可选字段为"northfinancechange1m"
:一分钟周期北向数据,"northfinancechange1d"
:日线周期北向数据 - VIP权限数据
#方式1:内置python
获取对应周期的北向数据
内置python
C.get_north_finance_change(period)
参数:
字段名 | 数据类型 | 描述 |
---|---|---|
period | str | 数据周期 |
返回结果:
- 根据
period
返回一个dict
,该字典的key
值是北向数据的时间戳,其值仍然是一个dict
,其值的key
值是北向数据的字段类型,其值是对应字段的值。该字典数据key
值有:
字段名 | 数据类型 | 描述 |
---|---|---|
hgtNorthBuyMoney | int | HGT北向买入资金 |
hgtNorthSellMoney | int | HGT北向卖出资金 |
hgtSouthBuyMoney | int | HGT南向买入资金 |
hgtSouthSellMoney | int | HGT南向卖出资金 |
sgtNorthBuyMoney | int | SGT北向买入资金 |
sgtNorthSellMoney | int | SGT北向卖出资金 |
sgtSouthBuyMoney | int | SGT南向买入资金 |
sgtSouthSellMoney | int | SGT南向卖出资金 |
hgtNorthNetInFlow | int | HGT北向资金净流入 |
hgtNorthBalanceByDay | int | HGT北向当日资金余额 |
hgtSouthNetInFlow | int | HGT南向资金净流入 |
hgtSouthBalanceByDay | int | HGT南向当日资金余额 |
sgtNorthNetInFlow | int | SGT北向资金净流入 |
sgtNorthBalanceByDay | int | SGT北向当日资金余额 |
sgtSouthNetInFlow | int | SGT南向资金净流入 |
sgtSouthBalanceByDay | int | SGT南向当日资金余额 |
示例1 通过内置python获取:
示例
# coding = gbk
def init(C):
return
# 获取市场北向数据
def handlebar(C):
print(C.get_north_finance_change('1d'))
返回值
{1416153600000: {"hgtNorthBuyMoney": 120820000, "hgtNorthSellMoney": 0,
"hgtSouthBuyMoney": 1772000000, "hgtSouthSellMoney": 84000000,
"sgtNorthBuyMoney": 0, "sgtNorthSellMoney": 0, "sgtSouthBuyMoney": 0,
"sgtSouthSellMoney": 0, "hgtNorthNetInFlow": 13000000000, "hgtNorthBalanceByDay": 0,
"hgtSouthNetInFlow": 1768000000, "hgtSouthBalanceByDay": 8732000000,
"sgtNorthNetInFlow": 0, "sgtNorthBalanceByDay": 0, "sgtSouthNetInFlow": 0, "sgtSouthBalanceByDay": 0}}