From 70b51a2636858fb8cfbf39d3764d88d07286d8ad Mon Sep 17 00:00:00 2001 From: admin <admin@example.com> Date: 星期二, 08 四月 2025 11:27:42 +0800 Subject: [PATCH] 增加并行数量 --- strategy/basic_methods.py | 46 ++++++++++++++++++++++++---------------------- 1 files changed, 24 insertions(+), 22 deletions(-) diff --git a/strategy/basic_methods.py b/strategy/basic_methods.py index 5011736..a7b4c12 100644 --- a/strategy/basic_methods.py +++ b/strategy/basic_methods.py @@ -2,13 +2,14 @@ from __future__ import print_function, absolute_import, unicode_literals import decimal + +from log_module.log import logger_common # from datetime import datetime from strategy import data_cache -from strategy.logging_config import get_logger from utils import hx_qc_value_util # 鑾峰彇logger瀹炰緥 -logger = get_logger() +logger = logger_common # 灏嗙函鏁板瓧浠g爜杞寲涓�=銆嬫帢閲戞牸寮忚偂绁ㄤ唬鐮� @@ -52,28 +53,28 @@ # print(f"open_growth=={open_growth}") -# 璁$畻鐬椂娑ㄥ箙鍏紡 -# 鍒濆鍖栧巻鍙蹭环鏍� -price_history = {} +# # 璁$畻鐬椂娑ㄥ箙鍏紡 +# # 鍒濆鍖栧巻鍙蹭环鏍� +# price_history = {} +# +# +# def calculate_growth(symbol, price): +# try: +# if symbol not in price_history: +# return 0 # 涓嶈冻涓や釜鍘嗗彶浠锋牸锛屾棤娉曡绠楁定骞� +# last_price = price_history[symbol] +# # print(f"price_history[symbol]~~~~~~~~~{price_history[symbol]}") +# if last_price != 0: +# growth = (price - last_price) / last_price * 100 # 璁$畻娑ㄥ箙鐧惧垎姣� +# return growth +# finally: +# price_history[symbol] = price +# # print(f"price======={price}") +# # print(f"price_history=={price_history}") +# # print(f"price_history[symbol]=={price_history[symbol]}") -def calculate_growth(symbol, price): - try: - if symbol not in price_history: - return 0 # 涓嶈冻涓や釜鍘嗗彶浠锋牸锛屾棤娉曡绠楁定骞� - last_price = price_history[symbol] - # print(f"price_history[symbol]~~~~~~~~~{price_history[symbol]}") - if last_price != 0: - growth = (price - last_price) / last_price * 100 # 璁$畻娑ㄥ箙鐧惧垎姣� - return growth - finally: - price_history[symbol] = price - # print(f"price======={price}") - # print(f"price_history=={price_history}") - # print(f"price_history[symbol]=={price_history[symbol]}") - - -# 璁$畻tick娑ㄥ箙鍏紡銆愪负鍗栧嚭绛栫暐鍗曠嫭鍒涘缓鍑芥暟銆� +# # 璁$畻鐬椂闂撮殧娑ㄥ箙鍏紡銆愪负鍗栧嚭绛栫暐鍗曠嫭鍒涘缓鍑芥暟銆� # 鍒濆鍖栧巻鍙蹭环鏍� history_price = {} @@ -147,6 +148,7 @@ frying_plate_day_min_index = next((i for i, d in enumerate(k_line_data[0:7]) if 'attribute' in d and d['attribute'] in data_cache.frying_plate_type), None) # 濡傛灉娌℃湁鎵惧埌锛岃繑鍥濶one # 鎵惧埌鏈�杩�7鏃ュ唴鐨勬湁璺屽仠鐨勫簭鍙� limit_down_day_min_index = next((i for i, d in enumerate(k_line_data[0:7]) if 'attribute' in d and d['attribute'] in data_cache.limit_down_type), None) # 濡傛灉娌℃湁鎵惧埌锛岃繑鍥濶one + # 鏈�杩戠殑娑ㄥ仠搴忓彿瀛樺湪 涓� 闈炴槰鏃� if limit_up_day_min_index is not None and limit_up_day_min_index > 0: # 寮�鐩樹环 < 娑ㄥ仠褰撴棩鏈�楂樹环 <= 浠婃棩娑ㄥ仠浠� -- Gitblit v1.8.0