CRM Integration API
Introduction
OMTrader v1.0 API for CRM application integration includes both REST API and WebSocket API.
- If the CRM system supports WebSocket clients natively, this is the preferred approach.
- Most CRM providers only support REST clients and rely on polling to fetch data from OMTrader.
API Access Levels
| API Level | Scope | Security |
|---|---|---|
| Trader | Trader Account | API Key |
| Manager | Access all or some groups | Basic Auth |
| Admin | Admin only | Basic Auth |
✅ CRM integrations require Manager API level access.
Prerequisites
Before using Manager API:
- An admin must create a Manager role account via the Admin Portal.
- This account will be used for API impersonation.
- The account must stay active while the CRM application is in use.
- For full access across all groups, assign the account to the top-level group.
💡 Tip: Name the account CRM API for easier identification and maintenance.
API Overview
Manager API includes extensive capabilities. Below are the common endpoints used for CRM integrations.
API Documentation
- Login to: http://manager.omtrader.io
- Explore APIs via the left tab (Swagger UI with OpenAPI specs).
- Swagger provides full JSON request/response samples and error formats.
OMTrader is a trading technology platform — we are not involved in trading activities ourselves.
The domain names shown in this documentation are for internal use cases and partner integrations only.
In production, the actual APIs will point to broker white-label domains such as:
api.broker-acem.com
trader.broker-acem.com
OMTrader does not charge fees or execute trades.
Market feed data shown in examples may sometimes be live market data, provided for demonstration purposes.
OMTrader is not a broker. We provide the platform technology only — all trading, fees, and market operations remain under the responsibility of the broker.
Authentication
Login Endpoint
POST {{url}}/api/v1/oauth2/login?remember_me=false
Headers:
Authorization: Basic <base64(username:password)>
Example (cURL):
curl --location --request POST 'api.omtrader.io/api/v1/oauth2/login?remember_me=false' \
--header 'Authorization: Basic bWFuYWdlcjoxMjM='
Response:
{
"success": true,
"code": 200,
"data": {
"account_id": 2,
"access_token": "...",
"refresh_token": "...",
"session_id": "...",
"expires_in": 3600,
"ip_address": "94.249.48.3",
"scope": "Manager"
},
"error": "",
"message": ""
}
Use the access_token in future requests:
Example (REST API):
curl --location --globoff '{{url}}/api/v1/manager/accounts?page=2&limit=5' \
--header 'Authorization: Bearer <access_token>'
Example (WebSocket):
{{ws}}/ws/v1?session_id={{session_id}}&access_token={{token}}
API Format Structure
| Prefix | Description |
|---|---|
| Verb | GET, POST, PUT, DELETE, BATCH |
| Host | Target API server |
| API | Fixed to /api |
| Version | v1, v2, ... |
| Scope | trader, manager, admin |
| Entity | accounts, groups, commissions... |
| Page/Limit | Pagination for GET requests |
Manager Client API
| Description | Verb | URL |
|---|---|---|
| Get Clients | GET | /api/v1/manager/clients?page=1 |
| Get Client by Id | GET | /api/v1/manager/clients/:id |
| Update Client | PUT | //api/v1/manager/clients/:id |
| Delete Client | DELETE | /api/v1/manager/clients/:id |
| Create Client | POST | /api/v1/manager/clients |
Client in OMTrader
A Client is the core identity within the OMTrader trading platform.
Each trading account must be linked to at least one client.
A single client can own multiple trading accounts (demo or live).
The client data model is extensive. Below is a simplified JSON object highlighting the most relevant fields for CRM and account integration:
{
"type": 0,
"status": 0,
"kyc_status": 0,
"manager_id": 0,
"preferred_group": 0,
"approved_by": 0,
"approval_date": null,
"close_date": null,
"last_contact_date": null,
"lead_source": "",
"lead_campaign": "",
"introducer": "",
"title": "",
"first_name": "",
"middle_name": "",
"family_name": "",
"gender": "",
"birth_date": null,
"language": "",
"preferred_method": 0,
"mobile": "",
"messengers": "",
"social_networks": "",
"external_id": "",
"document_type": 0,
"document_number": "",
"issue_date": null,
"expiry_date": null,
"comment": "",
"country": "",
"state": "",
"city": "",
"zip_code": "",
"address": "",
"national": "",
"tax_id": "",
"employment_status": 0,
"employment_industry": 0,
"education_level": 0,
"source_of_wealth": 0,
"net_worth": 0,
"annual_income": 0,
"annual_deposit": 0,
"forex_experience": 0,
"stocks_experience": 0,
"cfd_experience": 0
}
| Field | Type | Description |
|---|---|---|
type | Integer | Client type (e.g., individual, corporate). |
status | Integer | Current status of the client (active, inactive, closed). |
kyc_status | Integer | KYC verification status (pending, verified, rejected). |
manager_id | Integer | Assigned manager ID responsible for the client. |
preferred_group | Integer | Preferred trading group or account group for the client. |
approved_by | Integer | User ID of the manager/admin who approved the client. |
approval_date | Date/Null | Date the client was approved. |
close_date | Date/Null | Date the client account was closed. |
last_contact_date | Date/Null | Last date the client was contacted. |
lead_source | String | Source from which the client was acquired (e.g., referral, campaign). |
lead_campaign | String | Marketing campaign identifier for tracking leads. |
introducer | String | Person or partner who introduced the client. |
title | String | Client’s title (Mr, Mrs, Dr, etc.). |
first_name | String | Client’s first name. |
middle_name | String | Client’s middle name (if any). |
family_name | String | Client’s family/last name. |
gender | String | Gender of the client. |
birth_date | Date/Null | Client’s date of birth. |
language | String | Preferred language of communication. |
preferred_method | Integer | Preferred contact method (phone, email, etc.). |
mobile | String | Client’s mobile phone number. |
messengers | String | Messenger apps (WhatsApp, Telegram, etc.) linked to client. |
social_networks | String | Client’s social media accounts. |
external_id | String | External system identifier (CRM or ERP mapping). |
document_type | Integer | Type of ID document (passport, national ID, etc.). |
document_number | String | ID or passport number. |
issue_date | Date/Null | Document issue date. |
expiry_date | Date/Null | Document expiry date. |
comment | String | Free text comments or notes about the client. |
country | String | Client’s country of residence. |
state | String | State or province. |
city | String | City of residence. |
zip_code | String | Postal or ZIP code. |
address | String | Full residential address. |
national | String | Nationality of the client. |
tax_id | String | Tax identification number (if applicable). |
employment_status | Integer | Employment status (employed, self-employed, unemployed). |
employment_industry | Integer | Industry sector of employment. |
education_level | Integer | Highest education level attained. |
source_of_wealth | Integer | Declared source of wealth (salary, business, inheritance, etc.). |
net_worth | Integer | Estimated net worth of the client. |
annual_income | Integer | Declared annual income. |
annual_deposit | Integer | Expected annual deposit into trading accounts. |
forex_experience | Integer | Experience level with Forex trading. |
stocks_experience | Integer | Experience level with stock trading. |
cfd_experience | Integer | Experience level with CFD trading. |
Manager Account API
| Description | Verb | URL |
|---|---|---|
| Get Accounts | GET | /api/v1/manager/accounts |
| Get Account | GET | /api/v1/manager/accounts/:id |
| Update Account | PUT | /api/v1/manager/accounts/:id |
| Delete Account | DELETE | /api/v1/manager/accounts/:id |
| Create Account | POST | /api/v1/manager/accounts |
| Transfer Money | POST | /api/v1/manager/accounts/1/money |
| Get Transactions | GET | /api/v1/manager/accounts/1/transactions/history |
Trading Account in OMTrader
In OMTrader, an Account (or Trading Account) is the entry point to the trading portal, mobile app, or API.
-
API Key Access Each account can generate an API key, enabling algo systems or external applications to connect without exposing the trader’s username and password.
-
Same Permissions The API key inherits the same permissions as the trader’s account.
-
Easy Revocation The trader can cancel an API key at any time — instantly revoking access for the external app. No broker or admin approval is required.
This design makes it simple and secure for traders to integrate with algos or third-party apps, without needing ongoing support.
{
"group_id": 1,
"client_id": 3,
"username": "",
"user_password": "",
"investor_password": "",
"first_name": "John",
"middle_name": "A.",
"family_name": "Doe",
"company": "Doe Enterprises",
"email": "john.doe@example.com",
"phone": "+1234567890",
"country": "USA",
"zip_code": "12345",
"state": "California",
"city": "Los Angeles",
"address": "123 Main St"
}
| Field | Type | Description |
|---|---|---|
group_id | Integer | Trading group ID the account belongs to. |
client_id | Integer | Linked client identifier (owner of the account). |
username | String | Login username for the trading account. |
user_password | String | Main account password (used for portal/app login). |
investor_password | String | Investor/readonly password (view-only access). |
first_name | String | First name of the account holder. |
middle_name | String | Middle name of the account holder. |
family_name | String | Last name (surname) of the account holder. |
company | String | Company name, if registered as a corporate account. |
email | String | Email address linked to the account. |
phone | String | Phone number of the account holder. |
country | String | Country of residence. |
zip_code | String | Postal/ZIP code. |
state | String | State or province. |
city | String | City of residence. |
address | String | Full residential or business address. |
Manager Group API
| Description | Verb | URL |
|---|---|---|
| Get Groups | GET | /api/v1/manager/groups |
| Get Group by ID | GET | /api/v1/manager/group/:id |
| Update Group | PUT | /api/v1/manager/group/:id |
Groups in OMTrader
Groups are created by the Admin (owner/manager) to organize traders under different settings.
-
Trader Settings – Groups define parameters like risk tolerance, margin calls, and other trading conditions.
-
Manager Permissions – A manager can only view groups they are permitted to access.
-
CRM Applications – Typically have access to all trader groups for reporting and management.
-
Hierarchy – A group can be either a root or a child group.
Root groups override the settings of their child groups.
Child groups inherit default values but can be customized further if allowed.
This model follows industry-leading practices for flexibility in trader segmentation and risk control.
{
"id": 79,
"root": false,
"parent_id": 1,
"group_type": 0,
"desc": "",
"status": "",
"currency": "USD",
"currency_digits": 1,
"default_leverage": 100,
"limit_history": null,
"limit_orders": 0,
"limit_positions": 0,
"limit_positions_volume": 0,
"limit_symbols": null,
"margin_mode": 0,
"margin_call": 2,
"margin_stop_out": 1,
"full_stop_out": false,
"compensate_negative_balance": false,
"groups": [],
"trade_accounts": null,
"created_at": "2025-09-22T15:19:58.54515Z",
"updated_at": "2025-09-22T15:19:58.54515Z",
"created_by": 1
}
| Field | Type | Description |
|---|---|---|
id | Integer | Unique identifier for the group. |
root | Boolean | Marks whether this is a root group (overrides child settings). |
parent_id | Integer | ID of the parent group if this is a child group. |
group_type | Integer | Type of group (e.g., trading, demo, corporate). |
desc | String | Description of the group. |
status | String | Status of the group (active, inactive, archived). |
currency | String | Default currency assigned to accounts in this group. |
currency_digits | Integer | Number of decimal places for the currency. |
default_leverage | Integer | Default leverage assigned to accounts in the group. |
limit_history | Integer | Limit on historical data available (null = unlimited). |
limit_orders | Integer | Maximum number of pending orders allowed. |
limit_positions | Integer | Maximum number of open positions allowed. |
limit_positions_volume | Integer | Maximum total trading volume allowed across positions. |
limit_symbols | Integer | Limit on number of tradable symbols (null = no limit). |
margin_mode | Integer | Margin calculation mode (industry-standard codes). |
margin_call | Integer | Margin call level (%) when warnings are triggered. |
margin_stop_out | Integer | Stop-out level (%) where forced position closure occurs. |
full_stop_out | Boolean | If true, all positions closed at stop-out (not partial). |
compensate_negative_balance | Boolean | Whether the broker compensates negative balances. |
groups | Array | List of child groups under this group. |
trade_accounts | Array/Null | List of trading accounts assigned to this group. |
created_at | Timestamp | Date and time the group was created. |
updated_at | Timestamp | Last update time for the group. |
created_by | Integer | ID of the admin/manager who created the group. |
Manager Group Commission API
| Description | Verb | URL |
|---|---|---|
| Get Group Commissions | GET | /api/v1/manager/groups/{id}/commissions |
| Create Commission | POST | /api/v1/manager/commissions |
| Update Commission | PUT | /api/v1/manager/commissions/:id |
| Delete Commission | DELETE | /api/v1/manager/commissions/:id |
Commissions
Commissions let brokers charge fees on each trade. OMTrader follows industry-standard practices gathered from broker feedback.
-
Group-scoped: Every commission is attached to a Group.
-
Multiple setups: A group can have one or many commission setups; broker/manager decides which are active.
-
Tiered pricing: Commissions can use tiers with conditions (charge mode, ranges, min/max caps).
-
Familiar models: Per-lot, per-trade, notional %, or fixed—just like existing trading desks.
{
"group_id": 1,
"symbol_class_id": 1,
"name": "Standard Commission",
"desc": "Commission for standard trading",
"mode": 0,
"mode_range": 0,
"mode_charge": 0,
"mode_entry": 0,
"mode_action": 0,
"mode_profit": 0,
"mode_reason": 1,
"commission_tiers": [
{
"mode": 0,
"type": 0,
"value": 0.1,
"range_from": 0,
"range_to": 10000,
"min": 1.0,
"max": 100.0,
"currency": "USD"
}
]
}
Commission main
| Field | Type | Description |
|---|---|---|
group_id | Integer | Group ID this commission belongs to. |
symbol_class_id | Integer | Asset or symbol class ID (e.g., FX, CFD, Stocks). |
name | String | Commission name for identification. |
desc | String | Description of the commission setup. |
mode | Integer | Commission calculation mode (e.g., per-lot, per-trade, percent). |
mode_range | Integer | Defines how ranges are evaluated (by trade volume, notional, lots, etc.). |
mode_charge | Integer | Defines the charge type (e.g., per order, per unit, percentage). |
mode_entry | Integer | Whether commission is charged at entry of trade. |
mode_action | Integer | Defines trade action scope (buy, sell, both). |
mode_profit | Integer | Whether commission is tied to profit calculation. |
mode_reason | Integer | Reason code (industry-aligned: standard trade, rollover, adjustment, etc.). |
commission_tiers | Array | Tiered commission rules (see below). |
Commission Tier Object
| Field | Type | Description |
|---|---|---|
mode | Integer | Calculation mode for this tier. |
type | Integer | Fee type (per-lot, per-trade, percent, fixed). |
value | Number | Fee value (depends on type). |
range_from | Number | Lower bound for the tier (inclusive). |
range_to | Number | Upper bound for the tier (exclusive). |
min | Number | Minimum commission charged per trade. |
max | Number | Maximum commission charged per trade. |
currency | String | Currency in which fee is charged. |
Manager Group Symbols API
| Description | Verb | URL |
|---|---|---|
| Get Symbols | GET | /api/v1/manager/symbols |
| Get Symbol By Id | GET | /api/v1/manager/symbols/:id |
| Get Group Symbols | GET | /api/v1/manager/groups/:id/symbols |
| Update Group Symbol | PUT | api/v1/manager/group-symbols/:id |
Symbols
Symbols are the core concept of any trading system. They represent the instruments available for trading, usually organized by asset class such as Forex, Commodities, Stocks, Indices, and more.
-
Liquidity Contracts – Each symbol is defined in a contract between the broker and liquidity providers or banks, often linked to an exchange.
-
Broker Terms – The broker then offers the same symbol to traders, with adjustments such as:
Spreads
Swaps
Additional Fees
This model ensures consistency with global markets, while allowing brokers to customize pricing and conditions for their clients.
{
"id": 4,
"symbol": "USDCHF",
"isin": "1",
"desc": "US Dollar vs Swiss Franc",
"base_currency": "USD",
"quote_currency": "CHF",
"symbol_scale": 0,
"quote_scale": 0,
"broker_fee": 0,
"maker_fee": 0,
"symbol_class": {
"id": 0,
"parent_id": 0,
"desc": "",
"symbol_classes": null,
"symbols": null
},
"margin_flags": 0,
"margin_initial": 1,
"margin_maintenance": 1,
"margin_buy": 1,
"margin_sell": 1,
"buy_limit": 0,
"sell_limit": 0,
"buy_stop": 0,
"sell_stop": 0,
"buy_stop_limit": 0,
"sell_stop_limit": 0,
"maintenance_margin_buy": 1,
"maintenance_margin_sell": 1,
"maintenance_buy_limit": 0,
"maintenance_sell_limit": 0,
"maintenance_buy_stop": 0,
"maintenance_sell_stop": 0,
"maintenance_buy_stop_limit": 0,
"maintenance_sell_stop_limit": 0,
"enabled": true,
"trade_level": 0,
"execution": 0,
"gtc": 0,
"filling": 0,
"expiration": "0,1,2,3",
"orders": "0,1,2,3,4,5",
"min_value": 0.1,
"max_value": 100,
"step": 1,
"swaps_enabled": false,
"swap_type": 0,
"swap_long": 0,
"swap_short": 0,
"digits": 5,
....
}
The symbol model is large here is the basics
| Field | Type | Description |
|---|---|---|
id | Integer | Unique identifier for the symbol. |
symbol | String | Symbol code (e.g., USDCHF). |
isin | String | ISIN or internal identifier. |
desc | String | Description of the symbol (e.g., US Dollar vs Swiss Franc). |
base_currency | String | Base currency of the pair. |
quote_currency | String | Quote currency of the pair. |
symbol_scale | Integer | Precision scale for base currency. |
quote_scale | Integer | Precision scale for quote currency. |
broker_fee | Number | Broker fee applied per trade. |
maker_fee | Number | Maker fee (if applicable). |
symbol_class | Object | Classification of the symbol (asset class, parent grouping). |
margin_flags | Integer | Flags controlling margin behavior. |
margin_initial | Number | Initial margin requirement. |
margin_maintenance | Number | Maintenance margin requirement. |
margin_buy | Number | Margin requirement for buy positions. |
margin_sell | Number | Margin requirement for sell positions. |
buy_limit | Number | Buy limit order threshold. |
sell_limit | Number | Sell limit order threshold. |
buy_stop | Number | Buy stop order threshold. |
sell_stop | Number | Sell stop order threshold. |
buy_stop_limit | Number | Buy stop-limit order threshold. |
sell_stop_limit | Number | Sell stop-limit order threshold. |
maintenance_margin_buy | Number | Maintenance margin for buy positions. |
maintenance_margin_sell | Number | Maintenance margin for sell positions. |
maintenance_buy_limit | Number | Maintenance margin for buy limit orders. |
maintenance_sell_limit | Number | Maintenance margin for sell limit orders. |
maintenance_buy_stop | Number | Maintenance margin for buy stop orders. |
maintenance_sell_stop | Number | Maintenance margin for sell stop orders. |
maintenance_buy_stop_limit | Number | Maintenance margin for buy stop-limit orders. |
maintenance_sell_stop_limit | Number | Maintenance margin for sell stop-limit orders. |
enabled | Boolean | Whether the symbol is active and tradable. |
trade_level | Integer | Required client level to trade this symbol. |
execution | Integer | Execution type (e.g., market, instant, request). |
gtc | Integer | Good-till-cancelled order policy. |
filling | Integer | Order filling mode. |
expiration | String | Supported expiration modes. |
orders | String | Supported order types (encoded list). |
min_value | Number | Minimum order volume. |
max_value | Number | Maximum order volume. |
step | Number | Step size for order volumes. |
swaps_enabled | Boolean | Whether swaps are applied to this symbol. |
swap_type | Integer | Swap calculation type. |
swap_long | Number | Swap rate for long positions. |
swap_short | Number | Swap rate for short positions. |
digits | Integer | Number of decimal digits for price quotes. |
Manager Order API
Only for CRM APIs endpoints
| Description | Verb | URL |
|---|---|---|
| Get Orders | GET | api/v1/manager/orders |
| Get Order By Id | GET | /api/v1/manager/orders/:id |
| Get Orders History | GET | /api/v1/manager/orders/history?page=1&limit=1&sort_by=id&dir=ASC |
Order
An Order is the contract request to open a trade or position in the brokerage system.
-
Pending orders – Stored until they are triggered or cancelled.
-
Market orders – Executed immediately and then moved into Positions.
-
Order history – Large datasets can be returned when querying historical orders.
-
Pagination – To manage performance and response size, history queries support pagination via URL query parameters.
{
"user_id": ,
"account_id": ,
"symbol_id": ,
"type": ,
"order_price": ,
"volume": ,
"price_sl": ,
"price_tp": ,
"comment": "",
"expiration_police": 0,
"time_expiration": "2023-10-01T12:00:00Z"
}
| Field | Type | Description |
|---|---|---|
user_id | Integer | ID of the trader placing the order. |
account_id | Integer | Trading account ID linked to the order. |
symbol_id | Integer | Symbol being traded (e.g., EURUSD = 9). |
type | Integer | Order type (market, limit, stop, stop-limit, etc.). |
order_price | Number | Requested price for the order. |
volume | Number | Trade size (e.g., lots). |
price_sl | Number | Stop-loss price. |
price_tp | Number | Take-profit price. |
comment | String | Optional trader comment. |
expiration_police | Integer | Expiration policy (e.g., GTC, GTD, IOC). |
time_expiration | Timestamp | Expiration time if policy = GTD (Good Till Date). |
Order Type
| Code | Name | Description |
|---|---|---|
0 | market_order | Executes immediately at the current market price. |
1 | buy_limit | Buy order placed below current market price, triggers when price drops. |
2 | buy_stop | Buy order placed above current market price, triggers when price rises. |
3 | sell_limit | Sell order placed above current market price, triggers when price climbs. |
4 | sell_stop | Sell order placed below current market price, triggers when price falls. |
5 | buy_stop_limit | Combination: when price hits a stop level above market, a buy limit order is placed. |
6 | sell_stop_limit | Combination: when price hits a stop level below market, a sell limit order is placed. |
Manager Position API
Only for CRM APIs endpoints
| Description | Verb | URL |
|---|---|---|
| Get Positions | GET | api/v1/manager/positions?page=2&limit=10 |
| Get Position By Id | GET | /api/v1/manager/positions/:id |
| Get Position History | GET | /api/v1/manager/positions/history?page=1&limit=10&sort_by=id&dir=ASC |
Position
A Position is the result of an Order execution.
-
When a market order is filled or a pending order is triggered, a position is created at the given market price.
-
The Profit/Loss (P/L) of the position directly impacts the trader’s account balance.
-
Positions may be closed automatically when:
-
A margin call / stop-out level is reached.
-
The broker intervenes for risk management.
-
To protect the trader’s capital under extreme market conditions.
-
{
"id": 661,
"external_id": "",
"account_id": 1,
"dealer_id": 0,
"symbol_id": 2,
"action": 0,
"digits": 5,
"digits_currency": 2,
"reason": 0,
"contract_size": 1000,
"price_open": 1.34965,
"price_current": 0,
"price_sl": null,
"price_tp": null,
"profit": 0.077,
"exit_level": 0,
"exit_profit": 0,
"exit_loos": 0,
"storage": 0,
"rate_profit": 0,
"rate_margin": 0,
"comment": "",
"volume_initial_ext": 0,
"volume_current_ext": 0,
"volume_initial": 0.1,
"volume_current": 0.1,
"swaps": 0,
"commission": 0,
"total_profit": 0,
"side": 0,
"status": 0,
"created_at": "2025-09-22T08:57:59.148078179Z",
"updated_at": "2025-09-22T08:57:59.148078243Z",
"created_by": 1
},
| Field | Type | Description |
|---|---|---|
id | Integer | Unique position identifier. |
external_id | String | Optional external system reference from LP. |
account_id | Integer | Trading account linked to the position. |
dealer_id | Integer | Dealer or manager ID who handled the trade. |
symbol_id | Integer | ID of the traded symbol. |
action | Integer | Trade action (buy/sell, usually mapped by enum). |
digits | Integer | Price precision (symbol digits). |
digits_currency | Integer | Currency precision for P/L calculations. |
reason | Integer | Reason code for position creation (manual, algo, rollover, etc.). |
contract_size | Number | Standard contract size for this symbol. |
price_open | Number | Opening price of the position. |
price_current | Number | Current market price of the symbol. |
price_sl | Number/Null | Stop-loss level (if set). |
price_tp | Number/Null | Take-profit level (if set). |
profit | Number | Current floating profit/loss. |
exit_level | Number | Price level at which the position was closed (if applicable). |
exit_profit | Number | Final realized profit when closed. |
exit_loos | Number | Final realized loss (typo in schema, should be exit_loss). |
storage | Number | Storage/overnight financing applied. |
rate_profit | Number | Profit conversion rate (e.g., to account currency). |
rate_margin | Number | Margin conversion rate. |
comment | String | Free text notes for the position. |
volume_initial_ext | Number | External system reference for initial volume. |
volume_current_ext | Number | External system reference for current volume. |
volume_initial | Number | Initial traded volume. |
volume_current | Number | Remaining open volume. |
swaps | Number | Swap/rollover fees charged. |
commission | Number | Commission charged on the trade. |
total_profit | Number | Total P/L including swaps and commission. |
side | Integer | Trade side (long/short, enum mapped). |
status | Integer | Position status (open, closed, partially closed). |
created_at | Timestamp | Time the position was created. |
updated_at | Timestamp | Last updated time. |
created_by | Integer | User or system that created the position. |
Manager Deals API
Only for CRM APIs endpoints
| Description | Verb | URL |
|---|---|---|
| Get Deals | GET | /api/v1/trader/deals?page=-1&limit=1&sort_by=id&dir=ASC |
| Get Position By Id | GET | /api/v1/trader/deals/:id |
Deal
A Deal represents the entry or exit of a trading position — acting like a mini-ledger that directly impacts the trader’s balance.
-
Entry (IN): A deal that opens or increases a position, entering the market.
-
Exit (OUT): A deal that closes or reduces a position, realizing profit or loss into the trader’s balance.
-
Balance Impact: Each deal updates account balance, reflecting commissions, swaps, and realized P/L.
{
"id": 1,
"external_id": "",
"account_id": 1,
"dealer_id": 0,
"order_id": 0,
"action": 0,
"entry": 0,
"reason": 0,
"digits": 5,
"digits_currency": 2,
"contract_size": 1000,
"symbol_id": 1,
"price": 1.1753,
"external_volume": 0.1,
"profit": 0,
"storage": 0,
"commission": 0,
"profit_raw": 0,
"price_position": 1.1753,
"price_sl": null,
"price_tp": null,
"external_volume_closed": 0,
"tick_value": 0,
"tick_size": 0,
"volume": 0.1,
"closed_volume": 0,
"position_id": 1,
"comment": "",
"swap": 0,
"fee": 0,
"market_bid": 0,
"market_ask": 0,
"market_last": 0,
"side": 0,
"direction": 0,
"channel": 0,
"symbol": null,
"account": null,
"created_at": "2025-04-06T08:39:27.113509Z",
"updated_at": "2025-04-06T08:39:27.113509Z"
}
| Field | Type | Description |
|---|---|---|
id | Integer | Unique deal identifier. |
external_id | String | External system reference (if any). |
account_id | Integer | Trading account linked to the deal. |
dealer_id | Integer | Dealer or manager who handled the trade. |
order_id | Integer | Associated order ID. |
action | Integer | Action type (e.g., open, close, modify — enum mapped). |
entry | Integer | Entry type: IN (opening) or OUT (closing). |
reason | Integer | Reason code (manual, stop-out, system, etc.). |
digits | Integer | Price precision (symbol digits). |
digits_currency | Integer | Currency precision for P/L. |
contract_size | Number | Contract size for this symbol. |
symbol_id | Integer | ID of the traded symbol. |
price | Number | Deal execution price. |
external_volume | Number | External volume reference. |
profit | Number | Realized profit/loss from the deal. |
storage | Number | Overnight/storage charges. |
commission | Number | Commission charged. |
profit_raw | Number | Raw profit before adjustments. |
price_position | Number | Position price reference. |
price_sl | Number/Null | Stop-loss level at execution. |
price_tp | Number/Null | Take-profit level at execution. |
external_volume_closed | Number | Volume closed in external system. |
tick_value | Number | Value per tick movement. |
tick_size | Number | Minimum tick size. |
volume | Number | Executed deal volume. |
closed_volume | Number | Volume closed from the position. |
position_id | Integer | Linked position ID. |
comment | String | Optional trader/broker comment. |
swap | Number | Swap charges applied. |
fee | Number | Additional fees (if any). |
market_bid | Number | Market bid price at execution. |
market_ask | Number | Market ask price at execution. |
market_last | Number | Last market price at execution. |
side | Integer | Trade side (buy/sell). |
direction | Integer | Direction relative to position (in/out). |
channel | Integer | Execution channel (API, Web, Mobile, etc.). |
symbol | Object/Null | Embedded symbol details if expanded. |
account | Object/Null | Embedded account details if expanded. |
created_at | Timestamp | Time deal was created. |
updated_at | Timestamp | Last updated time. |
WebSocket API
WebSocket Events for CRM Providers
If your CRM supports WebSocket, you can stream real-time trading events and avoid heavy API polling.
What you get (out of the box):
-
Account Summary updates
-
Orders (new, updated, canceled)
-
Positions (opened, modified, closed)
-
Deals (entry/exit, realized P/L)
Security & session rules
Only the logged-in user may open a WebSocket connection.
You must use the access_token and session_id issued during login.
Connections are scope-limited to the user’s permissions and groups
WebSocket URL Format
{{ws}}/ws/v1?session_id={{session_id}}&access_token={{token}}
- Use
wss://for production (secure WebSocket).
Connection
GET {{ws}}/ws/v1?session_id={{session_id}}&access_token={{token}}
Example Response:
Connected to api.omtrader.io/ws/v1?session_id=...&access_token=...
WebSocket Event Format
{
"type": "event_name",
"data": { ... }
}
Subscription Events
| Event | Data | Description |
|---|---|---|
subscribe_group | group_id | Subscribes to a group's data stream |
subscribe_group_session | group_id | Subscribes to all sessions in a group |
Unsubscription Events
| Event | Data | Description |
|---|---|---|
unsubscribe_group | group_id | Unsubscribes from a group’s data stream |
unsubscribe_group_session | group_id | Unsubscribes from all sessions in a group |
WebSocket Heartbeat
To keep WebSocket alive, send a heartbeat ping (9) every 30 seconds:
private startHeartbeat() {
if (this.heartbeatInterval) {
clearInterval(this.heartbeatInterval);
}
this.heartbeatInterval = setInterval(() => {
if (this.webSocket && this.webSocket.readyState === WebSocket.OPEN) {
this.sendString("9");
}
}, 30000); // Every 30 seconds
}