feat: add stock indicators route and Alpaca account info
- New /stocks route with StockViewer component - New /api/indicators endpoint with SMA, EMA, RSI, MACD - New /api/alpaca/account endpoint - AlpacaAccountInfo component on home page - Indicator calculation utilities - Tests for utilities and components - Vite proxy config for /api
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import type { AlpacaAccount } from "../../../types";
|
||||
|
||||
// Mock Alpaca account data – replace with actual API call
|
||||
async function fetchAlpacaAccount(): Promise<AlpacaAccount> {
|
||||
return {
|
||||
cash: 12345.67,
|
||||
buying_power: 8000.0,
|
||||
portfolio_value: 25000.0,
|
||||
};
|
||||
}
|
||||
|
||||
export async function loader() {
|
||||
try {
|
||||
const account = await fetchAlpacaAccount();
|
||||
return Response.json(account);
|
||||
} catch {
|
||||
return Response.json(
|
||||
{ error: "Failed to fetch account info" },
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user