### GET Security Definitions Query Parameters Source: https://docs.ironbeamapi.com/index This example demonstrates how to specify multiple symbols in the query parameters for retrieving security definitions. The symbols must be valid exchange symbols. ```url symbols=XCME:ES.U16,XCME:6E.U16,XCME:NQ.U16 ``` -------------------------------- ### Install OpenAPI Generator CLI Source: https://docs.ironbeamapi.com/index Installs the OpenAPI Generator CLI tool globally or locally using npm. This tool is required for generating client libraries from an OpenAPI specification. Java 8 or later must be installed. ```bash npm install @openapitools/openapi-generator-cli -g ``` ```bash npm install @openapitools/openapi-generator-cli --save-dev ``` -------------------------------- ### GET /v2/info/user Source: https://docs.ironbeamapi.com/index Retrieves general user information. ```APIDOC ## GET /v2/info/user ### Description Retrieves general user information. ### Method GET ### Endpoint `/v2/info/user` ### Parameters #### Query Parameters - **traderId** (string) - Required - The trader ID to retrieve user information for. ### Response #### Success Response (200) - **status** (string) - The status of the request. - **message** (string) - A message indicating the result of the request. - **accountCategory** (integer) - The category of the account. - **accountTitle** (string) - The title of the account. - **emailAddress1** (string) - The primary email address. - **emailAddress2** (string) - The secondary email address. - **group** (string) - The user's group. - **isClearingAccount** (boolean) - Indicates if it is a clearing account. - **phone1** (string) - The primary phone number. - **phone2** (string) - The secondary phone number. - **subGroup** (string) - The user's subgroup. - **accounts** (array of strings) - A list of account IDs associated with the user. #### Response Example ```json { "status": "OK", "message": "string", "accountCategory": 0, "accountTitle": "string", "emailAddress1": "string", "emailAddress2": "string", "group": "string", "isClearingAccount": true, "phone1": "string", "phone2": "string", "subGroup": "string", "accounts": [ "5123345" ] } ``` ``` -------------------------------- ### Get Simulated Account Cash Report - Example Request Source: https://docs.ironbeamapi.com/index This code snippet demonstrates how to request the cash report for a simulated account. It requires an account ID and returns a JSON object with the account's cash status. This endpoint is available on both demo and production servers. ```shell curl -X GET https://demo.ironbeamapi.com/v2/simulatedAccount/getCashReport/{accountId} ``` -------------------------------- ### Search Symbol Options - API Request Example Source: https://docs.ironbeamapi.com/index Example of an API request to search for symbol options. This endpoint requires 'symbol', 'group', 'optionType', and 'near' as path parameters. 'symbol' is a string up to 21 characters, 'group' is a string up to 5 characters, 'optionType' can be 'call' or 'put', and 'near' is a boolean. The response lists matching symbol options. ```HTTP GET https://live.ironbeamapi.com/v2/info/symbol/search/options/ext/{symbol}/{group}/{optionType}/{near} ``` -------------------------------- ### Search Symbol Option Spreads - API Request Example Source: https://docs.ironbeamapi.com/index Example of an API request to search for symbol option spreads. This endpoint requires a 'symbol' path parameter, which is a string representing the symbol and must be less than or equal to 21 characters. The response returns a list of symbol spreads. ```HTTP GET https://live.ironbeamapi.com/v2/info/symbol/search/options/spreads/{symbol} ``` -------------------------------- ### Get Simulated Account Cash Report - Example Response (200 OK) Source: https://docs.ironbeamapi.com/index This JSON structure represents a successful response (200 OK) for the getCashReport endpoint. It includes the status, a message, the AccountId, and a detailed CashReport array with amount, entryDate, and availableDate for each entry. ```json { "status": "OK", "message": "string", "AccountId": "ABC51380561", "CashReport": [ { "amount": 1000, "entryDate": 20250910, "availableDate": 20250910 } ] } ``` -------------------------------- ### Get Symbol Option Groups - API Request Example Source: https://docs.ironbeamapi.com/index Example of an API request to retrieve symbol option groups. This endpoint requires a 'symbol' path parameter, which is a string representing the symbol and must be less than or equal to 21 characters. The response provides details on option groups, including expiration dates and descriptions. ```HTTP GET https://live.ironbeamapi.com/v2/info/symbol/search/options/{symbol} ``` -------------------------------- ### Get Symbol Groups - API Request Example Source: https://docs.ironbeamapi.com/index Example of an API request to retrieve symbol groups. This endpoint requires a 'complex' path parameter, which is a string representing the market complex and must be less than or equal to 50 characters. The response includes a list of symbol groups, status, and a message. ```HTTP GET https://live.ironbeamapi.com/v2/info/symbol/search/groups/{complex} ``` -------------------------------- ### Get all accounts Source: https://docs.ironbeamapi.com/index Retrieves all accounts associated with the authenticated user. ```APIDOC ## GET /v2/account/getAllAccounts ### Description Get all accounts associated with the authenticated user. ### Method GET ### Endpoint `/v2/account/getAllAccounts` ### Parameters #### Query Parameters #### Request Body ### Request Example ```json { "example": "request body" } ``` ### Response #### Success Response (200) - **accounts** (array) - A list of account IDs. - **status** (string) - Status of the response. - **message** (string) - A message associated with the response. #### Response Example ```json { "accounts": [ "5123345" ], "status": "OK", "message": "string" } ``` ``` -------------------------------- ### Place New Order (Limit Order Example) Source: https://docs.ironbeamapi.com/index This code snippet illustrates placing a limit order. Limit orders are executed at a specific price or better. It requires account ID, order details, and crucially, a limit price. ```python def place_limit_order(account_id, symbol, quantity, side, duration, limit_price): """Places a new limit order. Args: account_id (str): The account ID for the order. symbol (str): The trading symbol. quantity (int): The quantity to trade. side (str): The order side ('BUY' or 'SELL'). duration (str): The order duration ('DAY' or 'GOOD_TILL_CANCEL'). limit_price (float): The specific price for the limit order. Returns: dict: The API response containing the order ID. """ # Implementation details for placing a limit order via API pass ``` -------------------------------- ### Place New Order (Bracket Order Example) Source: https://docs.ironbeamapi.com/index This code snippet illustrates placing a bracket order, which includes a primary order along with simultaneous take-profit and stop-loss orders. It requires account ID, order details, and prices for stop-loss and take-profit. ```python def place_bracket_order(account_id, symbol, quantity, side, duration, entry_price, stop_loss_price, take_profit_price): """Places a new bracket order. Args: account_id (str): The account ID for the order. symbol (str): The trading symbol. quantity (int): The quantity to trade. side (str): The order side ('BUY' or 'SELL'). duration (str): The order duration ('DAY' or 'GOOD_TILL_CANCEL'). entry_price (float): The entry price for the primary order. stop_loss_price (float): The price for the stop-loss order. take_profit_price (float): The price for the take-profit order. Returns: dict: The API response containing the order ID. """ # Implementation details for placing a bracket order via API pass ``` -------------------------------- ### Place New Order (Stop Limit Order Example) Source: https://docs.ironbeamapi.com/index This code snippet demonstrates placing a stop-limit order, combining stop and limit order features. It requires account ID, order details, a stop price to trigger, and a limit price for execution. ```python def place_stop_limit_order(account_id, symbol, quantity, side, duration, stop_price, limit_price): """Places a new stop-limit order. Args: account_id (str): The account ID for the order. symbol (str): The trading symbol. quantity (int): The quantity to trade. side (str): The order side ('BUY' or 'SELL'). duration (str): The order duration ('DAY' or 'GOOD_TILL_CANCEL'). stop_price (float): The price at which the stop order will be triggered. limit_price (float): The specific price for the limit order. Returns: dict: The API response containing the order ID. """ # Implementation details for placing a stop-limit order via API pass ``` -------------------------------- ### Place New Order (Stop Order Example) Source: https://docs.ironbeamapi.com/index This code snippet shows how to place a stop order. Stop orders are triggered when the market price reaches a specific stop price. It requires account ID, order details, and the stop price. ```python def place_stop_order(account_id, symbol, quantity, side, duration, stop_price): """Places a new stop order. Args: account_id (str): The account ID for the order. symbol (str): The trading symbol. quantity (int): The quantity to trade. side (str): The order side ('BUY' or 'SELL'). duration (str): The order duration ('DAY' or 'GOOD_TILL_CANCEL'). stop_price (float): The price at which the stop order will be triggered. Returns: dict: The API response containing the order ID. """ # Implementation details for placing a stop order via API pass ``` -------------------------------- ### Place New Order (Market Order Example) Source: https://docs.ironbeamapi.com/index This code snippet demonstrates how to place a new market order. Market orders are executed at the current market price. This function requires account ID and order details like order type, side, quantity, and duration. ```python def place_market_order(account_id, symbol, quantity, side, duration): """Places a new market order. Args: account_id (str): The account ID for the order. symbol (str): The trading symbol. quantity (int): The quantity to trade. side (str): The order side ('BUY' or 'SELL'). duration (str): The order duration ('DAY' or 'GOOD_TILL_CANCEL'). Returns: dict: The API response containing the order ID. """ # Implementation details for placing a market order via API pass ``` -------------------------------- ### GET /info/security/definitions Source: https://docs.ironbeamapi.com/index Retrieves security definitions based on provided exchange symbols. ```APIDOC ## GET /info/security/definitions ### Description Retrieves security definitions for the given exchange symbols. The response contains detailed information about each security, including market data, contract specifications, and leg information. ### Method GET ### Endpoint https://live.ironbeamapi.com/v2/info/security/definitions https://demo.ironbeamapi.com/v2/info/security/definitions ### Parameters #### Query Parameters - **symbols** (Array of strings) - Required - Comma separated list of symbols (<= 10 items). Example: symbols=XCME:ES.U16,XCME:6E.U16,XCME:NQ.U16. Format: ^[A-Z0-9]{1,10}:[A-Z0-9]{1,10}$ ### Responses #### Success Response (200) OK - **securityDefinitions** (Array) - Contains security definitions. - **exchSym** (string) - Exchange symbol. - **exchangeSource** (string) - Source of the exchange data. - **activationTime** (number) - Activation timestamp. - **expirationTime** (number) - Expiration timestamp. - **marketComplex** (string) - Market complex identifier. - **marketGroup** (string) - Market group identifier. - **marketSymbol** (string) - Market symbol. - **cfiCode** (string) - CFI code. - **allowOpenOrders** (boolean) - Indicates if open orders are allowed. - **maturityMonth** (number) - Maturity month. - **maturityYear** (number) - Maturity year. - **productDescription** (string) - Description of the product. - **userDefinded** (boolean) - Indicates if user-defined. - **intradayDefinded** (boolean) - Indicates if intraday defined. - **optionType** (string) - Option type. - **optionExpirationType** (string) - Option expiration type. - **strikePrice** (number) - Strike price. - **underlyingSymbol** (string) - Underlying symbol. - **variableTickTableCode** (number) - Variable tick table code. - **exchangeStrategyType** (string) - Exchange strategy type. - **securityType** (string) - Security type. - **securityId** (number) - Security ID. - **legs** (Array) - List of contract legs. - **symbol** (string) - Symbol of the leg. - **ratio** (number) - Ratio of the leg. - **side** (string) - Side of the leg (e.g., "BID"). - **securityId** (number) - Security ID of the leg. - **exchange** (string) - Exchange of the leg. - **legExchangeSymbol** (string) - Exchange symbol for the leg. - **depthLevels** (number) - Number of depth levels for market data. - **mainFraction** (number) - Main fraction value. - **subFraction** (number) - Sub fraction value. - **scale** (number) - Scaling factor. - **minPriceIncrement** (number) - Minimum price increment. - **minPriceIncrementValue** (number) - Minimum price increment value. - **regCode** (string) - Regulatory code. - **currencyCode** (string) - Currency code. - **displayFactor** (number) - Display factor. - **allowTrading** (boolean) - Indicates if trading is allowed. - **scalingFactorScreen** (number) - Scaling factor for screen. - **exchangeSymbol** (string) - Exchange symbol. - **creationDate** (number) - Creation date timestamp. - **status** (string) - API status (e.g., "OK"). - **message** (string) - API message. #### Error Responses - **400** - Bad Request - **401** - Unauthorized - **403** - Forbidden - **406** - Not Acceptable - **429** - Too Many Requests - **500** - Internal Server Error - **default** - Default error response ### Request Example ```json { "symbols": ["XCME:ES.U16", "XCME:6E.U16"] } ``` ### Response Example (200) ```json { "securityDefinitions": [ { "exchSym": "XCME:6E.U16", "exchangeSource": "CME", "activationTime": 1470105600000, "expirationTime": 1470105600000, "marketComplex": "string", "marketGroup": "6E", "marketSymbol": "M6E", "cfiCode": "FXXXXX", "allowOpenOrders": true, "maturityMonth": 9, "maturityYear": 2016, "productDescription": "Euro FX", "userDefinded": false, "intradayDefinded": false, "optionType": "INVALID", "optionExpirationType": "INVALID", "strikePrice": 2000, "underlyingSymbol": "XCME:6E.U16", "variableTickTableCode": 0, "exchangeStrategyType": "NONE", "securityType": "INVALID", "securityId": 2000, "legs": [ { "symbol": "XCME:6E.U16", "ratio": 1, "side": "BID", "securityId": 2000, "exchange": "CME", "legExchangeSymbol": "XCME:6E.U16" } ], "depthLevels": 10, "mainFraction": 2000, "subFraction": 2000, "scale": 4, "minPriceIncrement": 2000, "minPriceIncrementValue": 2000, "regCode": "INVALID", "currencyCode": "USD", "displayFactor": 2000, "allowTrading": true, "scalingFactorScreen": 2000, "exchangeSymbol": "XCME:6E.U16", "creationDate": 1470105600000 } ], "status": "OK", "message": "string" } ``` ``` -------------------------------- ### GET /v2/info/security/definitions Source: https://docs.ironbeamapi.com/index Retrieves security definitions for specified exchange symbols. ```APIDOC ## GET /v2/info/security/definitions ### Description Retrieves the security definitions for the given exchange symbols. If the exchange symbol is not entitled for live data, the response will be empty. If the exchange symbol is entitled for live data, the response will contain a list of security definitions. The list of security definitions is not guaranteed to be in any particular order. ### Method GET ### Endpoint `/v2/info/security/definitions` ### Parameters #### Query Parameters - **symbols** (array of strings) - Required - A comma-separated list of symbols (e.g., `XCME:ES.U16,XCME:6E.U16,XCME:NQ.U16`). The array can contain up to 10 items. Each symbol must match the pattern `^[A-Z0-9]{1,10}:[A-Z0-9]{1,10}$`. ### Response #### Success Response (200) This response will contain a list of security definitions if the symbols are entitled for live data. The list may be empty if symbols are not entitled. #### Response Example ```json { "status": "OK", "message": "OK", "securityDefinitions": [ { "symbol": "XCME:ES.U16", "description": "E-MINI S&P 500 FUTURES", "exchange": "XCME", "securityType": "FUT", "tickSize": 0.25, "lotSize": 50, "contractMultiplier": 50, "expirationDate": "2023-12-21T00:00:00.000Z", "underlyingSymbol": "ES" } ] } ``` ``` -------------------------------- ### GET User Info Response Sample Source: https://docs.ironbeamapi.com/index This JSON response returns general information about a user, including account details, contact information, and associated accounts. ```json { "status": "OK", "message": "string", "accountCategory": 0, "accountTitle": "string", "emailAddress1": "string", "emailAddress2": "string", "group": "string", "isClearingAccount": true, "phone1": "string", "phone2": "string", "subGroup": "string", "accounts": [ "5123345" ] } ``` -------------------------------- ### C#: Authenticate and Connect to Ironbeam API Stream Source: https://docs.ironbeamapi.com/index This C# example demonstrates how to authenticate with the Ironbeam API to retrieve a token, create a data stream, and establish a WebSocket connection. It utilizes `HttpClient` for REST calls and `ClientWebSocket` for the WebSocket connection. Dependencies include `System.Net.Http`, `System.Net.WebSockets`, `System.Text`, and `System.Text.Json`. Inputs are username and password. ```csharp using System; using System.Collections.Generic; using System.Net.Http; using System.Net.WebSockets; using System.Text; using System.Text.Json; using System.Threading; using System.Threading.Tasks; public class Program { public static async Task Main(string[] args) { var httpClient = new HttpClient(); // Call the authorization endpoint to get a token var authResponse = await httpClient.PostAsync("https://demo.ironbeamapi.com/v2/auth", new StringContent(JsonSerializer.Serialize(new { username = "your_username", password = "your_password" }), Encoding.UTF8, "application/json")); var authData = JsonSerializer.Deserialize>(await authResponse.Content.ReadAsStringAsync()); var token = authData["token"]; // Call /stream/create to get a streamId var streamResponse = await httpClient.PostAsync("https://demo.ironbeamapi.com/v2/stream/create", new StringContent("", Encoding.UTF8, "application/json")); var streamData = JsonSerializer.Deserialize>(await streamResponse.Content.ReadAsStringAsync()); var streamId = streamData["streamId"]; // Open a WebSocket connection with the bearer token and streamId var webSocket = new ClientWebSocket(); var uri = new Uri($"wss://demo.ironbeamapi.com/v2/stream/{streamId}?token={token}"); var cts = new CancellationTokenSource(); await webSocket.ConnectAsync(uri, cts.Token); Console.WriteLine("Connection opened"); // Now you can use the webSocket object to send and receive messages } } ``` -------------------------------- ### GET /v2/info/trader Source: https://docs.ironbeamapi.com/index Retrieves general information about a specific trader. ```APIDOC ## GET /v2/info/trader ### Description Retrieves general information about a specific trader. ### Method GET ### Endpoint `/v2/info/trader` ### Parameters #### Query Parameters - **traderId** (string) - Required - The ID of the trader to retrieve information for. ### Response #### Success Response (200) - **status** (string) - The status of the request. - **message** (string) - A message indicating the result of the request. - **accounts** (array of strings) - A list of account IDs associated with the trader. - **isLive** (boolean) - Indicates if the trader account is live. - **traderId** (string) - The ID of the trader. #### Response Example ```json { "status": "OK", "message": "OK", "accounts": [ "5123345", "5123346", "5123347" ], "isLive": true, "traderId": "5123345" } ``` ``` -------------------------------- ### GET /fills Source: https://docs.ironbeamapi.com/index Retrieves information about order fills. The response contains a list of fill objects. ```APIDOC ## GET /fills ### Description Retrieves information about order fills. The response will contain a list of fill objects. ### Method GET ### Endpoint /fills ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **fills** (array) - A list of fill objects. - **orderId** (string) - The ID of the order. - **strategyId** (integer) - The ID of the strategy. - **accountId** (string) - The ID of the account. - **exchSym** (string) - The exchange symbol. - **status** (string) - The status of the fill. - **side** (string) - The side of the fill (e.g., BUY). - **quantity** (number) - The quantity of the fill. - **price** (number) - The price of the fill. - **fillQuantity** (number) - The quantity filled. - **fillTotalQuantity** (number) - The total quantity filled. - **fillPrice** (number) - The price of the fill. - **avgFillPrice** (number) - The average fill price. - **fillDate** (string) - The date and time of the fill. - **timeOrderEvent** (integer) - The timestamp of the order event. - **orderUpdateId** (string) - The ID of the order update. - **status** (string) - The status of the request (e.g., OK). - **message** (string) - A message indicating the result of the request. #### Response Example ```json { "fills": [ { "orderId": "5123345-1234567890", "strategyId": 1234567890, "accountId": "5123345", "exchSym": "XCME:6E.U16", "status": "ANY", "side": "BUY", "quantity": 1000, "price": 1000, "fillQuantity": 1000, "fillTotalQuantity": 1000, "fillPrice": 1000, "avgFillPrice": 1000, "fillDate": "2016-08-01T00:00:00Z", "timeOrderEvent": 123123123123, "orderUpdateId": "10336761658263818775-134" } ], "status": "OK", "message": "string" } ``` ``` -------------------------------- ### Python Example: Set Authorization Header Source: https://docs.ironbeamapi.com/index This Python code snippet illustrates how to construct the Authorization header required for subsequent API requests after obtaining a Bearer token. The token is appended to 'Bearer ' and used in the 'Authorization' header. ```python headers = { "Authorization": "Bearer " + token } ``` -------------------------------- ### Get Market Data Source: https://docs.ironbeamapi.com/index Retrieves real-time trading data for a given symbol. ```APIDOC ## GET /websites/ironbeamapi/traders/{symbol} ### Description Retrieves real-time trading data including price, change, volume, and trade details for a specified symbol. ### Method GET ### Endpoint `/websites/ironbeamapi/traders/{symbol}` ### Parameters #### Path Parameters * **symbol** (string) - Required - The trading symbol (e.g., `XCME:ES.U16`). #### Query Parameters * None #### Request Body * None ### Request Example (No request body for GET request) ### Response #### Success Response (200) * **status** (string) - The status of the request (e.g., "OK"). * **message** (string) - A status message. * **traders** (array) - An array of trade objects. * **symbol** (string) - The trading symbol. * **price** (number) - The last traded price. * **change** (number) - The price change from the previous trade. * **size** (number) - The size of the last trade. * **sequenceNumber** (number) - The sequence number of the trade. * **sendTime** (number) - The timestamp when the trade was sent. * **tickDirection** (string) - Indicates the direction of the tick (e.g., "UP", "DOWN", "INVALID"). * **aggressorSide** (number) - The side that aggressed the trade (e.g., 0 for buy, 1 for sell). * **tradeDate** (string) - The date of the trade in YYYYMMDD format. * **tradeId** (number) - The unique identifier for the trade. * **totalVolume** (number) - The total volume traded for the symbol. #### Response Example ```json { "status": "OK", "message": "string", "traders": [ { "symbol": "XCME:ES.U16", "price": 1.13535, "change": 0.0001, "size": 1, "sequenceNumber": 12132123, "sendTime": 1234567890, "tickDirection": "INVALID", "aggressorSide": 0, "tradeDate": "20200101", "tradeId": 2131220200101, "totalVolume": 1 } ] } ``` ### Error Handling * **400 Bad Request:** Invalid symbol or request parameters. * **404 Not Found:** The specified symbol does not exist. ``` -------------------------------- ### Get all accounts balance Source: https://docs.ironbeamapi.com/index Retrieves balances for all accounts associated with the authenticated user. ```APIDOC ## GET /v2/account/getAllBalances ### Description Get balances for all accounts associated with the authenticated user. ### Method GET ### Endpoint `/v2/account/getAllBalances` ### Parameters #### Query Parameters - **balanceType** (string) - Required - Enum: "CURRENT_OPEN" "START_OF_DAY". The type of balance to retrieve. #### Request Body ### Request Example ```json { "example": "request body" } ``` ### Response #### Success Response (200) - **balances** (array) - List of balance objects for each account. - **status** (string) - Status of the response. - **message** (string) - A message associated with the response. #### Response Example ```json { "balances": [ { "accountId": "5123345", "currencyCode": "USD", "cashBalance": 1000, "cashBalanceAvailable": 1000, "openTradeEquity": 1000, "totalEquity": 1000, "cashAddedToday": 1000, "netLiquidity": 1000, "netLiquidityAvailable": 1000, "daysOnCall": 365, "balanceType": "CURRENT_OPEN", "marginInfo": { "accountId": "5123345", "currencyCode": "USD", "marginO": { "marginError": "string", "errorSymbols": "string", "initialRiskMargin": 1000, "maintenanceRiskMargin": 1000, "initialTotalMargin": 1000, "maintenanceTotalMargin": 1000, "isEstimated": true, "asOfTime": 0 }, "marginOW": { "marginError": "string", "errorSymbols": "string", "initialRiskMargin": 1000, "maintenanceRiskMargin": 1000, "initialTotalMargin": 1000, "maintenanceTotalMargin": 1000, "isEstimated": true, "asOfTime": 0 }, "marginOWI": { "marginError": "string", "errorSymbols": "string", "initialRiskMargin": 1000, "maintenanceRiskMargin": 1000, "initialTotalMargin": 1000, "maintenanceTotalMargin": 1000, "isEstimated": true, "asOfTime": 0 } } } ], "status": "OK", "message": "string" } ``` ``` -------------------------------- ### GET /info/complexes/{exchange} Source: https://docs.ironbeamapi.com/index Retrieves the list of market complexes for a specified exchange. ```APIDOC ## GET /info/complexes/{exchange} ### Description Retrieves the list of market complexes for the given exchange. ### Method GET ### Endpoint /v2/info/complexes/{exchange} ### Path Parameters - **exchange** (string) - Required - The exchange identifier. Example: XCME. Max length: 10 characters. ### Response #### Success Response (200) - **marketComplexes** (array) - An array of market complex objects. - **groups** (array) - An array of group objects within the market complex. - **group** (string) - The group identifier. - **name** (string) - The name of the group. - **name** (string) - The name of the market complex. - **status** (string) - The status of the response (e.g., "OK"). - **message** (string) - A message associated with the response. #### Response Example (200) ```json { "marketComplexes": [ { "groups": [ { "group": "BIT", "name": "NANO BITCOIN SPRD J4-K4" } ], "name": "NANO BITCOIN SPRD J4-K4" } ], "status": "OK", "message": "string" } ``` #### Error Responses - **400**: Bad Request - **401**: Unauthorized - **403**: Forbidden - **406**: Not Acceptable - **429**: Too Many Requests - **500**: Internal Server Error - **default**: Default error response. ``` -------------------------------- ### Python API Call: Get Account Balance Source: https://docs.ironbeamapi.com/index This Python snippet shows how to fetch an account's balance using the Ironbeam API. It makes a GET request to the account balance endpoint, specifying the account ID and balance type in the query parameters. An Authorization header with a Bearer token is required. ```python import requests account_id = "account" url = "https://demo.ironbeamapi.com/v1/account/" + account_id + "/balance" query = { "balanceType": "CURRENT_OPEN" } headers = {"Authorization": "Bearer "+your_Bearer_token_here} response = requests.get(url, headers=headers, params=query) data = response.json() print(data) ``` -------------------------------- ### Set Simulated Account to Liquidate Only - Example Response (200 OK) Source: https://docs.ironbeamapi.com/index This JSON represents a successful response (200 OK) after setting the liquidate only status for a simulated account. It confirms the operation with a status and a message. ```json { "status": "OK", "message": "string" } ``` -------------------------------- ### Python WebSocket Streaming Example Source: https://docs.ironbeamapi.com/index Demonstrates how to connect to the IronBeam API's streaming endpoint using WebSockets in Python. This involves authenticating to obtain a token, creating a stream ID, and then establishing a WebSocket connection to receive real-time data like quotes, depth, and trades. It handles connection events and received messages. ```python import requests import websocket import json def on_message(ws, message): print(f"Received: {message}") def on_error(ws, error): print(f"Error: {error}") def on_close(ws): print("Connection closed") def on_open(ws): print("Connection opened") # Call the authorization endpoint to get a token auth_response = requests.post("https://demo.ironbeamapi.com/v2/auth", data={"username": "your_username", "password": "your_password"}) token = auth_response.json()['token'] # Call /stream/create to get a streamId stream_response = requests.get("https://demo.ironbeamapi.com/v2/stream/create", headers={"Authorization": f"Bearer {token}"}) streamId = stream_response.json()['streamId'] # Open a WebSocket connection with the bearer token and streamId ws = websocket.WebSocketApp( f"wss://demo.ironbeamapi.com/v2/stream/{streamId}?token={token}", on_message=on_message, on_error=on_error, on_close=on_close, ) ws.on_open = on_open ws.run_forever() ``` -------------------------------- ### Get Orders Source: https://docs.ironbeamapi.com/index Retrieves a list of orders for a specified account. Filtering by order status is supported. ```APIDOC ## GET /v2/order/{accountId}/tostrategyId/{orderId} ### Description Retrieves orders for the specified account. The order status can be used to filter the orders. ### Method GET ### Endpoint https://live.ironbeamapi.com/v2/order/{accountId}/tostrategyId/{orderId} https://demo.ironbeamapi.com/v2/order/{accountId}/tostrategyId/{orderId} ### Parameters #### Path Parameters - **accountId** (string) - Required - Account ID - **orderId** (string) - Required - Order ID ### Response #### Success Response (200) - **orderId** (string) - The ID of the order. - **strategyId** (integer) - The ID of the strategy associated with the order. - **status** (string) - The status of the order (e.g., "OK"). - **message** (string) - A message indicating the status of the operation. #### Response Example (200) ```json { "orderId": "5123345-1234567890", "strategyId": 1234567890, "status": "OK", "message": "OK" } ``` ### Error Handling - **200** OK - **400** Bad Request - **401** Unauthorized - **403** Forbidden - **406** Not Acceptable - **429** Too Many Requests - **500** Internal Server Error - **default** Default error response ``` -------------------------------- ### GET Trader Info Response Sample Source: https://docs.ironbeamapi.com/index This JSON response provides information about a trader, including their accounts, live status, and trader ID. ```json { "status": "OK", "message": "OK", "accounts": [ "5123345", "5123346", "5123347" ], "isLive": true, "traderId": "5123345" } ``` -------------------------------- ### Set Simulated Account to Liquidate Only - Example Request Source: https://docs.ironbeamapi.com/index This code snippet shows how to configure a simulated account to be in 'liquidate only' mode using a POST request. It requires the AccountId and a boolean for LiquidateOnly. If LiquidateOnly is false, TemplateId is also required. This endpoint is available on demo and production servers. ```shell curl -X POST https://demo.ironbeamapi.com/v2/simulatedAccount/setLiquidateOnly \ -H "Content-Type: application/json" \ -d '{ "AccountId": "string", "LiquidateOnly": true, "TemplateId": "XAP150" }' ``` -------------------------------- ### GET /v2/market/depth Source: https://docs.ironbeamapi.com/index Retrieves the current depth of market for specified instruments. Available on both production and demo servers. ```APIDOC ## GET /v2/market/depth ### Description Retrieves the current depth of market for the specified instrument. ### Method GET ### Endpoint `/v2/market/depth` ### Query Parameters - **symbols** (array of strings) - Required - A comma-separated list of symbols (up to 10 items). Example: `symbols=XCME:ES.U16,XCME:6E.U16,XCME:NQ.U16` ### Request Example ```json { "example": "(No request body for GET request, parameters are in query string)" } ``` ### Response #### Success Response (200) - **Depths** (array of objects) - An array of depth of market objects for each symbol. - **s** (string) - Symbol identifier. - **b** (array of objects) - Bid side of the market. - **l** (integer) - Level. - **t** (integer) - Timestamp. - **s** (string) - Side (e.g., 'B' for Bid). - **p** (integer) - Price. - **o** (integer) - Order count. - **sz** (integer) - Size. - **ioc** (integer) - IOC. - **is** (integer) - IS. - **a** (array of objects) - Ask side of the market. - **l** (integer) - Level. - **t** (integer) - Timestamp. - **s** (string) - Side (e.g., 'A' for Ask). - **p** (integer) - Price. - **o** (integer) - Order count. - **sz** (integer) - Size. - **ioc** (integer) - IOC. - **is** (integer) - IS. - **status** (string) - The status of the response (e.g., "OK"). - **message** (string) - A message providing details about the response. #### Response Example ```json { "Depths": [ { "s": "XCME:6E.U16", "b": [ { "l": 1, "t": 1234567890, "s": "B", "p": 2000, "o": 1000, "sz": 1000, "ioc": 1000, "is": 1000 } ], "a": [ { "l": 1, "t": 1234567890, "s": "B", "p": 2000, "o": 1000, "sz": 1000, "ioc": 1000, "is": 1000 } ] } ], "status": "OK", "message": "string" } ``` ``` -------------------------------- ### GET /account/getAllPositions Source: https://docs.ironbeamapi.com/index Retrieves a list of positions for all accounts associated with the authenticated user. The response contains a list of position objects. ```APIDOC ## GET /account/getAllPositions ### Description Retrieves a list of positions for all accounts associated with the authenticated user. The response will contain a list of position objects. ### Method GET ### Endpoint /account/getAllPositions ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **positions** (array) - A list of position objects. - **accountId** (string) - The ID of the account. - **positions** (array) - A list of positions within the account. - **accountId** (string) - The ID of the account. - **currencyCode** (string) - The currency code (e.g., USD). - **exchSym** (string) - The exchange symbol (e.g., XCME:6E.U16). - **positionId** (string) - The unique identifier for the position. - **quantity** (number) - The quantity of the position. - **price** (number) - The price of the position. - **dateOpened** (integer) - The date the position was opened (YYYYMMDD). - **side** (string) - The side of the position (e.g., LONG). - **unrealizedPL** (number) - The unrealized profit or loss. - **status** (string) - The status of the request (e.g., OK). - **message** (string) - A message indicating the result of the request. #### Response Example ```json { "positions": [ { "accountId": "5123345", "positions": [ { "accountId": "5123345", "currencyCode": "USD", "exchSym": "XCME:6E.U16", "positionId": "10198961658263821681-101", "quantity": 1000, "price": 2000, "dateOpened": 20160801, "side": "LONG", "unrealizedPL": 1000 } ] } ], "status": "OK", "message": "string" } ``` ``` -------------------------------- ### Get all fills for all accounts Source: https://docs.ironbeamapi.com/index Retrieves all fills for all accounts associated with the authenticated user. The response contains a list of fills, not guaranteed to be in any particular order. ```APIDOC ## GET /v2/account/getAllFills ### Description Retrieves all fills for all accounts associated with the authenticated user. The response will contain a list of fills. The list of fills is not guaranteed to be in any particular order. ### Method GET ### Endpoint `/v2/account/getAllFills` ### Parameters #### Query Parameters #### Request Body ### Request Example ```json { "example": "request body" } ``` ### Response #### Success Response (200) - **fills** (array) - List of fill objects. - **status** (string) - Status of the response. - **message** (string) - A message associated with the response. #### Response Example ```json { "fills": [ { "orderId": "5123345-1234567890", "strategyId": 1234567890, "accountId": "5123345", "exchSym": "XCME:6E.U16", "status": "ANY", "side": "BUY", "quantity": 1000, "price": 1000, "fillQuantity": 1000, "fillTotalQuantity": 1000, "fillPrice": 1000, "avgFillPrice": 1000, "fillDate": "2016-08-01T00:00:00Z", "timeOrderEvent": 123123123123, "orderUpdateId": "10336761658263818775-134" } ], "status": "OK", "message": "string" } ``` ```