新版仿ok交易所-后端
1
zj
2025-10-21 6b70d176a02e7d6b33635c21243a90a0b3c71492
1
4 files modified
36 ■■■■■ changed files
trading-order-admin/src/main/resources/application-prod.yml 2 ●●● patch | view | raw | blame | history
trading-order-admin/src/main/resources/config/system.properties 2 ●●● patch | view | raw | blame | history
trading-order-admin/src/main/resources/redisson/redisson-dev.yml 2 ●●● patch | view | raw | blame | history
trading-order-service/src/main/java/com/yami/trading/service/contract/ContractOrderCalculationServiceImpl.java 30 ●●●●● patch | view | raw | blame | history
trading-order-admin/src/main/resources/application-prod.yml
@@ -5,7 +5,7 @@
#    url: jdbc:mysql://127.0.0.1:6306/8.4?allowMultiQueries=true&useSSL=false&useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&serverTimezone=Europe/Paris&useLegacyDatetimeCode=false
    url: jdbc:mysql://127.0.0.1:3306/cme?allowMultiQueries=true&useSSL=false&useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&serverTimezone=Europe/Paris&useLegacyDatetimeCode=false
    username: root
    password: 9a64ce6be2011e9d
    password: 123456
    driver-class-name: com.mysql.cj.jdbc.Driver
    type: com.zaxxer.hikari.HikariDataSource
    hikari:
trading-order-admin/src/main/resources/config/system.properties
@@ -3,7 +3,7 @@
admin_url=https://127.0.0.1:8080/admin
web_url=http://127.0.0.1:8080/wap/
images_http=https://img.cme-coin.com/
images_http=https://img.durocaspitall.com/
loca.images.dir=/www/wwwroot/img
email.host=smtp.gmail.com
email.username=coinzne.com@gmail.com
trading-order-admin/src/main/resources/redisson/redisson-dev.yml
@@ -1,7 +1,7 @@
# 单节点设置
singleServerConfig:
  address: redis://127.0.0.1:6379
  database: 2
  database: 10
  password:
  idleConnectionTimeout: 10000
  connectTimeout: 10000
trading-order-service/src/main/java/com/yami/trading/service/contract/ContractOrderCalculationServiceImpl.java
@@ -117,25 +117,21 @@
        Item item = itemService.findBySymbol(order.getSymbol());
        if(null != order.getProfitLossRatio()){//根据后台设置的盈亏比来
            order.setProfit(order.getDepositOpen().multiply(new BigDecimal((order.getProfitLossRatio()/100))).setScale(2, RoundingMode.DOWN));
        }else{
            /*
             * 根据偏 差点数和手数算出盈亏金额
             */
            /**
             * 偏差点位
             */
            BigDecimal point = currentPrice.subtract(order.getTradeAvgPrice());
            BigDecimal amount = point.multiply(new BigDecimal("0.01")).multiply(order.getVolumeOpen()).setScale(4, BigDecimal.ROUND_DOWN);;
            if (ContractOrder.DIRECTION_BUY.equals(order.getDirection())) {
                order.setProfit(amount);
            } else{
                order.setProfit(amount.negate());
            }
        /*
         * 根据偏 差点数和手数算出盈亏金额
         */
        /**
         * 偏差点位
         */
        BigDecimal point = currentPrice.subtract(order.getTradeAvgPrice());
        BigDecimal amount = point.multiply(new BigDecimal("0.01")).multiply(order.getVolumeOpen()).setScale(4, BigDecimal.ROUND_DOWN);;
        if (ContractOrder.DIRECTION_BUY.equals(order.getDirection())) {
            order.setProfit(amount);
        } else{
            order.setProfit(amount.negate());
        }
        double faceValue = 0.01; // 合约面值(固定面值不能调整)
        double maintenanceMarginRate = 0.004; // 维持保证金率(固定不变)