Merge branch 'activity' of http://120.27.238.55:7000/r/exchange into activity
1 files added
6 files modified
| | |
| | | package com.xcong.excoin.modules.contract.parameter.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.xcong.excoin.utils.CommonUtils; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | |
| | | private int leverRatio; |
| | | |
| | | public String getOpeningPrice() { |
| | | return openingPrice == null ? "" : openingPrice.setScale(4, BigDecimal.ROUND_DOWN).toPlainString(); |
| | | return CommonUtils.amountDotFormat(this.symbol, openingPrice); |
| | | } |
| | | |
| | | public String getOpeningFeeAmount() { |
| | | return openingFeeAmount == null ? "" : openingFeeAmount.setScale(4, BigDecimal.ROUND_DOWN).toPlainString(); |
| | | return CommonUtils.amountDotFormat(this.symbol, openingFeeAmount); |
| | | } |
| | | |
| | | public String getBondAmount() { |
| | | return bondAmount == null ? "" : bondAmount.setScale(4, BigDecimal.ROUND_DOWN).toPlainString(); |
| | | return CommonUtils.amountDotFormat(this.symbol, bondAmount); |
| | | } |
| | | |
| | | public String getHoldAmount() { |
| | | return holdAmount == null ? "" : holdAmount.setScale(4, BigDecimal.ROUND_DOWN).toPlainString(); |
| | | return CommonUtils.amountDotFormat(this.symbol, holdAmount); |
| | | } |
| | | |
| | | public String getForceClosingPrice() { |
| | | return forceClosingPrice == null ? "" : forceClosingPrice.setScale(4, BigDecimal.ROUND_DOWN).toPlainString(); |
| | | return CommonUtils.amountDotFormat(this.symbol, forceClosingPrice); |
| | | } |
| | | |
| | | public String getStopLossPrice() { |
| | | return CommonUtils.amountDotFormat(this.symbol, stopLossPrice); |
| | | } |
| | | |
| | | public String getStopProfitPrice() { |
| | | return CommonUtils.amountDotFormat(this.symbol, stopProfitPrice); |
| | | } |
| | | |
| | | public void setOpeningFeeAmount(BigDecimal openingFeeAmount, BigDecimal feeSpread) { |
| | |
| | | package com.xcong.excoin.modules.contract.parameter.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.xcong.excoin.utils.CommonUtils; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | |
| | | |
| | | public String getOpeningPrice() { |
| | | |
| | | return dotFormat(openingPrice); |
| | | return CommonUtils.amountDotFormat(this.symbol, openingPrice); |
| | | } |
| | | |
| | | private String dotFormat(BigDecimal price) { |
| | |
| | | } |
| | | |
| | | public String getBondAmount() { |
| | | return dotFormat(bondAmount); |
| | | return CommonUtils.amountDotFormat(this.symbol, bondAmount); |
| | | } |
| | | |
| | | public String getForceClosingPrice() { |
| | | return dotFormat(forceClosingPrice); |
| | | return CommonUtils.amountDotFormat(this.symbol, forceClosingPrice); |
| | | } |
| | | |
| | | public String getProfitOrLoss() { |
| | |
| | | package com.xcong.excoin.modules.contract.parameter.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.xcong.excoin.utils.CommonUtils; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | |
| | | private int leverRatio; |
| | | |
| | | public String getClosingPrice() { |
| | | return closingPrice == null ? "" : closingPrice.setScale(4, BigDecimal.ROUND_DOWN).toPlainString(); |
| | | return CommonUtils.amountDotFormat(this.symbol, closingPrice); |
| | | } |
| | | |
| | | public String getClosingFeeAmount() { |
| | | return closingFeeAmount == null ? "" : closingFeeAmount.setScale(4, BigDecimal.ROUND_DOWN).toPlainString(); |
| | | return CommonUtils.amountDotFormat(this.symbol, closingFeeAmount); |
| | | } |
| | | |
| | | public String getRewardAmount() { |
| | | return rewardAmount == null ? "" : rewardAmount.setScale(4, BigDecimal.ROUND_DOWN).toPlainString(); |
| | | return CommonUtils.amountDotFormat(this.symbol, rewardAmount); |
| | | } |
| | | |
| | | public String getOpeningPrice() { |
| | | return openingPrice == null ? "" : openingPrice.setScale(4, BigDecimal.ROUND_DOWN).toPlainString(); |
| | | return CommonUtils.amountDotFormat(this.symbol, openingPrice); |
| | | } |
| | | |
| | | public String getOpeningFeeAmount() { |
| | | return openingFeeAmount == null ? "" : openingFeeAmount.setScale(4, BigDecimal.ROUND_DOWN).toPlainString(); |
| | | return CommonUtils.amountDotFormat(this.symbol, openingFeeAmount); |
| | | } |
| | | |
| | | public String getBondAmount() { |
| | | return bondAmount == null ? "" : bondAmount.setScale(4, BigDecimal.ROUND_DOWN).toPlainString(); |
| | | return CommonUtils.amountDotFormat(this.symbol, bondAmount); |
| | | } |
| | | |
| | | public String getHoldAmount() { |
| | | return holdAmount == null ? "" : holdAmount.setScale(4, BigDecimal.ROUND_DOWN).toPlainString(); |
| | | return CommonUtils.amountDotFormat(this.symbol, holdAmount); |
| | | } |
| | | |
| | | public String getStopLossPrice() { |
| | | return CommonUtils.amountDotFormat(this.symbol, stopLossPrice); |
| | | } |
| | | |
| | | public String getStopProfitPrice() { |
| | | return CommonUtils.amountDotFormat(this.symbol, stopProfitPrice); |
| | | } |
| | | |
| | | public String getEntrustOpeningPrice() { |
| | | return CommonUtils.amountDotFormat(this.symbol, entrustOpeningPrice); |
| | | } |
| | | |
| | | public void setClosingFeeAmount(BigDecimal closingFeeAmount, BigDecimal feeSpread) { |
| | |
| | | |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.xcong.excoin.utils.CommonUtils; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | |
| | | @ApiModelProperty(value = "订单编号") |
| | | private String orderNo; |
| | | |
| | | @ApiModelProperty(value = "币种") |
| | | private String symbol; |
| | | |
| | | public String getOrderNo() { |
| | | return StrUtil.isNotBlank(orderNo) ? orderNo.substring(orderNo.length() - 6) : ""; |
| | | } |
| | | |
| | | public String getOpeningFeeAmount() { |
| | | return openingFeeAmount == null ? "" : openingFeeAmount.setScale(4, BigDecimal.ROUND_DOWN).toPlainString(); |
| | | public String getOpeningPrice() { |
| | | return CommonUtils.amountDotFormat(this.symbol, openingPrice); |
| | | } |
| | | |
| | | public String getClosingPrice() { |
| | | return CommonUtils.amountDotFormat(this.symbol, closingPrice); |
| | | } |
| | | |
| | | public String getOpeningFeeAmount() { |
| | | return CommonUtils.amountDotFormat(this.symbol, openingFeeAmount); |
| | | } |
| | | |
| | | public String getForceClosingPrice() { |
| | | return CommonUtils.amountDotFormat(this.symbol, forceClosingPrice); |
| | | } |
| | | |
| | | public String getClosingFeeAmount() { |
| | | return closingFeeAmount == null ? "" : closingFeeAmount.setScale(4, BigDecimal.ROUND_DOWN).toPlainString(); |
| | | return CommonUtils.amountDotFormat(this.symbol, closingFeeAmount); |
| | | } |
| | | |
| | | public String getBondAmount() { |
| | | return bondAmount == null ? "" : bondAmount.setScale(4, BigDecimal.ROUND_DOWN).toPlainString(); |
| | | return CommonUtils.amountDotFormat(this.symbol, bondAmount); |
| | | } |
| | | |
| | | public String getRewardAmount() { |
| | | return rewardAmount == null ? "" : rewardAmount.setScale(4, BigDecimal.ROUND_DOWN).toPlainString(); |
| | | return CommonUtils.amountDotFormat(this.symbol, rewardAmount); |
| | | } |
| | | } |
| | |
| | | @ApiModelProperty(value = "USDT链名")
|
| | | private String lable;
|
| | |
|
| | | public BigDecimal getAvailableBalance() {
|
| | | return availableBalance == null ? availableBalance : availableBalance.setScale(4, BigDecimal.ROUND_DOWN);
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.xcong.excoin.utils; |
| | | |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | public class CommonUtils { |
| | | |
| | | /** |
| | | * 根据币种设置小数点 |
| | | * |
| | | * @param symbol |
| | | * @param price |
| | | * @return |
| | | */ |
| | | public static String amountDotFormat(String symbol, BigDecimal price) { |
| | | String priceFormat = ""; |
| | | |
| | | if (price == null) { |
| | | return ""; |
| | | } |
| | | |
| | | switch (symbol) { |
| | | case "BTC/USDT": |
| | | case "ETH/USDT": |
| | | case "LTC/USDT": |
| | | case "BCH/USDT": |
| | | priceFormat = price.setScale(2, BigDecimal.ROUND_DOWN).toPlainString(); |
| | | break; |
| | | case "EOS/USDT": |
| | | case "XRP/USDT": |
| | | case "ETC/USDT": |
| | | priceFormat = price.setScale(4, BigDecimal.ROUND_DOWN).toPlainString(); |
| | | break; |
| | | default: |
| | | priceFormat = price.setScale(2, BigDecimal.ROUND_DOWN).toPlainString(); |
| | | } |
| | | return priceFormat; |
| | | } |
| | | } |
| | |
| | | |
| | | private static final String APP_ID = "16082"; |
| | | private static final String APP_KEY = "f34c792a1112c16c190ed7190d386c4f"; |
| | | private static final String FROM = "biue@submail.biue.me"; |
| | | private static final String FROM = "hibit@submail.hibit.cc"; |
| | | private static final String SIGN_TYPE = ""; |
| | | |
| | | /** |
| | |
| | | JSONObject vars = new JSONObject(); |
| | | vars.put("code", code); |
| | | |
| | | String project = "zoKVB"; |
| | | String project = "CVj6P"; |
| | | return request(vars, project, to); |
| | | } |
| | | |
| | |
| | | JSONObject vars = new JSONObject(); |
| | | vars.put("time", time); |
| | | vars.put("orderNo", orderNo); |
| | | String project = "x820C2"; |
| | | String project = "4DvTC2"; |
| | | return request(vars, project, to); |
| | | } |
| | | |