# Broker Connections

### Overview

**Broker connections** form the foundation of the Lune platform, securely linking your brokerage or proprietary trading firm directly to our cloud infrastructure. These persistent connections ensure your accounts remain online 24/7 with automatic reconnection capabilities, completely eliminating the need for virtual private servers (VPS) or desktop software.

Once established, these connections power the core functionalities of the entire platform, including the Auto Trader, Copy Trading, Cockpit, Trading Journal, and Risk Management systems.

### Supported Platforms

Lune supports direct integration with leading futures trading platforms and technology providers:

* **Rithmic:** Connects directly via the R|Protocol WebSocket. This supports over 20 Rithmic-connected prop firms and brokerages, including Apex Trader Funding, TopstepTrader, Bulenox, and Earn2Trade.
* **ProjectX / TopstepX:** Utilizes secure API key authentication to support over 20 ProjectX-connected platforms, such as TopstepX, TickTickTrader, and Tradeify.
* **Tradovate:** Features seamless OAuth integration for both live and demo futures trading environments.
* **NinjaTrader:** Connects using Tradovate credentials through a secure OAuth portal to provide full NinjaTrader account access.

### Adding a Connection

Connecting a new broker or prop firm to your dashboard is accomplished through a simple three-step wizard.

#### Step 1: Name Your Connection

Assign a friendly, recognizable name to your connection to easily identify it within your workspace. The system provides a default suggestion based on the selected broker name.

#### Step 2: Authenticate

The secure authentication process varies slightly depending on your chosen platform:

* **Rithmic:** Enter your username and password, select your specific system or prop firm from the dropdown menu, and choose the geographic gateway region closest to you for the lowest latency. Credentials are encrypted with AES-256 and are never stored in plaintext.
* **ProjectX:** Select your prop firm, choose the Live or Simulation environment, and input your username alongside the API key generated from your prop firm dashboard.
* **Tradovate & NinjaTrader:** Select between Demo or Live environments, click the login button, and complete the OAuth authentication process directly on the broker's secure authorization page.

#### Step 3: Select Accounts

Once authenticated, the system discovers and lists all associated accounts along with their current balance and equity. You can toggle specific accounts on or off to choose which ones to import and optionally assign custom nicknames to each account.

### Connection Management

Users are provided with granular control over their active connections and individual accounts.

#### Connection Controls

* **Refresh:** Re-fetches data from the broker to discover any newly created accounts.
* **Edit Name:** Allows you to rename the connection group.
* **Delete:** Removes the connection and all associated accounts. This action requires confirmation and is safely blocked if the accounts are currently active in any Copy Trading groups.

#### Order Execution Mode

* **Broker Native:** Limit and stop orders are sent directly to the broker and are managed on the exchange.
* **Lune Managed:** The platform monitors the price in real time and triggers a market order the exact moment your specified price level is hit.

#### Connection Mode (ProjectX Only)

* **Auto (Default):** Prefers WebSocket connectivity but falls back to polling if necessary.
* **WebSocket:** Forces a real-time stream for the lowest possible latency.
* **Polling:** Utilizes API-only communication for strict single-session brokers.

#### Status Indicators

* **Connected:** Displays in green, indicating the connection is active and receiving data.
* **Connecting:** Indicates the system is currently establishing the connection.
* **Disconnected:** Displays in gray, indicating the connection is currently offline.
* **Error:** Displays in red, indicating a broker-side error such as invalid credentials or an expired OAuth session.
* **Stale:** Indicates no heartbeat has been received from the broker for over 60 seconds.

#### Account Controls

Individual accounts within a connection group can be managed seamlessly:

* **Enable/Disable:** Toggle individual accounts on or off without dropping the entire connection. Disabling an account with open positions will trigger a safety warning.
* **Disconnect:** Removes a specific account from your dashboard.

### Connection Tiers

Lune offers scaled connection limits based on your subscription tier. A single connection represents one set of broker credentials, and each connection can hold multiple associated accounts.

| Tier        | Connections Allowed | Maximum Accounts | Availability                   |
| ----------- | ------------------- | ---------------- | ------------------------------ |
| **Starter** | 2                   | 10               | Included free with account     |
| **Pro**     | 5                   | 20               | Available as a monthly upgrade |
| **Ultra**   | Unlimited           | 150              | Available as a monthly upgrade |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.lunefi.com/lune-platform/broker-connections.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
