### Get List of Accounts Server Response Source: https://help.cqg.com/apihelp/Documents/gettingstarted Example JSON structure for a server response containing account information. Includes brokerage details and account specifics. ```json { "information_reports": [ { "id": 1, "is_report_complete": true, "status_code": 1, "accounts_report": { "brokerages": [ { "id": 1234, "name": "CQG Sim", "sales_series": [ { "number": "12345", "name": "CQG Sim series", "accounts": [ { "account_id": 123456, "brokerage_account_number": "PS123456", "name": "SIM123456", "last_statement_date": 63588000, "is_view_only": false, "pre_trade_mid_market_mark_required": false, "allow_external_accounts": false, "is_omnibus": false, "is_group_member": false, "force_care_orders": false, "cleared_by_statements": true, "supports_exchange_balances_subscription": false, "supports_exchange_positions_subscription": false } ] } ], "type": 2 } ] } } ] } ``` -------------------------------- ### Get List of Accounts Client Message Source: https://help.cqg.com/apihelp/Documents/gettingstarted Example JSON structure for a client request to get a list of accounts. Includes a unique ID for the request. ```json { "information_requests": [ { "id": 1, "subscribe": true, "accounts_request": {} } ] } ``` -------------------------------- ### Logon Server Response Example Source: https://help.cqg.com/apihelp/Documents/gettingstarted Example JSON structure for a server logon result response. Includes session token, protocol version, and user identification. ```json { "logon_result": { "result_code": 0, "base_time": "2025-02-16T06:20:12", "session_token": "session identifier", "protocol_version_major": 2, "protocol_version_minor": 240, "user_id": 12345, "server_time": 226779398 } } ``` -------------------------------- ### Logoff Server Response Example Source: https://help.cqg.com/apihelp/Documents/gettingstarted Example JSON structure for a server logoff confirmation response. Includes a reason code for the logoff. ```json { "logged_off": { "logoff_reason": 1 } } ``` -------------------------------- ### Logon Client Message Example Source: https://help.cqg.com/apihelp/Documents/gettingstarted Example JSON structure for a client logon message to the CQG WebAPI. Includes user credentials, application details, and protocol version. ```json { "logon": { "user_name": "user name", "password": "***", "private_label": "company", "client_app_id": "company app", "client_version": "1.0", "protocol_version_major": 2, "protocol_version_minor": 240 } } ``` -------------------------------- ### Get Balances Server Response Source: https://help.cqg.com/apihelp/Documents/gettingstarted Example JSON structure for a server response containing last statement balances. Includes account ID, statement date, currency, and balance amount. ```json { "information_reports": [ { "id": 2, "is_report_complete": true, "status_code": 0, "last_statement_balances_report": { "balances": [ { "id": 1, "account_id": 123456, "statement_date": 63588000, "currency": "USD", "balance": 100000 } ] } } ] } ``` -------------------------------- ### Logical Operations Example Source: https://help.cqg.com/apihelp/Documents/messagegoflataction Provides examples of logical operations (AND, OR, NOT) for use in rule conditions. ```APIDOC ## Logical Operations You can use logical operations: AND, OR, NOT. Examples: football OR hockey, sports AND NOT baseball ``` -------------------------------- ### Place an Order API Source: https://help.cqg.com/apihelp/Documents/gettingstarted This endpoint facilitates the placement of new orders into the market. ```APIDOC ## POST /websites/help_cqg_apihelp (Place Order) ### Description Allows clients to place new orders. The request body contains detailed information about the order, including account ID, contract ID, order type, duration, side, and quantity. The server response provides order statuses, which may include 'in transit', 'in the order book', and 'filled', provided there is an active trade subscription with order scope. ### Method POST ### Endpoint /websites/help_cqg_apihelp ### Parameters #### Request Body - **order_requests** (array) - Required - A list of order requests. - **request_id** (integer) - Required - A unique identifier for the order request. - **new_order** (object) - Required - Contains the details of the new order. - **order** (object) - Required - The order object. - **account_id** (integer) - Required - The account ID for the order. - **contract_id** (integer) - Required - The contract ID for the order. - **cl_order_id** (string) - Required - A client-defined unique order ID. - **order_type** (integer) - Required - The type of order (e.g., 1 for market order). - **duration** (integer) - Required - The duration of the order (e.g., 1 for day order). - **side** (integer) - Required - The side of the order (e.g., 1 for buy). - **when_utc_timestamp** (object) - Required - The timestamp for when the order should be effective. - **seconds** (integer) - Required - The number of seconds. - **qty** (object) - Required - The quantity of the order. - **significand** (integer) - Required - The significand of the quantity. ### Request Example ```json { "order_requests": [ { "request_id": 0, "new_order": { "order": { "account_id": 123456, "contract_id": 1, "cl_order_id": "client unique order id", "order_type": 1, "duration": 1, "side": 1, "when_utc_timestamp": { "seconds": 1739914600 }, "qty": { "significand": 1 } } } } ] } ``` ### Response #### Success Response (200) - **order_statuses** (array) - A list of objects detailing the status of the placed order. - **subscription_ids** (array) - List of subscription IDs associated with the order. - **is_snapshot** (boolean) - Indicates if this is a snapshot. - **status** (integer) - The current status of the order (e.g., 1, 3, 8). - **order_id** (string) - The unique order ID assigned by the server. - **chain_order_id** (string) - The chain order ID. - **exec_order_id** (string) - The execution order ID (if applicable). - **status_utc_time** (integer) - The UTC time when the status was updated. - **submission_utc_time** (integer) - The UTC time when the order was submitted. - **fill_cnt** (integer) - The number of fills. - **scaled_avg_fill_price** (integer) - The scaled average fill price. - **order** (object) - The original order details. - **account_id** (integer) - The account ID. - **when_utc_time** (integer) - The UTC time when the order was effective. - **contract_id** (integer) - The contract ID. - **cl_order_id** (string) - The client-defined order ID. - **order_type** (integer) - The order type. - **duration** (integer) - The order duration. - **side** (integer) - The order side. - **is_manual** (boolean) - Indicates if the order was manually placed. - **is_user_attribute_checked** (boolean) - Indicates if user attributes were checked. - **when_utc_timestamp** (object) - The timestamp for when the order should be effective. - **seconds** (integer) - The number of seconds. - **qty** (object) - The quantity of the order. - **significand** (integer) - The significand of the quantity. - **execution_source_code** (string) - The execution source code. - **is_care_order** (boolean) - Indicates if it's a care order. - **transaction_statuses** (array) - A list of transaction statuses for the order. - **status** (integer) - The transaction status. - **trans_id** (integer) - The transaction ID. - **trans_utc_time** (integer) - The UTC time of the transaction. - **cl_order_id** (string) - The client-defined order ID. - **route_cl_order_id** (string) - The routed client order ID. - **trans_utc_timestamp** (object) - The UTC timestamp of the transaction. - **seconds** (integer) - The number of seconds. - **nanos** (integer) - The number of nanoseconds. - **mifid_execution_decision** (string) - MIFID execution decision. - **execution_source_code** (string) - The execution source code. - **is_automated** (boolean) - Indicates if the transaction was automated. - **mifid_execution_decision_is_algo** (boolean) - Indicates if MIFID decision was algorithmic. - **username** (string) - The username associated with the transaction. - **entered_by_user** (string) - The user who entered the order. - **first_statement_date** (integer) - The first statement date. - **account_id** (integer) - The account ID. - **status_utc_timestamp** (object) - The UTC timestamp of the order status. - **seconds** (integer) - The number of seconds. - **nanos** (integer) - The number of nanoseconds. - **submission_utc_timestamp** (object) - The UTC timestamp of the order submission. - **seconds** (integer) - The number of seconds. - **nanos** (integer) - The number of nanoseconds. - **avg_fill_price_correct** (integer) - The correct average fill price. - **fill_qty** (object) - The filled quantity. - **significand** (integer) - The significand of the filled quantity. - **remaining_qty** (object) - The remaining quantity. - **significand** (integer) - The significand of the remaining quantity. - **detailed_dom_order_id** (string) - The detailed DOM order ID. - **mifid_execution_decision** (string) - MIFID execution decision. - **mifid_execution_decision_is_algo** (boolean) - Indicates if MIFID decision was algorithmic. - **operator_id** (string) - The operator ID. #### Response Example ```json { "order_statuses": [ { "subscription_ids": [ 5 ], "is_snapshot": false, "status": 1, "order_id": "1809769617", "chain_order_id": "1809769617", "status_utc_time": 227988204, "submission_utc_time": 227988204, "fill_cnt": 0, "scaled_avg_fill_price": 0, "order": { "account_id": 123456, "when_utc_time": 227788000, "contract_id": 1, "cl_order_id": "client unique order id", "order_type": 1, "duration": 1, "side": 1, "is_manual": true, "is_user_attribute_checked": false, "when_utc_timestamp": { "seconds": 1739914600 }, "qty": { "significand": 1 }, "execution_source_code": "Y", "is_care_order": false }, "transaction_statuses": [ { "status": 1, "trans_id": 394602971392, "trans_utc_time": 227988204, "cl_order_id": "client unique order id", "route_cl_order_id": "OrderID1809769617", "trans_utc_timestamp": { "seconds": 1739914800, "nanos": 204300000 }, "mifid_execution_decision": "NORE", "execution_source_code": "Y", "is_automated": false, "mifid_execution_decision_is_algo": false, "username": "test user" } ], "entered_by_user": "test user", "first_statement_date": 149988000, "account_id": 123456, "status_utc_timestamp": { "seconds": 1739914800, "nanos": 204300000 }, "submission_utc_timestamp": { "seconds": 1739914800, "nanos": 204268000 }, "avg_fill_price_correct": 0, "fill_qty": { "significand": 0 }, "remaining_qty": { "significand": 1 }, "mifid_execution_decision": "NORE", "mifid_execution_decision_is_algo": false, "operator_id": "4567" } ] } ``` ### Additional Response Examples (Order Statuses) **Status: 3 (e.g., 'In Transit')** ```json { "order_statuses": [ { "subscription_ids": [ 5 ], "is_snapshot": false, "status": 3, "order_id": "1809769617", "chain_order_id": "1809769617", "exec_order_id": "2118-40E6515CE38E38E4", "status_utc_time": 227988206, "submission_utc_time": 227988204, "fill_cnt": 0, "scaled_avg_fill_price": 0, "order": { "account_id": 123456, "when_utc_time": 227788000, "contract_id": 1, "cl_order_id": "client unique order id", "order_type": 1, "duration": 1, "side": 1, "is_manual": true, "is_user_attribute_checked": false, "when_utc_timestamp": { "seconds": 1739914600 }, "qty": { "significand": 1 }, "execution_source_code": "Y", "is_care_order": false }, "transaction_statuses": [ { "status": 3, "trans_id": 394602971648, "trans_utc_time": 227988206, "cl_order_id": "client unique order id", "route_cl_order_id": "OrderID1809769617", "trans_utc_timestamp": { "seconds": 1739914800, "nanos": 206820000 }, "mifid_execution_decision": "NORE", "execution_source_code": "Y", "is_automated": false, "mifid_execution_decision_is_algo": false } ], "entered_by_user": "test user", "first_statement_date": 149988000, "account_id": 123456, "status_utc_timestamp": { "seconds": 1739914800, "nanos": 206820000 }, "submission_utc_timestamp": { "seconds": 1739914800, "nanos": 204268000 }, "avg_fill_price_correct": 0, "fill_qty": { "significand": 0 }, "remaining_qty": { "significand": 1 }, "detailed_dom_order_id": "2118-40E6515CE38E38E4", "route_cl_order_id": "OrderID1809769617", "mifid_execution_decision": "NORE", "mifid_execution_decision_is_algo": false, "operator_id": "4567" } ] } ``` **Status: 8 (e.g., 'Filled')** ```json { "order_statuses": [ { "subscription_ids": [ 1 ], "is_snapshot": false, "status": 8, "order_id": "1809769617", "chain_order_id": "1809769617", "exec_order_id": "2118-40E6515CE38E38E4", "status_utc_time": 227988207, "submission_utc_time": 227988204, "fill_cnt": 1, "scaled_avg_fill_price": 626175, "order": { "account_id": 123456, "when_utc_time": 227788000, "contract_id": 1, "cl_order_id": "client unique order id", "order_type": 1, "duration": 1, "side": 1, "is_manual": true, "is_user_attribute_checked": false, "when_utc_timestamp": { "seconds": 1739914600 }, "qty": { "significand": 1 }, "execution_source_code": "Y", "is_care_order": false } } ] } ``` ``` -------------------------------- ### Get Balances Client Message Source: https://help.cqg.com/apihelp/Documents/gettingstarted Example JSON structure for a client request to retrieve last statement balances. Includes a unique ID for the request. ```json { "information_requests": [ { "id": 2, "last_statement_balances_request": {} } ] } ``` -------------------------------- ### Retrieve Trading Session Time Ranges using SessionTimeRangeRequest Source: https://help.cqg.com/apihelp/Documents/metadata This example demonstrates how to request intraday trading session information for a specified contract. It shows the client message structure to request a count of sessions starting from a specific time and the corresponding server response containing session details like open, close, and trade dates. ```json { "information_requests": [ { "id": 7, "session_timerange_request": { "session_info_id": 206, "from_utc_time": 0, "count": 3 } } ] } ``` ```json { "information_reports": [ { "id": 7, "status_code": 0, "session_timerange_report": { "session_time_ranges": [ { "pre_open_utc_time": 57997000, "open_utc_time": 59797000, "close_utc_time": 115597000, "post_close_utc_time": 115597000, "trade_date": 149797000, "session_name": "Globex Night" }, { "pre_open_utc_time": 115597000, "open_utc_time": 115597000, "close_utc_time": 128197000, "post_close_utc_time": 139897000, "trade_date": 149797000, "session_name": "Globex Day" }, { "pre_open_utc_time": 144397000, "open_utc_time": null, "close_utc_time": null, "post_close_utc_time": null, "trade_date": null, "session_name": null } ] } } ] } ``` -------------------------------- ### Security Definition Example Source: https://help.cqg.com/apihelp/Documents/securitydefinitiond An example FIX message for a Security Definition request. ```APIDOC ## Security Definition Example ### Description Example of a FIX message used for requesting security definitions. ### Request Example ``` 8=FIX.4.2 | 9=113 | 35=d | 320=Request113 | 322=214673df-7906-408e-bf6e-915568689eff | 323=1 | 393=1 | 55=U.Q1-641347 | 10=110 | ``` ``` -------------------------------- ### CQG WebAPI - Market Data Subscription Source: https://help.cqg.com/apihelp/Documents/gettingstarted Information on how to subscribe to real-time market data feeds for various instruments using the CQG WebAPI. ```APIDOC ## POST /marketdata/subscribe ### Description Subscribes to real-time market data for specified instruments. ### Method POST ### Endpoint /marketdata/subscribe ### Parameters #### Query Parameters - **session_id** (string) - Required - The session ID obtained from the logon endpoint. #### Request Body - **instrument_id** (string) - Required - The unique identifier for the instrument. - **fields** (array of strings) - Optional - A list of data fields to subscribe to (e.g., 'last_price', 'bid', 'ask'). Defaults to common fields if not provided. ### Request Example ```json { "instrument_id": "ESZ3", "fields": ["last_price", "volume", "bid", "ask"] } ``` ### Response #### Success Response (200) - **subscription_id** (string) - A unique identifier for this data subscription. - **instrument** (string) - The instrument ID subscribed to. - **data** (object) - Current market data for the instrument (fields depend on subscription). #### Response Example ```json { "subscription_id": "sub_12345", "instrument": "ESZ3", "data": { "last_price": 4500.50, "volume": 100000, "bid": 4500.25, "ask": 4500.75 } } ``` ``` -------------------------------- ### CQG WebAPI - Orders Source: https://help.cqg.com/apihelp/Documents/gettingstarted Details on how to place, modify, and cancel orders through the CQG WebAPI. ```APIDOC ## POST /orders ### Description Places a new order in the market. ### Method POST ### Endpoint /orders ### Parameters #### Query Parameters - **session_id** (string) - Required - The session ID obtained from the logon endpoint. #### Request Body - **instrument_id** (string) - Required - The unique identifier for the instrument. - **order_type** (string) - Required - The type of order (e.g., 'limit', 'market', 'stop'). - **side** (string) - Required - The order side ('buy' or 'sell'). - **quantity** (integer) - Required - The number of contracts to trade. - **price** (number) - Optional - The limit price for limit orders. - **stop_price** (number) - Optional - The stop price for stop orders. ### Request Example ```json { "instrument_id": "ESZ3", "order_type": "limit", "side": "buy", "quantity": 1, "price": 4500.00 } ``` ### Response #### Success Response (200) - **order_id** (string) - A unique identifier for the placed order. - **status** (string) - The initial status of the order (e.g., 'new', 'filled'). #### Response Example ```json { "order_id": "ord_98765", "status": "new" } ``` ``` -------------------------------- ### Position Report Example Source: https://help.cqg.com/apihelp/Documents/fcmconfirmedpositionspositionreportuap An example of a Position Report message using FIX protocol. ```APIDOC ## Position Report Example This example demonstrates the structure of a FIX Position Report message. ### Endpoint N/A (FIX message) ### Request Example ``` 8=FIX.4.2 | 9=143 | 35=UAP | 1=403 | 32=8.00000000 | 54=1 | 55=F.US.DDU06 | 325=N | 50710=s25 | 50724=0 | 15=USD | 20017=1250.00000000 | 20021=2062.50000000 | 20018=800.00000000 | 6=2220.00000000 | 50730=789.00000000 | 50715=20080718-00:00:00.000 | 20023=20080720-00:00:00.000 | 10=131 | ``` ### Response * **Success Response (200)**: * **FIX Message**: The received FIX message representing the position report. ### Response Example ``` 8=FIX.4.2 | 9=143 | 35=UAP | 1=403 | 32=8.00000000 | 54=1 | 55=F.US.DDU06 | 325=N | 50710=s25 | 50724=0 | 15=USD | 20017=1250.00000000 | 20021=2062.50000000 | 20018=800.00000000 | 6=2220.00000000 | 50730=789.00000000 | 50715=20080718-00:00:00.000 | 20023=20080720-00:00:00.000 | 10=131 | ``` ``` -------------------------------- ### CQG WebAPI - Logon Source: https://help.cqg.com/apihelp/Documents/gettingstarted This section details the process of logging into the CQG WebAPI to establish a connection and authenticate your session. ```APIDOC ## POST /logon ### Description Establishes a connection to the CQG WebAPI and authenticates the user. ### Method POST ### Endpoint /logon ### Parameters #### Request Body - **username** (string) - Required - The username for authentication. - **password** (string) - Required - The password for authentication. ### Request Example ```json { "username": "your_username", "password": "your_password" } ``` ### Response #### Success Response (200) - **session_id** (string) - A unique identifier for the authenticated session. #### Response Example ```json { "session_id": "a1b2c3d4e5f67890" } ``` ``` -------------------------------- ### Logoff Client Message Example Source: https://help.cqg.com/apihelp/Documents/gettingstarted Example JSON structure for a client logoff message to the CQG WebAPI. ```json { "logoff": {} } ``` -------------------------------- ### Order Status Example - CQG API Source: https://help.cqg.com/apihelp/Documents/traderoutinginformation This JSON object represents an example of an OrderStatus message received from the CQG API. It includes details about the subscription, the order itself, and associated transaction statuses. The example demonstrates the structure for order_id, chain_order_id, timestamps, quantities, and nested order and transaction details. ```json { "order_statuses": [ { "subscription_ids": [ 5 ], "is_snapshot": false, "status": 1, "order_id": "1809769617", "chain_order_id": "1809769617", "status_utc_time": 227988204, "submission_utc_time": 227988204, "fill_cnt": 0, "scaled_avg_fill_price": 0, "order": { "account_id": 123456, "when_utc_time": 227788000, "contract_id": 1, "cl_order_id": "client unique order id", "order_type": 1, "duration": 1, "side": 1, "is_manual": true, "is_user_attribute_checked": false, "when_utc_timestamp": { "seconds": 1739914600 }, "qty": { "significand": 1 }, "execution_source_code": "Y", "is_care_order": false }, "transaction_statuses": [ { "status": 1, "trans_id": 394602971392, "trans_utc_time": 227988204, "cl_order_id": "client unique order id", "trans_utc_timestamp": { "seconds": 1739914800, "nanos": 204300000 }, "mifid_execution_decision": "NORE", "execution_source_code": "Y", "is_automated": false, "mifid_execution_decision_is_algo": false, "username": "test user" } ], "entered_by_user": "test user", "first_statement_date": 149988000, "account_id": 123456, "status_utc_timestamp": { "seconds": 1739914800, "nanos": 204300000 }, "submission_utc_timestamp": { "seconds": 1739914800, "nanos": 204268000 }, "avg_fill_price_correct": 0, "fill_qty": { "significand": 0 }, "remaining_qty": { "significand": 1 } } ] } ``` -------------------------------- ### Order Placement Parameters Source: https://help.cqg.com/apihelp/Documents/neworderliste This section details the parameters available for placing orders, including account information, order quantity, type, price, and execution instructions. ```APIDOC ## Order Placement Parameters ### Description This endpoint allows for the placement of various order types with specified details. ### Method POST ### Endpoint `/orders` ### Parameters #### Request Body - **NoOrders** (Int) - Y - Number of orders to follow. - **Account** (String(256)) - Y* - Account ID (provided by the CQG gateway). Must be the first field in repeating group. - **ClOrdID** (String(64)) - Y - Unique identifier of the order as order request originator. Its uniqueness must be guaranteed within a single trading day for day orders and across days for multi-day orders as defined by FIX 4.2 specification. - **ListSeqNo** (Int) - Y - This order’s ordinal position (0-based) within the compound order. - **ExecInst** (Multiple Value String) - N - Execution instructions. Valid values: i = Iceberg, q = Quantity Triggered Stop (QTS), 6 = Post Only. - **HandlInst** (Char) - N - Instructions for order handling. Valid value: 1 = Automated execution order. - **IDSource** (String) - N - Reserved for contract identification. - **OrderQty** (Qty) - Y* - Quantity of order submitted by the client. Must be an unsigned integer greater than zero. - **OrdType** (Char) - Y - Sets the type of order. Valid values: 1 = Market, 2 = Limit, 3 = Stop, 4 = Stop limit. - **Price** (Price) - C - Limit price. Conditionally required for limit and stop limit orders. - **SecurityID** (String) - N - Reserved for contract identification. - **Side** (Char) - Y - Indicates the side of the order. Valid values: 1 = Buy, 2 = Sell, 5 = Sell Short, 6 = Sell Short Exempt. - **Symbol** (String(64)) - Y - An identifier for an instrument that can be traded on a CQG system. - **TimeInForce** (Char) - N - Specifies how long the order remains in effect. Valid values: 0 = DAY, 1 = Good Till Cancel (GTC), 2 = At the Opening (OPG), 3 = Immediate or Cancel (IOC), 4 = Fill or Kill (FOK), 6 = Good Till Date (GTD), 7 = At the Close, A = Good Till Time (GTT), B = Good For Auction (GFA). - **TransactTime** (UTC Timestamp) - Y - Time this order request was initiated. - **SymbolSfx** (String) - N - Reserved for contract identification. - **OpenClose** (Char) - C - Indicates whether the resulting position is an opening or closing position. Valid values: O = Open, C = Close, P = Close previous day. ### Request Example ```json { "NoOrders": 1, "Account": "YOUR_ACCOUNT_ID", "ClOrdID": "ORDER123", "ListSeqNo": 0, "OrderQty": 100, "OrdType": "2", "Price": 100.50, "Side": "1", "Symbol": "ESM3", "TimeInForce": "0", "TransactTime": "2023-10-27T10:00:00Z" } ``` ### Response #### Success Response (200) - **OrderID** (String) - The unique identifier assigned to the order. - **Status** (String) - The current status of the order. #### Response Example ```json { "OrderID": "ORD987654", "Status": "New" } ``` ``` -------------------------------- ### Order Cancel/Replace Multileg Example (FIX) Source: https://help.cqg.com/apihelp/Documents/ordercancelreplacemultilegac Provides an example FIX message for an Order Cancel/Replace request involving multiple legs. ```APIDOC ## Order Cancel/Replace Multileg Example ### Description This is an example FIX message demonstrating an Order Cancel/Replace request for a multileg order. ### Method N/A (FIX Message Example) ### Endpoint N/A (FIX Message Example) ### Request Example ``` 8=FIX.4.2|9=145|35=AC|49=user|56=CQG_Gateway|34=1872|52=20130106-15:34:36.459|37=748503366|41=CQG_748503366|11=Order2529|1=1|54=1|50555=2|50600=F.US.EDAH22|50654=456|50624=1|50623=1|50600=F.US.EDAZ23|50654=123_123|50624=2|50623=1|60=20130215-12:48:48|38=3|44=2000|10=173| ``` *Note: '|' character is used as a delimiter in this example for readability; actual FIX messages use SOH (Start of Header) character.* ``` -------------------------------- ### Execution Instructions Source: https://help.cqg.com/apihelp/Documents/messageorder Defines specific ways an order should be executed, including conditions for filling, visibility, and price following. ```APIDOC ## Execution Instructions Enum ### Description Specifies various execution instructions for orders. ### Values - **EXEC_INSTRUCTION_AON** (1): All or None (fill order only completely). - **EXEC_INSTRUCTION_ICEBERG** (2): Iceberg (show only part of order size). - **EXEC_INSTRUCTION_QT** (3): Quantity triggered (aka DOM Triggered, honor additional quantity threshold for triggering). - **EXEC_INSTRUCTION_TRAIL** (4): Trailing order (price of the order is following market one direction by specific offset). - **EXEC_INSTRUCTION_FUNARI** (5): Funari (Limit order becomes a Market on Close). - **EXEC_INSTRUCTION_MIT** (6): Market if Touched (Limit order becomes a Market when market reaches order’s limit price). - **EXEC_INSTRUCTION_MLM** (7): Market Limit Market is a limit order that is used to place a buy order above the best offer to fill by the best offer or a sell order below the best bid to fill by the best bid. - **EXEC_INSTRUCTION_POSTONLY** (8): Post-only order. Ensures the limit order will be added to the order book and not match with a pre-existing order. - **EXEC_INSTRUCTION_MTL** (10): Market with leftover as Limit (market order then unexecuted quantity becomes limit order at last price). - **EXEC_INSTRUCTION_AUCTION** (11): An auction order is an order to buy or sell in the market at the Calculated Opening Price (COP). Unmatched auction orders are converted to limit orders on the market open. - **EXEC_INSTRUCTION_ATANYPRICE** (13): At Any Price Orders are US-Style Market Orders. - **EXEC_INSTRUCTION_LMT_PRARGD** (14): Limit order with prearranged transaction flag (IntentToCross) set. - **EXEC_INSTRUCTION_ICO** (15): Internal Cross Only. This order type is used by OTC to pull up to order size quantity from the exchange on the opposite side. - **EXEC_INSTRUCTION_CRFQ_LMT** (16): Complex Order Request for Quote (LMT). - **EXEC_INSTRUCTION_CRFQ_MKT** (17): Complex Order Request for Quote (MKT). *Note: `None` (plain order without any exec instructions) is not explicitly provided in OrderRequest. ``` -------------------------------- ### Multi-Step Logon Initiation Source: https://help.cqg.com/apihelp/Documents/logon Starts a multi-step logon process by sending a 'logon_init' message. This is the first step in a sequence that may involve secure password handling and agreement acceptance. ```json { "logon_init": { "private_label": "company", "client_app_id": "company app", "client_version": "1.0", "protocol_version_major": 2, "protocol_version_minor": 240 } } ``` -------------------------------- ### Testing Environment Source: https://help.cqg.com/apihelp/Documents/environments Explains the testing environment for the Quotes Direct API, offering early access to upcoming releases with specific restrictions and configuration details. ```APIDOC ## Testing Environment The testing environment grants developers early access to a production-like environment of upcoming Quotes Direct releases. Compared to production, the testing environment has the following restrictions: - Only one Feed ID is available - All data is delayed one hour Revise your FIX client configuration to use the following testing components: - Template Dissemination server: - ftp://develop.cqg.com/Testing/ - Request the login/password and Feed ID (tag 1180-ApplID) information from Sales@CQG.com. - Security Definition Server: - Host: 10.1.0.71 - Port: 2222 - Username: test - Password: test - Incremental refresh mcast group: - IP-address and port are provided via security definitions. - Snapshots mcast group: - IP-address and port are provided via security definitions. - Replay Servers: - IP-address and port are provided via security definitions. ``` -------------------------------- ### FIX Allocation Ack Message (P) Example Source: https://help.cqg.com/apihelp/Documents/allocationackp This snippet demonstrates an example of an Allocation Acknowledgment (P) message sent from the CQG gateway to a FIX client. It confirms or rejects a previously sent Allocation (J) message. The example includes standard FIX header and trailer fields, along with allocation-specific tags. ```fix 8=FIX.4.2 | 9=241 | 35=P | 49=trader | 56=CQG_Gateway | 34=2 | 52=20150327-13:06:16.601 | 70=allocid | 60=20150327-13:06:16.601 | 87=0 |10=059 | ``` -------------------------------- ### Generate Python Protobuf Code Source: https://help.cqg.com/apihelp/Documents/gettingstarted Commands to generate Python Protobuf code from .proto files. Requires precompiled protoc and specifies proto paths for WebAPI and common types. Outputs generated code to a specified directory. ```shell protoc --proto_path=source_proto_dir --proto_path=google_proto_dir --python_out=destination_dir source_proto_dir/WebAPI/*.proto protoc --proto_path=source_proto_dir --proto_path=google_proto_dir --python_out=destination_dir source_proto_dir/common/*.proto ``` -------------------------------- ### Get Market Data Request and Response Source: https://help.cqg.com/apihelp/Documents/gettingstarted This snippet demonstrates how to request real-time market data for a specific contract, including trades, settlements, and best bid/ask quotes. The client specifies the contract ID and desired data level, and the server returns subscription status along with the market data, including prices, volumes, and timestamps. ```json { "market_data_subscriptions": [ { "contract_id": 1, "level": 2, "request_id": 3 } ] } ``` ```json { "market_data_subscription_statuses": [ { "contract_id": 1, "status_code": 0, "level": 2, "past_quotes_included": false, "yields_included": false, "session_market_values_included": false, "source_price_included": false, "requests_for_quotation_included": false, "trade_attributes_included": false, "market_state_included": false, "request_id": 3, "off_market_trades_included": false, "currency_rate_included": false, "premium_included": false } ], "real_time_market_data": [ { "contract_id": 1, "quotes": [ { "type": 5, "quote_utc_time": 225587999, "scaled_price": 626175 }, { "type": 0, "quote_utc_time": 226787548, "scaled_price": 626225, "scaled_volume": 1, "sales_condition": 4 }, { "type": 2, "quote_utc_time": 226857784, "scaled_price": 626425 }, { "type": 1, "quote_utc_time": 226861172, "scaled_price": 626150 } ], "is_snapshot": true, "market_values": [ { "scaled_open_price": 626100, "scaled_high_price": 627000, "scaled_low_price": 623500, "scaled_last_price": 626225, "scaled_yesterday_settlement": 624700, "scaled_total_volume": 71, "scaled_yesterday_last": 624650, "day_index": 0, "tick_volume": 23, "scaled_settlement": 626175, "trade_date": 149988000, "scaled_last_trade_price": 626225, "scaled_close_price": 626225, "scaled_last_price_no_settlement": 626225, "last_trade_utc_timestamp": { "seconds": 1739913599, "nanos": 548000000 } } ], "quotes_trade_date": 149988000, "correct_price_scale": 0.01 } ] } ``` -------------------------------- ### Security Definition Request Example (FIX) Source: https://help.cqg.com/apihelp/Documents/securitydefinitionrequestc An example FIX message for a Security Definition Request, illustrating the use of various fields including those from the Underlying Security Group. ```APIDOC ## Security Definition Request Example ### Description This example demonstrates a FIX message for a Security Definition Request (tag 35=c), including the definition of a multi-leg strategy (UDS) with two legs. ### Method FIX Protocol Message ### Endpoint N/A (FIX Protocol) ### Request Example ``` 8=FIX.4.2|9=190|35=c|49=CQG_Gateway|56=CQG_Gateway|34=30|52=20110810-12:57:25.863|320=Request113|321=1|146=2|20050=1|311=C.US.EW.V11.12450|319=1|54=1|20050=2|311=P.US.EW.V11.12450|319=1|54=2|20049=straddlelong|10=053 ``` **Note:** `|` is used here for readability; in actual FIX messages, SOH (Start of Header) characters are used as delimiters. ``` -------------------------------- ### CQG WebAPI - Orders Source: https://help.cqg.com/apihelp/Documents/migrationguide Details on placing and managing orders through the CQG WebAPI. ```APIDOC ## POST /place_order ### Description Places a new order for a specified instrument. ### Method POST ### Endpoint /place_order ### Parameters #### Request Body - **session_id** (string) - Required - The session ID obtained from the logon endpoint. - **symbol** (string) - Required - The symbol of the instrument. - **exchange** (string) - Required - The exchange where the instrument is traded. - **order_type** (string) - Required - The type of order (e.g., "LIMIT", "MARKET"). - **quantity** (integer) - Required - The number of contracts to trade. - **price** (number) - Optional - The limit price for limit orders. - **side** (string) - Required - "BUY" or "SELL". ### Request Example ```json { "session_id": "abc123xyz789", "symbol": "NQ 12-22", "exchange": "CME", "order_type": "LIMIT", "quantity": 1, "price": 12000.50, "side": "BUY" } ``` ### Response #### Success Response (200) - **order_id** (string) - A unique identifier for the placed order. - **status** (string) - Indicates the status of the order placement. #### Response Example ```json { "order_id": "ord_789ghi", "status": "accepted" } ``` ``` -------------------------------- ### New Order Single FIX Message Example Source: https://help.cqg.com/apihelp/Documents/newordersingled An example of a FIX (Financial Information eXchange) message for a New Order Single request. This message includes standard FIX tags and CQG-specific fields. ```fix 8=FIX.4.2 | 9=141 | 35=D | 49=fix_client | 56=CQG_Gateway | 34=4 | 52=20061124-15:51:12.093 | 1=286 | 11=MS24 | 55=F.US.TYAZ06 | 54=2 | 60=20061124-15:50:51 | 38=5 | 40=4 | 44=1.22 | 77=O | 20154=S | 99=1.24 | 10=045 | ```