| | |
| | | |
| | | |
| | | # 获取量比(今日量/max(60天最大量,昨日量)) |
| | | def get_volume_rate(code, with_info=False): |
| | | # 将总卖量计算在内 |
| | | def get_volume_rate(code, total_sell_volume=0, with_info=False): |
| | | today = get_today_volumn(code) |
| | | max60, yesterday = get_histry_volumn(code) |
| | | if today is None or max60 is None or yesterday is None: |
| | | raise Exception("获取量失败") |
| | | rate = round(int(today) / max(int(max60[0]), int(yesterday)), 2) |
| | | rate = round((int(today) + total_sell_volume) / max(int(max60[0]), int(yesterday)), 2) |
| | | if not with_info: |
| | | return rate |
| | | return rate, (today, max(int(max60[0]), int(yesterday))) |
| | | |
| | | |
| | | # 获取量参考日期 |
| | | def get_volume_refer_date(code): |
| | | max60, yesterday = get_histry_volumn(code) |
| | | if max60 is None or yesterday is None: |
| | | raise Exception("获取失败") |
| | | if int(max60[0]) >= int(yesterday): |
| | | return max60[1] |
| | | else: |
| | | return "上个交易日" |
| | | |
| | | |
| | | # 获取量比索引 |
| | | def get_volume_rate_index(volume_rate): |
| | | rates = [0.2, 0.4, 0.6, 0.8, 1, 1.2, 1.4, 1.6] |