Price Server API ================ A comprehensive API for retrieving cryptocurrency price data and managing price overrides. ===[ Endpoints ]============= GET /api/price/latest Get the most recent price point from the database. No parameters required. Example Request: curl "https://price.ducatprotocol.com/api/price/latest" --------- GET /api/price/point Get price data for a specific timestamp. Query Parameters: - ts (integer, required): Unix timestamp for the price point (minimum: 1231006505). Example Request: curl "https://price.ducatprotocol.com/api/price/point?ts=1640995200" --------- GET /api/price/history Get price history within a specified time range. Query Parameters: - start (integer, required): Start timestamp for the price history range (minimum: 1231006505). - end (integer, optional): End timestamp for the price history range (defaults to current time). - res (string, optional): Resolution interval for the price data. Options: 5m, 30m, 1h, 12h, 1d, 1w, 30d (default: 1h). Example Request: curl "https://price.ducatprotocol.com/api/price/history?start=1640995200&end=1641081600&res=1h" --------- GET /api/price/thold Get threshold breach events for a given threshold and time period. Query Parameters: - ts (integer, required): Start timestamp for the threshold check (minimum: 1231006505). - th (number, required): Threshold price to check for breaches (minimum: 0). Example Request: curl "https://price.ducatprotocol.com/api/price/thold?ts=1640995200&th=50000" --------- GET /api/override/add Add a price override for a specific timestamp (non-production only). Query Parameters: - price (number, required): Override price value (minimum: 0). - stamp (integer, required): Timestamp for the override (minimum: 1231006505). Headers: - x-api-key (string, required): API key for authentication (minimum 32 characters). Example Request: curl -H "x-api-key: your-api-key-here" "https://price.ducatprotocol.com/api/override/add?price=50000&stamp=1640995200" --------- GET /api/override/remove Remove a price override for a specific timestamp (non-production only). Query Parameters: - stamp (integer, required): Timestamp of the override to remove (minimum: 1231006505). Headers: - x-api-key (string, required): API key for authentication (minimum 32 characters). Example Request: curl -H "x-api-key: your-api-key-here" "https://price.ducatprotocol.com/api/override/remove?stamp=1640995200" --------- GET /api/override/list List all price overrides in the database (non-production only). No parameters required. Headers: - x-api-key (string, required): API key for authentication (minimum 32 characters). Example Request: curl -H "x-api-key: your-api-key-here" "https://price.ducatprotocol.com/api/override/list" --------- GET /api/override/clear Clear all price overrides from the database (non-production only). No parameters required. Headers: - x-api-key (string, required): API key for authentication (minimum 32 characters). Example Request: curl -H "x-api-key: your-api-key-here" "https://price.ducatprotocol.com/api/override/clear" ===[ Response Format ]============ The API returns JSON objects with price data. Common response formats include: Price Point Response: { "origin": "gecko", "price": 50000.50, "stamp": 1640995200 } Price History Response: [ { "origin": "gecko", "price": 50000.50, "stamp": 1640995200 }, { "origin": "gecko", "price": 51000.75, "stamp": 1641081600 } ] Threshold Event Response: { "event_origin": "gecko", "event_price": 50000.50, "event_stamp": 1640995200, "event_type": "threshold_breach", "latest_origin": "gecko", "latest_price": 51000.75, "latest_stamp": 1641081600, "quote_origin": "gecko", "quote_price": 50500.25, "quote_stamp": 1641038400 } Override Response: "price override added" Override List Response: [ { "origin": "override", "price": 50000.50, "stamp": 1640995200 }, { "origin": "override", "price": 51000.75, "stamp": 1641081600 } ] Clear Response: "price overrides cleared" ===[ Usage Examples ]============ Get Latest Price: curl "https://price.ducatprotocol.com/api/price/latest" Get Price for Specific Time: curl "https://price.ducatprotocol.com/api/price/point?ts=1640995200" Get Hourly Price History: curl "https://price.ducatprotocol.com/api/price/history?start=1640995200&end=1641081600&res=1h" Check Threshold Breach: curl "https://price.ducatprotocol.com/api/price/thold?ts=1640995200&th=50000" Add Price Override: curl -H "x-api-key: your-api-key-here" "https://price.ducatprotocol.com/api/override/add?price=50000&stamp=1640995200" Remove Price Override: curl -H "x-api-key: your-api-key-here" "https://price.ducatprotocol.com/api/override/remove?stamp=1640995200" List Price Overrides: curl -H "x-api-key: your-api-key-here" "https://price.ducatprotocol.com/api/override/list" Clear Price Overrides: curl -H "x-api-key: your-api-key-here" "https://price.ducatprotocol.com/api/override/clear" ===[ Error Responses ]============ 400 Bad Request - Invalid parameters: invalid price 401 Unauthorized - Invalid API key or production mode: permission denied 422 Unprocessable Entity - Invalid timestamp: invalid timestamp 500 Internal Server Error: unknown error --- For detailed API specification, see the OpenAPI/Swagger documentation.