66 lines
2.3 KiB
Protocol Buffer
66 lines
2.3 KiB
Protocol Buffer
syntax = "proto3";
|
||
package blockchain;
|
||
|
||
option go_package = "code.30cm.net/digimon/app-cloudep-blockchain";
|
||
|
||
// OKResp
|
||
message OKResp {}
|
||
// NoneReq
|
||
message NoneReq {}
|
||
|
||
// ListSymbolsRequest is the request for the ListSymbols RPC.
|
||
// It is currently empty but can be extended with filtering or pagination fields in the future.
|
||
message ListSymbolsRequest {}
|
||
|
||
// ListSymbolsResponse contains a list of symbols.
|
||
message ListSymbolsResponse {
|
||
repeated Symbol symbols = 1;
|
||
}
|
||
// Symbol represents information about a trading pair.
|
||
message Symbol {
|
||
string symbol = 1; // 交易對名稱 (BTCUSDT)
|
||
string status = 2; // 狀態(如 "TRADING" 表示可交易)
|
||
string base_asset = 3; // 主幣種(如 BTCUSDT 的 BTC)
|
||
int32 base_asset_precision = 4; // 主幣的小數點精度
|
||
string quote_asset = 5; // 報價幣種(如 BTCUSDT 的 USDT)
|
||
int32 quote_asset_precision = 6; // 報價資產顯示的小數位數
|
||
}
|
||
|
||
message HistoryReq {
|
||
string symbol = 1; // 交易對名稱 (BTCUSDT)
|
||
string interval =2; // 4h 1m 1d ...
|
||
string start_time=3;
|
||
string end_time=4;
|
||
}
|
||
|
||
message ListCandleDataResp {
|
||
repeated Kline data=1;
|
||
}
|
||
|
||
// 單根 K 線
|
||
message Kline {
|
||
int64 open_time = 1; // 開盤時間(毫秒)
|
||
string open = 2; // 開盤價
|
||
string high = 3; // 最高價
|
||
string low = 4; // 最低價
|
||
string close = 5; // 收盤價
|
||
string volume = 6; // 成交量
|
||
int64 close_time = 7; // 收盤時間(毫秒)
|
||
string quote_asset_volume = 8; // 成交額(以報價資產計)
|
||
int32 number_of_trades = 9; // 交易筆數
|
||
string taker_buy_base_asset_volume = 10; // 主動買入成交量
|
||
string taker_buy_quote_asset_volume = 11; // 主動買入成交額
|
||
string symbol = 12; // 交易對 (partition key)
|
||
string interval = 13; // K 線區間 (partition key) e.g. 1d, 4h, 15m
|
||
}
|
||
|
||
|
||
service BlockchainService{
|
||
// ListSymbols retrieves all available trading symbols.
|
||
rpc ListSymbols(ListSymbolsRequest) returns(ListSymbolsResponse);
|
||
rpc GetHistoryKlineData(HistoryReq)returns(OKResp);
|
||
rpc ListCandleData(HistoryReq)returns(ListCandleDataResp);
|
||
// Ping is a health-check endpoint.
|
||
rpc Ping(NoneReq) returns(OKResp);
|
||
}
|