| | |
| | | package com.xcong.excoin.modules.gateApi; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取所有已挂多仓条件单的网格元素。 |
| | | * 小于空仓仓位线的多单 |
| | | * |
| | | * @return 已挂多仓条件单的 GridElement 列表 |
| | | */ |
| | | public static List<GridElement> findAllLongOrders(BigDecimal currentPrice) { |
| | | List<GridElement> result = new ArrayList<>(); |
| | | for (GridElement e : INDEX.values()) { |
| | | if (e.isHasLongOrder() && e.getGridPrice().compareTo(currentPrice) < 0) { |
| | | result.add(e); |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 获取所有已挂空仓条件单的网格元素。 |
| | | * 大于多仓仓位线的空单 |
| | | * |
| | | * @return 已挂空仓条件单的 GridElement 列表 |
| | | */ |
| | | public static List<GridElement> findAllShortOrders(BigDecimal currentPrice) { |
| | | List<GridElement> result = new ArrayList<>(); |
| | | for (GridElement e : INDEX.values()) { |
| | | if (e.isHasShortOrder() && e.getGridPrice().compareTo(currentPrice) < 0) { |
| | | result.add(e); |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | private static void putDynamicIndices(GridElement e) { |
| | | PRICE_INDEX.put(e.getGridPrice(), e); |
| | | if (e.getLongOrderId() != null) { |