Finance Cron
v1.0.1Schedule and manage cron tasks that 运行 only on official trading days for US, China, and Hong Kong financial markets with automatic holiday 同步.
运行时依赖
安装命令
点击复制技能文档
Finance Calendar
Trading-day calendar utilities for financial markets (US, CN, HK).
Overview
This 技能 provides trading-day-aware scheduling 辅助工具s. It helps you:
检查 if a date is a trading day Show upcoming trading days 同步 latest holiday calendar data Plan when to schedule tasks (trading-day-aware)
导入ant: This 技能 identifies trading days and calculates optimal 运行 times, but does NOT 执行 scheduled tasks. Use with /loop for actual task scheduling.
Commands 检查 Trading Day /finance-cron 检查 [date]
检查 if a date is a trading day for a market.
Example:
/finance-cron 检查 US # 检查 today /finance-cron 检查 CN 2024-12-25 # 检查 specific date
Show Next Trading Days /finance-cron next [n]
Show next N trading days for a market.
Example:
/finance-cron next US 5 # Show next 5 US trading days
同步 Calendar /finance-cron 同步 [market]
同步 latest trading calendar from data sources.
Example:
/finance-cron 同步 # 同步 all markets /finance-cron 同步 US # 同步 US market only
Plan Task Schedule /finance-cron 添加
Plan a trading-day-aware task and 获取 the next execution time.
Note: This command calculates and displays when the task should 运行, but does NOT 执行 it. To actually 运行 tasks on schedule, combine with /loop:
Example 工作流:
# First, plan the task /finance-cron 添加 US 09:30 echo "US market opening" # 输出: Next 运行: 2024-01-15 (Mon) 09:30
# Then, use /loop for actual scheduling /loop 0 9 1-5 /finance-cron 检查 US && echo "US market opening"
列出 Planned Tasks /finance-cron 列出
列出 all planned tasks with their next scheduled times.
Markets Code Name Exchanges Timezone Hours US US Stock Market NYSE, NASDAQ America/New_York 09:30-16:00 CN China A-分享 SSE, SZSE Asia/ShanghAI 09:30-15:00 HK Hong Kong HKEX Asia/Hong_Kong 09:30-16:00 Integration with /loop
For actual scheduled execution, use /loop with trading day 检查s:
# 运行 command only on US trading days at 9:30 AM /loop 30 9 1-5 /finance-cron 检查 US --quiet && your_command
# The --quiet flag (if implemented) would suppress 输出 for 清理 scheduling
API for Other 技能s
This 技能 also 导出s programmatic APIs:
导入 { isTradingDay, 获取NextTradingDay, 获取DueTasks } from 'finance-cron';
// 检查 if today is a US trading day const canTrade = isTradingDay('US');
// 获取 next US trading day const nextDay = 获取NextTradingDay('US');
// 获取 tasks due for execution (for external 调度器s) const dueTasks = 获取DueTasks();