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.
112 lines
2.9 KiB
112 lines
2.9 KiB
syntax = "proto3"; |
|
|
|
import "google/protobuf/struct.proto"; |
|
import "api/pub.proto"; |
|
|
|
option go_package = "./pb"; |
|
|
|
// 交易系统服务 |
|
service TradingService { |
|
// 获取指标绘图属性 |
|
rpc IndicatorPlots(ReqIndicatorPlots) returns (RspIndicatorPlots); |
|
|
|
// 获取指标序列 |
|
rpc IndicatorSeries(ReqIndicatorSeries) returns (RspIndicatorSeries); |
|
|
|
// 获取指标序列 |
|
rpc StrategySeries(ReqStrategySeries) returns (RspStrategySeries); |
|
|
|
// 交易计划回测 |
|
rpc Backtest(ReqBacktest) returns (RspBacktest); |
|
|
|
// 交易计划参数调试回测 |
|
rpc BacktestRace(ReqBacktestRace) returns (RspBacktestRace); |
|
|
|
// 交易计划回测记录(进行中) |
|
rpc BacktestLog(ReqBacktestLog) returns (RspBacktestLog); |
|
} |
|
|
|
message ReqIndicatorPlots { |
|
repeated string indicators = 1; |
|
} |
|
message RspIndicatorPlots{ |
|
repeated IndicatorPlot plots = 1; |
|
} |
|
|
|
message ReqIndicatorSeries { |
|
string indicator = 1; |
|
int32 digit = 2; // 结果小数位数 |
|
SeriesRange series = 9; |
|
google.protobuf.Struct input = 10; // 指标参数 |
|
} |
|
message RspIndicatorSeries { |
|
repeated double matrix = 1; |
|
repeated int64 times = 2; |
|
repeated IndicatorState states = 3; |
|
} |
|
message IndicatorState { |
|
string state = 1; |
|
repeated double matrix = 2; |
|
} |
|
|
|
message ReqStrategySeries { |
|
SeriesRange series = 1; |
|
string sig_strategy = 2; |
|
google.protobuf.Struct input = 3; // 指标参数 |
|
} |
|
message RspStrategySeries { |
|
repeated Side signal = 1; // 0.sell,1.buy |
|
repeated int64 times = 2; |
|
} |
|
|
|
message ReqBacktest { |
|
int64 plan_id = 1; |
|
string stime = 2; |
|
string etime = 3; |
|
} |
|
message RspBacktest { |
|
int64 backtest_id = 1; |
|
} |
|
|
|
message BacktestLog { |
|
int64 backtest_id = 1; |
|
int64 plan_id = 2; |
|
int64 stime = 3; |
|
int64 etime = 4; |
|
string interval = 5; // 交易周期 |
|
} |
|
message ReqBacktestLog { |
|
Paging paging = 1; |
|
} |
|
message RspBacktestLog { |
|
repeated BacktestLog logs = 1; |
|
} |
|
|
|
message ReqBacktestRace { |
|
int64 plan_id = 1; // 交易计划 |
|
repeated InputRange series_input_range = 5; // 运行参数 |
|
repeated InputRange sig_input_range = 6; // 信号策略参数 |
|
repeated InputRange close_input_range = 7; // 平仓策略参数 |
|
repeated InputRange trade_input_range = 8; // 交易策略参数 |
|
repeated InputRange risk_input_range = 9; // 风控策略参数 |
|
} |
|
message RspBacktestRace { |
|
|
|
} |
|
|
|
// // 回测统计信息(line charts) |
|
// message ReqBacktestLogStats { |
|
// int64 plan_id = 1; |
|
// int64 backtest_id = 2; |
|
// } |
|
// message RspBacktestLogStats { |
|
// repeated int64 times = 1; // k线时间 |
|
// repeated double equitys = 2; // 平仓后账户净值 |
|
// repeated BacktestLogBuySellPoint buy_sell = 9; // 买卖点数据统计 charts data |
|
// } |
|
// // {time: 1763890200000, value: 86400, text: 'BUY:86400', direction: 'up'} |
|
// message BacktestLogBuySellPoint { |
|
// double value = 2; // k线收盘价 |
|
// Side side = 3; // 买卖方向 |
|
// string text = 4; // 买卖点描述 |
|
// }
|
|
|