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
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/coreQuick 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