# Guide

## DCA (Dollar Cost Averaging) API Integration Documentation

### Overview

The OpenOcean Socket Data Push service provides real-time event streaming via **Socket.IO** over WebSocket transport.

This service allows clients to subscribe to user-specific data streams using a wallet address. Once subscribed, the server pushes live updates automatically.

This document explains how to connect, subscribe, handle events, and implement best practices for production usage.

### API Base Information

#### Base Endpoint

```
https://open-api.openocean.finance/socket
```

### Custom Path

The service uses a custom Socket.IO path. Make sure the `path` option is configured correctly.

```
/v1/socket
```

### Transport Protocol

Only WebSocket transport is recommended:

```
transports: ['websocket']
```

### Example (Node.js)

```javascript
const ioClient = require('socket.io-client');

const socket = ioClient('https://open-api.openocean.finance/socket', {
    path: '/v1/socket',
    transports: ['websocket'],
    reconnection: true,
});

socket.on('connect', () => {
    console.log('connect!');
    socket.emit('subscribe', {
        address: '0x677883Ea48511bD266D09bEFefc0A925E5e1C01F'
    });
});

socket.on('data', (msg) => {
    console.log('received:', msg);
});

socket.on('connect_error', (err) => {
    console.error('connect_error', err);
});

socket.on('disconnect', (reason) => {
    console.log('disconnect:', reason);
});
```

### Socket Event Data

* To receive real-time updates, emit a `subscribe` event with your wallet address
* All real-time messages are delivered via the `data` event
* event\_type: dca\_filled,limitorder\_filled

**Example Data Payload:**

```json
{
  "event_type": "dca_filled",
  "data": {
    "chainId": 56,
    "makerAsset": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
    "takerAsset": "0xfde4c96c8593536e31f229ea8f37b2ada2699bb2",
    "makerAmount": "20000000",
    "makerAddress": "0x...",
    "txHash": "0x...",
    "orderHash": "0x...",
  }
}
```

### Support

For technical support or questions about the API:

* Check the [OpenOcean Documentation](https://docs.openocean.finance)
* Contact the development team
* Review error logs and API responses
