JSPM

@neural-trader/brokers

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 23
  • Score
    100M100P100Q66928F
  • License MIT OR Apache-2.0

Broker integrations for Neural Trader - Alpaca, Interactive Brokers, TD Ameritrade

Package Exports

  • @neural-trader/brokers
  • @neural-trader/brokers/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@neural-trader/brokers) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@neural-trader/brokers

npm version License

Broker integrations for Neural Trader supporting Alpaca, Interactive Brokers, and TD Ameritrade with unified API.

Features

  • Multi-Broker Support: Alpaca, Interactive Brokers, TD Ameritrade
  • Unified API: Single interface for all brokers
  • Order Management: Place, cancel, and track orders
  • Account Info: Real-time balance and positions
  • Paper Trading: Test strategies risk-free
  • Rust Performance: Fast order execution

Installation

npm install @neural-trader/brokers @neural-trader/core

Quick Start

import { BrokerClient, listBrokerTypes } from '@neural-trader/brokers';

// List available brokers
console.log('Available brokers:', listBrokerTypes());

// Connect to broker
const client = new BrokerClient({
  brokerType: 'alpaca',
  apiKey: 'your-api-key',
  apiSecret: 'your-secret',
  baseUrl: 'https://paper-api.alpaca.markets',
  paperTrading: true
});

await client.connect();

// Place order
const order = {
  symbol: 'AAPL',
  side: 'buy',
  orderType: 'market',
  quantity: 100,
  timeInForce: 'day'
};

const response = await client.placeOrder(order);
console.log(`Order placed: ${response.orderId}`);

// Get account balance
const balance = await client.getAccountBalance();
console.log(`Cash: $${balance.cash}, Equity: $${balance.equity}`);

// Disconnect
await client.disconnect();

API Reference

class BrokerClient {
  constructor(config: BrokerConfig);
  connect(): Promise<boolean>;
  disconnect(): Promise<void>;
  placeOrder(order: OrderRequest): Promise<OrderResponse>;
  cancelOrder(orderId: string): Promise<boolean>;
  getOrderStatus(orderId: string): Promise<OrderResponse>;
  getAccountBalance(): Promise<AccountBalance>;
  listOrders(): Promise<OrderResponse[]>;
  getPositions(): Promise<JsPosition[]>;
}

function listBrokerTypes(): string[];
function validateBrokerConfig(config: BrokerConfig): boolean;

License

MIT OR Apache-2.0