feat: add stock detail page with chart, position, and orders
- Add /api/alpaca/orders endpoint for order history - Add TradingView chart component for candlestick visualization - Add /analyze/:ticker route with position and orders display - Make ticker cells in analyze page clickable for navigation
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
import Alpaca from "@alpacahq/alpaca-trade-api";
|
||||
|
||||
const alpaca = new Alpaca({
|
||||
keyId: process.env.ALPACA_API_KEY!,
|
||||
secretKey: process.env.ALPACA_SECRET_KEY!,
|
||||
baseUrl: process.env.ALPACA_BASE_URL || "https://paper-api.alpaca.markets",
|
||||
retryOnError: false,
|
||||
});
|
||||
|
||||
export async function loader() {
|
||||
try {
|
||||
const orders = await alpaca.getOrders();
|
||||
return Response.json({ orders });
|
||||
} catch (error) {
|
||||
console.error("Alpaca orders error:", error);
|
||||
return Response.json({ orders: [] }, { status: 500 });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user