1 files added
3 files modified
New file |
| | |
| | | package com.xcong.excoin.common.enumerates; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * 币种小数点 |
| | | */ |
| | | @Getter |
| | | public enum SymbolsPlacesEnum { |
| | | |
| | | BTC("BTC/USDT", 2) |
| | | ,ETH("ETH/USDT", 2) |
| | | ,LTC("LTC/USDT", 2) |
| | | ,BCH("BCH/USDT", 2) |
| | | ,EOS("EOS/USDT", 4) |
| | | ,XRP("XRP/USDT", 5) |
| | | ,ETC("ETC/USDT", 4); |
| | | |
| | | private String symbol; |
| | | |
| | | private Integer places; |
| | | |
| | | private SymbolsPlacesEnum(String symbol, Integer places) { |
| | | this.symbol = symbol; |
| | | this.places = places; |
| | | } |
| | | |
| | | public static Integer getValueByName(String symbol) { |
| | | Integer places = 0; |
| | | for (SymbolsPlacesEnum symbolsPlacesEnum : values()) { |
| | | if (symbol.equals(symbolsPlacesEnum.getSymbol())){ |
| | | places = symbolsPlacesEnum.getPlaces(); |
| | | break; |
| | | } |
| | | } |
| | | return places; |
| | | } |
| | | } |
| | |
| | | package com.xcong.excoin.modules.contract.parameter.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.xcong.excoin.common.enumerates.SymbolsPlacesEnum; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | |
| | | private int symbolCntSale; |
| | | |
| | | public String getOpeningPrice() { |
| | | return openingPrice == null ? "" : openingPrice.setScale(4, BigDecimal.ROUND_DOWN).toPlainString(); |
| | | return openingPrice == null ? "" : openingPrice.setScale(SymbolsPlacesEnum.getValueByName(this.symbol), BigDecimal.ROUND_DOWN).toPlainString(); |
| | | } |
| | | |
| | | public String getOpeningFeeAmount() { |
| | |
| | | } |
| | | |
| | | public String getForceClosingPrice() { |
| | | return forceClosingPrice == null ? "" : forceClosingPrice.setScale(4, BigDecimal.ROUND_DOWN).toPlainString(); |
| | | return forceClosingPrice == null ? "" : forceClosingPrice.setScale(SymbolsPlacesEnum.getValueByName(this.symbol), BigDecimal.ROUND_DOWN).toPlainString(); |
| | | } |
| | | |
| | | 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.common.enumerates.SymbolsPlacesEnum; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | |
| | | private Integer positionType; |
| | | |
| | | public String getOpeningPrice() { |
| | | return openingPrice.setScale(4, BigDecimal.ROUND_DOWN).toPlainString(); |
| | | return openingPrice.setScale(SymbolsPlacesEnum.getValueByName(this.symbol), BigDecimal.ROUND_DOWN).toPlainString(); |
| | | } |
| | | |
| | | public String getBondAmount() { |
| | |
| | | } |
| | | |
| | | public String getForceClosingPrice() { |
| | | return forceClosingPrice.setScale(4, BigDecimal.ROUND_DOWN).toPlainString(); |
| | | return forceClosingPrice.setScale(SymbolsPlacesEnum.getValueByName(this.symbol), BigDecimal.ROUND_DOWN).toPlainString(); |
| | | } |
| | | |
| | | public String getProfitOrLoss() { |
| | |
| | | package com.xcong.excoin.modules.contract.parameter.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.xcong.excoin.common.enumerates.SymbolsPlacesEnum; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | |
| | | private int symbolCntSale; |
| | | |
| | | public String getClosingPrice() { |
| | | return closingPrice == null ? "" : closingPrice.setScale(4, BigDecimal.ROUND_DOWN).toPlainString(); |
| | | return closingPrice == null ? "" : closingPrice.setScale(SymbolsPlacesEnum.getValueByName(this.symbol), BigDecimal.ROUND_DOWN).toPlainString(); |
| | | } |
| | | |
| | | public String getClosingFeeAmount() { |
| | |
| | | } |
| | | |
| | | public String getOpeningPrice() { |
| | | return openingPrice == null ? "" : openingPrice.setScale(4, BigDecimal.ROUND_DOWN).toPlainString(); |
| | | return openingPrice == null ? "" : openingPrice.setScale(SymbolsPlacesEnum.getValueByName(this.symbol), BigDecimal.ROUND_DOWN).toPlainString(); |
| | | } |
| | | |
| | | public String getOpeningFeeAmount() { |