Skip to main content

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 LevelScopeSecurity
TraderTrader AccountAPI Key
ManagerAccess all or some groupsBasic Auth
AdminAdmin onlyBasic 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.
Tip

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.

Important

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

PrefixDescription
VerbGET, POST, PUT, DELETE, BATCH
HostTarget API server
APIFixed to /api
Versionv1, v2, ...
Scopetrader, manager, admin
Entityaccounts, groups, commissions...
Page/LimitPagination for GET requests

Manager Client API

DescriptionVerbURL
Get ClientsGET/api/v1/manager/clients?page=1
Get Client by IdGET/api/v1/manager/clients/:id
Update ClientPUT//api/v1/manager/clients/:id
Delete ClientDELETE/api/v1/manager/clients/:id
Create ClientPOST/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

}
FieldTypeDescription
typeIntegerClient type (e.g., individual, corporate).
statusIntegerCurrent status of the client (active, inactive, closed).
kyc_statusIntegerKYC verification status (pending, verified, rejected).
manager_idIntegerAssigned manager ID responsible for the client.
preferred_groupIntegerPreferred trading group or account group for the client.
approved_byIntegerUser ID of the manager/admin who approved the client.
approval_dateDate/NullDate the client was approved.
close_dateDate/NullDate the client account was closed.
last_contact_dateDate/NullLast date the client was contacted.
lead_sourceStringSource from which the client was acquired (e.g., referral, campaign).
lead_campaignStringMarketing campaign identifier for tracking leads.
introducerStringPerson or partner who introduced the client.
titleStringClient’s title (Mr, Mrs, Dr, etc.).
first_nameStringClient’s first name.
middle_nameStringClient’s middle name (if any).
family_nameStringClient’s family/last name.
genderStringGender of the client.
birth_dateDate/NullClient’s date of birth.
languageStringPreferred language of communication.
preferred_methodIntegerPreferred contact method (phone, email, etc.).
mobileStringClient’s mobile phone number.
messengersStringMessenger apps (WhatsApp, Telegram, etc.) linked to client.
social_networksStringClient’s social media accounts.
external_idStringExternal system identifier (CRM or ERP mapping).
document_typeIntegerType of ID document (passport, national ID, etc.).
document_numberStringID or passport number.
issue_dateDate/NullDocument issue date.
expiry_dateDate/NullDocument expiry date.
commentStringFree text comments or notes about the client.
countryStringClient’s country of residence.
stateStringState or province.
cityStringCity of residence.
zip_codeStringPostal or ZIP code.
addressStringFull residential address.
nationalStringNationality of the client.
tax_idStringTax identification number (if applicable).
employment_statusIntegerEmployment status (employed, self-employed, unemployed).
employment_industryIntegerIndustry sector of employment.
education_levelIntegerHighest education level attained.
source_of_wealthIntegerDeclared source of wealth (salary, business, inheritance, etc.).
net_worthIntegerEstimated net worth of the client.
annual_incomeIntegerDeclared annual income.
annual_depositIntegerExpected annual deposit into trading accounts.
forex_experienceIntegerExperience level with Forex trading.
stocks_experienceIntegerExperience level with stock trading.
cfd_experienceIntegerExperience level with CFD trading.

Manager Account API

DescriptionVerbURL
Get AccountsGET/api/v1/manager/accounts
Get AccountGET/api/v1/manager/accounts/:id
Update AccountPUT/api/v1/manager/accounts/:id
Delete AccountDELETE/api/v1/manager/accounts/:id
Create AccountPOST/api/v1/manager/accounts
Transfer MoneyPOST/api/v1/manager/accounts/1/money
Get TransactionsGET/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"
}

FieldTypeDescription
group_idIntegerTrading group ID the account belongs to.
client_idIntegerLinked client identifier (owner of the account).
usernameStringLogin username for the trading account.
user_passwordStringMain account password (used for portal/app login).
investor_passwordStringInvestor/readonly password (view-only access).
first_nameStringFirst name of the account holder.
middle_nameStringMiddle name of the account holder.
family_nameStringLast name (surname) of the account holder.
companyStringCompany name, if registered as a corporate account.
emailStringEmail address linked to the account.
phoneStringPhone number of the account holder.
countryStringCountry of residence.
zip_codeStringPostal/ZIP code.
stateStringState or province.
cityStringCity of residence.
addressStringFull residential or business address.

