新版仿ok交易所-后端
zyy
2026-01-27 e1cf5740980e055432013394f14e51e0cb661d7b
trading-order-huobi/src/main/java/com.yami.trading.huobi/data/job/AbstractGetDataJob.java
@@ -6,6 +6,7 @@
import com.yami.trading.common.util.Arith;
import com.yami.trading.huobi.data.AdjustmentValueCache;
import com.yami.trading.huobi.data.DataCache;
import com.yami.trading.huobi.data.RandomNumbersGenerator;
import com.yami.trading.huobi.data.internal.DataDBService;
import com.yami.trading.huobi.data.model.AdjustmentValue;
import com.yami.trading.huobi.hobi.HobiDataService;
@@ -87,7 +88,15 @@
                        // 首次执行:生成含正负值的调整序列
                        if (adjustments == null || currentIndex == null) {
                            adjustments = generateRandomAdjustments(delayValue.getValue(), frequency, decimal);
                            //分几段执行
                            int nums = Math.max(10, frequency / 10);
                            List<BigDecimal> result = RandomNumbersGenerator.generateNumbers(delayValue.getValue(), nums, decimal + 4);
                            for (int i = 0; i < result.size(); i++) {
                                if (adjustments == null) {
                                    adjustments = new ArrayList<>();
                                }
                                adjustments.addAll(generateRandomAdjustments(result.get(i), frequency / 10, decimal));
                            }
                            currentIndex = 0;
                            AdjustmentValueCache.getPreAllocatedAdjustments().put(symbol, adjustments);
                            AdjustmentValueCache.getCurrentAdjustmentIndex().put(symbol, currentIndex);
@@ -175,11 +184,17 @@
            realtime.setTs(Long.valueOf(realtime.getTs() + "000"));
        }
        realtime.setName(item.getName());
        if (high == null || realtime.getHigh().doubleValue() > high) {
        /*if (high == null || realtime.getHigh().doubleValue() > high) {
            DataCache.getRealtimeHigh().put(symbol, realtime.getHigh().doubleValue());
        }
        if ((low == null || realtime.getLow().doubleValue() < low) && realtime.getLow().doubleValue() > 0) {
            DataCache.getRealtimeLow().put(symbol, realtime.getLow().doubleValue());
        }*/
        if (high != null) {
            realtime.setHigh(BigDecimal.valueOf(high));
        }
        if (low != null) {
            realtime.setLow(BigDecimal.valueOf(low));
        }
        this.dataDBService.saveAsyn(realtime);
    }
@@ -299,7 +314,18 @@
    public static void main(String[] args) {
        AbstractGetDataJob abstractGetDataJob = new CryptosGetDataJob();
        List<BigDecimal> list = abstractGetDataJob.generateRandomAdjustments(new BigDecimal(0.002), 300, 8);
        List<BigDecimal> list = new ArrayList<>();
        int frequency = 166;
        int decimal = 4;
        //分几段执行
        int nums = Math.max(10, frequency / 10);
        List<BigDecimal> result = RandomNumbersGenerator.generateNumbers(BigDecimal.valueOf(0.0026), nums, decimal + 4);
        System.out.println(result);
        for (int i = 0; i < result.size(); i++) {
            List<BigDecimal> numbers = abstractGetDataJob.generateRandomAdjustments(result.get(i), frequency / 10, decimal);
            list.addAll(numbers);
        }
        BigDecimal sum = BigDecimal.ZERO;
        int num = 0;
        int dmt = 1;