### Get Order Summary Request Example (HTTP) Source: https://docs.tread.fi/interacting-with-the-api/api-reference/core-order-api Demonstrates an example GET request to retrieve a summary of a specific order. The endpoint requires the order ID as a path parameter and an Authorization header with an API key. This request is designed for fetching basic order details efficiently. ```http GET /api/order_summary/45a18223-aeab-4451-9253-c3135261d55b ``` -------------------------------- ### Python: Setup TreadFi API Connection Source: https://docs.tread.fi/interacting-with-the-api/examples Initializes the necessary variables and headers for interacting with the TreadFi API. This includes setting the server URL, API endpoints, and authorization token. Ensure SERVER_URL and API_TOKEN are replaced with your actual credentials. ```python import requests import json SERVER_URL = 'http://localhost:8000' # Or whereever your server is hosted API_PREFIX = '/api/' ORDERS_RESOURCE_PATH = 'orders/' SINGLE_ORDER_PATH = 'order/' ACCOUNT_BALANCES_PATH = 'balances/' ORDERS_URL = SERVER_URL + API_PREFIX + ORDERS_RESOURCE_PATH API_TOKEN = '' required_headers = { 'Authorization': f'Token {API_TOKEN}', } ``` -------------------------------- ### GET /api/balances/ Source: https://docs.tread.fi/interacting-with-the-api/examples Retrieves the account balances for the authenticated user. ```APIDOC ## GET /api/balances/ ### Description Retrieves the account balances for the authenticated user. ### Method GET ### Endpoint /api/balances/ ### Response #### Success Response (200) - **balances** (object) - An object containing account balances for different tokens. #### Response Example ```json { "BTC": 1.5, "USD": 10000.0 } ``` ``` -------------------------------- ### GET /api/orders_with_stats/ Request Example Source: https://docs.tread.fi/interacting-with-the-api/api-reference/core-order-api This example demonstrates how to make a GET request to the /api/orders_with_stats/ endpoint. This endpoint is used to retrieve a paginated list of orders along with their associated statistics and analytics. The example shows query parameters for pagination (page and page_size) and mentions the required Authorization header. ```http GET /api/orders_with_stats/?page=1&page_size=100 Authorization: Token ``` -------------------------------- ### API Response Examples (JavaScript) Source: https://docs.tread.fi/interacting-with-the-api/api-reference/accounts Provides examples of successful and error responses from the Tread.fi API in JSON format, commonly handled in JavaScript applications. These cover successful account creation, server errors, and unauthorized access. ```javascript { "message": "Successfully created abcdef" } ``` ```javascript { "message": "Something went wrong..." } ``` ```javascript { "message": "Invalid credentials" } ``` -------------------------------- ### Python: Get Account Balances from TreadFi API Source: https://docs.tread.fi/interacting-with-the-api/examples Fetches the current account balances associated with the API credentials. This is done by sending a GET request to the account balances endpoint. The retrieved balances are then printed in JSON format. ```python response = requests.get(SERVER_URL + API_PREFIX + ACCOUNT_BALANCES_PATH, headers=required_headers) print(response.json()) ``` -------------------------------- ### Market Order Request Example Source: https://docs.tread.fi/interacting-with-the-api/api-reference/simple-orders-market-limit-ioc-iceberg This example demonstrates how to construct a POST request to the /api/orders/ endpoint to place a market order. It specifies the trading pair, side, accounts, strategy type, and the quantity of the quote asset to be used. This order prioritizes immediate execution at the best available market price. ```json POST /api/orders/ Authorization: Bearer Content-Type: application/json { "pair": "BTC-USD", "side": "buy", "accounts": ["coinbase_main"], "strategy": "Market", "quote_asset_qty": "1000.00", "notes": "Simple market buy for $1000 of BTC" } ``` -------------------------------- ### Market Order Response Example Source: https://docs.tread.fi/interacting-with-the-api/api-reference/simple-orders-market-limit-ioc-iceberg This is an example of a successful response from the Tread.fi API after submitting a market order. It includes the order ID, details about the trade execution such as tokens involved, amounts, strategy used, and the status of the order. ```json { "id": "a1b2c3d4-e5f6-7890-1234-567890abcdef", "custom_order_id": "", "notes": "Simple market buy for $1000 of BTC", "pair": "BTC-USD", "side": "buy", "exchanges": ["coinbase"], "buy_token": "BTC", "sell_token": "USD", "sell_token_amount": "1000.00", "strategy": "Market", "status": "ACTIVE", "user": "user_456", "created_at": "2024-01-10T14:30:00Z", "updated_at": "2024-01-10T14:30:01Z" } ``` -------------------------------- ### Limit Order Request Example Source: https://docs.tread.fi/interacting-with-the-api/api-reference/simple-orders-market-limit-ioc-iceberg This example shows a POST request to place a limit order using the Tread.fi API. It includes the trading pair, side, accounts, strategy type, the desired quantity of the base asset, and crucially, the `limit_price` at which the order should be executed. This order will only fill at the specified price or better. ```json POST /api/orders/ Authorization: Bearer Content-Type: application/json { "pair": "BTC-USD", "side": "buy", "accounts": ["coinbase_main"], "strategy": "Limit", "base_asset_qty": "0.5", "limit_price": "45000.00" } ``` -------------------------------- ### Example Order Response with Placements and Fills Source: https://docs.tread.fi/interacting-with-the-api/api-reference/core-order-api This is an example of a successful response (200 OK) when retrieving order details. It includes various order parameters and a nested 'placements' array, each containing its own 'fills' array. Note the data types and structure, which may vary slightly from the basic order retrieval. ```javascript { "id": "6debb950-614a-4366-b73b-7d7574fd9e15", "buy_token": "ETH", "sell_token": "USD", "side": "buy", "pair": "ETH-USDT", "sell_token_amount": 50000.0, "strategy": "6fe4ba3e-c578-45bd-824c-c523bf3c56de", "super_strategy": "d960c28f-a6bd-4f55-9c5c-fc561cc95640", "super_strategy_name": "Impact Minimization", "strategy_params": { "passive_only": true }, "limit_price": 1.0, "start_datetime": "2023-08-08T23:54:06.300319Z", "time_end": "2023-08-08T23:59:06.300319", "duration": 300, "accounts": ["09d3144b-9359-4ec3-8772-2dd1bfb86652"], "account_names": ["Binance_1"], "user": "2", "status": "ACTIVE", "engine_passiveness": "0.2", "schedule_discretion": "0.08", "failure_reason": "", "executed_qty": 1.2, "executed_price": 1846.5, "executed_notional": 2215.8, "notes": "", "custom_order_id": "", "updated_leverage": 10, "placements": [ { 'id': '6abb7966-9641-4c78-8bd6-f4c9bd075399', 'created_at': '2023-08-01T08:25:31.704064Z', 'order': "6debb950-614a-4366-b73b-7d7574fd9e15", 'placement_type': 'MAKE', 'price': '28931.15000000000000000000', 'qty': '0.00000100000000000000', 'exchange': 'Binance', 'fills': [ { "id": "44c82c49-1e9d-43f8-98cd-318a2c01a317", "created_at": '2023-08-01T08:25:31.704064Z', "fill_time": '2023-08-01T08:25:31.704064Z', "role": "MAKE", "external_id": "21949858", "executed_price": 1658.40, "executed_qty": 3.5, "exchange": "Binance", "fee": 0.0443 } ], 'passiveness': '0.0078071000', 'filled': False, 'external_id': None, 'status': 'FAILED', 'sub_status': 'MIN_AMOUNT', 'is_cross': False, 'is_simple': False, 'contract_value': '1.00000000000000000000' } ] } ``` -------------------------------- ### Limit Order Response Example Source: https://docs.tread.fi/interacting-with-the-api/api-reference/simple-orders-market-limit-ioc-iceberg This is an example of a successful response after submitting a limit order. It details the order ID, associated parameters like pair, side, strategy, and the specific `limit_price`. The response also includes status and timestamps, confirming the order has been placed. ```json { "id": "b2c3d4e5-f6a7-8901-2345-67890abcdef1", "custom_order_id": "", "notes": "", "pair": "BTC-USD", "side": "buy", "exchanges": ["coinbase"], "buy_token": "BTC", "buy_token_amount": "0.5", "sell_token": "USD", "strategy": "Limit", "limit_price": "45000.00", "status": "ACTIVE", "user": "user_456", "created_at": "2024-01-10T15:00:00Z", "updated_at": "2024-01-10T15:00:01Z" } ``` -------------------------------- ### 200 OK Response Example Source: https://docs.tread.fi/interacting-with-the-api/api-reference/core-order-api Represents a successful operation. This example shows successful order cancellation scenarios. ```json { "200": { "description": "OK", "examples": [ { "scenario": "Order successfully canceled", "response": "Order canceled!" }, { "scenario": "Order already canceled", "response": "Order already canceled!" } ] } } ``` -------------------------------- ### Example JSON Response for Orders Source: https://docs.tread.fi/interacting-with-the-api/api-reference/core-order-api This is an example JSON response structure for retrieving a list of orders, including their status, associated statistics, and pagination information. It details fields like order ID, pair, side, status, and summary statistics. ```json { "orders": [ { "id": "550e8400-e29b-41d4-a716-446655440000", "pair": "BTC/USDT", "side": "buy", "status": "COMPLETE", "time_start": "2024-01-15T10:00:00Z", "duration": 3600, "target_token": "BTC", "order_qty": "1.00000000", "remaining_qty": "0.00000000", "executed_qty": "1.00000000", "executed_notional": "45000.00", "exchange_names": ["binance", "coinbase"], "account_names": ["main_account"], "schedule_discretion": "0.10000000", "engine_passiveness": "0.05000000", "alpha_tilt": "0.00000000", "strategy": "TWAP", "trajectory": "TWAP", "strategy_params": {}, "participation_rate_target_percent": null, "market_type": "SPOT", "parent_order_id": null, "stats": { "order_id": "550e8400-e29b-41d4-a716-446655440000", "stat_id": "123e4567-e89b-12d3-a456-426614174000", "interval_volume": "1000000.00000000", "vwap": "45000.00000000", "arrival_price": "44950.00000000", "departure_price": "45050.00000000" }, "fills": [ { "placement_id": "123e4567-e89b-12d3-a456-426614174001", "exchange": "binance", "role": "taker", "executed_price": "45000.00", "executed_qty": "0.50000000", "executed_notional": "22500.00", "fee": "22.50", "fill_time": "2024-01-15T10:30:00Z" } ] } ], "page_number": 1, "page_size": 100, "num_pages": 5, "order_count": 450 } ``` -------------------------------- ### Initialize TaaS Docker Webserver (Mac/Unix) Source: https://docs.tread.fi/self-hosted-service This script uses curl to send a POST request with a license key to a specified API endpoint, then pipes the response to bash for execution. It initializes the latest Docker image and downloads the TaaS application, setting up the webserver. Ensure the license key is correctly inserted before execution. ```shell curl -fs -d '{ "license_key": "" }' https://ktf83pe7y6.execute-api.us-east-1.amazonaws.com/beta/taas-distribution/setup | bash ``` -------------------------------- ### POST /api/orders/ Source: https://docs.tread.fi/interacting-with-the-api/examples Submits a new order to the TreadFi platform. Allows specifying trading pair, side, amount, duration, and strategy. ```APIDOC ## POST /api/orders/ ### Description Submits a new order to the TreadFi platform. Allows specifying trading pair, side, amount, duration, and strategy. ### Method POST ### Endpoint /api/orders/ ### Parameters #### Request Body - **accounts** (array of strings) - Required - The names of the accounts to use for the order. - **pair** (string) - Required - The trading pair (e.g., 'BTC-USD'). - **side** (string) - Required - The order side ('buy' or 'sell'). - **sell_token_amount** (number) - Required - The amount of tokens to sell. - **duration** (number) - Required - The duration of the order in seconds. - **strategy** (string) - Required - The trading strategy (e.g., 'TWAP'). - **engine_passiveness** (number) - Optional - The passiveness setting for the engine. ### Request Example ```json { "accounts": ["", ""], "pair": "BTC-USD", "side": "buy", "sell_token_amount": 500, "duration": 120, "strategy": "TWAP", "engine_passiveness": 0.1 } ``` ### Response #### Success Response (200) - **id** (string) - The unique identifier of the submitted order. #### Response Example ```json { "id": "", "status": "open" } ``` ``` -------------------------------- ### POST /beta/taas-distribution/setup-aio Source: https://docs.tread.fi/self-hosted-service/app-configurations This endpoint is used to set up and configure the TreadFi application. It accepts a JSON payload containing configuration parameters, such as license keys for authentication. ```APIDOC ## POST /beta/taas-distribution/setup-aio ### Description This endpoint is used to set up and configure the TreadFi application. It accepts a JSON payload containing configuration parameters, such as license keys for authentication. ### Method POST ### Endpoint https://ktf83pe7y6.execute-api.us-east-1.amazonaws.com/beta/taas-distribution/setup-aio ### Parameters #### Request Body - **license_key** (string) - Required - This is how you authenticate as a user of the app. ### Request Example ```json { "license_key": "XXXX-XXXX-XXXX-XXXX" } ``` ### Response #### Success Response (200) * **message** (string) - A confirmation message indicating successful setup. #### Response Example ```json { "message": "App configured successfully." } ``` ``` -------------------------------- ### GET /api/order/{order_id} Source: https://docs.tread.fi/interacting-with-the-api/examples Retrieves the details of a specific order using its unique identifier. ```APIDOC ## GET /api/order/{order_id} ### Description Retrieves the details of a specific order using its unique identifier. ### Method GET ### Endpoint /api/order/{order_id} ### Parameters #### Path Parameters - **order_id** (string) - Required - The unique identifier of the order to retrieve. ### Response #### Success Response (200) - **details** (object) - Contains the full details of the order. #### Response Example ```json { "id": "", "pair": "BTC-USD", "side": "buy", "amount": 500, "status": "filled" } ``` ``` -------------------------------- ### Download Stable Build Source: https://docs.tread.fi/self-hosted-service/on-premise-setup/stable-and-nightly-builds This endpoint allows you to download the stable build of Tread.fi, suitable for production environments. It requires specifying 'stable' for both version and market access version. ```APIDOC ## Download Stable Build ### Description Downloads the stable build of Tread.fi, which has undergone user and automated testing and is recommended for production use. ### Method POST ### Endpoint https://........ ### Parameters #### Request Body - **version** (string) - Required - The build version to download. Use 'stable' for the stable build. - **market_access_version** (string) - Required - The market access version. Use 'stable' for the stable build. - **license_key** (string) - Required - Your valid license key. ### Request Example ```json { "version" : "stable", "market_access_version": "stable", "license_key" : "LICENSE_KEY" } ``` ### Response #### Success Response (200) Details about the successful download (e.g., file path, confirmation message). #### Response Example ```json { "message": "Stable build downloaded successfully." } ``` ``` -------------------------------- ### Get Order Details by Custom ID API Request (HTTP) Source: https://docs.tread.fi/interacting-with-the-api/api-reference/core-order-api This example shows how to make an HTTP GET request to retrieve order details using a custom order ID. It specifies the endpoint and query parameters required. ```http GET /api/orders/?custom_order_ids=ETH_ACC_001 ``` -------------------------------- ### Python: Get Order Details from TreadFi API Source: https://docs.tread.fi/interacting-with-the-api/examples Retrieves the details of a specific order using its unique ID. The code first extracts the order ID from a previous response (assumed to be stored in the 'body' variable) and then makes a GET request to the API. The order details are printed as JSON. ```python order_id = body['id'] response = requests.get(SERVER_URL + API_PREFIX + SINGLE_ORDER_PATH + order_id, headers=required_headers) print(response.json()) ``` -------------------------------- ### Place IOC Order Request - API Source: https://docs.tread.fi/interacting-with-the-api/api-reference/simple-orders-market-limit-ioc-iceberg This snippet shows an example POST request to the /api/orders/ endpoint to place an IOC (Immediate Or Cancel) order. It includes necessary headers and a JSON payload specifying the trading pair, side, accounts, strategy, and quantity. ```http POST /api/orders/ Authorization: Bearer Content-Type: application/json { "pair": "ETH-USD", "side": "sell", "accounts": ["binance_main"], "strategy": "IOC", "base_asset_qty": "10.0" } ``` -------------------------------- ### Get Account Balances (JavaScript Example) Source: https://docs.tread.fi/interacting-with-the-api/api-reference/accounts Retrieves token balances and positions for configured accounts. The response includes details like exchange, asset symbol, size, notional value, market type, and profit/loss. It handles successful responses (200 OK) and error scenarios (500 Internal Server Error, 401 Unauthorized). ```javascript { "AccountABC": { "exchange": "Bybit", "assets": [ { "symbol": "ETH:PERP-USDT", "size": 1.69, "notional": 3051.5284, "market_type": "perp", "asset_type": "position", "unrealized_profit": 24.6772, "initial_margin": 306.80066534, "maint_margin": 16.90546734, "margin_balance": 298.90609459, "leverage": 10.0, "notional_pct_total": 0.994565 }, { "symbol": "USDT", "size": 275.56989474, "notional": 275.569895, "market_type": "unified", "asset_type": "token", "unrealized_profit": 23.33619985, "initial_margin": 308.47710954, "maint_margin": 17.08121552, "margin_balance": 298.90609459, "leverage": null, "notional_pct_total": 0.817474 }, ... ] }, "Account123": { "exchange": "Binance", "assets": [ { "symbol": "USDT", "size": 1414.06039641, "notional": 1414.060396, "market_type": "perp", "asset_type": "token", "unrealized_profit": 11.02638782, "initial_margin": 155.72429442, "maint_margin": 3.32015061, "margin_balance": 1425.08678423, "leverage": null, "notional_pct_total": 0.6449 }, { "symbol": "BTC:PERP-USDT", "size": 0.021, "notional": 572.956735, "market_type": "perp", "asset_type": "position", "unrealized_profit": 7.87343483, "initial_margin": 114.59134696, "maint_margin": 2.29182693, "margin_balance": null, "leverage": 5.0, "notional_pct_total": 0.261304 }, ... ] } } ``` ```javascript { "message": "Something went wrong..." } ``` ```javascript { "message": "Invalid credentials" } ``` -------------------------------- ### Cancel All Orders Request and Response Examples Source: https://docs.tread.fi/interacting-with-the-api/api-reference/core-order-api This section provides examples for the POST /api/cancel_all_orders/ endpoint. It includes a sample request body with account names and an example of a successful response indicating all orders have been canceled. ```json POST /api/cancel_all_orders/?exclude_paused=true { "account_names": "binance_main,coinbase_pro" } ``` ```json { "message": "Successfully canceled all orders." } ``` -------------------------------- ### 404 Order Not Found Error Examples Source: https://docs.tread.fi/interacting-with-the-api/api-reference/core-order-api This JSON structure provides examples of error responses for a 404 Order Not Found error. This occurs when the specified order ID does not correspond to an existing order in the system, or if the order is inaccessible. The examples show simple string messages indicating that the order could not be located. ```json { "404": { "description": "Not Found", "examples": [ { "scenario": "Order does not exist", "response": "No order found with given ID!" }, { "scenario": "Order not accessible", "response": "Order not found or access denied" } ] } } ``` -------------------------------- ### 500 Internal Server Error Examples (JSON) Source: https://docs.tread.fi/interacting-with-the-api/api-reference/core-order-api This snippet presents JSON responses for a 500 Internal Server Error, indicating server-side problems. It includes examples of errors related to database connectivity, external service failures, and general unexpected system issues. These examples help in understanding and reporting server-side problems. ```json { "500": { "description": "Internal Server Error", "examples": [ { "scenario": "Database connection error", "response": { "error": "Database connection failed" } }, { "scenario": "External service failure", "response": { "error": "Price feed service unavailable" } }, { "scenario": "Unexpected system error", "response": { "error": "Something went wrong" } } ] } } ``` -------------------------------- ### Create Multi Order - 201 Created Response Source: https://docs.tread.fi/interacting-with-the-api/api-reference/multi-order Example JSON response for a successfully created multi-order (HTTP 201 Created). It includes the order ID, timestamps, execution details, and status. ```json { "id": "397e42c1-a617-458b-9db9-dc51f326b918", "created_at": "2025-01-13T20:33:22.331268Z", "updated_at": "2025-01-13T20:33:22.331288Z", "start_datetime": "2025-01-13T20:33:22.323949Z", "duration": 600, "exposure_tolerance": "0.50000000000000000000", "notional_exposure": 34.554926518, "executed_notional": 93712.607473482, "is_active": false, "child_order_ids": [ "5ee11fdd-334d-418a-b138-7df74f17e417", "54509111-7204-4626-8513-d7f040f76bf3" ], "strategy": "ccb82677-249d-4b01-8f60-7a02379e963a", "strategy_params": {}, "engine_passiveness": "0.02000000000000000000", "schedule_discretion": "0.06000000000000000000", "alpha_tilt": "0.00000000000000000000", "pov_limit": null, "limit_price_spread": null, "order_condition": "ETH-USDT@Binance ETH:PERP-USDT@Binance - 1 >", "order_condition_vars": {}, "order_condition_expiry": null, "user": "13", "status": "SCHEDULED", "failure_reason": "", "completely_filled": true, "is_paused": false, "pct_filled": 100.0, "account_names": [ "mock" ], "pairs": "BTC-USDT,BTC:PERP-USDT", "calculated_status": "COMPLETE", "sell_token_amount": "0.50000000000000000000, 46871.66540000000000000000", "buy_token": "USDT, BTC:PERP", "sell_token": "BTC, USDT" } ``` -------------------------------- ### Set Leverage Response Examples (JSON, JavaScript) Source: https://docs.tread.fi/interacting-with-the-api/api-reference/accounts Demonstrates the JSON responses for the set leverage API endpoint. This includes a success message and specific error formats for bad requests (e.g., invalid input types) and general processing failures. ```javascript { "message": "Leverage changed successfully." } ``` ```json { "errors": ["account_ids must be an array of strings"] } ``` ```javascript { "message": "Invalid credentials" } ``` ```javascript { "message": "Failed to set leverage" } ``` -------------------------------- ### Resume Order Request Example Source: https://docs.tread.fi/interacting-with-the-api/api-reference/core-order-api This snippet demonstrates how to make a POST request to resume a specific order. It includes the endpoint, headers, and the JSON body containing the order ID. ```http POST /api/resume_order/ { "order_id": "6debb950-614a-4366-b73b-7d7574fd9e15" } ``` -------------------------------- ### Pause All Orders API Request Example Source: https://docs.tread.fi/interacting-with-the-api/api-reference/core-order-api This example demonstrates how to pause all active orders for an authenticated user using the TreadFi API. The request uses the POST method on the '/api/pause_all_orders/' endpoint and requires an 'Authorization' header with an API key. ```http POST /api/pause_all_orders/ HTTP/1.1 Host: your-treadfi-api-host.com Authorization: Token ``` -------------------------------- ### Example Multi Order Response (JSON) Source: https://docs.tread.fi/interacting-with-the-api/api-reference/multi-order A successful response (200 OK) for fetching multi orders. It includes a list of multi orders, each with detailed information such as ID, timestamps, execution details, associated child orders, and status. Pagination metadata is also provided. ```json { "multi_orders": [ { "id": "6debb950-614a-4366-b73b-7d7574fd9e15", "created_at": "2023-12-01T10:00:00Z", "updated_at": "2023-12-01T10:30:00Z", "start_timedate": "2023-12-01T10:00:00Z", "duration": 3600, "exposure_tolerance": "0.05", "notional_exposure": "22500.00", "executed_notional": "22500.00", "child_order_ids": [ "7fecb951-725b-5477-c84c-8e8685ge0f26", "8gfdca62-836c-6588-d95d-9f9796hf1g37" ], "accounts": ["binance_main", "coinbase_pro"], "strategy": "TWAP", "strategy_params": { "interval": 300, "slices": 12 }, "engine_passiveness": "0.5", "schedule_discretion": "0.3", "alpha_tilt": "0.1", "limit_price_spread": null, "failure_reason": null, "pct_filled": "100.00", "account_names": ["binance_main", "coinbase_pro"], "pairs": "BTC-USD,ETH-USD", "status": "COMPLETED", "is_active": false, "is_paused": false, "fee_notional": "22.50", "order_condition": "", "custom_order_id": "multi_order_123", "child_orders": [ { "id": "7fecb951-725b-5477-c84c-8e8685ge0f26", "custom_order_id": "child_order_1", "parent_order_id": "6debb950-614a-4366-b73b-7d7574fd9e15", "notes": "", "pair": "BTC-USD", "side": "buy", "exchanges": ["binance"], "buy_token": "BTC", "buy_token_amount": "0.25", "sell_token": "USD", "sell_token_amount": "11250.00", "strategy": "TWAP", "strategy_params": { "interval": 300, "slices": 6 }, "status": "COMPLETED", "executed_notional": "11250.00", "pct_filled": "100.00", "created_at": "2023-12-01T10:00:00Z", "updated_at": "2023-12-01T10:30:00Z", "time_start": "2023-12-01T10:00:00Z", "duration": 1800, "limit_price": "45000.00", "engine_passiveness": "0.5", "schedule_discretion": "0.3", "alpha_tilt": "0.1", "is_active": false, "is_paused": false, "failure_reason": null, "fee": "11.25", "fills": [ { "id": "fill_001", "timestamp": "2023-12-01T10:05:00Z", "quantity": "0.04166667", "price": "45000.00", "notional": "1875.00", "venue": "binance", "fee": "1.875" } ] } ] } ], "page_number": 1, "page_size": 100, "num_pages": 2, "multi_order_count": 144 } ``` -------------------------------- ### Price Condition Example (Spread) Source: https://docs.tread.fi/conditional-order This example demonstrates triggering an order based on the spread between two related assets. It calculates the difference between ETH-USDT and ETH:PERP-USDT on Binance and executes the order if the spread is greater than 1. This can be used for arbitrage or hedging strategies. ```TaaS Logic ( ETH-USDT@Binance - ETH:PERP-USDT@Binance ) > 1 ``` -------------------------------- ### POST /api/orders/ Source: https://docs.tread.fi/interacting-with-the-api/api-reference/core-order-api Submit an order for scheduling and execution. The request contains all the parameters necessary to carry out the execution until completion. The order is queued immediately if start_datetime is not set or is in the past. ```APIDOC ## POST /api/orders/ ### Description Submit an order for scheduling and execution. The request contains all the parameters necessary to carry out the execution until completion. The order is queued immediately if `start_datetime` is not set or is in the past. ### Method POST ### Endpoint /api/orders/ ### Parameters #### Request Body - **param1** (type) - Required/Optional - Description ### Request Example { "example": "request body" } ### Response #### Success Response (200) - **field1** (type) - Description #### Response Example { "example": "response body" } ``` -------------------------------- ### Get Order Book API Endpoint Source: https://docs.tread.fi/interacting-with-the-api/api-reference/miscellaneous Fetches a snapshot of the order book for a specific trading pair on a given exchange. This GET request requires 'pair' and 'exchange_name' as parameters. The response contains 'bids' and 'asks' arrays, each with 'price' and 'size' for the order book entries. ```json { "bids": [ { "price": 100425.3, "size": 550.82 }, ... ], "asks": [ { "price": 100425.4, "size": 562.54 }, ... ] } ``` -------------------------------- ### Download Nightly Build Source: https://docs.tread.fi/self-hosted-service/on-premise-setup/stable-and-nightly-builds This endpoint allows you to download the latest nightly build of Tread.fi, providing access to the newest features. The 'version' parameter should not be set to obtain the nightly build. ```APIDOC ## Download Nightly Build ### Description Downloads the nightly build of Tread.fi, containing the latest features and functionality. This build has undergone automated testing but not extensive user testing. ### Method POST ### Endpoint https://........ ### Parameters #### Request Body - **license_key** (string) - Required - Your valid license key. ### Request Example ```json { "license_key" : "LICENSE_KEY" } ``` ### Response #### Success Response (200) Details about the successful download of the nightly build. #### Response Example ```json { "message": "Nightly build downloaded successfully." } ``` ``` -------------------------------- ### Get Token Pairs API Endpoint Source: https://docs.tread.fi/interacting-with-the-api/api-reference/miscellaneous Retrieves a list of available trading pairs and their metadata across different exchanges. This GET request can optionally be filtered by market type. The response includes a 'pairs' object where keys are trading pair names and values are exchange-specific mappings. ```json { "pairs": { "JFI-USDC": { "OKX": "JFI-USDC", "MockExchange": "JFI-USDC" }, "SHIBI-USDT": { "Bybit": "SHIBIUSDT" }, "ICX-USDC": { "OKX": "ICX-USDC", "MockExchange": "ICX-USDC" }, ... } } ```