-
Notifications
You must be signed in to change notification settings - Fork 0
183 lines (178 loc) · 7.31 KB
/
Copy pathpublish_advisory_site.yml
File metadata and controls
183 lines (178 loc) · 7.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
name: Publish Intelligent Advisory Site
on:
workflow_dispatch:
inputs:
as_of:
description: "Report date. Defaults to the most recent fully closed Saturday when empty."
required: false
type: string
site_url:
description: "Public site URL used in RSS links."
required: false
default: "https://quantstrategylab.github.io/QuantAdvisorResearch"
type: string
political_events_path:
description: "Path inside PoliticalEventTrackingResearch."
required: false
default: "data/live/political_events.csv"
type: string
political_watchlist_path:
description: "Path inside PoliticalEventTrackingResearch."
required: false
default: "data/live/political_watchlist.csv"
type: string
ai_signal_path:
description: "Path inside ResearchSignalContextPipelines."
required: false
default: "data/output/latest_signal.json"
type: string
theme_momentum_path:
description: "Optional path inside ResearchSignalContextPipelines. Empty disables theme momentum context."
required: false
default: "data/output/theme_momentum_snapshot.json"
type: string
market_confirmation_path:
description: "Optional market confirmation CSV path inside advisor repository. Empty disables this input."
required: false
default: ""
type: string
market_data_proxy_urls:
description: "Optional comma/newline-separated public proxy URLs for free market data fetches."
required: false
default: ""
type: string
market_data_proxy_pool_url:
description: "Optional public text URL returning one proxy per line for free market data fetches."
required: false
default: ""
type: string
schedule:
- cron: "0 13 * * 6"
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: false
jobs:
build-site:
runs-on: ubuntu-latest
timeout-minutes: 60
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Checkout advisor repository
uses: actions/checkout@v6
with:
path: advisor
- name: Checkout political event repository
uses: actions/checkout@v6
with:
repository: QuantStrategyLab/PoliticalEventTrackingResearch
path: political-events
- name: Checkout signal context repository
uses: actions/checkout@v6
with:
repository: QuantStrategyLab/ResearchSignalContextPipelines
path: research-signal-context
- uses: actions/setup-python@v6
with:
python-version: "3.11"
- name: Install advisor package
working-directory: advisor
run: python -m pip install -e .
- name: Restore market data cache
uses: actions/cache/restore@v5
continue-on-error: true
with:
path: advisor/.cache/market-data
key: ${{ runner.os }}-qar-market-data-v1-${{ github.run_id }}-${{ github.run_attempt }}
restore-keys: |
${{ runner.os }}-qar-market-data-v1-
- name: Build report and static site
id: build_report
working-directory: advisor
env:
INPUT_AS_OF: ${{ github.event.inputs.as_of || '' }}
SITE_URL: ${{ github.event.inputs.site_url || 'https://quantstrategylab.github.io/QuantAdvisorResearch' }}
POLITICAL_EVENTS_PATH: ${{ github.event.inputs.political_events_path || 'data/live/political_events.csv' }}
POLITICAL_WATCHLIST_PATH: ${{ github.event.inputs.political_watchlist_path || 'data/live/political_watchlist.csv' }}
AI_SIGNAL_PATH: ${{ github.event.inputs.ai_signal_path || 'data/output/latest_signal.json' }}
THEME_MOMENTUM_PATH: ${{ github.event.inputs.theme_momentum_path || 'data/output/theme_momentum_snapshot.json' }}
MARKET_CONFIRMATION_PATH: ${{ github.event.inputs.market_confirmation_path || '' }}
MARKET_DATA_PROXY_URLS: ${{ github.event.inputs.market_data_proxy_urls || vars.MARKET_DATA_PROXY_URLS || '' }}
MARKET_DATA_PROXY_POOL_URL: ${{ github.event.inputs.market_data_proxy_pool_url || vars.MARKET_DATA_PROXY_POOL_URL || '' }}
run: |
set -euo pipefail
if [ -n "${INPUT_AS_OF}" ]; then
AS_OF="${INPUT_AS_OF}"
else
AS_OF="$(python -c 'from quant_advisor_research.build_pipeline import default_weekly_as_of; print(default_weekly_as_of().isoformat())')"
fi
mkdir -p .cache/market-data
ARGS=(
--as-of "${AS_OF}"
--cadence weekly
--political-events "../political-events/${POLITICAL_EVENTS_PATH}"
--political-watchlist "../political-events/${POLITICAL_WATCHLIST_PATH}"
--ai-signal "../research-signal-context/${AI_SIGNAL_PATH}"
--output-dir data/output/published
--site-output-dir site
--site-url "${SITE_URL}"
--feed-title "智慧投顾研究系统"
--recover-site-archive
--market-cache-dir .cache/market-data
--recommendation-review
)
if [ -n "${THEME_MOMENTUM_PATH}" ]; then
ARGS+=(--theme-momentum "../research-signal-context/${THEME_MOMENTUM_PATH}")
fi
if [ -n "${MARKET_CONFIRMATION_PATH}" ]; then
ARGS+=(--market-confirmation "${MARKET_CONFIRMATION_PATH}")
fi
if [ -n "${MARKET_DATA_PROXY_URLS}" ]; then
ARGS+=(--market-proxy-urls "${MARKET_DATA_PROXY_URLS}")
fi
if [ -n "${MARKET_DATA_PROXY_POOL_URL}" ]; then
ARGS+=(--market-proxy-pool-url "${MARKET_DATA_PROXY_POOL_URL}")
fi
python scripts/build_advisory_artifacts.py "${ARGS[@]}"
- name: Save market data cache
if: ${{ success() }}
uses: actions/cache/save@v5
continue-on-error: true
with:
path: advisor/.cache/market-data
key: ${{ runner.os }}-qar-market-data-v1-${{ github.run_id }}-${{ github.run_attempt }}
- name: Upload site artifact
uses: actions/upload-artifact@v7
with:
name: model-recommendations-site
path: advisor/site
if-no-files-found: error
- name: Configure Pages
uses: actions/configure-pages@v6
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v5
with:
path: advisor/site
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v5
- name: Notify Telegram subscribers
if: ${{ success() }}
continue-on-error: true
working-directory: advisor
env:
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
NOTIFY_LANG: ${{ vars.NOTIFY_LANG || 'zh' }}
SITE_URL: ${{ github.event.inputs.site_url || 'https://quantstrategylab.github.io/QuantAdvisorResearch' }}
REPORT_PATH: ${{ steps.build_report.outputs.report_path }}
run: |
set -euo pipefail
python scripts/notify_advisory_telegram.py \
--report "${REPORT_PATH}" \
--site-url "${SITE_URL}"