From f34371f754a4099355dfa0f2a6b6bcca81ec2817 Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期二, 30 四月 2024 17:29:25 +0800 Subject: [PATCH] 激进买入策略修改 --- test/test.py | 27 ++++++++++++++++++++------- 1 files changed, 20 insertions(+), 7 deletions(-) diff --git a/test/test.py b/test/test.py index 9c093b9..fdaa657 100644 --- a/test/test.py +++ b/test/test.py @@ -1,8 +1,21 @@ +from utils import tool + + +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__": - num = 25070171 - limit_up_price = 5.1 - if limit_up_price: - money_y = round((num * float(limit_up_price)) / 1e8, 1) - money = int(200 * money_y + 280) - count = int(money_y * 10) // 10 + 3 - print( money, count) + print(test_active_buy()) -- Gitblit v1.8.0