syntax = "proto2";
package Qot_GetValuationPlateStockList;
option java_package = "com.futu.openapi.pb";
option go_package = "github.com/futuopen/ftapi4go/pb/qotgetvaluationplatestocklist";

import "Qot_Common.proto";

// 指数所属板块条目
message PlateItem
{
	optional Qot_Common.Security security = 1;  // 股票
	optional string name                  = 2;  // 板块名称
}

// 成分股估值条目（板块成分股 / 指数成分股 共用）
message StockItem
{
	optional Qot_Common.Security security = 1;    // 股票
	optional string name                  = 6;    // 股票名称
	optional double valuationVal          = 2;    // 估值
	optional double forwardValue          = 3;    // 预测估值，当前仅支持 PE 和 PS
	optional double valuationPercentile   = 4;    // 估值历史分位，百分号前的值，如 12.34 表示 12.34%
	optional double marketCap             = 5;    // 市值
}

message C2S
{
	required Qot_Common.Security security       = 1;  // 股票
	optional Qot_Common.ValuationType valuationType        = 2;  // 估值类型，详见 Qot_Common.ValuationType 定义，支持 1-3，默认 1(PE)
	optional string nextKey                     = 3;  // 分页标识，首次不填，续拉时填上次返回的 nextKey；"-1" 表示无更多数据
	optional int32 num                          = 4;  // 每页返回数量，默认 10，范围 1~50
	optional Qot_Common.SortType sortType        = 5;  // 排序方向，详见 Qot_Common.SortType 定义，默认升序（SortType_Asc=2）
	optional Qot_Common.SortField sortId = 6; // 排序列，详见 Qot_Common.SortField，51=市值（默认）52=估值 53=预测估值 54=历史分位
	optional Qot_Common.Security filterSecurity = 7;  // 板块:仅指数成分股估值有效,按板块筛选成分股，不传则不筛选
}

message S2C
{
	optional int32 count                       = 1;  // 成分股总数
	repeated StockItem stockList               = 2;  // 成分股估值列表（标的为板块时走板块成分股估值；标的为指数时走指数成分股估值）
	optional string nextKey                    = 3;  // 分页标识，"-1" 表示无更多数据
	repeated PlateItem plateList               = 4;  // 指数成分股所属行业/板块列表；仅在指数全部板块首次请求时返回
}

message Request
{
	required C2S c2s = 1;
}

message Response
{
	required int32  retType = 1 [default = -400]; // RetType，返回结果
	optional string retMsg  = 2;
	optional int32  errCode = 3;
	optional S2C s2c = 4;
}
