diff --git a/README.md b/README.md index 7955f0e5f..1dfb52ed7 100644 --- a/README.md +++ b/README.md @@ -769,6 +769,9 @@ vibe-trading serve --port 8899 | `PUT` | `/settings/llm` | Update local LLM settings | | `GET` | `/settings/data-sources` | Read local data source settings | | `PUT` | `/settings/data-sources` | Update local data source settings | +| `POST` | `/scheduled-runs` | Create a scheduled research job (interval-ms or cron) | +| `GET` | `/scheduled-runs` | List scheduled jobs | +| `DELETE` | `/scheduled-runs/{job_id}` | Cancel a scheduled job | Interactive docs: `http://localhost:8899/docs` @@ -784,6 +787,29 @@ The Web UI Settings page lets local users update the LLM provider/model, base UR Settings reads are side-effect free: `GET /settings/llm` and `GET /settings/data-sources` never create `agent/.env`, and they only return project-relative paths. Settings reads and writes can expose credential state or update credentials/runtime environment, so they require `API_AUTH_KEY` when configured. If `API_AUTH_KEY` is unset for dev mode, settings access is accepted only from loopback clients. +### Scheduled research + +Run a research prompt or backtest on a repeating schedule. The background executor is **off by default** — start the server with `VIBE_TRADING_ENABLE_SCHEDULER=1` to enable it: + +```bash +VIBE_TRADING_ENABLE_SCHEDULER=1 vibe-trading serve --port 8899 +``` + +Then create jobs over REST. `schedule` is either a bare integer (interval in **milliseconds**) or a 5-field cron expression (`min hour dom mon dow`): + +```bash +# every 6 hours (cron) +curl -X POST http://localhost:8899/scheduled-runs \ + -H "Content-Type: application/json" \ + -d '{"prompt":"Scan CSI300 for momentum breakouts and backtest the top 5","schedule":"0 */6 * * *"}' + +# list / cancel +curl http://localhost:8899/scheduled-runs +curl -X DELETE http://localhost:8899/scheduled-runs/ +``` + +Each fire runs the `prompt` through a fresh agent session (optional backtest parameters go in `config`), and jobs persist under `~/.vibe-trading/` so they survive restarts. Without the flag, the `/scheduled-runs` endpoints still record jobs but nothing fires. Add `-H "Authorization: Bearer "` to each call when `API_AUTH_KEY` is set. + --- ## 🔌 MCP Plugin diff --git a/README_ar.md b/README_ar.md index aeb9d7826..d5d3fb4f8 100644 --- a/README_ar.md +++ b/README_ar.md @@ -760,6 +760,9 @@ vibe-trading serve --port 8899 | `PUT` | `/settings/llm` | تحديث إعدادات LLM المحلية | | `GET` | `/settings/data-sources` | قراءة إعدادات مصادر البيانات المحلية | | `PUT` | `/settings/data-sources` | تحديث إعدادات مصادر البيانات المحلية | +| `POST` | `/scheduled-runs` | إنشاء مهمة بحث مجدولة (interval-ms أو cron) | +| `GET` | `/scheduled-runs` | سرد المهام المجدولة | +| `DELETE` | `/scheduled-runs/{job_id}` | إلغاء مهمة مجدولة | توثيق تفاعلي: `http://localhost:8899/docs` @@ -775,6 +778,29 @@ vibe-trading serve --port 8899 قراءات Settings بلا آثار جانبية: لا تنشئ `GET /settings/llm` ولا `GET /settings/data-sources` ملف `agent/.env`، ولا تعيدان إلا مسارات نسبية للمشروع. قد تكشف قراءات وكتابات Settings حالة بيانات الاعتماد أو تحدث بيانات الاعتماد/بيئة التشغيل، لذلك تتطلب `API_AUTH_KEY` عند ضبطه. إذا كان `API_AUTH_KEY` غير مضبوط في وضع التطوير، فلا يقبل الوصول إلى Settings إلا من عملاء loopback. +### البحث المجدول (Scheduled research) + +شغّل prompt بحثي أو backtest وفق جدول متكرر. المنفّذ الخلفي **معطّل افتراضياً** — شغّل الخادم بـ `VIBE_TRADING_ENABLE_SCHEDULER=1` لتفعيله: + +```bash +VIBE_TRADING_ENABLE_SCHEDULER=1 vibe-trading serve --port 8899 +``` + +ثم أنشئ المهام عبر REST. الحقل `schedule` إما عدد صحيح بسيط (الفاصل بـ**المللي ثانية**) أو تعبير cron من 5 حقول (`دقيقة ساعة يوم شهر يوم-الأسبوع`): + +```bash +# كل 6 ساعات (cron) +curl -X POST http://localhost:8899/scheduled-runs \ + -H "Content-Type: application/json" \ + -d '{"prompt":"Scan CSI300 for momentum breakouts and backtest the top 5","schedule":"0 */6 * * *"}' + +# السرد / الإلغاء +curl http://localhost:8899/scheduled-runs +curl -X DELETE http://localhost:8899/scheduled-runs/ +``` + +كل تشغيل ينفّذ `prompt` في جلسة agent جديدة (تُوضع معلمات backtest الاختيارية في `config`)، وتُحفظ المهام تحت `~/.vibe-trading/` فتبقى بعد إعادة التشغيل. بدون هذه الراية، تسجّل نقاط `/scheduled-runs` المهام لكن لا يُطلق شيء. أضف `-H "Authorization: Bearer "` لكل طلب عند ضبط `API_AUTH_KEY`. + --- ## 🔌 MCP Plugin diff --git a/README_ja.md b/README_ja.md index 566eb6c44..0ee6294aa 100644 --- a/README_ja.md +++ b/README_ja.md @@ -757,6 +757,9 @@ vibe-trading serve --port 8899 | `PUT` | `/settings/llm` | local LLM settings を更新 | | `GET` | `/settings/data-sources` | local data source settings を読み取り | | `PUT` | `/settings/data-sources` | local data source settings を更新 | +| `POST` | `/scheduled-runs` | 定期リサーチジョブを作成(interval-ms または cron) | +| `GET` | `/scheduled-runs` | スケジュール済みジョブを一覧 | +| `DELETE` | `/scheduled-runs/{job_id}` | スケジュール済みジョブをキャンセル | Interactive docs: `http://localhost:8899/docs` @@ -772,6 +775,29 @@ Web UI Settings page では、local users が LLM provider/model、base URL、ge Settings reads は side-effect free です。`GET /settings/llm` と `GET /settings/data-sources` は `agent/.env` を作成せず、project-relative paths だけを返します。Settings の読み書きは credential state の公開や credentials/runtime environment の更新を伴うため、設定済みの場合は `API_AUTH_KEY` が必要です。dev mode で `API_AUTH_KEY` が未設定の場合、settings access は loopback clients からのみ受け付けます。 +### Scheduled research(定期リサーチ) + +リサーチ prompt や backtest を繰り返しスケジュールで実行します。バックグラウンド executor は**既定でオフ**です。`VIBE_TRADING_ENABLE_SCHEDULER=1` を付けて server を起動すると有効になります: + +```bash +VIBE_TRADING_ENABLE_SCHEDULER=1 vibe-trading serve --port 8899 +``` + +その後、REST でジョブを作成します。`schedule` は単なる整数(interval は**ミリ秒**)か、5 フィールドの cron 式(`分 時 日 月 曜日`)です: + +```bash +# 6 時間ごと(cron) +curl -X POST http://localhost:8899/scheduled-runs \ + -H "Content-Type: application/json" \ + -d '{"prompt":"Scan CSI300 for momentum breakouts and backtest the top 5","schedule":"0 */6 * * *"}' + +# 一覧 / キャンセル +curl http://localhost:8899/scheduled-runs +curl -X DELETE http://localhost:8899/scheduled-runs/ +``` + +各実行は新しい agent session で `prompt` を実行し(任意の backtest パラメータは `config` に入れます)、ジョブは `~/.vibe-trading/` に永続化されるため再起動後も残ります。このフラグがない場合、`/scheduled-runs` endpoints はジョブを記録しますが実行はされません。`API_AUTH_KEY` を設定している場合は各呼び出しに `-H "Authorization: Bearer "` を付けてください。 + --- ## 🔌 MCP Plugin diff --git a/README_ko.md b/README_ko.md index 3d8497d46..a6281a7bc 100644 --- a/README_ko.md +++ b/README_ko.md @@ -760,6 +760,9 @@ vibe-trading serve --port 8899 | `PUT` | `/settings/llm` | local LLM settings 업데이트 | | `GET` | `/settings/data-sources` | local data source settings 읽기 | | `PUT` | `/settings/data-sources` | local data source settings 업데이트 | +| `POST` | `/scheduled-runs` | 예약 리서치 작업 생성 (interval-ms 또는 cron) | +| `GET` | `/scheduled-runs` | 예약된 작업 목록 | +| `DELETE` | `/scheduled-runs/{job_id}` | 예약 작업 취소 | Interactive docs: `http://localhost:8899/docs` @@ -775,6 +778,29 @@ Web UI Settings page에서는 local user가 LLM provider/model, base URL, genera Settings read는 side effect가 없습니다. `GET /settings/llm`과 `GET /settings/data-sources`는 `agent/.env`를 만들지 않으며 project-relative path만 반환합니다. Settings read/write는 credential state를 노출하거나 credential/runtime environment를 업데이트할 수 있으므로 `API_AUTH_KEY`가 설정되어 있으면 인증이 필요합니다. dev mode에서 `API_AUTH_KEY`가 설정되지 않은 경우 settings access는 loopback client에서만 허용됩니다. +### Scheduled research (예약 리서치) + +리서치 prompt나 backtest를 반복 일정으로 실행합니다. 백그라운드 executor는 **기본적으로 꺼져 있습니다** — `VIBE_TRADING_ENABLE_SCHEDULER=1`로 server를 시작하면 활성화됩니다: + +```bash +VIBE_TRADING_ENABLE_SCHEDULER=1 vibe-trading serve --port 8899 +``` + +그런 다음 REST로 작업을 생성합니다. `schedule`은 단순 정수(간격, 단위 **밀리초**)이거나 5필드 cron 표현식(`분 시 일 월 요일`)입니다: + +```bash +# 6시간마다 (cron) +curl -X POST http://localhost:8899/scheduled-runs \ + -H "Content-Type: application/json" \ + -d '{"prompt":"Scan CSI300 for momentum breakouts and backtest the top 5","schedule":"0 */6 * * *"}' + +# 목록 / 취소 +curl http://localhost:8899/scheduled-runs +curl -X DELETE http://localhost:8899/scheduled-runs/ +``` + +각 실행은 새 agent session에서 `prompt`를 실행하며(선택적 backtest 파라미터는 `config`에 넣습니다), 작업은 `~/.vibe-trading/`에 저장되어 재시작 후에도 유지됩니다. 이 플래그가 없으면 `/scheduled-runs` endpoint는 작업을 기록하지만 실행되지는 않습니다. `API_AUTH_KEY`가 설정된 경우 각 호출에 `-H "Authorization: Bearer "`를 추가하세요. + --- ## 🔌 MCP Plugin diff --git a/README_zh.md b/README_zh.md index 1dde3d0ed..803a4ae25 100644 --- a/README_zh.md +++ b/README_zh.md @@ -754,6 +754,9 @@ vibe-trading serve --port 8899 | `PUT` | `/settings/llm` | 更新本地 LLM settings | | `GET` | `/settings/data-sources` | 读取本地数据源 settings | | `PUT` | `/settings/data-sources` | 更新本地数据源 settings | +| `POST` | `/scheduled-runs` | 创建定时研究任务(间隔毫秒或 cron) | +| `GET` | `/scheduled-runs` | 列出定时任务 | +| `DELETE` | `/scheduled-runs/{job_id}` | 取消定时任务 | 交互式文档:`http://localhost:8899/docs` @@ -769,6 +772,29 @@ Web UI Settings 页面允许本地用户更新 LLM provider/model、base URL、g Settings 读取无副作用:`GET /settings/llm` 和 `GET /settings/data-sources` 永远不会创建 `agent/.env`,并且只返回项目相对路径。Settings 读写可能暴露凭据状态或更新凭据/运行时环境,因此在配置了 `API_AUTH_KEY` 时会要求认证。如果 dev mode 下未设置 `API_AUTH_KEY`,settings 访问只接受 loopback clients。 +### 定时研究(Scheduled research) + +让研究 prompt 或回测按固定周期重复运行。后台执行器**默认关闭**——启动服务时设置 `VIBE_TRADING_ENABLE_SCHEDULER=1` 才会开启: + +```bash +VIBE_TRADING_ENABLE_SCHEDULER=1 vibe-trading serve --port 8899 +``` + +然后通过 REST 创建任务。`schedule` 可以是纯整数(间隔**毫秒**)或 5 段 cron 表达式(`分 时 日 月 周`): + +```bash +# 每 6 小时(cron) +curl -X POST http://localhost:8899/scheduled-runs \ + -H "Content-Type: application/json" \ + -d '{"prompt":"Scan CSI300 for momentum breakouts and backtest the top 5","schedule":"0 */6 * * *"}' + +# 列出 / 取消 +curl http://localhost:8899/scheduled-runs +curl -X DELETE http://localhost:8899/scheduled-runs/ +``` + +每次触发都会在一个全新的 agent session 中运行该 `prompt`(可选回测参数放在 `config` 里),任务持久化到 `~/.vibe-trading/`,重启后依然保留。不设这个开关时,`/scheduled-runs` 端点仍会记录任务,但不会真正触发。配置了 `API_AUTH_KEY` 时,每次请求需加 `-H "Authorization: Bearer "`。 + --- ## 🔌 MCP Plugin