2025-08-04 01:55:56 +00:00
|
|
|
|
syntax = "proto3";
|
|
|
|
|
package blockchain;
|
|
|
|
|
|
|
|
|
|
option go_package = "code.30cm.net/digimon/app-cloudep-blockchain";
|
|
|
|
|
|
|
|
|
|
// OKResp
|
|
|
|
|
message OKResp {}
|
|
|
|
|
// NoneReq
|
|
|
|
|
message NoneReq {}
|
|
|
|
|
|
2025-08-04 14:02:01 +00:00
|
|
|
|
// 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; // 報價資產顯示的小數位數
|
|
|
|
|
}
|
|
|
|
|
|
2025-08-14 23:41:29 +00:00
|
|
|
|
message HistoryReq {
|
|
|
|
|
string symbol = 1; // 交易對名稱 (BTCUSDT)
|
|
|
|
|
string interval =2; // 4h 1m 1d ...
|
|
|
|
|
string start_time=3;
|
|
|
|
|
string end_time=4;
|
|
|
|
|
}
|
|
|
|
|
|
2025-08-20 09:34:27 +00:00
|
|
|
|
message ListCandleDataResp {
|
2025-08-23 13:25:09 +00:00
|
|
|
|
repeated Kline data=1;
|
|
|
|
|
}
|
2025-08-20 09:34:27 +00:00
|
|
|
|
|
2025-08-23 13:25:09 +00:00
|
|
|
|
// 單根 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
|
2025-08-20 09:34:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
2025-08-23 13:25:09 +00:00
|
|
|
|
|
2025-08-04 01:55:56 +00:00
|
|
|
|
service BlockchainService{
|
2025-08-04 14:02:01 +00:00
|
|
|
|
// ListSymbols retrieves all available trading symbols.
|
|
|
|
|
rpc ListSymbols(ListSymbolsRequest) returns(ListSymbolsResponse);
|
2025-08-14 23:41:29 +00:00
|
|
|
|
rpc GetHistoryKlineData(HistoryReq)returns(OKResp);
|
2025-08-20 09:34:27 +00:00
|
|
|
|
rpc ListCandleData(HistoryReq)returns(ListCandleDataResp);
|
2025-08-04 14:02:01 +00:00
|
|
|
|
// Ping is a health-check endpoint.
|
2025-08-04 01:55:56 +00:00
|
|
|
|
rpc Ping(NoneReq) returns(OKResp);
|
2025-08-04 14:02:01 +00:00
|
|
|
|
}
|