"""
|
激进买数据管理
|
"""
|
import constant
|
from code_attribute import code_nature_analyse, code_volumn_manager, gpcode_manager
|
from code_attribute.code_l1_data_manager import L1DataManager
|
from l2.l2_sell_manager import L2MarketSellManager
|
|
|
class RedicalBuyDataManager():
|
@classmethod
|
def can_buy(cls, code):
|
"""
|
是否可以买
|
@param code: 代码
|
@param total_sell_volume: 总卖量
|
@return:
|
"""
|
k_format = code_nature_analyse.CodeNatureRecordManager().get_k_format_cache(code)
|
if k_format:
|
if not k_format[13]:
|
return False, "近60个交易日无涨停"
|
if k_format[14]:
|
# 昨天炸板,且当前的量比小于33%
|
current_total_sell_data = L2MarketSellManager().get_current_total_sell_data(code)
|
total_sell_volume = 0
|
if current_total_sell_data:
|
total_sell_volume = current_total_sell_data[2]
|
volume_rate = code_volumn_manager.get_volume_rate(code, total_sell_volume=total_sell_volume)
|
if volume_rate < 0.33:
|
return False, f"昨日炸板,量比({volume_rate})<0.33"
|
|
# MAX_CODE_PRICE = 50
|
# MIN_CODE_PRICE = 2
|
# 获取涨停价
|
price = gpcode_manager.get_limit_up_price_as_num(code)
|
if not price:
|
# 获取现价
|
price = L1DataManager.get_l1_current_price(code)
|
if price:
|
if price < constant.MIN_CODE_PRICE or price > constant.MAX_CODE_PRICE:
|
return False, "价格不满足需求"
|
if gpcode_manager.BlackListCodeManager().is_in_cache(code):
|
return False, "已拉黑"
|
return True, ""
|