Manager Group API

DescriptionVerbURL
Get GroupsGET/api/v1/manager/groups
Get Group by IDGET/api/v1/manager/group/:id
Update GroupPUT/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
}

FieldTypeDescription
idIntegerUnique identifier for the group.
rootBooleanMarks whether this is a root group (overrides child settings).
parent_idIntegerID of the parent group if this is a child group.
group_typeIntegerType of group (e.g., trading, demo, corporate).
descStringDescription of the group.
statusStringStatus of the group (active, inactive, archived).
currencyStringDefault currency assigned to accounts in this group.
currency_digitsIntegerNumber of decimal places for the currency.
default_leverageIntegerDefault leverage assigned to accounts in the group.
limit_historyIntegerLimit on historical data available (null = unlimited).
limit_ordersIntegerMaximum number of pending orders allowed.
limit_positionsIntegerMaximum number of open positions allowed.
limit_positions_volumeIntegerMaximum total trading volume allowed across positions.
limit_symbolsIntegerLimit on number of tradable symbols (null = no limit).
margin_modeIntegerMargin calculation mode (industry-standard codes).
margin_callIntegerMargin call level (%) when warnings are triggered.
margin_stop_outIntegerStop-out level (%) where forced position closure occurs.
full_stop_outBooleanIf true, all positions closed at stop-out (not partial).
compensate_negative_balanceBooleanWhether the broker compensates negative balances.
groupsArrayList of child groups under this group.
trade_accountsArray/NullList of trading accounts assigned to this group.
created_atTimestampDate and time the group was created.
updated_atTimestampLast update time for the group.
created_byIntegerID of the admin/manager who created the group.

Manager Group Commission API

DescriptionVerbURL
Get Group CommissionsGET/api/v1/manager/groups/{id}/commissions
Create CommissionPOST/api/v1/manager/commissions
Update CommissionPUT/api/v1/manager/commissions/:id
Delete CommissionDELETE/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

FieldTypeDescription
group_idIntegerGroup ID this commission belongs to.
symbol_class_idIntegerAsset or symbol class ID (e.g., FX, CFD, Stocks).
nameStringCommission name for identification.
descStringDescription of the commission setup.
modeIntegerCommission calculation mode (e.g., per-lot, per-trade, percent).
mode_rangeIntegerDefines how ranges are evaluated (by trade volume, notional, lots, etc.).
mode_chargeIntegerDefines the charge type (e.g., per order, per unit, percentage).
mode_entryIntegerWhether commission is charged at entry of trade.
mode_actionIntegerDefines trade action scope (buy, sell, both).
mode_profitIntegerWhether commission is tied to profit calculation.
mode_reasonIntegerReason code (industry-aligned: standard trade, rollover, adjustment, etc.).
commission_tiersArrayTiered commission rules (see below).

Commission Tier Object

FieldTypeDescription
modeIntegerCalculation mode for this tier.
typeIntegerFee type (per-lot, per-trade, percent, fixed).
valueNumberFee value (depends on type).
range_fromNumberLower bound for the tier (inclusive).
range_toNumberUpper bound for the tier (exclusive).
minNumberMinimum commission charged per trade.
maxNumberMaximum commission charged per trade.
currencyStringCurrency in which fee is charged.

Manager Group Symbols API

DescriptionVerbURL
Get SymbolsGET/api/v1/manager/symbols
Get Symbol By IdGET/api/v1/manager/symbols/:id
Get Group SymbolsGET/api/v1/manager/groups/:id/symbols
Update Group SymbolPUTapi/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

