| | |
| | | return True, end_info[ |
| | | 1], f"时间段:{start_time}-{end_info[0]} 已成交/委托数量({codes})没有超过{end_info[2]}个,委托金额为:{end_info[1]}" |
| | | |
| | | @classmethod |
| | | def __get_possible_buy_moneys(cls): |
| | | """ |
| | | 获取可能的买入金额 |
| | | @return: |
| | | """ |
| | | moneys = set() |
| | | radical_buy_setting = BuyMoneyAndCountSetting().get_radical_buy_setting() |
| | | if radical_buy_setting: |
| | | moneys |= set([x[1] for x in radical_buy_setting[1]]) |
| | | normal_buy_setting = BuyMoneyAndCountSetting().get_normal_buy_setting() |
| | | if normal_buy_setting: |
| | | moneys |= set([x[1] for x in normal_buy_setting[1]]) |
| | | moneys.add(constant.BUY_MONEY_PER_CODE) |
| | | print(moneys) |
| | | return moneys |
| | | |
| | | @classmethod |
| | | def get_possible_buy_volumes(cls, limit_up_price): |
| | | """ |
| | | 获取所有可能下单的量 |
| | | @param limit_up_price: 涨停价 |
| | | @return: |
| | | """ |
| | | moneys = cls.__get_possible_buy_moneys() |
| | | total_volumes = set() |
| | | for money in moneys: |
| | | volumes = cls.get_possible_buy_volumes_by_money(limit_up_price, money) |
| | | if volumes: |
| | | total_volumes |= set(list(volumes)) |
| | | return total_volumes |
| | | |
| | | @classmethod |
| | | def get_possible_buy_volumes_by_money(cls, limit_up_price, money): |
| | | """ |
| | | 获取所有可能下单的量 |
| | | @param money: 金额 |
| | | @param limit_up_price: 涨停价 |
| | | @return: |
| | | """ |
| | | total_volume_unit_100 = tool.get_buy_volume_by_money(limit_up_price, money)//100 |
| | | if total_volume_unit_100 % 2 == 0: |
| | | return 100 * (total_volume_unit_100 // 2 - 1), 100 * (total_volume_unit_100 // 2 + 1) |
| | | else: |
| | | return 100 * (total_volume_unit_100 // 2), 100 * (total_volume_unit_100 // 2 + 1) |
| | | |
| | | |
| | | if __name__ == '__main__': |
| | | print(RadicalBuyBlockCodeCountManager().get_block_code_count("测试")) |
| | | print(BuyMoneyUtil.get_possible_buy_volumes(14.38)) |
| | | |
| | | # print(json.dumps(list(BuyMoneyUtil.get_possible_buy_moneys()))) |