Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
developers:websocket [2025/03/14 02:50] – created chad | developers:websocket [2025/03/14 19:15] (current) – [Message Structure Overview] chad | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Plus500 Futures Technologies | + | ===== WebSocket API Introduction |
- | Welcome to the **Plus500 Futures Technologies | + | The WebSocket API provides a high-performance, |
- | With an **industry-standard design**, it is easy to integrate and built to meet the demands of **futures traders, risk managers, and financial platforms**. | + | ==== WebSockets ==== |
+ | WebSockets establish a persistent, full-duplex connection between | ||
- | ===== Key Capabilities ===== | + | **Key Advantages: |
+ | * Persistent connection reduces handshake overhead | ||
+ | * Low-latency, | ||
+ | * Efficient bandwidth usage compared to REST APIs | ||
- | ^ Feature ^ Included ^ Description ^ | + | ==== Google Protocol Buffers |
- | | **Real-time Quotes** | ✅ | Stream live bid/ask price updates for any instrument. | | + | The API utilizes Protobuf for efficient, compact, and high-speed message serialization. Unlike JSON or XML, Protobuf messages are smaller |
- | | **Level 1 Data** | ✅ | Access top-of-book best bid and offer (BBO). | | + | |
- | | **Level 2 (Market Depth)** | ✅ | View **up to 10 levels** of bid/ask depth. | | + | |
- | | **Market by Order (MBO)** | ✅ | See individual resting orders in the order book. | | + | |
- | | **Trade Feed (Ticker)** | ✅ | Get a **real-time execution stream** of all trades. | | + | |
- | | **Order Management** | ✅ | Submit, modify, and cancel orders programmatically. | | + | |
- | | **Position & Account Monitoring** | ✅ | Track open positions, P&L, and margin usage. | | + | |
- | | **Instrument Metadata** | ✅ | Retrieve contract specs, tick sizes, and margin requirements. | | + | |
- | | **Spread Trading** | ✅ | Execute spread orders with **complex multi-leg strategies**. | | + | |
- | | **Risk & Margin Data** | ✅ | Get real-time margin requirements and risk exposure. | | + | |
- | | **Historical Data Requests** | ✅ | Fetch recent trade history and market activity. | | + | |
- | | **Efficient Binary Encoding** | ✅ | Uses Protobuf | + | |
- | | **Secure Authentication** | ✅ | Ensures safe access with API key-based authentication. | | + | |
- | | **Robust Reconnection** | ✅ | Auto-reconnect and resume subscriptions on disconnection. | | + | |
- | ===== Why Use This API? ===== | + | **Why Protobuf?** |
+ | * **Compact Encoding:** Reduces message size for faster transmission | ||
+ | * **High Performance: | ||
+ | * **Schema Evolution: | ||
- | * **Fast & Reliable** – Designed for **high-frequency updates and real-time execution**. | + | ==== Communication Model ==== |
- | * **Compact & Efficient** – Protobuf minimizes bandwidth, ensuring **fast message processing**. | + | The API follows a structured messaging approach: |
- | * **Comprehensive Market Data** – Access **Level 1, Level 2, and Market by Order** data. | + | * **Client Messages:** Requests sent from clients to the server (e.g., order submission, subscription requests) |
- | * **Built for Futures Trading** – Includes **contract metadata, spread trading, | + | * **Server Messages:** Responses |
- | * **Scalable & Industry-Proven** – Handles **thousands of concurrent connections**. | + | |
- | * **Secure & Encrypted** – Uses **WSS (WebSocket Secure) over SSL/TLS** to protect data. | + | |
- | * **Event-Driven & Easy to Integrate** – A simple subscription model delivers the data you need. | + | |
- | ===== Getting Started ===== | + | ==== Message Structure Overview |
- | To begin integrating, visit the [[getting_started|Getting Started]] guide for **connection details, authentication steps, and demo projects**. | + | All messages sent to the server must be wrapped in a **ClientMessage** envelope, and all messages received from the server will be contained within a **ServerMessage** envelope. This ensures a consistent structure and simplifies message parsing. |
+ | |||
+ | === Client Message Structure === | ||
+ | |||
+ | A **ClientMessage** is the top-level wrapper for all messages sent to the server. It contains fields for various message types, such as authentication requests, order submissions, | ||
+ | |||
+ | Example **ClientMessage**: | ||
+ | |||
+ | < | ||
+ | message ClientMessage { | ||
+ | oneof payload { | ||
+ | AuthenticationRequest authentication_request = 1; | ||
+ | MarketSubscription market_subscription = 2; | ||
+ | OrderRequest order_request = 3; | ||
+ | // ... other client messages | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | === Server Message Structure === | ||
+ | |||
+ | A **ServerMessage** is the top-level wrapper for all responses and updates from the server. It encapsulates messages related to market data, account updates, and execution reports. | ||
+ | |||
+ | Example **ServerMessage**: | ||
+ | |||
+ | < | ||
+ | message ServerMessage { | ||
+ | oneof payload { | ||
+ | AuthenticationResponse authentication_response = 1; | ||
+ | MarketSnapshot market_snapshot = 2; | ||
+ | OrderUpdate order_update = 3; | ||
+ | // ... other server messages | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | |||
+ | === Message Tools === | ||
+ | |||
+ | The [[https:// | ||
+ | |||
+ | < | ||
+ | Reach out to support if you would like a API tool' | ||
+ | </ | ||
+ | |||
+ | ^ **Platform** ^ **Client Message Helper** ^ | ||
+ | | **.Net** | [[https:// | ||
- | For a detailed breakdown of all available messages, see the [[message_reference|Message Reference]]. | ||
- | ---- | ||
- | 💡 **Tip:** Use WebSocket clients like `wscat` or our sample SDKs to test the API before building your integration. | ||
- | ===== Next Steps ===== | ||
- | * Connect and Authenticate to **market data streams** ([[api: | ||