| | |
| | | # usefulMoney * 0.9 * low_emotion_mood_ratio / Unfinished_opening_plan_number) |
| | | # 除以3应该是一个常量,如果以Unfinished_opening_plan_number,会出现float division by zero |
| | | |
| | | # 如果今日计划下单数量不为空 或 计划金额为默认值,那么就实时计算第一次计划金额,并固定记录下来 |
| | | # 如果今日计划下单数量不为空 或 计划金额为默认值,那么就实时计算第计划金额,记录下来 |
| | | if not data_cache.today_planned_order_amount or data_cache.today_first_planned_order_amount <= 0: |
| | | data_cache.today_planned_order_amount = usefulMoney * 0.95 * ideal_trading_market_score / 3 |
| | | logger.info(f"第一次实时计算计划下单金额==={data_cache.today_planned_order_amount}元") |
| | | logger.info(f"实时计算计划下单金额==={data_cache.today_planned_order_amount}元") |
| | | |
| | | # 开仓计划运行时间段 |
| | | # 计算并固定首次下单时的计划金额(有延迟误差) |
| | | # # 如果一日三仓的计划还未完成 且 首次开仓金额为0 |
| | | if Unfinished_opening_plan_number != 0 and data_cache.today_first_planned_order_amount <= 0: |
| | | # 如果GUI看盘手动设置了具体的下单金额【data_cache.BUY_MONEY_PER_CODE 中默认值为-1,只有当GUI看盘手动设置了并提交才会>=0】,就按照GUI设置的金额下单。否则就按照评分策略的金额下单, |
| | | # if data_cache.BUY_MONEY_PER_CODE >= 0: |
| | | # data_cache.today_planned_order_amount = data_cache.BUY_MONEY_PER_CODE |
| | | # logger.info(f"采用GUI设置方式=》今日计划下单金额:{data_cache.today_planned_order_amount}") |
| | | # else: |
| | | # # 如果今日还没有一个新增仓位,就不停计算更新计划金额 |
| | | # if addition_position_number > 0: |
| | | # data_cache.today_planned_order_amount = data_cache.opening_strategy_results |
| | | # logger.info(f"采用开仓策略计算方式=》今日计划下单金额:{data_cache.today_planned_order_amount}") |
| | | if addition_position_number > 0: |
| | | # 下过一次单过后再计算动态下单金额 |
| | | data_cache.today_first_planned_order_amount = float(data_cache.today_planned_order_amount) |