| | |
| | | # yesterday 昨天的量 |
| | | import json |
| | | |
| | | from code_attribute import gpcode_manager |
| | | from db.redis_manager_delegate import RedisUtils |
| | | from log_module import async_log_util |
| | | from utils import global_util, tool |
| | |
| | | # 设置历史量 |
| | | def set_histry_volumn(code, max60, yesterday, max60_day, max60_day_count): |
| | | redis = __redis_manager.getRedis() |
| | | global_util.max60_volumn[code] = (max60, max60_day,max60_day_count) |
| | | global_util.max60_volumn[code] = (max60, max60_day, max60_day_count) |
| | | global_util.yesterday_volumn[code] = yesterday |
| | | try: |
| | | RedisUtils.setex_async(0, "volumn_max60-{}".format(code), tool.get_expire(), |
| | |
| | | RedisUtils.realse(redis) |
| | | |
| | | |
| | | __reference_volume_as_money_y_dict = {} |
| | | |
| | | |
| | | def get_reference_volume_as_money_y(code): |
| | | """ |
| | | 返回参考量今日对应的金额(单位为亿) |
| | | @param code: |
| | | @return: |
| | | """ |
| | | if code in __reference_volume_as_money_y_dict: |
| | | return __reference_volume_as_money_y_dict.get(code) |
| | | max60, yesterday = get_histry_volumn(code) |
| | | if max60: |
| | | num = max60[0] |
| | | limit_up_price = gpcode_manager.get_limit_up_price(code) |
| | | if limit_up_price: |
| | | money_y = round((num * float(limit_up_price)) / 1e8, 1) |
| | | __reference_volume_as_money_y_dict[code] = money_y |
| | | return money_y |
| | | # 默认为5亿 |
| | | return 5 |
| | | |
| | | |
| | | if __name__ == "__main__": |
| | | print(get_volume_rate("000059")) |