| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285 |
- // JSON descriptor
- //提示词: 通过这个json 结构给我生成一个 protobufjs使用的 JSON descriptors
- //通用返回值结构。
- const common = {
- 'nested': {
- 'Response': {
- 'fields': {
- 'code': {
- 'type': 'int32',
- 'id': 1,
- },
- 'msg': {
- 'type': 'string',
- 'id': 2,
- },
- 'status': {
- 'type': 'string',
- 'id': 3,
- },
- 'ts': {
- 'type': 'int64',
- 'id': 4,
- },
- 'ch': {
- 'type': 'string',
- 'id': 5,
- },
- },
- },
- },
- }
- //market.v2.trade.recommend.pair
- const market_v2_trade_recommend_pair = {
- 'nested': {
- 'Response': { // 把 Response 放在最外层
- 'fields': {
- 'code': {
- 'type': 'int32',
- 'id': 1
- },
- 'msg': {
- 'type': 'string',
- 'id': 2
- },
- 'status': {
- 'type': 'string',
- 'id': 3
- },
- 'ts': {
- 'type': 'int64',
- 'id': 4
- },
- 'ch': {
- 'type': 'string',
- 'id': 5
- },
- 'recommendpair': {
- 'type': 'RecommendPair',
- 'id': 6
- }
- }
- },
- 'RecommendPair': { // 定义内部消息类型
- 'nested': { // 新增 nested 层
- 'TradePair': { // 把 TradePair 定义移到 RecommendPair 内部
- 'fields': {
- 'tradeId': {
- 'type': 'int64',
- 'id': 1
- },
- 'cny': {
- 'type': 'string',
- 'id': 2
- },
- 'totalamount': {
- 'type': 'string',
- 'id': 3
- },
- 'last': {
- 'type': 'string',
- 'id': 4
- },
- 'volume': {
- 'type': 'string',
- 'id': 5
- },
- 'change': {
- 'type': 'string',
- 'id': 6
- }
- }
- }
- },
- 'fields': {
- 'listList': {
- 'rule': 'repeated',
- 'type': 'TradePair',
- 'id': 1
- }
- }
- }
- }
- };
- const market_v2_trade_area_tickers = {
- 'nested': {
- 'TradeAreaPair': {
- 'fields': {
- 'listList': {
- 'rule': 'repeated',
- 'type': 'TradePair',
- 'id': 1,
- 'default': [], // 添加默认值
- },
- },
- },
- 'TradePair': {
- 'fields': {
- 'tradeid': {
- 'type': 'int64',
- 'id': 1,
- },
- 'cny': {
- 'type': 'double',
- 'id': 2,
- },
- 'buy': {
- 'type': 'double',
- 'id': 3,
- },
- 'lever': {
- 'type': 'int64',
- 'id': 4,
- },
- 'sell': {
- 'type': 'double',
- 'id': 5,
- },
- 'last': {
- 'type': 'double',
- 'id': 6,
- },
- 'volume': {
- 'type': 'double',
- 'id': 7,
- },
- 'change': {
- 'type': 'double',
- 'id': 8,
- },
- 'high': {
- 'type': 'double',
- 'id': 9,
- },
- 'low': {
- 'type': 'double',
- 'id': 10,
- },
- 'isopen': {
- 'type': 'int64',
- 'id': 11,
- },
- 'open': {
- 'type': 'int64',
- 'id': 12,
- },
- 'amount': {
- 'type': 'double',
- 'id': 13,
- },
- 'isfiatconvert': {
- 'type': 'bool',
- 'id': 14,
- },
- },
- },
- 'Response': {
- 'fields': {
- 'code': {
- 'type': 'int32',
- 'id': 1,
- },
- 'msg': {
- 'type': 'string',
- 'id': 2,
- },
- 'status': {
- 'type': 'string',
- 'id': 3,
- },
- 'ts': {
- 'type': 'int64',
- 'id': 4,
- },
- 'ch': {
- 'type': 'string',
- 'id': 5,
- },
- 'tradeareapair': {
- 'type': 'TradeAreaPair',
- 'id': 6,
- },
- },
- },
- },
- }
- const market_v2_trade_main_pair = {
- 'nested': {
- 'MainPair': {
- 'fields': {
- 'listList': {
- 'rule': 'repeated',
- 'type': 'Trade',
- 'id': 1,
- 'default': [], // 添加默认值
- },
- },
- },
- 'Trade': {
- 'fields': {
- 'tradeId': {
- 'type': 'int64',
- 'id': 1,
- },
- 'cny': {
- 'type': 'double',
- 'id': 2,
- },
- 'totalamount': {
- 'type': 'double',
- 'id': 3,
- },
- 'last': {
- 'type': 'double',
- 'id': 4,
- },
- 'volume': {
- 'type': 'double',
- 'id': 5,
- },
- 'change': {
- 'type': 'double',
- 'id': 6,
- },
- },
- },
- 'Response': {
- 'fields': {
- 'code': {
- 'type': 'int32',
- 'id': 1,
- },
- 'msg': {
- 'type': 'string',
- 'id': 2,
- },
- 'status': {
- 'type': 'string',
- 'id': 3,
- },
- 'ts': {
- 'type': 'int64',
- 'id': 4,
- },
- 'ch': {
- 'type': 'string',
- 'id': 5,
- },
- 'mainpair': {
- 'type': 'MainPair',
- 'id': 6,
- },
- },
- },
- },
- }
- module.exports = {
- common,
- market_v2_trade_recommend_pair,
- market_v2_trade_area_tickers,
- market_v2_trade_main_pair,
- }
|