You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
68 lines
1.9 KiB
68 lines
1.9 KiB
syntax = "proto3"; |
|
|
|
import "api/pub.proto"; |
|
|
|
option go_package = "./pb"; |
|
|
|
// 订阅/查询/存储,交易所k线图/热度/深度等基础数据指标 |
|
service ExchangeService { |
|
// 订阅实时K线 |
|
rpc SubscribeKline(stream ReqStreamSubscribeKline) returns (stream RspStreamSubscribeKline); |
|
|
|
// 获取支持的交易所列表 |
|
rpc Exchanges(ReqExchanges) returns (RspExchanges); |
|
|
|
// 获取交易所交易产品状态 |
|
rpc ExchangeInstanceState(ReqExchangeInstanceState) returns (RspExchangeInstanceState); |
|
|
|
// 查询历史k线 |
|
rpc HistoryKline(ReqHistoryKline) returns (RspHistoryKline); |
|
} |
|
|
|
message ReqStreamSubscribeKline { |
|
SubscribeType subType = 1; |
|
repeated ExchangeType exchanges = 2; // 交易所 |
|
repeated string instIds = 3; |
|
repeated string intervals = 4; |
|
bool onlyConfirm = 5; // 只要confirm的k线 |
|
} |
|
message RspStreamSubscribeKline { StreamKline kline = 1; } |
|
|
|
message StreamKline { |
|
repeated Kline klines = 2; |
|
ExchangeType exchange = 3; // 交易所 |
|
string instId = 4; // 交易产品id |
|
int64 streamId = 5; // subscribe stream id |
|
} |
|
|
|
message ReqExchanges { |
|
} |
|
message RspExchanges { |
|
repeated ExchangeType exchanges = 1; |
|
} |
|
|
|
message ReqExchangeInstanceState { |
|
repeated string insts = 1; |
|
bool allExchange = 2; |
|
repeated ExchangeType exchanges = 3; // 交易所 |
|
} |
|
message RspExchangeInstanceState { |
|
repeated TradeInstanceState instsState = 1; // 交易产品列表 |
|
} |
|
|
|
message ReqHistoryKline { |
|
ExchangeType exchange = 1; // 交易所 |
|
string instId = 2; |
|
string interval = 3; |
|
uint64 before = 4; |
|
uint64 after = 5; |
|
uint32 count = 6; // k线条数,before或after其中一个为0时有效 |
|
bool open = 7; // 是否开区间, 不包含 before/after |
|
bool live = 8; // 实时k线, before和after为0时是否追加实时k线 |
|
} |
|
message RspHistoryKline { |
|
ExchangeType exchange = 1; // 交易所 |
|
string instId = 2; |
|
string interval = 3; |
|
repeated Kline klines = 9; |
|
}
|
|
|