From 9219e18a9b2fb06b95b5c881b057d3fde7270ca3 Mon Sep 17 00:00:00 2001
From: zainali5120 <512061637@qq.com>
Date: Thu, 25 Feb 2021 10:28:54 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/whole_new' into whole_new

---
 src/test/java/com/xcong/excoin/WholeTest.java |   65 ++++++++++++++++++++++++--------
 1 files changed, 49 insertions(+), 16 deletions(-)

diff --git a/src/test/java/com/xcong/excoin/WholeTest.java b/src/test/java/com/xcong/excoin/WholeTest.java
index a58c732..708ff9d 100644
--- a/src/test/java/com/xcong/excoin/WholeTest.java
+++ b/src/test/java/com/xcong/excoin/WholeTest.java
@@ -13,11 +13,13 @@
 import com.xcong.excoin.modules.member.entity.MemberEntity;
 import com.xcong.excoin.modules.member.entity.MemberWalletContractEntity;
 import com.xcong.excoin.rabbit.pricequeue.OrderModel;
+import com.xcong.excoin.rabbit.pricequeue.OrderOperatePriceService;
 import com.xcong.excoin.rabbit.pricequeue.WebsocketPriceService;
 import com.xcong.excoin.rabbit.producer.OrderProducer;
 import com.xcong.excoin.utils.CalculateUtil;
 import com.xcong.excoin.utils.RedisUtils;
 import com.xcong.excoin.utils.ThreadPoolUtils;
+import lombok.SneakyThrows;
 import org.junit.jupiter.api.Test;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
@@ -28,6 +30,7 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
 
 /**
  * @author wzy
@@ -116,22 +119,6 @@
         CalculateUtil.getForceSetPriceForWhole("BTC/USDT", memberEntity);
     }
 
-    @Test
-    public void initOrderTest() {
-        List<HashMap<String, Object>> wholeHoldOrders = contractHoldOrderDao.selectAllWholeOrderMemberIdAndSymbol();
-        if (CollUtil.isNotEmpty(wholeHoldOrders)) {
-            MemberEntity memberEntity = null;
-            for (HashMap<String, Object> wholeHoldOrder : wholeHoldOrders) {
-                Long memberId = (Long) wholeHoldOrder.get("member_id");
-                String symbol = (String) wholeHoldOrder.get("symbol");
-                if (memberEntity == null || !memberId.equals(memberEntity.getId())) {
-                    memberEntity = memberDao.selectById(memberId);
-                }
-                System.out.println(memberId + "-----" + symbol);
-            }
-        }
-    }
-
     @Resource
     private RedisUtils redisUtils;
 
@@ -156,6 +143,52 @@
         CalculateUtil.getForceSetPriceForWhole(null, memberEntity);
     }
 
+    public static void main(String[] args) {
+        Map<String, String> map = new ConcurrentHashMap<>();
+        map.put("1", "1");
+        map.put("2", "2");
+        map.put("3", "3");
+        map.put("4", "4");
+        map.put("5", "5");
 
+        new Thread(new Runnable() {
+            @SneakyThrows
+            @Override
+            public void run() {
+                for (Map.Entry<String, String> entry : map.entrySet()) {
+                    System.out.println(entry.getKey() + " - " + entry.getValue());
+                    if (entry.getKey().equals("3")) {
+                        System.out.println(11);
+                        map.remove("3");
+                    }
+                    Thread.sleep(1000);
+                }
+
+                System.out.println(map.get("3"));
+            }
+        }).start();
+
+    }
+
+    @Test
+    public void mapTest() {
+//        websocketPriceService.wholeBomb();
+        OrderOperatePriceService.wholePriceDataOperation(63L);
+    }
+
+
+    @Test
+    public void wholeForceTest() {
+        // 8301.38608660
+//        System.out.println(new BigDecimal("9925.29996175").subtract(new BigDecimal("1623.91387515")));
+
+        BigDecimal aa = new BigDecimal("9925.29996175").subtract(new BigDecimal("8301.38608660").negate()).subtract(new BigDecimal("1623.91387515")).subtract(new BigDecimal("0.1").multiply(new BigDecimal(50)).multiply(new BigDecimal("32478.27750300")));
+        BigDecimal bb = new BigDecimal(50).multiply(new BigDecimal("0.1"));
+        BigDecimal divide = aa.divide(bb, 8, BigDecimal.ROUND_DOWN);
+        System.out.println(divide);
+        // -(账户权益-委托保证金-全仓维持保证金-全仓未实现盈利-数量*面值*开仓价格)/(数量*面值)
+        // 30818.00028568 --
+        // 29157.72306836 --
+    }
 
 }

--
Gitblit v1.9.1