### cURL Example Request: Search Open Positions Source: https://gateway.docs.projectx.com/docs/intro/api-reference/positions/search-open-positions An example cURL command demonstrating how to make a POST request to search for open positions, providing the account ID in the request body. ```curl curl -X 'POST' \ 'https://gateway-api-demo.s2f.projectx.com/api/Position/searchOpen' \ -H 'accept: text/plain' \ -H 'Content-Type: application/json' \ -d '{ "accountId": 536 }' ``` -------------------------------- ### Example Error Response for Order Placement Source: https://gateway.docs.projectx.com/docs/intro/api-reference/order/order-place An example of an error response, specifically a 401 Unauthorized status, that can be returned by the /api/Order/place endpoint when authentication fails. ```json Error: response status is 401 ``` -------------------------------- ### cURL: Example Request for Account Search API Source: https://gateway.docs.projectx.com/docs/intro/api-reference/account/search-accounts Provides a cURL command demonstrating how to make a request to the 'Search for Account' API endpoint. This example shows a basic request without specific body parameters. ```cURL curl -X 'undefined' \ 'https://gateway-api-demo.s2f.projectx.com/api/Account/search' \ -H 'accept: text/plain' \ -H 'Content-Type: application/json' ``` -------------------------------- ### Example Error Response for Open Orders Search Source: https://gateway.docs.projectx.com/docs/intro/api-reference/order/order-search-open An example of an error response from the ProjectX Gateway API, indicating a 401 Unauthorized status. ```Text Error: response status is 401 ``` -------------------------------- ### JSON Request Body for Account Search Source: https://gateway.docs.projectx.com/docs/intro/getting-started/placing-your-first-order Example JSON payload for the Account Search API, specifying the request to retrieve only active accounts. This is sent as the body of the POST request. ```json { "onlyActiveAccounts": true } ``` -------------------------------- ### JSON Example Success Response: Search Open Positions Source: https://gateway.docs.projectx.com/docs/intro/api-reference/positions/search-open-positions A sample JSON response indicating a successful search for open positions, including an array of position objects with their details. ```json { "positions": [ { "id": 6124, "accountId": 536, "contractId": "CON.F.US.GMET.J25", "creationTimestamp": "2025-04-21T19:52:32.175721+00:00", "type": 1, "size": 2, "averagePrice": 1575.750000000 } ], "success": true, "errorCode": 0, "errorMessage": null } ``` -------------------------------- ### JSON Response Body for Account Search Source: https://gateway.docs.projectx.com/docs/intro/getting-started/placing-your-first-order Example JSON response from the Account Search API, showing a list of accounts with their details (id, name, canTrade, isVisible), along with success status and any error information. ```json { "accounts": [ { "id": 1, "name": "TEST_ACCOUNT_1", "canTrade": true, "isVisible": true } ], "success": true, "errorCode": 0, "errorMessage": null } ``` -------------------------------- ### cURL Example Request to Search Orders Source: https://gateway.docs.projectx.com/docs/intro/api-reference/order/order-search Demonstrates how to make a POST request to the /api/Order/search endpoint using cURL, including the required JSON body for account ID and timestamp filters. This example shows a typical request structure for interacting with the API. ```curl curl -X 'POST' \ 'https://gateway-api-demo.s2f.projectx.com/api/Order/search' \ -H 'accept: text/plain' \ -H 'Content-Type: application/json' \ -d '{ "accountId": 202, "startTimestamp": "2024-12-30T16:48:16.003Z", "endTimestamp": "2025-12-30T16:48:16.003Z" }' ``` -------------------------------- ### Example cURL Request to Search Contracts Source: https://gateway.docs.projectx.com/docs/intro/api-reference/market-data/search-contracts Demonstrates how to make a POST request to the /api/Contract/search endpoint using cURL, including setting headers and the JSON request body. ```cURL curl -X 'POST' \ 'https://gateway-api-demo.s2f.projectx.com/api/Contract/search' \ -H 'accept: text/plain' \ -H 'Content-Type: application/json' \ -d '{ "live": false, "searchText": "NQ" }' ``` -------------------------------- ### Example JSON Success Response for Trade Search Source: https://gateway.docs.projectx.com/docs/intro/api-reference/trade/trade-search An example of a successful JSON response returned by the ProjectX Gateway Trade Search API, showing a list of trade objects with their properties, along with success status and error details. ```json { "trades": [ { "id": 8604, "accountId": 203, "contractId": "CON.F.US.EP.H25", "creationTimestamp": "2025-01-21T16:13:52.523293+00:00", "price": 6065.250000000, "profitAndLoss": 50.000000000, "fees": 1.4000, "side": 1, "size": 1, "voided": false, "orderId": 14328 }, { "id": 8603, "accountId": 203, "contractId": "CON.F.US.EP.H25", "creationTimestamp": "2025-01-21T16:13:04.142302+00:00", "price": 6064.250000000, "profitAndLoss": null, //a null value indicates a half-turn trade "fees": 1.4000, "side": 0, "size": 1, "voided": false, "orderId": 14326 } ], "success": true, "errorCode": 0, "errorMessage": null } ``` -------------------------------- ### Error Response Example for Order Search Source: https://gateway.docs.projectx.com/docs/intro/api-reference/order/order-search Provides an example of a non-successful response from the API, specifically indicating a 401 Unauthorized status, which typically means the request lacked valid authentication credentials. ```text Error: response status is 401 ``` -------------------------------- ### Example cURL Request to Place an Order Source: https://gateway.docs.projectx.com/docs/intro/api-reference/order/order-place A cURL command demonstrating how to send a POST request to the /api/Order/place endpoint with a JSON body to place a market order for a specific contract and account. ```curl curl -X 'POST' \ 'https://gateway-api-demo.s2f.projectx.com/api/Order/place' \ -H 'accept: text/plain' \ -H 'Content-Type: application/json' \ -d '{ "accountId": 465, "contractId": "CON.F.US.DA6.M25", "type": 2, "side": 1, "size": 1, "limitPrice": null, "stopPrice": null, "trailPrice": null, "customTag": null, "linkedOrderId": null }' ``` -------------------------------- ### Example Error Response for Contract Search Source: https://gateway.docs.projectx.com/docs/intro/api-reference/market-data/search-contracts-by-id An example of an error response, specifically a 401 Unauthorized status, from the API when searching for a contract. ```text Error: response status is 401 ``` -------------------------------- ### Example JSON Success Response for Search Contracts Source: https://gateway.docs.projectx.com/docs/intro/api-reference/market-data/search-contracts Illustrates a successful JSON response from the /api/Contract/search endpoint, showing a list of found contracts with their details. ```JSON { "contracts": [ { "id": "CON.F.US.ENQ.H25", "name": "ENQH25", "description": "E-mini NASDAQ-100: March 2025", "tickSize": 0.25, "tickValue": 5, "activeContract": true }, { "id": "CON.F.US.MNQ.H25", "name": "MNQH25", "description": "Micro E-mini Nasdaq-100: March 2025", "tickSize": 0.25, "tickValue": 0.5, "activeContract": true }, { "id": "CON.F.US.NQG.G25", "name": "NQGG25", "description": "E-Mini Natural Gas: February 2025", "tickSize": 0.005, "tickValue": 12.5, "activeContract": true }, { "id": "CON.F.US.NQM.G25", "name": "NQMG25", "description": "E-Mini Crude Oil: February 2025", "tickSize": 0.025, "tickValue": 12.5, "activeContract": true } ], "success": true, "errorCode": 0, "errorMessage": null } ``` -------------------------------- ### cURL Example Request to Close Position Source: https://gateway.docs.projectx.com/docs/intro/api-reference/positions/close-positions An example cURL command demonstrating how to send a POST request to the 'closeContract' API endpoint, including the necessary headers and JSON body with account and contract IDs. ```cURL curl -X 'POST' \ 'https://gateway-api-demo.s2f.projectx.com/api/Position/closeContract' \ -H 'accept: text/plain' \ -H 'Content-Type: application/json' \ -d '{ "accountId": 536, "contractId": "CON.F.US.GMET.J25" }' ``` -------------------------------- ### Example Error Response for Search Contracts Source: https://gateway.docs.projectx.com/docs/intro/api-reference/market-data/search-contracts Shows a typical error response from the /api/Contract/search endpoint, indicating an unauthorized access. ```Plain text Error: response status is 401 ``` -------------------------------- ### Example cURL Request for Trade Search API Source: https://gateway.docs.projectx.com/docs/intro/api-reference/trade/trade-search A cURL command demonstrating how to make a POST request to the ProjectX Gateway Trade Search API, including necessary headers and a JSON request body with account and timestamp filters. ```bash curl -X 'POST' \ 'https://gateway-api-demo.s2f.projectx.com/api/Trade/search' \ -H 'accept: text/plain' \ -H 'Content-Type: application/json' \ -d '{ "accountId": 203, "startTimestamp": "2025-01-20T15:47:39.882Z", "endTimestamp": "2025-01-30T15:47:39.882Z" }' ``` -------------------------------- ### API Authentication Response Example Source: https://gateway.docs.projectx.com/docs/intro/getting-started/authenticate/authenticate-api-key This JSON object illustrates the expected successful response from the Auth/loginKey API call. It contains the token (session token), a success flag, an errorCode, and an errorMessage. ```json { "token": "your_session_token_here", "success": true, "errorCode": 0, "errorMessage": null } ``` -------------------------------- ### Example cURL Request to Search Open Orders Source: https://gateway.docs.projectx.com/docs/intro/api-reference/order/order-search-open A cURL command demonstrating how to make a POST request to the ProjectX Gateway API to search for open orders, including required headers and JSON body. ```cURL curl -X 'POST' \ 'https://gateway-api-demo.s2f.projectx.com/api/Order/searchOpen' \ -H 'accept: text/plain' \ -H 'Content-Type: application/json' \ -d '{ "accountId": 212 }' ``` -------------------------------- ### Example JSON Success Response for Order Placement Source: https://gateway.docs.projectx.com/docs/intro/api-reference/order/order-place A JSON object representing a successful response from the /api/Order/place endpoint, indicating the new order ID, a success status, and no error message. ```json { "orderId": 9056, "success": true, "errorCode": 0, "errorMessage": null } ``` -------------------------------- ### JSON Example Error Response: Unauthorized Access Source: https://gateway.docs.projectx.com/docs/intro/api-reference/positions/search-open-positions A sample error response indicating an HTTP 401 Unauthorized status, typically due to missing or invalid authentication credentials. ```json Error: response status is 401 ``` -------------------------------- ### Connect to Market Hub and Subscribe to Contract Data (JavaScript) Source: https://gateway.docs.projectx.com/docs/intro/realtime This JavaScript code illustrates how to set up a SignalR connection to the Market Hub, using a JWT token for authentication. It shows how to subscribe to real-time market data, including contract quotes, trades, and market depth, with built-in automatic reconnection and data logging. ```javascript // Import the necessary modules from @microsoft/signalr const { HubConnectionBuilder, HttpTransportType } = require('@microsoft/signalr'); function setupSignalRConnection() { const JWT_TOKEN = 'your_bearer_token'; const marketHubUrl = 'https://gateway-rtc-demo.s2f.projectx.com/hubs/market?access_token=YOUR_JWT_TOKEN'; const CONTRACT_ID = 'CON.F.US.RTY.H25'; const rtcConnection = new HubConnectionBuilder() .withUrl(marketHubUrl, { skipNegotiation: true, transport: HttpTransportType.WebSockets, accessTokenFactory: () => JWT_TOKEN, timeout: 10000 }) .withAutomaticReconnect() .build(); rtcConnection.start() .then(() => { const subscribe = () => { rtcConnection.invoke('SubscribeContractQuotes', CONTRACT_ID); rtcConnection.invoke('SubscribeContractTrades', CONTRACT_ID); rtcConnection.invoke('SubscribeContractMarketDepth', CONTRACT_ID); }; const unsubscribe = () => { rtcConnection.invoke('UnsubscribeContractQuotes', CONTRACT_ID); rtcConnection.invoke('UnsubscribeContractTrades', CONTRACT_ID); rtcConnection.invoke('UnsubscribeContractMarketDepth', CONTRACT_ID); }; rtcConnection.on('GatewayQuote', (contractId, data) => { console.log('Received market quote data', data); }); rtcConnection.on('GatewayTrade', (contractId, data) => { console.log('Received market trade data', data); }); rtcConnection.on('GatewayDepth', (contractId, data) => { console.log('Received market depth data', data); }); subscribe(); rtcConnection.onreconnected((connectionId) => { console.log('RTC Connection Reconnected'); subscribe(); }); }) .catch((err) => { console.error('Error starting connection:', err); }); } // Call the function to set up and start the connection setupSignalRConnection(); ``` -------------------------------- ### Connect to User Hub and Subscribe to Account Data (JavaScript) Source: https://gateway.docs.projectx.com/docs/intro/realtime This JavaScript code demonstrates how to establish a SignalR connection to the User Hub, authenticate with a JWT token, and subscribe to real-time updates for user accounts, orders, positions, and trades. It includes logic for automatic reconnection and logging received data. ```javascript // Import the necessary modules from @microsoft/signalr const { HubConnectionBuilder, HttpTransportType } = require('@microsoft/signalr'); function setupSignalRConnection() { const JWT_TOKEN = 'your_bearer_token'; const SELECTED_ACCOUNT_ID = 123; // your currently selected/visible account ID const userHubUrl = 'https://gateway-rtc-demo.s2f.projectx.com/hubs/user?access_token=YOUR_JWT_TOKEN'; const rtcConnection = new HubConnectionBuilder() .withUrl(userHubUrl, { skipNegotiation: true, transport: HttpTransportType.WebSockets, accessTokenFactory: () => JWT_TOKEN, timeout: 10000 }) .withAutomaticReconnect() .build(); rtcConnection.start() .then(() => { const subscribe = () => { rtcConnection.invoke('SubscribeAccounts'); rtcConnection.invoke('SubscribeOrders', SELECTED_ACCOUNT_ID); rtcConnection.invoke('SubscribePositions', SELECTED_ACCOUNT_ID); rtcConnection.invoke('SubscribeTrades', SELECTED_ACCOUNT_ID); }; const unsubscribe = () => { rtcConnection.invoke('UnsubscribeAccounts'); rtcConnection.invoke('UnsubscribeOrders', SELECTED_ACCOUNT_ID); rtcConnection.invoke('UnsubscribePositions', SELECTED_ACCOUNT_ID); rtcConnection.invoke('UnsubscribeTrades', SELECTED_ACCOUNT_ID); }; rtcConnection.on('GatewayUserAccount', (data) => { console.log('Received account update', data); }); rtcConnection.on('GatewayUserOrder', (data) => { console.log('Received order update', data); }); rtcConnection.on('GatewayUserPosition', (data) => { console.log('Received position update', data); }); rtcConnection.on('GatewayUserTrade', (data) => { console.log('Received trade update', data); }); subscribe(); rtcConnection.onreconnected((connectionId) => { console.log('RTC Connection Reconnected'); subscribe(); }); }) .catch((err) => { console.error('Error starting connection:', err); }); } // Call the function to set up and start the connection setupSignalRConnection(); ``` -------------------------------- ### Example JSON Success Response for Contract Search Source: https://gateway.docs.projectx.com/docs/intro/api-reference/market-data/search-contracts-by-id A JSON object representing a successful response from the /api/Contract/searchById endpoint, containing details of the found contract. ```json { "contracts": [ { "id": "CON.F.US.ENQ.H25", "name": "ENQH25", "description": "E-mini NASDAQ-100: March 2025", "tickSize": 0.25, "tickValue": 5, "activeContract": true } ], "success": true, "errorCode": 0, "errorMessage": null } ``` -------------------------------- ### Example Error Response for Partial Close Source: https://gateway.docs.projectx.com/docs/intro/api-reference/positions/close-positions-partial Illustrates a common error response, such as an authentication failure (HTTP 401), for the partial close API endpoint. ```text Error: response status is 401 ``` -------------------------------- ### Example cURL Request to Search Contract by Id Source: https://gateway.docs.projectx.com/docs/intro/api-reference/market-data/search-contracts-by-id A cURL command demonstrating how to make a POST request to the /api/Contract/searchById endpoint with a specific contract ID in the request body. ```curl curl -X 'POST' \ 'https://gateway-api-demo.s2f.projectx.com/api/Contract/searchById' \ -H 'accept: text/plain' \ -H 'Content-Type: application/json' \ -d '{ "contractId": "CON.F.US.ENQ.H25" }' ``` -------------------------------- ### Example Successful JSON Response for Open Orders Search Source: https://gateway.docs.projectx.com/docs/intro/api-reference/order/order-search-open A JSON object representing a successful response from the ProjectX Gateway API when searching for open orders, showing the structure of returned order data. ```JSON { "orders": [ { "id": 26970, "accountId": 212, "contractId": "CON.F.US.EP.M25", "creationTimestamp": "2025-04-21T19:45:52.105808+00:00", "updateTimestamp": "2025-04-21T19:45:52.105808+00:00", "status": 1, "type": 4, "side": 1, "size": 1, "limitPrice": null, "stopPrice": 5138.000000000 } ], "success": true, "errorCode": 0, "errorMessage": null } ``` -------------------------------- ### Example cURL Request to Partially Close Position Source: https://gateway.docs.projectx.com/docs/intro/api-reference/positions/close-positions-partial Demonstrates how to make a POST request using cURL to partially close a position with sample account and contract IDs and JSON payload. ```bash curl -X 'POST' \ 'https://gateway-api-demo.s2f.projectx.com/api/Position/partialCloseContract' \ -H 'accept: text/plain' \ -H 'Content-Type: application/json' \ -d '{ "accountId": 536, "contractId": "CON.F.US.GMET.J25", "size": 1 }' ``` -------------------------------- ### Authenticate Application with ProjectX Gateway API (cURL) Source: https://gateway.docs.projectx.com/docs/intro/getting-started/authenticate/authenticate-as-application Example cURL command to send a POST request to the /api/Auth/loginApp endpoint. It demonstrates the required JSON payload for authenticating an authorized application, including placeholder values for username, password, deviceId, appId, and verifyKey. ```shell curl -X 'POST' \ 'https://gateway-api-demo.s2f.projectx.com/api/Auth/loginApp' \ -H 'accept: text/plain' \ -H 'Content-Type: application/json' \ -d '{ "userName": "yourUsername", "password": "yourPassword", "deviceId": "yourDeviceId", "appId": "B76015F2-04D3-477E-9191-C5E22CB2C957", "verifyKey": "yourVerifyKey" }' ``` -------------------------------- ### JSON Example Success Response for Order Search Source: https://gateway.docs.projectx.com/docs/intro/api-reference/order/order-search Illustrates a successful JSON response from the /api/Order/search endpoint, showing a list of found orders with their details such as ID, account ID, contract ID, timestamps, status, type, side, size, and prices. It also includes the overall success status and error information. ```json { "orders": [ { "id": 26060, "accountId": 545, "contractId": "CON.F.US.EP.M25", "creationTimestamp": "2025-04-14T17:49:10.142532+00:00", "updateTimestamp": null, "status": 2, "type": 2, "side": 0, "size": 1, "limitPrice": null, "stopPrice": null }, { "id": 26062, "accountId": 545, "contractId": "CON.F.US.EP.M25", "creationTimestamp": "2025-04-14T17:49:53.043234+00:00", "updateTimestamp": null, "status": 2, "type": 2, "side": 1, "size": 1, "limitPrice": null, "stopPrice": null } ], "success": true, "errorCode": 0, "errorMessage": null } ``` -------------------------------- ### JSON: Example Success Response for Account Search API Source: https://gateway.docs.projectx.com/docs/intro/api-reference/account/search-accounts Illustrates the structure of a successful JSON response from the 'Search for Account' API. It includes an array of account objects with 'id', 'name', 'balance', 'canTrade', and 'isVisible' fields, along with 'success', 'errorCode', and 'errorMessage' status fields. ```JSON { "accounts": [ { "id": 1, "name": "TEST_ACCOUNT_1", "balance": 50000, "canTrade": true, "isVisible": true } ], "success": true, "errorCode": 0, "errorMessage": null } ``` -------------------------------- ### Example JSON Success Response for Partial Close Source: https://gateway.docs.projectx.com/docs/intro/api-reference/positions/close-positions-partial Shows the expected JSON response for a successful partial close operation, indicating success status, zero error code, and null error message. ```json { "success": true, "errorCode": 0, "errorMessage": null } ``` -------------------------------- ### ProjectX Gateway API: Auth/loginApp Successful Response Source: https://gateway.docs.projectx.com/docs/intro/getting-started/authenticate/authenticate-as-application Example JSON response received after a successful authentication request to the /api/Auth/loginApp endpoint. It includes the session token, a boolean indicating success, an error code (0 for success), and a null error message. ```json { "token": "your_session_token_here", "success": true, "errorCode": 0, "errorMessage": null } ``` -------------------------------- ### JSON: Example Error Response for Account Search API Source: https://gateway.docs.projectx.com/docs/intro/api-reference/account/search-accounts Shows a typical error response from the 'Search for Account' API, specifically indicating a 401 Unauthorized status, which signifies a failure in authentication or authorization. ```JSON Error: response status is 401 ``` -------------------------------- ### Validate Session Token API and Examples Source: https://gateway.docs.projectx.com/docs/intro/getting-started/validate-session This section provides the API endpoint details, a cURL example for making the validation request, and an example JSON response for the session token validation process. Session tokens are valid for 24 hours and must be re-validated upon expiration to receive a new token. ```APIDOC API URL: POST https://gateway-api-demo.s2f.projectx.com/api/Auth/validate API Reference: /api/Auth/validate ``` ```cURL curl -X 'POST' \ 'https://gateway-api-demo.s2f.projectx.com/api/Auth/validate' \ -H 'accept: text/plain' \ -H 'Content-Type: application/json' ``` ```JSON { "success": true, "errorCode": 0, "errorMessage": null, "newToken": "NEW_TOKEN" } ``` -------------------------------- ### API Endpoint for Account Search Source: https://gateway.docs.projectx.com/docs/intro/getting-started/placing-your-first-order Details for the Account Search API endpoint, including the URL and a link to its Swagger documentation. This endpoint is used to retrieve a list of active accounts linked to the user. ```APIDOC POST https://gateway-api-demo.s2f.projectx.com/api/Account/search API Reference: /api/Account/search (Swagger link: https://gateway-api-demo.s2f.projectx.com/swagger/index.html#/Account/Account_SearchAccounts) ``` -------------------------------- ### cURL Command for Account Search API Source: https://gateway.docs.projectx.com/docs/intro/getting-started/placing-your-first-order A cURL command to perform a POST request to the Account Search API endpoint. This command includes the necessary headers for content type and the JSON request body to retrieve only active accounts. ```bash curl -X 'POST' \ 'https://gateway-api-demo.s2f.projectx.com/api/Account/search' \ -H 'accept: text/plain' \ -H 'Content-Type: application/json' \ -d '{ "onlyActiveAccounts": true }' ``` -------------------------------- ### ProjectX Gateway API Overview Source: https://gateway.docs.projectx.com/docs/intro/index This section provides an overview of the ProjectX Gateway API, its purpose in managing prop firm trader operations, and the necessary prerequisites for using it. It assumes familiarity with REST API concepts and tools like cURL or Postman. ```APIDOC ProjectX Gateway API: Purpose: Manages prop firm trader operations. Architecture: REST API. Prerequisites: - Understanding of REST API. - Tools: cURL or Postman for making requests. Key Sections: - Getting Started: Basic setup and requirements. - API Reference: Detailed endpoint documentation. - Realtime Updates: Information on live data feeds. ``` -------------------------------- ### Retrieve Bars API: cURL Example Request Source: https://gateway.docs.projectx.com/docs/intro/api-reference/market-data/retrieve-bars Example cURL command to send a POST request to the /api/History/retrieveBars endpoint. This request retrieves 7 hourly bars for a specific contract ID within a defined time range, excluding partial bars. ```curl curl -X 'POST' \ 'https://gateway-api-demo.s2f.projectx.com/api/History/retrieveBars' \ -H 'accept: text/plain' \ -H 'Content-Type: application/json' \ -d '{ "contractId": "CON.F.US.RTY.Z24", "live": false, "startTime": "2024-12-01T00:00:00Z", "endTime": "2024-12-31T21:00:00Z", "unit": 3, "unitNumber": 1, "limit": 7, "includePartialBar": false }' ``` -------------------------------- ### API Reference: Place an Order Endpoint Source: https://gateway.docs.projectx.com/docs/intro/api-reference/order/order-place Detailed API documentation for the POST /api/Order/place endpoint, used to submit new orders. Includes the API URL, a comprehensive list of parameters with their types, descriptions, and requirements. ```APIDOC API URL: POST https://gateway-api-demo.s2f.projectx.com/api/Order/place Parameters: - accountId: integer (Required, false) - The account ID. - contractId: string (Required, false) - The contract ID. - type: integer (Required, false) - The order type: 1 = Limit, 2 = Market, 4 = Stop, 5 = TrailingStop, 6 = JoinBid, 7 = JoinAsk - side: integer (Required, false) - The side of the order: 0 = Bid (buy), 1 = Ask (sell) - size: integer (Required, false) - The size of the order. - limitPrice: decimal (Optional, true) - The limit price for the order, if applicable. - stopPrice: decimal (Optional, true) - The stop price for the order, if applicable. - trailPrice: decimal (Optional, true) - The trail price for the order, if applicable. - customTag: string (Optional, true) - An optional custom tag for the order. - linkedOrderId: integer (Optional, true) - The linked order id. ``` -------------------------------- ### Retrieve Bars API: JSON Success Response Example Source: https://gateway.docs.projectx.com/docs/intro/api-reference/market-data/retrieve-bars Example JSON response for a successful retrieval of historical bar data. It shows an array of bar objects, each containing timestamp (t), open (o), high (h), low (l), close (c), and volume (v) values, along with success status. ```json { "bars": [ { "t": "2024-12-20T14:00:00+00:00", "o": 2208.100000000, "h": 2217.000000000, "l": 2206.700000000, "c": 2210.100000000, "v": 87 }, { "t": "2024-12-20T13:00:00+00:00", "o": 2195.800000000, "h": 2215.000000000, "l": 2192.900000000, "c": 2209.800000 ``` -------------------------------- ### Example JSON Error Response for Order Modification Source: https://gateway.docs.projectx.com/docs/intro/api-reference/order/order-modify A simple error message indicating a 401 Unauthorized status from the order modification API. ```JSON Error: response status is 401 ``` -------------------------------- ### JSON Error Response for Close Position Source: https://gateway.docs.projectx.com/docs/intro/api-reference/positions/close-positions An example error message indicating a failed API call, specifically a 401 Unauthorized status. ```JSON Error: response status is 401 ``` -------------------------------- ### JSON Success Response for Close Position Source: https://gateway.docs.projectx.com/docs/intro/api-reference/positions/close-positions An example JSON response indicating a successful operation after attempting to close a position via the API. ```JSON { "success": true, "errorCode": 0, "errorMessage": null } ``` -------------------------------- ### ProjectX Gateway API: Auth/loginApp Endpoint Details Source: https://gateway.docs.projectx.com/docs/intro/getting-started/authenticate/authenticate-as-application Documentation for the /api/Auth/loginApp endpoint, which handles application authentication. It specifies the HTTP method, the full endpoint URL, and provides a link to the Swagger documentation for further details. ```APIDOC Endpoint: /api/Auth/loginApp Method: POST URL: https://gateway-api-demo.s2f.projectx.com/api/Auth/loginApp Swagger Reference: https://gateway-api-demo.s2f.projectx.com/swagger/index.html#/Auth/Auth_LoginApp ``` -------------------------------- ### Example Error Response for Trade Search Source: https://gateway.docs.projectx.com/docs/intro/api-reference/trade/trade-search A simple error message indicating an unauthorized access (HTTP 401) when attempting to call the Trade Search API. ```text Error: response status is 401 ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.