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 time = 2; string interval = 3; // 周期 double open = 4; double high = 5; double low = 6; double close = 7; double vol = 8; // 交易量 double 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; }