Files
stonks-oracle/pipelines/kargo/market-hours-check.yaml
T
Celes Renata c85c0068a2 fix: clean up utcnow deprecation warnings, fix 12 failing tests, add CI/CD pipeline manifests
- Replace all datetime.utcnow() with datetime.now(tz=timezone.utc) across 8 files
- Fix 12 failing tests to match current implementation behavior
- Fix pytest_plugins in non-top-level conftest (moved to root conftest.py)
- Auto-fix 189 lint issues (import sorting, unused imports)
- Add CI/CD pipeline infrastructure (ARC, ArgoCD, Kargo manifests)
- Add values-beta.yaml and values-paper.yaml for staged deployments
- Update GitHub Actions workflow to use self-hosted-gremlin runners
- Add integration-test job to CI pipeline

Result: 1596 passed, 0 failed, 0 warnings
2026-04-18 03:59:28 +00:00

39 lines
1.4 KiB
YAML

apiVersion: argoproj.io/v1alpha1
kind: AnalysisTemplate
metadata:
name: market-hours-check
namespace: stonks-oracle
spec:
metrics:
- name: outside-market-hours
provider:
job:
spec:
template:
spec:
containers:
- name: check
image: alpine:3.19
command: [sh, -c]
args:
- |
apk add --no-cache tzdata
export TZ=America/New_York
DOW=$(date +%u) # 1=Mon, 7=Sun
HOUR=$(date +%H)
MIN=$(date +%M)
TIME_MIN=$((HOUR * 60 + MIN))
MARKET_OPEN=570 # 09:30
MARKET_CLOSE=960 # 16:00
if [ "$DOW" -ge 6 ]; then
echo "Weekend — promotions allowed"
exit 0
fi
if [ "$TIME_MIN" -lt "$MARKET_OPEN" ] || [ "$TIME_MIN" -ge "$MARKET_CLOSE" ]; then
echo "Outside market hours — promotions allowed"
exit 0
fi
echo "Market hours active ($(date)) — promotion blocked"
exit 1
restartPolicy: Never