一键导入
stock-trader
Trade US stocks and ETFs via Alpaca and Interactive Brokers. Paper trading supported.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Trade US stocks and ETFs via Alpaca and Interactive Brokers. Paper trading supported.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Complete market analysis for Crypto, Forex, and Stocks with RSI, MACD, trends, and trading recommendations.
Binary Options trading via BinaryFaster. Execute CALL/PUT trades, manage positions, track results.
Regulatory compliance across jurisdictions. KYC status, tax reporting, trading restrictions, and legal guidelines.
Social trading - copy the best traders automatically. Track whales, influencers, and top performers.
DeFi yield hunting across protocols. Find the best APY, auto-compound, manage LP positions, and optimize gas.
Derivatives trading - options, futures, and perpetuals. Advanced strategies for hedging and leverage.
| name | stock-trader |
| description | Trade US stocks and ETFs via Alpaca and Interactive Brokers. Paper trading supported. |
| metadata | {"openclaw":{"emoji":"📈","requires":{"bins":["node"],"env":["ALPACA_API_KEY","ALPACA_API_SECRET"]}}} |
Trade US stocks, ETFs, and options with K.I.T.
| Broker | Status | Markets | Features |
|---|---|---|---|
| Alpaca | ✅ Ready | US Stocks, ETFs | Commission-free, Paper trading |
| Interactive Brokers | 🚧 Coming | Global | Stocks, Options, Futures, Forex |
| Tradier | 📋 Planned | US Stocks | Commission-free options |
# Environment variables
export ALPACA_API_KEY="your-api-key"
export ALPACA_API_SECRET="your-secret-key"
export ALPACA_PAPER="true" # Start with paper trading!
Or in ~/.kit/config.json:
{
"exchanges": {
"alpaca": {
"apiKey": "your-api-key",
"apiSecret": "your-secret-key",
"paper": true
}
}
}
import { createStockConnector } from '@binaryfaster/kit';
const stocks = createStockConnector();
await stocks.connect({
broker: 'alpaca',
apiKey: process.env.ALPACA_API_KEY!,
apiSecret: process.env.ALPACA_API_SECRET!,
paper: true,
});
// Check account
const account = await stocks.getAccount();
console.log(`Balance: $${account.portfolioValue}`);
// Get positions
const positions = await stocks.getPositions();
console.log('Positions:', positions);
// Get full portfolio
const portfolio = await stocks.getPortfolio();
console.log(`Total Value: $${portfolio.account.portfolioValue}`);
console.log(`P&L: $${portfolio.totalPL} (${portfolio.totalPLPercent.toFixed(2)}%)`);
// List positions
for (const pos of portfolio.positions) {
console.log(`${pos.symbol}: ${pos.qty} shares, ${pos.unrealizedPLPercent.toFixed(2)}%`);
}
// Market buy
const buyOrder = await stocks.buy('AAPL', 10);
// Limit buy
const limitBuy = await stocks.buy('TSLA', 5, {
type: 'limit',
limitPrice: 200.00,
});
// Sell
const sellOrder = await stocks.sell('AAPL', 5);
// Close position (all shares)
await stocks.closePosition('AAPL');
// Close all positions (PANIC BUTTON!)
await stocks.closeAllPositions();
// Get quote
const quote = await stocks.getQuote('AAPL');
console.log(`AAPL: $${quote.price}`);
// Check market hours
const isOpen = await stocks.isMarketOpen();
console.log(`Market is ${isOpen ? 'OPEN' : 'CLOSED'}`);
// Pivot points
const pivots = await stocks.analyzePivotPoints('SPY');
console.log(`Support: $${pivots.s1} | Pivot: $${pivots.pivot} | Resistance: $${pivots.r1}`);
// Get open orders
const openOrders = await stocks.getOrders('open');
// Cancel specific order
await stocks.cancelOrder(order.id);
// Cancel ALL orders
await stocks.cancelAllOrders();
const report = await stocks.generateReport();
console.log(report);
Output:
📊 STOCK PORTFOLIO REPORT
============================================================
ACCOUNT
------------------------------------------------------------
Cash: $50,000.00
Portfolio: $52,450.00
Buying Power: $100,000.00
Day Trades: 1/3
Market: 🟢 OPEN
POSITIONS (3)
------------------------------------------------------------
AAPL 10 shares @ $175.50 | $1,780.00 📈 +1.43%
TSLA 5 shares @ $195.00 | $985.00 📉 -1.03%
MSFT 8 shares @ $400.25 | $3,250.00 📈 +1.87%
TOTALS
------------------------------------------------------------
Unrealized P&L: $85.00 (+1.68%)
After integration, K.I.T. understands:
| Type | Description | Example |
|---|---|---|
market | Execute immediately at best price | stocks.buy('AAPL', 10) |
limit | Execute only at specified price or better | stocks.buy('AAPL', 10, { type: 'limit', limitPrice: 170 }) |
stop | Trigger market order when price reached | stocks.buy('AAPL', 10, { type: 'stop', stopPrice: 180 }) |
stop_limit | Trigger limit order when price reached | Combined stop + limit |
trailing_stop | Dynamic stop that follows price | trailPercent: 5 |
| TIF | Description |
|---|---|
day | Valid for current trading day |
gtc | Good 'til cancelled (90 days) |
ioc | Immediate or cancel |
fok | Fill or kill |
opg | Market open only |
cls | Market close only |
Regular Hours: 9:30 AM - 4:00 PM ET (Mon-Fri)
Extended Hours (Alpaca):
// Trade in extended hours
const order = await stocks.buy('AAPL', 10, { extendedHours: true });
If your account has < $25,000:
// Set stop loss after buying
const buyOrder = await stocks.buy('AAPL', 10);
const stopOrder = await stocks.sell('AAPL', 10, {
type: 'stop',
stopPrice: buyOrder.filledAvgPrice * 0.95, // 5% stop loss
});
// Trailing stop
const trailingStop = await stocks.sell('AAPL', 10, {
type: 'trailing_stop',
trailPercent: 5, // 5% trailing stop
});
ALWAYS START WITH PAPER TRADING!
// Paper trading (simulation)
await stocks.connect({
broker: 'alpaca',
apiKey: 'paper-key',
apiSecret: 'paper-secret',
paper: true, // <-- Paper mode
});
// Live trading (real money!)
await stocks.connect({
broker: 'alpaca',
apiKey: 'live-key',
apiSecret: 'live-secret',
paper: false, // <-- Real money!
});
try {
const order = await stocks.buy('AAPL', 1000000); // Too many shares
} catch (error) {
console.error('Order failed:', error.message);
// "Alpaca API Error: 403 - insufficient buying power"
}
Common errors:
insufficient_buying_power - Not enough cashaccount_blocked - Account restrictedmarket_closed - Try extended hourssymbol_not_found - Check symbol spellingskills/stock-trader/
├── SKILL.md # This file
└── examples/
└── basic-trading.ts # Example code
src/tools/
└── stock-connector.ts # Main implementation
Version: 1.0.0
Created: 2026-02-10
Author: K.I.T. [Sprint-Agent]
📈 K.I.T. - Your AI Stock Trader