> ## Documentation Index
> Fetch the complete documentation index at: https://finance.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# JavaScript SDK

> Official JavaScript/Node.js SDK for the Aries API

## Installation

Install the Aries JavaScript SDK using npm or yarn:

```bash theme={null}
npm install @aries-exchange/sdk
# or
yarn add @aries-exchange/sdk
```

## Quick Start

```javascript theme={null}
import { AriesClient } from '@aries-exchange/sdk';

// Initialize the client
const client = new AriesClient({
  clientId: 'your_client_id',
  clientSecret: 'your_client_secret'
});

// Get account information
const accounts = await client.accounts.getUserAccounts();
console.log(accounts);

// Place an order
const order = await client.orders.placeOrder({
  symbol: 'AAPL',
  quantity: 10,
  side: 'buy',
  orderType: 'market'
});
console.log(order);
```

## Authentication

The JavaScript SDK supports OAuth2 authentication:

```javascript theme={null}
import { AriesClient } from '@aries-exchange/sdk';

const client = new AriesClient({
  clientId: 'your_client_id',
  clientSecret: 'your_client_secret'
});

// The SDK handles token management automatically
```

## Making API Calls

### Get Market Data

```javascript theme={null}
// Search for securities
const results = await client.marketData.search('AAPL');

// Get equity details
const equity = await client.marketData.getEquityDetails('AAPL');
```

### Manage Orders

```javascript theme={null}
// Place a limit order
const order = await client.orders.placeOrder({
  symbol: 'AAPL',
  quantity: 10,
  side: 'buy',
  orderType: 'limit',
  limitPrice: 150.00
});

// Cancel an order
await client.orders.cancelOrder('order_123');
```

## WebSocket Support

Stream real-time data using WebSockets:

```javascript theme={null}
import { AriesWebSocket } from '@aries-exchange/sdk';

const ws = new AriesWebSocket({
  clientId: 'your_client_id',
  clientSecret: 'your_client_secret'
});

// Subscribe to market data
ws.on('marketData', (data) => {
  console.log('Received:', data);
});

ws.subscribeMarketData(['AAPL', 'GOOGL']);
ws.connect();
```

## TypeScript Support

The SDK is written in TypeScript and includes full type definitions:

```typescript theme={null}
import { AriesClient, Order, OrderSide } from '@aries-exchange/sdk';

const client = new AriesClient({
  clientId: 'your_client_id',
  clientSecret: 'your_client_secret'
});

const order: Order = await client.orders.placeOrder({
  symbol: 'AAPL',
  quantity: 10,
  side: 'buy' as OrderSide,
  orderType: 'market'
});
```

## Error Handling

```javascript theme={null}
import { AriesClient, AriesAPIError } from '@aries-exchange/sdk';

const client = new AriesClient({ clientId: '...', clientSecret: '...' });

try {
  const order = await client.orders.placeOrder({...});
} catch (error) {
  if (error instanceof AriesAPIError) {
    console.error('API Error:', error.message);
    console.error('Status Code:', error.statusCode);
  }
}
```

## Requirements

* Node.js 14 or higher
* Works in browser environments with bundlers (Webpack, Vite, etc.)

## Additional Resources

* [GitHub Repository](#)
* [npm Package](#)
* [API Reference](/api-reference)
