jack 3 weeks ago
parent 22ef11dfcc
commit eb28ea72b1
  1. 5
      alpha-fetcher-gui/go.mod
  2. 2
      alpha-fetcher-gui/go.sum
  3. 5
      fetch-alphas/wqb-get-alphas-one-week.py
  4. 4
      rpc_batch_fetch_dataset/rpc_create_dataset_record.py
  5. 65
      test/wqb-fetch-universe/fetch_universe.py
  6. 13
      test/wqb-fetch-universe/test.py

@ -0,0 +1,5 @@
module alpha-fetcher-gui
go 1.25.1
require fyne.io/fyne/v2 v2.7.3 // indirect

@ -0,0 +1,2 @@
fyne.io/fyne/v2 v2.7.3 h1:xBT/iYbdnNHONWO38fZMBrVBiJG8rV/Jypmy4tVfRWE=
fyne.io/fyne/v2 v2.7.3/go.mod h1:gu+dlIcZWSzKZmnrY8Fbnj2Hirabv2ek+AKsfQ2bBlw=

@ -100,10 +100,7 @@ class AlphaManager:
except Exception as e:
self.logger.error(f"标记颜色失败: {e}")
return False
def wechat_check_corr_message(self, message: str):
"""微信通知(可选功能)"""
self.logger.info(f"通知消息: {message}")
def _make_request_with_retry(self, url: str, max_retries: int = 3, retry_delay: float = 2.0):
"""

@ -10,7 +10,7 @@ params = {
'limit': 50,
'order': '-coverage',
'region': 'EUR',
'universe': 'TOP2500'
'universe': 'TOP1200'
}
need_save = 0
@ -121,7 +121,7 @@ if client:
if all_results:
# 输出 coverage 大于 0.5 的数据的 id
print("\ncoverage > 0.5 的数据 ID:")
print("\ncoverage > 0.5 的数据 ID:\n")
coverage_ids = []
for item in all_results:
if 'coverage' in item and item['coverage'] > 0.5:

@ -0,0 +1,65 @@
# -*- coding: utf-8 -*-
import httpx
from httpx import BasicAuth
def login():
"""登录WorldQuant Brain API"""
# 从nacos获取账号密码
nacos_resp = httpx.get('http://192.168.31.41:30848/nacos/v1/cs/configs?dataId=wq_account&group=quantify')
if nacos_resp.status_code != 200:
print('获取账号密码失败')
return False
config = nacos_resp.json()
username = config['user_name']
password = config['password']
print(f"正在登录账户: {username}")
# 创建客户端并认证
client = httpx.Client(auth=BasicAuth(username, password))
# 发送登录请求
response = client.post('https://api.worldquantbrain.com/authentication')
print(f"登录状态: {response.status_code}")
if response.status_code == 201:
print("登录成功!")
print(response.json())
return client
else:
print(f"登录失败: {response.json()}")
client.close()
return None
def fetch_universe(client):
try:
response = client.options('https://api.worldquantbrain.com/simulations')
print(f"Options请求状态: {response.status_code}")
results = response.json()
except Exception as e:
print(f"Options请求失败: {e}")
return {}
return results
# 使用示例
client = login()
if client:
results = fetch_universe(client)
universe_data = (results.get('actions', {})
.get('POST', {})
.get('settings', {})
.get('children', {})
.get('universe', {})
.get('choices', {})
.get('instrumentType', {})
.get('EQUITY', {})
.get('region', {})
)
print(universe_data)
client.close()

@ -0,0 +1,13 @@
# -*- coding: utf-8 -*-
data = {'USA': [{'value': 'TOP3000', 'label': 'TOP3000'}, {'value': 'TOP1000', 'label': 'TOP1000'}, {'value': 'TOP500', 'label': 'TOP500'}, {'value': 'TOP200', 'label': 'TOP200'},
{'value': 'ILLIQUID_MINVOL1M', 'label': 'ILLIQUID_MINVOL1M'}, {'value': 'TOPSP500', 'label': 'TOPSP500'}],
'GLB': [{'value': 'TOP3000', 'label': 'TOP3000'}, {'value': 'MINVOL1M', 'label': 'MINVOL1M'}, {'value': 'TOPDIV3000', 'label': 'TOPDIV3000'}],
'EUR': [{'value': 'TOP2500', 'label': 'TOP2500'}, {'value': 'TOP1200', 'label': 'TOP1200'}, {'value': 'TOP800', 'label': 'TOP800'}, {'value': 'TOP400', 'label': 'TOP400'},
{'value': 'ILLIQUID_MINVOL1M', 'label': 'ILLIQUID_MINVOL1M'}, {'value': 'TOPCS1600', 'label': 'TOPCS1600'}],
'ASI': [{'value': 'MINVOL1M', 'label': 'MINVOL1M'}, {'value': 'ILLIQUID_MINVOL1M', 'label': 'ILLIQUID_MINVOL1M'}], 'CHN': [{'value': 'TOP2000U', 'label': 'TOP2000U'}],
'KOR': [{'value': 'TOP600', 'label': 'TOP600'}], 'TWN': [{'value': 'TOP500', 'label': 'TOP500'}, {'value': 'TOP100', 'label': 'TOP100'}],
'IND': [{'value': 'TOP500', 'label': 'TOP500'}]}
result = {k: [item['value'] for item in v] for k, v in data.items()}
print(result)
Loading…
Cancel
Save