Developers/Docs/API/Investment

Investment API

Trade stocks, ETFs, and crypto with real-time market data, fractional shares, and commission-free execution

Commission-Free
Trade stocks and ETFs with $0 commission fees

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

GET
/v1/market/quote/:symbol

Real-time stock quotes with bid/ask spread and market depth

POST
/v1/orders/market

Execute market orders for stocks, ETFs, and crypto

POST
/v1/orders/limit

Place limit orders with custom price targets

GET
/v1/portfolio/:id

Retrieve portfolio holdings, performance, and allocation

GET
/v1/market/historical/:symbol

Historical price data with OHLCV bars

POST
/v1/watchlist

Create 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: '...' }
});