| | |
| | | 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; |
| | |
| | | |
| | | // 首次执行:生成含正负值的调整序列 |
| | | 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); |
| | |
| | | |
| | | 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 = 200; |
| | | int decimal = 6; |
| | | //分几段执行 |
| | | int nums = Math.max(10, frequency / 10); |
| | | List<BigDecimal> result = RandomNumbersGenerator.generateNumbers(BigDecimal.valueOf(0.02), nums, decimal + 4); |
| | | for (int i = 0; i < result.size(); i++) { |
| | | list.addAll(abstractGetDataJob.generateRandomAdjustments(result.get(i), frequency / 10, decimal)); |
| | | } |
| | | |
| | | BigDecimal sum = BigDecimal.ZERO; |
| | | int num = 0; |
| | | int dmt = 1; |