FieldTypeDescription
idIntegerUnique identifier for the symbol.
symbolStringSymbol code (e.g., USDCHF).
isinStringISIN or internal identifier.
descStringDescription of the symbol (e.g., US Dollar vs Swiss Franc).
base_currencyStringBase currency of the pair.
quote_currencyStringQuote currency of the pair.
symbol_scaleIntegerPrecision scale for base currency.
quote_scaleIntegerPrecision scale for quote currency.
broker_feeNumberBroker fee applied per trade.
maker_feeNumberMaker fee (if applicable).
symbol_classObjectClassification of the symbol (asset class, parent grouping).
margin_flagsIntegerFlags controlling margin behavior.
margin_initialNumberInitial margin requirement.
margin_maintenanceNumberMaintenance margin requirement.
margin_buyNumberMargin requirement for buy positions.
margin_sellNumberMargin requirement for sell positions.
buy_limitNumberBuy limit order threshold.
sell_limitNumberSell limit order threshold.
buy_stopNumberBuy stop order threshold.
sell_stopNumberSell stop order threshold.
buy_stop_limitNumberBuy stop-limit order threshold.
sell_stop_limitNumberSell stop-limit order threshold.
maintenance_margin_buyNumberMaintenance margin for buy positions.
maintenance_margin_sellNumberMaintenance margin for sell positions.
maintenance_buy_limitNumberMaintenance margin for buy limit orders.
maintenance_sell_limitNumberMaintenance margin for sell limit orders.
maintenance_buy_stopNumberMaintenance margin for buy stop orders.
maintenance_sell_stopNumberMaintenance margin for sell stop orders.
maintenance_buy_stop_limitNumberMaintenance margin for buy stop-limit orders.
maintenance_sell_stop_limitNumberMaintenance margin for sell stop-limit orders.
enabledBooleanWhether the symbol is active and tradable.
trade_levelIntegerRequired client level to trade this symbol.
executionIntegerExecution type (e.g., market, instant, request).
gtcIntegerGood-till-cancelled order policy.
fillingIntegerOrder filling mode.
expirationStringSupported expiration modes.
ordersStringSupported order types (encoded list).
min_valueNumberMinimum order volume.
max_valueNumberMaximum order volume.
stepNumberStep size for order volumes.
swaps_enabledBooleanWhether swaps are applied to this symbol.
swap_typeIntegerSwap calculation type.
swap_longNumberSwap rate for long positions.
swap_shortNumberSwap rate for short positions.
digitsIntegerNumber of decimal digits for price quotes.

Manager Order API

Only for CRM APIs endpoints

DescriptionVerbURL
Get OrdersGETapi/v1/manager/orders
Get Order By IdGET/api/v1/manager/orders/:id
Get Orders HistoryGET/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"
}

FieldTypeDescription
user_idIntegerID of the trader placing the order.
account_idIntegerTrading account ID linked to the order.
symbol_idIntegerSymbol being traded (e.g., EURUSD = 9).
typeIntegerOrder type (market, limit, stop, stop-limit, etc.).
order_priceNumberRequested price for the order.
volumeNumberTrade size (e.g., lots).
price_slNumberStop-loss price.
price_tpNumberTake-profit price.
commentStringOptional trader comment.
expiration_policeIntegerExpiration policy (e.g., GTC, GTD, IOC).
time_expirationTimestampExpiration time if policy = GTD (Good Till Date).

Order Type

CodeNameDescription
0market_orderExecutes immediately at the current market price.
1buy_limitBuy order placed below current market price, triggers when price drops.
2buy_stopBuy order placed above current market price, triggers when price rises.
3sell_limitSell order placed above current market price, triggers when price climbs.
4sell_stopSell order placed below current market price, triggers when price falls.
5buy_stop_limitCombination: when price hits a stop level above market, a buy limit order is placed.
6sell_stop_limitCombination: when price hits a stop level below market, a sell limit order is placed.

Manager Position API

Only for CRM APIs endpoints

