get_snapshot - 取行情快照

get_snapshot 是 PTrade 中用于取行情快照的接口。

提示

  • live-or-trading-module-only

原型

get_snapshot(security)

释义

get_snapshot 是 PTrade 中用于取行情快照的接口。

研究:不支持;回测:不支持;模拟:官方目录未明确;实盘:支持。

参数

参数 是否必填 官方原始定义
security security

返回值

正常返回一个dict类型数据,包含每只股票代码的行情快照信息,其中key为股票代码,value为对应的快照信息。异常返回空dict,如{}(dict[str:dict[...]])

快照包含以下信息:

amount:持仓量(str:int)(期货字段,股票返回0);

bid_grp:委买档位(第一档包含委托队列(仅L2支持))(str:dict[int:list[float,int,int,{int:int,...}],int:list[float,int,int]...]);

business_amount:总成交量(str:int);

business_amount_in:内盘成交量(str:int);

business_amount_out:外盘成交量(str:int);

business_balance:总成交额(str:float);

business_count:成交笔数(str:int)

circulation_amount:流通股本(str:int);

current_amount:最近成交量(现手)(str:int);

down_px:跌停价格(str:float);

end_trade_date:最后交易日(str:str)

entrust_diff:委差(str:float);

entrust_rate:委比(str:float);

示例

当前官方章节未提供可独立抽取的示例代码。请根据函数签名和参数说明构造调用,并在对应运行环境验证。

详细说明

get_snapshot(security)

使用场景

该函数仅在交易模块可用

接口说明

该接口用于获取实时行情快照。

注意事项

证监会行业、聚源行业、概念板块、地域板块所对应标的的行情数据为非标准的交易所下发数据,是由数据源自行按照成分股分类规则进行计算的,存在与三方数据源不一致的情况。如用户需要在策略中使用,应自行评估该数据的合理性

参数详细说明

security: 单只股票代码或者多只股票代码组成的列表,必填字段(list[str]/str);

返回值

正常返回一个dict类型数据,包含每只股票代码的行情快照信息,其中key为股票代码,value为对应的快照信息。异常返回空dict,如{}(dict[str:dict[...]])

快照包含以下信息:

amount:持仓量(str:int)(期货字段,股票返回0);

bid_grp:委买档位(第一档包含委托队列(仅L2支持))(str:dict[int:list[float,int,int,{int:int,...}],int:list[float,int,int]...]);

business_amount:总成交量(str:int);

business_amount_in:内盘成交量(str:int);

business_amount_out:外盘成交量(str:int);

business_balance:总成交额(str:float);

business_count:成交笔数(str:int)

circulation_amount:流通股本(str:int);

current_amount:最近成交量(现手)(str:int);

down_px:跌停价格(str:float);

end_trade_date:最后交易日(str:str)

entrust_diff:委差(str:float);

entrust_rate:委比(str:float);

high_px:最高价(str:float);

hsTimeStamp:时间戳(str:float);

last_px:最新成交价(str:float);

low_px:最低价(str:float);

offer_grp:委卖档位(第一档包含委托队列(仅L2支持))(str:dict[int:list[float,int,int,{int:int,...}],int:list[float,int,int]...]);

open_px:今开盘价(str:float);

pb_rate:市净率(str:float);

pe_rate:动态市盈率(str:float);

preclose_px:昨收价(str:float);

prev_settlement:昨结算(str:float)(期货字段,股票返回0.0);

px_change_rate:涨跌幅(str:float);

settlement:结算价(str:float)(期货字段,股票返回0.0)

start_trade_date:首个交易日(str:float)

tick_size:最小报价单位(str:float)

total_bid_turnover:委买金额(str:int);

total_bidqty:委买量(str:int);

total_offer_turnover:委卖金额(str:int)

total_offerqty:委卖量(str:int);

trade_mins:交易分钟数(str:int)

trade_status:交易状态(str:str);

turnover_ratio:换手率(str:int);

up_px:涨停价格(str:float);

vol_ratio:量比(str:float);

wavg_px:加权平均价(str:float);

iopv:基金份额参考净值(str:float);

字段备注: