Administrator
7 days ago 920927331afecb67e85268eecb567a91b53f1e61
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
package com.xcong.excoin.modules.okxNewPrice.okxWs.wanggeList;
 
import com.xcong.excoin.rabbit.pricequeue.AscBigDecimal;
import com.xcong.excoin.rabbit.pricequeue.DescBigDecimal;
 
import java.util.concurrent.PriorityBlockingQueue;
 
/**
 * 网格交易队列管理类
 *
 * 用于管理系统中各种网格交易相关的优先级阻塞队列,
 * 包括完整的网格队列、平仓队列和开仓队列。
 *
 * @author Administrator
 */
public class WangGeListQueue {
 
    //------------------------------------------------------------------------------------------------------------------
    //------------------------------------------------------------------------------------------------------------------
    // todo 系统启动后,初始化网格队列
    /**
     * 完整的网格 头元素最小
     */
    public static PriorityBlockingQueue<AscBigDecimal> QUEUE_ASC = null;
 
 
    //------------------------------------------------------------------------------------------------------------------
    //------------------------------------------------------------------------------------------------------------------
    // todo 当用户下了第一单后,根据开仓价格初始化网格平仓队列和开仓队列
    /**
     * 网格平仓队列 头元素最小
     */
    public static PriorityBlockingQueue<AscBigDecimal> QUEUE_PINGCANG_ASC = null;
 
    /**
     * 网格开仓队列 头元素最大
     */
    public static PriorityBlockingQueue<DescBigDecimal> QUEUE_KAICANG_DESC = null;
 
    /**
     * 获取完整的网格队列(升序)
     * 如果队列未初始化则创建新的优先级阻塞队列
     *
     * @return 返回升序排列的PriorityBlockingQueue队列,队列头部元素最小
     */
    public static PriorityBlockingQueue<AscBigDecimal> getQueueAsc() {
        if (QUEUE_ASC == null) {
            QUEUE_ASC = new PriorityBlockingQueue<AscBigDecimal>();
        }
        return QUEUE_ASC;
    }
 
    /**
     * 获取网格平仓队列(升序)
     * 如果队列未初始化则创建新的优先级阻塞队列
     *
     * @return 返回升序排列的PriorityBlockingQueue队列,队列头部元素最小
     */
    public static PriorityBlockingQueue<AscBigDecimal> getPingCang() {
        if (QUEUE_PINGCANG_ASC == null) {
            QUEUE_PINGCANG_ASC = new PriorityBlockingQueue<AscBigDecimal>();
        }
        return QUEUE_PINGCANG_ASC;
    }
 
    /**
     * 获取网格开仓队列(降序)
     * 如果队列未初始化则创建新的优先级阻塞队列
     *
     * @return 返回降序排列的PriorityBlockingQueue队列,队列头部元素最大
     */
    public static PriorityBlockingQueue<DescBigDecimal> getKaiCang() {
        if (QUEUE_KAICANG_DESC == null) {
            QUEUE_KAICANG_DESC = new PriorityBlockingQueue<DescBigDecimal>();
        }
        return QUEUE_KAICANG_DESC;
    }
 
}