syntax = "proto2";
package Qot_GetTopMoversRank;
option java_package = "com.futu.openapi.pb";
option go_package = "github.com/futuopen/ftapi4go/pb/qotgettopmoverrank";

import "Qot_Common.proto";
import "Qot_OptionCommon.proto";

// 排序方向
enum SortDir {
    SortDir_Descending = 0;     // 降序(领涨,默认)
    SortDir_Ascending = 1;      // 升序(领跌)
}

// 筛选条件类型
enum IndicatorType {
    IndicatorType_Unknown = 0;
    IndicatorType_Price = 1;           // 价格筛选(枚举, 参考PriceFilter)
    IndicatorType_MarketCap = 2;       // 市值区间
    IndicatorType_PE = 3;              // 市盈率区间
}

// 价格筛选枚举
enum PriceFilter {
    PriceFilter_All = 0;              // 所有(默认)
    PriceFilter_LessThan1 = 1;        // 小于1
    PriceFilter_Between1And10 = 2;    // 1~10之间
    PriceFilter_Between10And100 = 3;  // 10~100之间
    PriceFilter_GreaterThan100 = 4;   // 大于100
    PriceFilter_Near52WeekHigh = 5;   // 接近52周最高
    PriceFilter_Near52WeekLow = 6;    // 接近52周最低
}

// 筛选条件
message Indicator {
    required int32 indicatorType = 1;                       // IndicatorType
    optional Qot_OptionCommon.Interval indicatorValue = 2;  // 筛选区间(MarketCap/PE使用)
    optional int32 priceFilter = 3;                         // PriceFilter, 价格筛选枚举(IndicatorType_Price时使用)
}

message C2S {
    required int32 market = 1;             // Qot_Common.QotMarket (HK=1, US=11)
    optional int32 sortDir = 2;            // SortDir, 排序方向, 默认降序(领涨)
    optional int32 offset = 3;             // 起始位置, 默认0
    optional int32 count = 4;              // 返回数量 [1,200], 默认50
    repeated Indicator filterList = 5;     // 筛选条件(AND关系)
}

// 盘中领涨/领跌数据项
message TopMoversRankItem {
    required Qot_Common.Security security = 1;  // 股票
    optional string name = 2;                    // 名称

    optional double curPrice = 10;             // 最新价
    optional double changeRatio = 11;          // 涨跌幅(%)
    optional double changeAmount = 12;         // 涨跌额
    optional double turnover = 13;             // 成交额
    optional int64 volume = 14;                // 成交量
    optional double turnoverRatio = 15;        // 换手率(%)
    optional double peTTM = 16;                // 市盈率TTM
    optional double amplitude = 17;            // 振幅(%)
    optional double marketCap = 18;            // 市值
    optional double volumeRatio = 19;          // 量比
}

message S2C {
    repeated TopMoversRankItem dataList = 1;    // 数据列表
    optional int32 allCount = 2;                // 符合条件的总数据量
}

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;
}
