contract.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. import Serve from '@/api/serve'
  2. class Contract {
  3. /**
  4. * 合约初始化面板数据
  5. * @param {Object} data
  6. */
  7. static getMarketInfo(data) {
  8. return Serve.get(`/contract/getMarketInfo`, data);
  9. }
  10. /**
  11. * 获取合约市场
  12. */
  13. static getMarketList(data) {
  14. return Serve.get('/contract/getMarketList', data)
  15. }
  16. /**
  17. * 获取合约账户信息
  18. */
  19. static contractAccount(data, config) {
  20. return Serve.get('/contract/contractAccount', data, config)
  21. }
  22. /**
  23. * 获取合约详情
  24. */
  25. static getSymbolDetail(data) {
  26. return Serve.get('/contract/getSymbolDetail', data)
  27. }
  28. /**
  29. * 可开张数(合约上限)
  30. * */
  31. static openNum(data,config) {
  32. return Serve.get('/contract/openNum', data,config)
  33. }
  34. /**
  35. * 合约开仓
  36. */
  37. static openPosition(data, config) {
  38. return Serve.post('/contract/openPosition', data, config)
  39. }
  40. // 获取合约持仓
  41. static holdPosition(data, config) {
  42. return Serve.get('/contract/holdPosition', data, config)
  43. }
  44. // 合约平仓
  45. static closePosition(data, config) {
  46. return Serve.post('/contract/closePosition', data, config)
  47. }
  48. // 一键全平
  49. static closeAllPosition(data, config) {
  50. return Serve.post('/contract/closeAllPosition', data, config)
  51. }
  52. // 获取当前合约委托
  53. static getCurrentEntrust(data, config) {
  54. return Serve.get('/contract/getCurrentEntrust', data, config)
  55. }
  56. // 撤单
  57. static cancelEntrust(data, config) {
  58. return Serve.post('/contract/cancelEntrust', data, config)
  59. }
  60. // 历史委托
  61. static getHistoryEntrust(data, config) {
  62. return Serve.get('/contract/getHistoryEntrust', data, config)
  63. }
  64. // 获取k线数据
  65. static getKline(data, config) {
  66. return Serve.get('/contract/getKline', data, config)
  67. }
  68. // 获取委托明细
  69. static getEntrustDealList(data, config) {
  70. return Serve.get('/contract/getEntrustDealList', data, config)
  71. }
  72. // 获取开通状态
  73. static openStatus() {
  74. return Serve.get('/contract/openStatus')
  75. }
  76. // 开通永续合约
  77. static opening() {
  78. return Serve.post('/contract/opening')
  79. }
  80. static setStrategy(data, config) {
  81. return Serve.post('/contract/setStrategy', data, config)
  82. }
  83. // 委托盈亏分享
  84. static entrustShare(data) {
  85. return Serve.get('/contract/entrustShare', data, { loading: true })
  86. }
  87. // 持仓盈亏分享
  88. static positionShare(data) {
  89. return Serve.get('/contract/positionShare', data, { loading: true })
  90. }
  91. // 一键全平
  92. static onekeyAllFlat(data) {
  93. return Serve.post('/contract/onekeyAllFlat', data, { loading: true })
  94. }
  95. // 一键反向
  96. static onekeyReverse(data) {
  97. return Serve.post('/contract/onekeyReverse', data, { loading: true })
  98. }
  99. //秒合约
  100. //获取秒合约币种列表
  101. static marketListM(data){
  102. return Serve.post('/contract/liststype', data, { loading: true })
  103. }
  104. //获取秒合约币种列表
  105. static marketInfoM(data){
  106. return Serve.post('/contract/info', data, { loading: true })
  107. }
  108. static createOrderM(data){
  109. return Serve.post('/contract/createOrder', data, { loading: true })
  110. }
  111. static OrderListM(data){
  112. return Serve.post('/contract/orderLists', data, { loading: true })
  113. }
  114. }
  115. export default Contract;