@ -0,0 +1,41 @@ |
||||
# Python |
||||
__pycache__/ |
||||
*.py[cod] |
||||
*$py.class |
||||
*.so |
||||
.Python |
||||
build/ |
||||
develop-eggs/ |
||||
dist/ |
||||
downloads/ |
||||
eggs/ |
||||
.eggs/ |
||||
lib/ |
||||
lib64/ |
||||
parts/ |
||||
sdist/ |
||||
var/ |
||||
wheels/ |
||||
*.egg-info/ |
||||
.installed.cfg |
||||
*.egg |
||||
|
||||
# PyInstaller |
||||
*.manifest |
||||
*.spec |
||||
WorldQuant_Brain_Alpha_Generator.spec |
||||
|
||||
# Credentials |
||||
brain_credentials.txt |
||||
|
||||
# Generated files |
||||
alpha_ids.txt |
||||
|
||||
# Mac |
||||
.DS_Store |
||||
mac/dist/ |
||||
mac/build/ |
||||
|
||||
# Windows |
||||
dist/ |
||||
build/ |
||||
@ -0,0 +1,108 @@ |
||||
"""Alpha 策略生成模块""" |
||||
|
||||
|
||||
class AlphaStrategy: |
||||
def get_simulation_data(self, datafields, mode=1): |
||||
"""根据模式生成策略列表""" |
||||
|
||||
if mode == 1: |
||||
return self.generate_basic_strategy(datafields) |
||||
elif mode == 2: |
||||
return self.generate_multi_factor_strategy(datafields) |
||||
else: |
||||
print("❌ 无效的策略模式") |
||||
return [] |
||||
|
||||
def generate_basic_strategy(self, datafields): |
||||
"""生成基础策略""" |
||||
|
||||
strategies = [] |
||||
for field in datafields: |
||||
# 1. 日内策略 |
||||
strategies.extend([ |
||||
# 日内收益率 |
||||
"group_rank((close - open)/open, subindustry)", |
||||
|
||||
# 隔夜收益率 |
||||
"group_rank((open - delay(close, 1))/delay(close, 1), subindustry)", |
||||
|
||||
# 高低价差异 |
||||
"group_rank((high - low)/open, subindustry)" |
||||
]) |
||||
|
||||
# 2. 波动率策略 |
||||
strategies.extend([ |
||||
# 波动率偏度 |
||||
f"power(ts_std_dev(abs({field}), 30), 2) - power(ts_std_dev({field}, 30), 2)", |
||||
|
||||
# 波动率动态调整 |
||||
f"group_rank(std({field}, 20)/mean({field}, 20) * (1/cap), subindustry)" |
||||
]) |
||||
|
||||
# 3. 成交量策略 |
||||
if field in ['volume', 'turnover']: |
||||
strategies.extend([ |
||||
# 成交量异常 |
||||
"group_rank((volume/sharesout - mean(volume/sharesout, 20))/std(volume/sharesout, 20), subindustry)", |
||||
|
||||
# 成交量趋势 |
||||
"ts_corr(volume/sharesout, abs(returns), 10)" |
||||
]) |
||||
|
||||
# 4. 市场微观结构 |
||||
strategies.extend([ |
||||
# 小单买卖压力 |
||||
f"group_neutralize(power(rank({field} - group_mean({field}, 1, subindustry)), 3), bucket(rank(cap), range='0,1,0.1'))", |
||||
|
||||
# 流动性压力 |
||||
f"group_rank(correlation({field}, volume/sharesout, 20), subindustry)" |
||||
]) |
||||
|
||||
# 5. 条件触发策略 |
||||
strategies.extend([ |
||||
# 条件触发 |
||||
f"trade_when(ts_rank(ts_std_dev(returns, 10), 252) < 0.9, {field}, -1)", |
||||
|
||||
# 市场状态过滤 |
||||
f"trade_when(volume > mean(volume, 20), {field}, -1)" |
||||
]) |
||||
|
||||
return strategies |
||||
|
||||
def generate_multi_factor_strategy(self, datafields): |
||||
"""生成多因子组合策略""" |
||||
|
||||
strategies = [] |
||||
n = len(datafields) |
||||
|
||||
for i in range(0, n-1, 2): |
||||
field1 = datafields[i] |
||||
field2 = datafields[i+1] |
||||
|
||||
# 1. 回归中性化 |
||||
strategies.extend([ |
||||
f"regression_neut(vector_neut({field1}, {field2}), abs(ts_mean(returns, 252)/ts_std_dev(returns, 252)))", |
||||
|
||||
# 多重回归 |
||||
f"regression_neut(regression_neut({field1}, {field2}), ts_std_dev(returns, 30))" |
||||
]) |
||||
|
||||
# 2. 条件组合 |
||||
strategies.extend([ |
||||
# 条件选择 |
||||
f"if_else(rank({field1}) > 0.5, {field2}, -1 * {field2})", |
||||
|
||||
# 分组组合 |
||||
f"group_neutralize({field1} * {field2}, bucket(rank(cap), range='0.1,1,0.1'))" |
||||
]) |
||||
|
||||
# 3. 复杂信号 |
||||
strategies.extend([ |
||||
# 信号强度 |
||||
f"power(rank(group_neutralize(-ts_decay_exp_window(ts_sum(if_else({field1}-group_mean({field1},1,industry)-0.02>0,1,0)*ts_corr({field2},cap,5),3),50),industry)),2)", |
||||
|
||||
# 市场状态 |
||||
f"trade_when(ts_rank(ts_std_dev(returns,10),252)<0.9, {field1} * {field2}, -1)" |
||||
]) |
||||
|
||||
return strategies |
||||
@ -0,0 +1,54 @@ |
||||
import PyInstaller.__main__ |
||||
import os |
||||
import sys |
||||
import shutil |
||||
|
||||
# 确保目录存在 |
||||
if not os.path.exists('dist'): |
||||
os.makedirs('dist') |
||||
|
||||
# 设置命令行参数 |
||||
args = [ |
||||
'main.py', # 主程序入口 |
||||
'--name=Alpha_工具', # 可执行文件名 |
||||
'--onefile', # 打包成单个文件 |
||||
'--console', # 使用控制台窗口(改为控制台模式) |
||||
'--add-data=dataset_config.py{0}.'.format(os.pathsep), # 添加配置文件 |
||||
'--add-data=alpha_strategy.py{0}.'.format(os.pathsep), # 添加策略文件 |
||||
'--add-data=brain_batch_alpha.py{0}.'.format(os.pathsep), # 添加核心处理文件 |
||||
'--clean', # 清理临时文件 |
||||
'--noconfirm', # 不确认覆盖 |
||||
] |
||||
|
||||
# 如果有图标文件,添加图标 |
||||
if os.path.exists('icon.ico'): |
||||
args.append('--icon=icon.ico') |
||||
|
||||
# 运行打包命令 |
||||
PyInstaller.__main__.run(args) |
||||
|
||||
# 打包完成后,复制或创建配置文件到dist目录 |
||||
print("\n正在处理配置文件...") |
||||
try: |
||||
# 处理认证文件 |
||||
if os.path.exists('brain_credentials.txt'): |
||||
shutil.copy2('brain_credentials.txt', 'dist/') |
||||
print("✅ brain_credentials.txt 复制成功") |
||||
else: |
||||
# 创建示例认证文件 |
||||
with open('dist/brain_credentials.txt', 'w') as f: |
||||
f.write('["your_email@example.com","your_password"]') |
||||
print("✅ 创建了示例 brain_credentials.txt") |
||||
|
||||
# 处理Alpha ID文件 |
||||
if os.path.exists('alpha_ids.txt'): |
||||
shutil.copy2('alpha_ids.txt', 'dist/') |
||||
print("✅ alpha_ids.txt 复制成功") |
||||
else: |
||||
# 创建空的alpha_ids.txt |
||||
with open('dist/alpha_ids.txt', 'w') as f: |
||||
... |
||||
print("✅ 创建了空的 alpha_ids.txt") |
||||
|
||||
except Exception as e: |
||||
print(f"❌ 处理配置文件时出错: {str(e)}") |
||||
@ -0,0 +1,52 @@ |
||||
import PyInstaller.__main__ |
||||
import os |
||||
import sys |
||||
import shutil |
||||
|
||||
# 确保目录存在 |
||||
if not os.path.exists('dist'): |
||||
os.makedirs('dist') |
||||
|
||||
# 设置命令行参数 |
||||
args = [ |
||||
'main.py', # 主程序入口 |
||||
'--name=Alpha_工具', # 可执行文件名 |
||||
'--onefile', # 打包成单个文件 |
||||
'--console', # 使用控制台窗口 |
||||
'--add-data=dataset_config.py{0}.'.format(os.pathsep), # 添加配置文件 |
||||
'--add-data=alpha_strategy.py{0}.'.format(os.pathsep), # 添加策略文件 |
||||
'--add-data=brain_batch_alpha.py{0}.'.format(os.pathsep), # 添加核心处理文件 |
||||
'--clean', # 清理临时文件 |
||||
'--noconfirm', # 不确认覆盖 |
||||
] |
||||
|
||||
# 如果有图标文件,添加图标 |
||||
if os.path.exists('icon.ico'): |
||||
args.append('--icon=icon.ico') |
||||
|
||||
# 运行打包命令 |
||||
PyInstaller.__main__.run(args) |
||||
|
||||
# 打包完成后,复制或创建配置文件到dist目录 |
||||
print("\n正在处理配置文件...") |
||||
try: |
||||
# 处理认证文件 |
||||
if os.path.exists('brain_credentials.txt'): |
||||
shutil.copy2('brain_credentials.txt', 'dist/') |
||||
print("✅ brain_credentials.txt 复制成功") |
||||
else: |
||||
with open('dist/brain_credentials.txt', 'w') as f: |
||||
f.write('["your_email@example.com","your_password"]') |
||||
print("✅ 创建了示例 brain_credentials.txt") |
||||
|
||||
# 处理Alpha ID文件 |
||||
if os.path.exists('alpha_ids.txt'): |
||||
shutil.copy2('alpha_ids.txt', 'dist/') |
||||
print("✅ alpha_ids.txt 复制成功") |
||||
else: |
||||
with open('dist/alpha_ids.txt', 'w') as f: |
||||
... |
||||
print("✅ 创建了空的 alpha_ids.txt") |
||||
|
||||
except Exception as e: |
||||
print(f"❌ 处理配置文件时出错: {str(e)}") |
||||
@ -0,0 +1,88 @@ |
||||
import zipapp |
||||
import os |
||||
import shutil |
||||
import subprocess |
||||
import sys |
||||
|
||||
|
||||
def create_zipapp(): |
||||
# 创建临时目录 |
||||
build_dir = "build" |
||||
if os.path.exists(build_dir): |
||||
shutil.rmtree(build_dir) |
||||
os.makedirs(build_dir) |
||||
|
||||
# 复制源文件 |
||||
source_files = [ |
||||
"main.py", |
||||
"brain_batch_alpha.py", |
||||
"alpha_strategy.py", |
||||
"dataset_config.py", |
||||
] |
||||
|
||||
for file in source_files: |
||||
shutil.copy2(file, build_dir) |
||||
|
||||
# 复制配置文件 |
||||
config_files = [ |
||||
"brain_credentials.txt", |
||||
"alpha_ids.txt", |
||||
] |
||||
|
||||
for file in config_files: |
||||
if os.path.exists(file): |
||||
shutil.copy2(file, build_dir) |
||||
else: |
||||
print(f"Warning: {file} not found, will be created on first run") |
||||
|
||||
# 创建 requirements.txt |
||||
with open(os.path.join(build_dir, "requirements.txt"), "w") as f: |
||||
f.write("requests>=2.31.0\npandas>=2.0.0\n") |
||||
|
||||
# 创建 __main__.py |
||||
with open(os.path.join(build_dir, "__main__.py"), "w") as f: |
||||
f.write(""" |
||||
import sys |
||||
import os |
||||
|
||||
|
||||
def install_deps(): |
||||
import subprocess |
||||
import pkg_resources |
||||
|
||||
required = {'requests>=2.31.0', 'pandas>=2.0.0'} |
||||
installed = {f"{pkg.key}=={pkg.version}" for pkg in pkg_resources.working_set} |
||||
missing = required - installed |
||||
|
||||
if missing: |
||||
subprocess.check_call([sys.executable, '-m', 'pip', 'install', *missing]) |
||||
|
||||
|
||||
if __name__ == '__main__': |
||||
# 安装依赖 |
||||
install_deps() |
||||
|
||||
# 导入主程序 |
||||
from main import main |
||||
main() |
||||
""") |
||||
|
||||
# 创建可执行文件 |
||||
output = "Alpha_Tool.pyz" |
||||
if os.path.exists(output): |
||||
os.remove(output) |
||||
|
||||
zipapp.create_archive( |
||||
build_dir, |
||||
output, |
||||
main="__main__:main", |
||||
compressed=True |
||||
) |
||||
|
||||
print(f"\n✅ 成功创建 {output}") |
||||
print("使用方法:") |
||||
print(f"python {output}") |
||||
|
||||
|
||||
if __name__ == "__main__": |
||||
create_zipapp() |
||||
@ -0,0 +1,110 @@ |
||||
"""数据集配置管理模块""" |
||||
|
||||
DATASET_CONFIGS = { |
||||
'fundamental6': { |
||||
'id': 'fundamental6', |
||||
'universe': 'TOP3000', |
||||
'description': '基础财务数据', |
||||
'api_settings': { |
||||
'instrumentType': 'EQUITY', |
||||
'region': 'USA', |
||||
'delay': 1, |
||||
'decay': 0, |
||||
'neutralization': 'SUBINDUSTRY', |
||||
'truncation': 0.08, |
||||
'pasteurization': 'ON', |
||||
'unitHandling': 'VERIFY', |
||||
'nanHandling': 'ON', |
||||
'language': 'FASTEXPR' |
||||
}, |
||||
'fields': [ |
||||
'assets', 'liabilities', 'revenue', 'netincome', |
||||
'cash', 'debt', 'equity', 'eps', 'pe_ratio', |
||||
'pb_ratio', 'market_cap', 'dividend_yield' |
||||
] |
||||
}, |
||||
'analyst4': { |
||||
'id': 'analyst4', |
||||
'universe': 'TOP1000', |
||||
'description': '分析师预测数据', |
||||
'api_settings': { |
||||
'instrumentType': 'EQUITY', |
||||
'region': 'USA', |
||||
'delay': 1, |
||||
'decay': 0, |
||||
'neutralization': 'SUBINDUSTRY', |
||||
'truncation': 0.08, |
||||
'pasteurization': 'ON', |
||||
'unitHandling': 'VERIFY', |
||||
'nanHandling': 'ON', |
||||
'language': 'FASTEXPR' |
||||
}, |
||||
'fields': [ |
||||
'anl4_tbvps_low', 'anl4_tbvps_high', |
||||
'anl4_tbvps_mean', 'anl4_tbvps_median' |
||||
] |
||||
}, |
||||
'pv1': { |
||||
'id': 'pv1', |
||||
'universe': 'TOP1000', |
||||
'description': '股市成交量数据', |
||||
'api_settings': { |
||||
'instrumentType': 'EQUITY', |
||||
'region': 'USA', |
||||
'delay': 1, |
||||
'decay': 0, |
||||
'neutralization': 'SUBINDUSTRY', |
||||
'truncation': 0.08, |
||||
'pasteurization': 'ON', |
||||
'unitHandling': 'VERIFY', |
||||
'nanHandling': 'ON', |
||||
'language': 'FASTEXPR' |
||||
}, |
||||
'fields': [ |
||||
'volume', 'close', 'open', 'high', 'low', |
||||
'vwap', 'returns', 'turnover', 'volatility' |
||||
] |
||||
} |
||||
} |
||||
|
||||
|
||||
def get_dataset_list(): |
||||
"""获取所有可用数据集列表""" |
||||
|
||||
return [ |
||||
f"{idx+1}: {name} ({config['universe']}) - {config['description']}" |
||||
for idx, (name, config) in enumerate(DATASET_CONFIGS.items()) |
||||
] |
||||
|
||||
|
||||
def get_dataset_config(dataset_name): |
||||
"""获取指定数据集的配置""" |
||||
|
||||
return DATASET_CONFIGS.get(dataset_name) |
||||
|
||||
|
||||
def get_dataset_by_index(index): |
||||
"""通过索引获取数据集名称""" |
||||
|
||||
try: |
||||
return list(DATASET_CONFIGS.keys())[int(index)-1] |
||||
except (IndexError, ValueError): |
||||
return None |
||||
|
||||
|
||||
def get_dataset_fields(dataset_name): |
||||
"""获取指定数据集的字段列表""" |
||||
|
||||
config = DATASET_CONFIGS.get(dataset_name) |
||||
return config['fields'] if config else [] |
||||
|
||||
|
||||
def get_api_settings(dataset_name): |
||||
"""获取指定数据集的API设置""" |
||||
|
||||
config = DATASET_CONFIGS.get(dataset_name) |
||||
if config and 'api_settings' in config: |
||||
settings = config['api_settings'].copy() |
||||
settings['universe'] = config['universe'] |
||||
return settings |
||||
return None |
||||
@ -0,0 +1,69 @@ |
||||
import PyInstaller.__main__ |
||||
import os |
||||
import sys |
||||
import shutil |
||||
|
||||
# 获取项目根目录的绝对路径 |
||||
ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) |
||||
|
||||
# 创建 mac 目录 |
||||
mac_dir = os.path.dirname(os.path.abspath(__file__)) |
||||
mac_dist_dir = os.path.join(mac_dir, 'dist') |
||||
if not os.path.exists(mac_dir): |
||||
os.makedirs(mac_dir) |
||||
if not os.path.exists(mac_dist_dir): |
||||
os.makedirs(mac_dist_dir) |
||||
|
||||
# 设置命令行参数 |
||||
args = [ |
||||
os.path.join(ROOT_DIR, 'main.py'), # 主程序入口 |
||||
'--name=Alpha_Tool', # Mac版本名称 |
||||
'--onefile', # 打包成单个文件 |
||||
'--console', # 使用控制台窗口 |
||||
f'--add-data={os.path.join(ROOT_DIR, "dataset_config.py")}{os.pathsep}.', |
||||
f'--add-data={os.path.join(ROOT_DIR, "alpha_strategy.py")}{os.pathsep}.', |
||||
f'--add-data={os.path.join(ROOT_DIR, "brain_batch_alpha.py")}{os.pathsep}.', |
||||
'--clean', |
||||
'--noconfirm', |
||||
f'--distpath={mac_dist_dir}', |
||||
f'--workpath={os.path.join(mac_dir, "build")}', |
||||
f'--specpath={mac_dir}' |
||||
] |
||||
|
||||
# 如果有 Mac 图标文件,添加图标 |
||||
icon_path = os.path.join(mac_dir, 'icon.icns') |
||||
if os.path.exists(icon_path): |
||||
args.append(f'--icon={icon_path}') |
||||
|
||||
try: |
||||
# 运行打包命令 |
||||
PyInstaller.__main__.run(args) |
||||
|
||||
# 打包完成后,复制或创建配置文件到 dist 目录 |
||||
print("\n正在处理配置文件...") |
||||
|
||||
# 处理认证文件 |
||||
credentials_src = os.path.join(ROOT_DIR, 'brain_credentials.txt') |
||||
if os.path.exists(credentials_src): |
||||
shutil.copy2(credentials_src, mac_dist_dir) |
||||
print("✅ brain_credentials.txt 复制成功") |
||||
else: |
||||
with open(os.path.join(mac_dist_dir, 'brain_credentials.txt'), 'w') as f: |
||||
f.write('["your_email@example.com","your_password"]') |
||||
print("✅ 创建了示例 brain_credentials.txt") |
||||
|
||||
# 处理 Alpha ID 文件 |
||||
alpha_ids_src = os.path.join(ROOT_DIR, 'alpha_ids.txt') |
||||
if os.path.exists(alpha_ids_src): |
||||
shutil.copy2(alpha_ids_src, mac_dist_dir) |
||||
print("✅ alpha_ids.txt 复制成功") |
||||
else: |
||||
with open(os.path.join(mac_dist_dir, 'alpha_ids.txt'), 'w') as f: |
||||
... |
||||
print("✅ 创建了空的 alpha_ids.txt") |
||||
|
||||
print(f"\n✅ Mac 版本打包完成! 文件位于 {mac_dist_dir}") |
||||
|
||||
except Exception as e: |
||||
print(f"\n❌ 打包过程出错: {str(e)}") |
||||
sys.exit(1) |
||||
|
After Width: | Height: | Size: 56 KiB |
|
After Width: | Height: | Size: 62 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 30 KiB |
|
After Width: | Height: | Size: 823 B |
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 30 KiB |
|
After Width: | Height: | Size: 62 KiB |
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 5.8 KiB |
|
After Width: | Height: | Size: 62 KiB |
|
After Width: | Height: | Size: 62 KiB |
|
After Width: | Height: | Size: 5.8 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 62 KiB |
@ -0,0 +1,98 @@ |
||||
"""WorldQuant Brain 批量 Alpha 生成系统""" |
||||
|
||||
import os |
||||
|
||||
from brain_batch_alpha import BrainBatchAlpha |
||||
from dataset_config import get_dataset_by_index, get_dataset_list |
||||
|
||||
STORAGE_ALPHA_ID_PATH = "alpha_ids.txt" |
||||
|
||||
|
||||
def submit_alpha_ids(brain, num_to_submit=2): |
||||
"""提交保存的 Alpha ID""" |
||||
try: |
||||
if not os.path.exists(STORAGE_ALPHA_ID_PATH): |
||||
print("❌ 没有找到保存的Alpha ID文件") |
||||
return |
||||
|
||||
with open(STORAGE_ALPHA_ID_PATH, 'r') as f: |
||||
alpha_ids = [line.strip() for line in f.readlines() if line.strip()] |
||||
|
||||
if not alpha_ids: |
||||
print("❌ 没有可提交的Alpha ID") |
||||
return |
||||
|
||||
print("\n📝 已保存的Alpha ID列表:") |
||||
for i, alpha_id in enumerate(alpha_ids, 1): |
||||
print(f"{i}. {alpha_id}") |
||||
|
||||
if num_to_submit > len(alpha_ids): |
||||
num_to_submit = len(alpha_ids) |
||||
|
||||
selected_ids = alpha_ids[:num_to_submit] |
||||
successful, failed = brain.submit_multiple_alphas(selected_ids) |
||||
|
||||
# 更新 alpha_ids.txt |
||||
remaining_ids = [id for id in alpha_ids if id not in successful] |
||||
with open(STORAGE_ALPHA_ID_PATH, 'w') as f: |
||||
f.writelines([f"{id}\n" for id in remaining_ids]) |
||||
|
||||
except Exception as e: |
||||
print(f"❌ 提交 Alpha 时出错: {str(e)}") |
||||
|
||||
|
||||
def main(): |
||||
"""主程序入口""" |
||||
try: |
||||
print("🚀 启动 WorldQuant Brain 批量 Alpha 生成系统") |
||||
|
||||
print("\n📋 请选择运行模式:") |
||||
print("1: 自动模式 (测试并自动提交 2 个合格 Alpha)") |
||||
print("2: 仅测试模式 (测试并保存合格 Alpha ID)") |
||||
print("3: 仅提交模式 (提交已保存的合格 Alpha ID)") |
||||
|
||||
mode = int(input("\n请选择模式 (1-3): ")) |
||||
if mode not in [1, 2, 3]: |
||||
print("❌ 无效的模式选择") |
||||
return |
||||
|
||||
brain = BrainBatchAlpha() |
||||
|
||||
if mode in [1, 2]: |
||||
print("\n📊 可用数据集列表:") |
||||
for dataset in get_dataset_list(): |
||||
print(dataset) |
||||
|
||||
dataset_index = input("\n请选择数据集编号: ") |
||||
dataset_name = get_dataset_by_index(dataset_index) |
||||
if not dataset_name: |
||||
print("❌ 无效的数据集编号") |
||||
return |
||||
|
||||
print("\n📈 可用策略模式:") |
||||
print("1: 基础策略模式") |
||||
print("2: 多因子组合模式") |
||||
|
||||
strategy_mode = int(input("\n请选择策略模式 (1-2): ")) |
||||
if strategy_mode not in [1, 2]: |
||||
print("❌ 无效的策略模式") |
||||
return |
||||
|
||||
results = brain.simulate_alphas(None, strategy_mode, dataset_name) |
||||
|
||||
if mode == 1: |
||||
submit_alpha_ids(brain, 2) |
||||
|
||||
elif mode == 3: |
||||
num_to_submit = int(input("\n请输入要提交的 Alpha 数量: ")) |
||||
if num_to_submit <= 0: |
||||
print("❌ 无效的提交数量") |
||||
return |
||||
submit_alpha_ids(brain, num_to_submit) |
||||
|
||||
except Exception as e: |
||||
print(f"❌ 程序运行出错: {str(e)}") |
||||
|
||||
|
||||
if __name__ == "__main__": |
||||
main() |
||||
@ -0,0 +1,4 @@ |
||||
requests>=2.31.0 |
||||
pandas>=2.0.0 |
||||
pyinstaller>=5.13.2 |
||||
pillow>=10.0.0 |
||||
@ -0,0 +1,29 @@ |
||||
from setuptools import setup, find_packages |
||||
|
||||
|
||||
setup( |
||||
name="Alpha_Tool", |
||||
version="1.0.0", |
||||
author="YourName", |
||||
description="WorldQuant Brain Alpha Generator", |
||||
packages=find_packages(), |
||||
python_requires=">=3.8", |
||||
install_requires=[ |
||||
"requests>=2.31.0", |
||||
"pandas>=2.0.0", |
||||
], |
||||
entry_points={ |
||||
'console_scripts': [ |
||||
'alpha_tool=main:main', |
||||
], |
||||
}, |
||||
# 包含非Python文件 |
||||
package_data={ |
||||
'': ['*.txt', '*.json', '*.ico', '*.png'], |
||||
}, |
||||
# 额外信息 |
||||
classifiers=[ |
||||
"Programming Language :: Python :: 3", |
||||
"Operating System :: OS Independent", |
||||
], |
||||
) |
||||
|
After Width: | Height: | Size: 66 KiB |