1rok offers a powerful platform to run portfolio-construction agents utilizing leading LLM models. With a versatile inline tool registry and support for various financial data sources, the system facilitates effective trading practices. Users can compare model performance with live leaderboard tracking on paper trading, enhancing decision-making in finance.
1rok serves as a versatile standalone harness designed to run multiple portfolio-construction agents using various LLM (Large Language Model) providers, including OpenAI, Anthropic, Gemini, xAI, DeepSeek, GLM, and OpenRouter. This project enables agents to interact with a range of financial data sources such as Alpaca, Yahoo Finance, FRED, and Tavily, using a sophisticated inline tool registry defined within the repository.
A feature of 1rok is its live leaderboard that monitors the performance of each model's portfolio during paper trading on Alpaca, accessible via investingbench.vercel.app.
Key Features
- Inline Tool Registry: Offers functionalities for listing and calling tools through local handlers, maintaining a single registry for each pipeline run.
- Diverse Tool Groups: Comprises eight tool groups, including market, stock, research, technical analysis, options, earnings, portfolio management, and Tavily web search.
- Multiple LLM Providers: Integrates seven LLM providers into a single workflow, facilitating a seamless tool-calling loop.
- Specialist Agents: Includes roles such as orchestrator, screener, and various analyst types like fundamental, valuation, technical, sentiment, catalyst, macro, and risk agents to enhance decision-making capabilities.
- Two-Stage Pipeline: The pipeline architecture includes a
runcommand that generates a portfolio-construction JSON artifact, followed by anexecutecommand that interprets this artifact to place orders via Alpaca. - Provider-Agnostic Schemas: Utilizes Zod definitions that convert to each provider's tool-call format, streamlined with shared retry and loop logic.
Agent Pipeline Overview
The project operates with a structured pipeline consisting of four stages involving ten specialized agents running weekly. The flow starts with the Macro agent, which assesses the economic regime, followed by the Screener that identifies potential candidates. Six agents then evaluate the candidates in parallel:
flowchart TD
Macro["Macro Agent<br/><i>The Economist</i>"]:::entry
Screener["Screener Agent<br/><i>The Scout</i>"]:::entry
Sentiment["Sentiment<br/><i>Mood Reader</i>"]:::analysis
Fundamental["Fundamental<br/><i>Accountant</i>"]:::analysis
Valuation["Valuation<br/><i>Appraiser</i>"]:::analysis
Catalyst["Catalyst<br/><i>Event Watcher</i>"]:::analysis
Risk["Risk<br/><i>Risk Manager</i>"]:::analysis
Technical["Technical<br/><i>Chart Reader</i>"]:::analysis
Orchestrator["Orchestrator Agent<br/><i>The CIO</i>"]:::synthesis
Constructor["Portfolio Constructor<br/><i>The Trader</i>"]:::execution
Execute["Order Execution<br/><i>Alpaca API</i>"]:::execution
Macro --> Screener
Screener --> Sentiment
Screener --> Fundamental
Screener --> Valuation
Screener --> Catalyst
Screener --> Risk
Screener --> Technical
Sentiment --> Orchestrator
Fundamental --> Orchestrator
Valuation --> Orchestrator
Catalyst --> Orchestrator
Risk --> Orchestrator
Technical --> Orchestrator
Orchestrator --> Constructor
Constructor --> Execute
classDef entry stroke:#ff8c00,stroke-width:2px
classDef analysis stroke:#888,stroke-width:1px
classDef synthesis stroke:#22c55e,stroke-width:2px
classDef execution stroke:#aaa,stroke-width:1px
The architecture of the project is designed to facilitate efficient interactions with trading APIs while maintaining a clear and structured workflow:
CLI (run | execute)
│
▼
Provider ── TradingPipeline ── InlineToolRegistry (per run)
│ │
▼ ▼
Specialist agents ───── Tool handlers
│
▼
src/data/services
│
▼
Alpaca · Yahoo Finance · FRED · Tavily
For those interested in the programmatic use, the integration is greatly simplified:
import { createProviderFromModel } from "1rok/harness";
import { TradingPipeline } from "1rok/pipeline";
const provider = createProviderFromModel("gpt-5.2-medium");
const pipeline = new TradingPipeline({ provider });
const result = await pipeline.run();
For detailed usage and additional functionalities, refer to the full README within the repository. The comprehensive structure of 1rok offers a robust solution for harnessing advanced LLMs for effective trading portfolio construction and management.
No comments yet.
Sign in to be the first to comment.