hotconi.proto.js 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. // JSON descriptor
  2. //提示词: 通过这个json 结构给我生成一个 protobufjs使用的 JSON descriptors
  3. //通用返回值结构。
  4. const common = {
  5. 'nested': {
  6. 'Response': {
  7. 'fields': {
  8. 'code': {
  9. 'type': 'int32',
  10. 'id': 1,
  11. },
  12. 'msg': {
  13. 'type': 'string',
  14. 'id': 2,
  15. },
  16. 'status': {
  17. 'type': 'string',
  18. 'id': 3,
  19. },
  20. 'ts': {
  21. 'type': 'int64',
  22. 'id': 4,
  23. },
  24. 'ch': {
  25. 'type': 'string',
  26. 'id': 5,
  27. },
  28. },
  29. },
  30. },
  31. }
  32. //market.v2.trade.recommend.pair
  33. const market_v2_trade_recommend_pair = {
  34. 'nested': {
  35. 'Response': { // 把 Response 放在最外层
  36. 'fields': {
  37. 'code': {
  38. 'type': 'int32',
  39. 'id': 1
  40. },
  41. 'msg': {
  42. 'type': 'string',
  43. 'id': 2
  44. },
  45. 'status': {
  46. 'type': 'string',
  47. 'id': 3
  48. },
  49. 'ts': {
  50. 'type': 'int64',
  51. 'id': 4
  52. },
  53. 'ch': {
  54. 'type': 'string',
  55. 'id': 5
  56. },
  57. 'recommendpair': {
  58. 'type': 'RecommendPair',
  59. 'id': 6
  60. }
  61. }
  62. },
  63. 'RecommendPair': { // 定义内部消息类型
  64. 'nested': { // 新增 nested 层
  65. 'TradePair': { // 把 TradePair 定义移到 RecommendPair 内部
  66. 'fields': {
  67. 'tradeId': {
  68. 'type': 'int64',
  69. 'id': 1
  70. },
  71. 'cny': {
  72. 'type': 'string',
  73. 'id': 2
  74. },
  75. 'totalamount': {
  76. 'type': 'string',
  77. 'id': 3
  78. },
  79. 'last': {
  80. 'type': 'string',
  81. 'id': 4
  82. },
  83. 'volume': {
  84. 'type': 'string',
  85. 'id': 5
  86. },
  87. 'change': {
  88. 'type': 'string',
  89. 'id': 6
  90. }
  91. }
  92. }
  93. },
  94. 'fields': {
  95. 'listList': {
  96. 'rule': 'repeated',
  97. 'type': 'TradePair',
  98. 'id': 1
  99. }
  100. }
  101. }
  102. }
  103. };
  104. const market_v2_trade_area_tickers = {
  105. 'nested': {
  106. 'TradeAreaPair': {
  107. 'fields': {
  108. 'listList': {
  109. 'rule': 'repeated',
  110. 'type': 'TradePair',
  111. 'id': 1,
  112. 'default': [], // 添加默认值
  113. },
  114. },
  115. },
  116. 'TradePair': {
  117. 'fields': {
  118. 'tradeid': {
  119. 'type': 'int64',
  120. 'id': 1,
  121. },
  122. 'cny': {
  123. 'type': 'double',
  124. 'id': 2,
  125. },
  126. 'buy': {
  127. 'type': 'double',
  128. 'id': 3,
  129. },
  130. 'lever': {
  131. 'type': 'int64',
  132. 'id': 4,
  133. },
  134. 'sell': {
  135. 'type': 'double',
  136. 'id': 5,
  137. },
  138. 'last': {
  139. 'type': 'double',
  140. 'id': 6,
  141. },
  142. 'volume': {
  143. 'type': 'double',
  144. 'id': 7,
  145. },
  146. 'change': {
  147. 'type': 'double',
  148. 'id': 8,
  149. },
  150. 'high': {
  151. 'type': 'double',
  152. 'id': 9,
  153. },
  154. 'low': {
  155. 'type': 'double',
  156. 'id': 10,
  157. },
  158. 'isopen': {
  159. 'type': 'int64',
  160. 'id': 11,
  161. },
  162. 'open': {
  163. 'type': 'int64',
  164. 'id': 12,
  165. },
  166. 'amount': {
  167. 'type': 'double',
  168. 'id': 13,
  169. },
  170. 'isfiatconvert': {
  171. 'type': 'bool',
  172. 'id': 14,
  173. },
  174. },
  175. },
  176. 'Response': {
  177. 'fields': {
  178. 'code': {
  179. 'type': 'int32',
  180. 'id': 1,
  181. },
  182. 'msg': {
  183. 'type': 'string',
  184. 'id': 2,
  185. },
  186. 'status': {
  187. 'type': 'string',
  188. 'id': 3,
  189. },
  190. 'ts': {
  191. 'type': 'int64',
  192. 'id': 4,
  193. },
  194. 'ch': {
  195. 'type': 'string',
  196. 'id': 5,
  197. },
  198. 'tradeareapair': {
  199. 'type': 'TradeAreaPair',
  200. 'id': 6,
  201. },
  202. },
  203. },
  204. },
  205. }
  206. const market_v2_trade_main_pair = {
  207. 'nested': {
  208. 'MainPair': {
  209. 'fields': {
  210. 'listList': {
  211. 'rule': 'repeated',
  212. 'type': 'Trade',
  213. 'id': 1,
  214. 'default': [], // 添加默认值
  215. },
  216. },
  217. },
  218. 'Trade': {
  219. 'fields': {
  220. 'tradeId': {
  221. 'type': 'int64',
  222. 'id': 1,
  223. },
  224. 'cny': {
  225. 'type': 'double',
  226. 'id': 2,
  227. },
  228. 'totalamount': {
  229. 'type': 'double',
  230. 'id': 3,
  231. },
  232. 'last': {
  233. 'type': 'double',
  234. 'id': 4,
  235. },
  236. 'volume': {
  237. 'type': 'double',
  238. 'id': 5,
  239. },
  240. 'change': {
  241. 'type': 'double',
  242. 'id': 6,
  243. },
  244. },
  245. },
  246. 'Response': {
  247. 'fields': {
  248. 'code': {
  249. 'type': 'int32',
  250. 'id': 1,
  251. },
  252. 'msg': {
  253. 'type': 'string',
  254. 'id': 2,
  255. },
  256. 'status': {
  257. 'type': 'string',
  258. 'id': 3,
  259. },
  260. 'ts': {
  261. 'type': 'int64',
  262. 'id': 4,
  263. },
  264. 'ch': {
  265. 'type': 'string',
  266. 'id': 5,
  267. },
  268. 'mainpair': {
  269. 'type': 'MainPair',
  270. 'id': 6,
  271. },
  272. },
  273. },
  274. },
  275. }
  276. module.exports = {
  277. common,
  278. market_v2_trade_recommend_pair,
  279. market_v2_trade_area_tickers,
  280. market_v2_trade_main_pair,
  281. }