Administrator
2024-07-15 cf4df50c71235bfa6ee73776c556ee1f95ce6356
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
from settings.trade_setting import TradeBlockBuyModeManager
 
 
def test_active_buy():
    current_rank = 2
 
    TIME_STR_RANGES = ["10:00:00", "10:30:00", "11:00:00", "13:00:00", "13:30:00", "14:00:00", "14:30:00",
                       "15:00:00"]
    TIME_INT_RANGES = [int(x.replace(':', '')) for x in TIME_STR_RANGES]
    MAX_RANKS = [3, 3, 2, 2, 1, 0, 0, 0]
    now_time_str = "09:36:00".replace(':', '')
    for i in range(len(TIME_INT_RANGES)):
        if int(now_time_str) <= TIME_INT_RANGES[i]:
            if MAX_RANKS[i] > current_rank:
                return True
            break
    return False
 
 
if __name__ == "__main__":
    block_codes = {"000333"}
    print(block_codes | {"000222"})
 
    print(TradeBlockBuyModeManager().can_buy_unique_block(), bin(TradeBlockBuyModeManager().get_mode()))
    print(TradeBlockBuyModeManager().add_unique_block())
    print(TradeBlockBuyModeManager().can_buy_unique_block(), bin(TradeBlockBuyModeManager().get_mode()))
    print(TradeBlockBuyModeManager().remove_unique_block())
    print(TradeBlockBuyModeManager().can_buy_unique_block(), bin(TradeBlockBuyModeManager().get_mode()))