DescriptionVerbURL
Get PositionsGETapi/v1/manager/positions?page=2&limit=10
Get Position By IdGET/api/v1/manager/positions/:id
Get Position HistoryGET/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:

    1. A margin call / stop-out level is reached.

    2. The broker intervenes for risk management.

    3. 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
},
FieldTypeDescription
idIntegerUnique position identifier.
external_idStringOptional external system reference from LP.
account_idIntegerTrading account linked to the position.
dealer_idIntegerDealer or manager ID who handled the trade.
symbol_idIntegerID of the traded symbol.
actionIntegerTrade action (buy/sell, usually mapped by enum).
digitsIntegerPrice precision (symbol digits).
digits_currencyIntegerCurrency precision for P/L calculations.
reasonIntegerReason code for position creation (manual, algo, rollover, etc.).
contract_sizeNumberStandard contract size for this symbol.
price_openNumberOpening price of the position.
price_currentNumberCurrent market price of the symbol.
price_slNumber/NullStop-loss level (if set).
price_tpNumber/NullTake-profit level (if set).
profitNumberCurrent floating profit/loss.
exit_levelNumberPrice level at which the position was closed (if applicable).
exit_profitNumberFinal realized profit when closed.
exit_loosNumberFinal realized loss (typo in schema, should be exit_loss).
storageNumberStorage/overnight financing applied.
rate_profitNumberProfit conversion rate (e.g., to account currency).
rate_marginNumberMargin conversion rate.
commentStringFree text notes for the position.
volume_initial_extNumberExternal system reference for initial volume.
volume_current_extNumberExternal system reference for current volume.
volume_initialNumberInitial traded volume.
volume_currentNumberRemaining open volume.
swapsNumberSwap/rollover fees charged.
commissionNumberCommission charged on the trade.
total_profitNumberTotal P/L including swaps and commission.
sideIntegerTrade side (long/short, enum mapped).
statusIntegerPosition status (open, closed, partially closed).
created_atTimestampTime the position was created.
updated_atTimestampLast updated time.
created_byIntegerUser or system that created the position.

Manager Deals API

Only for CRM APIs endpoints

DescriptionVerbURL
Get DealsGET/api/v1/trader/deals?page=-1&limit=1&sort_by=id&dir=ASC
Get Position By IdGET/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"
}

FieldTypeDescription
idIntegerUnique deal identifier.
external_idStringExternal system reference (if any).
account_idIntegerTrading account linked to the deal.
dealer_idIntegerDealer or manager who handled the trade.
order_idIntegerAssociated order ID.
actionIntegerAction type (e.g., open, close, modify — enum mapped).
entryIntegerEntry type: IN (opening) or OUT (closing).
reasonIntegerReason code (manual, stop-out, system, etc.).
digitsIntegerPrice precision (symbol digits).
digits_currencyIntegerCurrency precision for P/L.
contract_sizeNumberContract size for this symbol.
symbol_idIntegerID of the traded symbol.
priceNumberDeal execution price.
external_volumeNumberExternal volume reference.
profitNumberRealized profit/loss from the deal.
storageNumberOvernight/storage charges.
commissionNumberCommission charged.
profit_rawNumberRaw profit before adjustments.
price_positionNumberPosition price reference.
price_slNumber/NullStop-loss level at execution.
price_tpNumber/NullTake-profit level at execution.
external_volume_closedNumberVolume closed in external system.
tick_valueNumberValue per tick movement.
tick_sizeNumberMinimum tick size.
volumeNumberExecuted deal volume.
closed_volumeNumberVolume closed from the position.
position_idIntegerLinked position ID.
commentStringOptional trader/broker comment.
swapNumberSwap charges applied.
feeNumberAdditional fees (if any).
market_bidNumberMarket bid price at execution.
market_askNumberMarket ask price at execution.
market_lastNumberLast market price at execution.
sideIntegerTrade side (buy/sell).
directionIntegerDirection relative to position (in/out).
channelIntegerExecution channel (API, Web, Mobile, etc.).
symbolObject/NullEmbedded symbol details if expanded.
accountObject/NullEmbedded account details if expanded.
created_atTimestampTime deal was created.
updated_atTimestampLast 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):

  1. Account Summary updates

  2. Orders (new, updated, canceled)

  3. Positions (opened, modified, closed)

  4. 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

EventDataDescription
subscribe_groupgroup_idSubscribes to a group's data stream
subscribe_group_sessiongroup_idSubscribes to all sessions in a group

Unsubscription Events

EventDataDescription
unsubscribe_groupgroup_idUnsubscribes from a group’s data stream
unsubscribe_group_sessiongroup_idUnsubscribes 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
}