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.
135 lines
2.5 KiB
135 lines
2.5 KiB
syntax = "proto3"; |
|
|
|
option go_package = "./pb"; |
|
|
|
enum SubscribeType { |
|
Subscribe = 0; |
|
Unsubscribe = 1; |
|
UnsubscribeAll = 2; |
|
} |
|
|
|
enum ExchangeType { |
|
SIG = 0; |
|
OKX = 1; |
|
BINANCE = 2; |
|
} |
|
|
|
enum TradeInstanceType { |
|
Unknow = 0; |
|
Spot = 1; // 1现货 |
|
PerpetualContract = 2; // 2永续合约 |
|
} |
|
|
|
enum Event { |
|
UNKNOWN = 0; |
|
SUBSCRIBED = 1; |
|
UNSUBSCRIBED = 2; |
|
SNAPSHOT = 3; |
|
UPDATE = 4; |
|
AUTHENTICATED = 5; |
|
ERROR = 99; |
|
} |
|
|
|
enum Channel { |
|
BOOK = 0; |
|
TRADE = 1; |
|
TICKER = 2; |
|
KLINE = 3; |
|
BALANCE = 4; |
|
ORDER = 5; |
|
} |
|
|
|
enum Side { |
|
SELL = 0; |
|
BUY = 1; |
|
} |
|
|
|
enum OrderType { |
|
MARKET = 0; |
|
LIMIT = 1; |
|
STOP_MARKET = 2; |
|
STOP_LIMIT = 3; |
|
POST_ONLY = 4; |
|
IOC_LIMIT = 5; |
|
} |
|
|
|
message Error { |
|
int64 error_code = 1; |
|
string error_message = 2; |
|
} |
|
|
|
// 交易产品基础信息 |
|
message TradeInstance { |
|
string instId = 1; |
|
string instPair = 2; |
|
string instCoin = 3; |
|
TradeInstanceType instType = 4; |
|
int32 status = 5; |
|
int32 priceSz = 6; |
|
int32 quantitySz = 7; |
|
string icon = 8; |
|
string updateBy = 9; |
|
int64 updateTime = 10; |
|
repeated int32 leverages = 11; |
|
repeated TradeInstanceExchange exchanges = 15; // 交易产品支持的交易所 |
|
} |
|
|
|
// 交易所交易产品 |
|
message TradeInstanceExchange { |
|
string exchangeInstId = 1; |
|
string instId = 2; |
|
int32 status = 3; |
|
ExchangeType exchange = 4; |
|
string updateBy = 5; |
|
int64 updateTime = 6; |
|
} |
|
|
|
// 交易所交易产品基础信息 |
|
message MarketTradeInstance { |
|
ExchangeType exchange = 1; |
|
string instId = 2; |
|
string exchangeInstId = 3; |
|
TradeInstanceType instType = 4; |
|
string instCoin = 5; |
|
int32 status = 6; |
|
int32 priceSz = 9; |
|
int32 quantitySz = 10; |
|
repeated int32 leverages = 11; |
|
} |
|
|
|
// 交易所交易产品状态 |
|
message TradeInstanceState { |
|
ExchangeType exchange = 1; |
|
string instId = 2; |
|
int32 status = 3; |
|
string last = 4; // 最后成交价格 |
|
} |
|
|
|
message Kline { |
|
int64 ts = 2; |
|
string interval = 3; // 周期 |
|
string open = 4; |
|
string high = 5; |
|
string low = 6; |
|
string close = 7; |
|
string vol = 8; // 交易量 |
|
string volQuote = 9; // 交易额 |
|
bool confirm = 10; // k线是否完结 |
|
} |
|
|
|
// https://maicoin.github.io/max-websocket-docs/#/private_channels?id=snapshot |
|
message Order { |
|
ExchangeType exchange = 1; |
|
string symbol = 2; |
|
string id = 3; |
|
Side side = 4; |
|
OrderType order_type = 5; |
|
string price = 6; |
|
string stop_price = 7; |
|
string status = 9; |
|
string quantity = 11; |
|
string executed_quantity = 12; |
|
string client_order_id = 14; |
|
int64 group_id = 15; |
|
int64 created_at = 10; |
|
}
|
|
|