Investment API
Trade stocks, ETFs, and crypto with real-time market data, fractional shares, and commission-free execution
On this page
Overview
The Investment API enables programmatic trading and portfolio management. Access real-time market data, execute trades, and build sophisticated investment applications with institutional-grade infrastructure.
Real-time Data
Live market quotes and price streaming
Fractional Shares
Buy any dollar amount of stocks
Portfolio Analytics
Performance tracking and allocation insights
API Endpoints
/v1/market/quote/:symbolReal-time stock quotes with bid/ask spread and market depth
/v1/orders/marketExecute market orders for stocks, ETFs, and crypto
/v1/orders/limitPlace limit orders with custom price targets
/v1/portfolio/:idRetrieve portfolio holdings, performance, and allocation
/v1/market/historical/:symbolHistorical price data with OHLCV bars
/v1/watchlistCreate and manage watchlists with price alerts
Code Examples
Get Real-time Quote
// Get real-time stock quote
const taxu = require('@taxu/taxu-js')('your_api_key');
const quote = await taxu.investment.market.quote('AAPL');
console.log(quote);
// {
// symbol: 'AAPL',
// price: 178.45,
// change: 2.35,
// changePercent: 1.33,
// bid: 178.42,
// ask: 178.48,
// volume: 52341876,
// marketCap: 2780000000000,
// high: 179.23,
// low: 176.89,
// open: 177.10,
// previousClose: 176.10,
// timestamp: '2024-01-15T15:45:30Z'
// }Place Market Order
// Buy fractional shares
const order = await taxu.investment.orders.market({
symbol: 'TSLA',
side: 'buy',
notional: 500, // Buy $500 worth
timeInForce: 'day'
});
console.log(order);
// {
// id: 'ord_xyz123',
// symbol: 'TSLA',
// side: 'buy',
// quantity: 1.95, // Fractional shares
// filledQuantity: 1.95,
// averagePrice: 256.41,
// totalCost: 500.00,
// status: 'filled',
// filledAt: '2024-01-15T15:46:12Z'
// }Market Data
Real-time Streaming
Subscribe to WebSocket streams for live price updates, order book changes, and trade executions:
// Subscribe to real-time quotes
const stream = taxu.investment.market.stream(['AAPL', 'GOOGL', 'MSFT']);
stream.on('quote', (data) => {
console.log(data);
// { symbol: 'AAPL', price: 178.52, timestamp: '...' }
});