| | |
| | | def get_path_prefix(): |
| | | return 'D:' if is_windows() else '/home/userzjj' |
| | | |
| | | |
| | | # 定义log日志的路径 |
| | | LOG_PATH = f"{get_path_prefix()}/logs" |
| | | |
| | |
| | | K_BARS_PATH = f"{DATA_DIR_PATH}/all_stocks_all_K_line_property_dict.json" |
| | | # 每日涨停概念记录数据 |
| | | KPL_LIMIT_UP_DATA_PATH = f"{DATA_DIR_PATH}/limit_up_block_date_data.jsonl" |
| | | # 日内所有股票开盘数据存储 |
| | | # 日内所有股票开盘数据存储 [只是在初步编写时测试使用] |
| | | KPL_LIMIT_UP_BLOCK_NAMES_PATH = f"{DATA_DIR_PATH}/limit_up_block_names.json" |
| | | |
| | | |
| | | |
| | | # 订阅L2代码数据 |
| | | SUBSCRIPT_L2_CODES = set() |
| | |
| | | # 计算90天内涨停天数 |
| | | for i in k_line_data: |
| | | if 'attribute' in i and ( |
| | | i['attribute'] == 'one_line_limit_up' or i['attribute'] == 'limit_down_then_limit_up' or i[ |
| | | 'attribute'] == 'limit_up_then_limit_down_then_limit_up' or i['attribute'] == 'limit_up'): |
| | | i['attribute'] == 'one_line_limit_up' or i['attribute'] == 'limit_down_then_limit_up' or i['attribute'] == 'limit_up_then_limit_down_then_limit_up' or i['attribute'] == 'limit_up'): |
| | | limit_up_day += 1 |
| | | # print(f"涨停提日期:{i['bob']}") |
| | | # print(f"涨停天数----limit_up_day======{limit_up_day}") |
| | |
| | | logger.info( |
| | | f"最新价: {current_price}, 当日最高价:{current_high},瞬时涨幅: {tick_growth:.2f}%,当日当时涨幅:{today_growth}%,公司名称:{k_line_data[0]['sec_name']},当前时间:{current_created_at},低于水位线:{deep_low:.2f},交易量今日与昨日的比例{round(current_volume / k_line_data[0]['volume'], 2)}") |
| | | logger.info( |
| | | f"大盘情绪分数:{data_cache.real_time_market_strong},设想的下单金额:{data_cache.today_planned_order_amount}") |
| | | f"大盘综合强度分数:{data_cache.real_time_market_strong},大盘指数情绪预期分数==={data_cache.index_trend_expectation_score}分,设想的下单金额:{data_cache.today_planned_order_amount}") |
| | | # 调用下单方法下单 |
| | | order_methods.buy_order_by_value(symbol, data_cache.today_planned_order_amount, |
| | | k_line_data[0]['sec_name'], |
| | |
| | | logger.info( |
| | | f"最新价: {current_price}, 当日最高价:{current_high},瞬时涨幅: {tick_growth:.2f}%,当日当时涨幅:{today_growth}%,公司名称:{k_line_data[0]['sec_name']},当前时间:{current_created_at},低于水位线:{deep_low:.2f},交易量今日与昨日的比例{round(current_volume / k_line_data[0]['volume'], 2)}") # 输出当前价格和3秒涨幅信息 |
| | | logger.info( |
| | | f"大盘情绪分数:{data_cache.real_time_market_strong},设想的下单金额:{data_cache.today_planned_order_amount}") |
| | | f"大盘综合强度分数:{data_cache.real_time_market_strong},大盘指数情绪预期分数==={data_cache.index_trend_expectation_score}分,设想的下单金额:{data_cache.today_planned_order_amount}") |
| | | # 调用下单方法下单 |
| | | order_methods.buy_order_by_value(symbol, |
| | | data_cache.today_planned_order_amount, |
| | |
| | | TSXV_today_growth = 0 |
| | | # 创业板指 开盘涨幅 |
| | | TSXV_open_growth = 0 |
| | | # 大盘指数情绪预期分数 |
| | | index_trend_expectation_score = 0 |
| | | |
| | | # 每次买入的金额 |
| | | BUY_MONEY_PER_CODE = -1 |
| | |
| | | Shanghai_index_volume = round(Shanghai_index_data[1]/100000000, 2) # 上证指数 当日当时成交量 |
| | | Shanghai_index_turnover = round(Shanghai_index_data[2]/100000000, 2) # 上证指数 当日当时成交额度 |
| | | Shanghai_Yesterday_closing_index = round(Shanghai_index_data[3], 2) # 上证指数 昨日收盘指数 |
| | | logger.info(f"上证 指数:{Shanghai_index} 昨日收盘指数:{Shanghai_Yesterday_closing_index} 成交量------------{Shanghai_index_volume}亿 手 成交额------------{Shanghai_index_turnover}亿 元") |
| | | logger.info(f"上证 指数:{Shanghai_index} 昨日收盘指数:{Shanghai_Yesterday_closing_index} 成交量:{Shanghai_index_volume}亿 手 成交额:{Shanghai_index_turnover}亿 元") |
| | | |
| | | # 深证指数数据 |
| | | Shenzhen_index_data = current_info.get('399001') |
| | |
| | | Shenzhen_index_volume = round(Shenzhen_index_data[1]/100000000, 2) # 深证指数 当日当时成交量 |
| | | Shenzhen_index_turnover = round(Shenzhen_index_data[2]/100000000, 2) # 深证指数 当日当时成交额度 |
| | | Shenzhen_Yesterday_closing_index = round(Shenzhen_index_data[3], 2) # 深证指数 昨日收盘指数 |
| | | logger.info(f"深证 指数:{Shenzhen_index} 昨日收盘指数:{Shenzhen_Yesterday_closing_index} 成交量------------{Shenzhen_index_volume}亿 手 成交额------------{Shenzhen_index_turnover}亿 元") |
| | | logger.info(f"深证 指数:{Shenzhen_index} 昨日收盘指数:{Shenzhen_Yesterday_closing_index} 成交量:{Shenzhen_index_volume}亿 手 成交额:{Shenzhen_index_turnover}亿 元") |
| | | |
| | | # 创业板指数数据 |
| | | TSXV_index_data = current_info.get('399006') |
| | |
| | | TSXV_index_volume = round(TSXV_index_data[1]/100000000, 2) # 创业板指 当日当时成交量 |
| | | TSXV_index_turnover = round(TSXV_index_data[2]/100000000, 2) # 创业板指 当日当时成交额度 |
| | | TSXV_Yesterday_closing_index = round(TSXV_index_data[3], 2) # 深证指数 昨日收盘指数 |
| | | logger.info(f"创业板 指数:{TSXV_index} 昨日收盘指数:{TSXV_Yesterday_closing_index} 成交量------------{TSXV_index_volume}亿 手 成交额------------{TSXV_index_turnover}亿 元") |
| | | logger.info(f"创业板 指数:{TSXV_index} 昨日收盘指数:{TSXV_Yesterday_closing_index} 成交量:{TSXV_index_volume}亿 手 成交额:{TSXV_index_turnover}亿 元") |
| | | |
| | | # 调用涨幅公式计算对应的股票tick瞬时涨幅 |
| | | data_cache.Shanghai_tick_growth = basic_methods.tick_growth('000001', Shanghai_index) |
| | |
| | | ds.append(request_plate_codes(d)) |
| | | dask_result = batch_get_plate_codes(ds) |
| | | dask_result.compute() |
| | | now_time = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') |
| | | if data_cache.L1_data_start_time < now_time < data_cache.closing_time: |
| | | logger.info(f"精选板块股票强度数据更新 == {market_sift_plate_stock_dict}") |
| | | return market_sift_plate_stock_dict |
| | | |
| | |
| | | low_emotion_mood_ratio = 0 |
| | | logger.info(f"极端低迷情绪比例===={low_emotion_mood_ratio * 100}%") |
| | | |
| | | index_trend_expectation_score = index_trend_expectation() |
| | | logger.info(f"大盘指数情绪预期分数==={index_trend_expectation_score}分") |
| | | print(f"大盘指数情绪预期分数==={index_trend_expectation_score}分") |
| | | data_cache.index_trend_expectation_score = index_trend_expectation() |
| | | logger.info(f"大盘指数情绪预期分数==={data_cache.index_trend_expectation_score}分") |
| | | # print(f"大盘指数情绪预期分数==={data_cache.index_trend_expectation_score}分") |
| | | # 目前大盘指数情绪预期分数 尚不科学 强制设置为初始0值 |
| | | index_trend_expectation_score = 0 |
| | | |