Skip to main content

nautilus_derive/http/
mod.rs

1// -------------------------------------------------------------------------------------------------
2//  Copyright (C) 2015-2026 Nautech Systems Pty Ltd. All rights reserved.
3//  https://nautechsystems.io
4//
5//  Licensed under the GNU Lesser General Public License Version 3.0 (the "License");
6//  You may not use this file except in compliance with the License.
7//  You may obtain a copy of the License at https://www.gnu.org/licenses/lgpl-3.0.en.html
8//
9//  Unless required by applicable law or agreed to in writing, software
10//  distributed under the License is distributed on an "AS IS" BASIS,
11//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12//  See the License for the specific language governing permissions and
13//  limitations under the License.
14// -------------------------------------------------------------------------------------------------
15
16//! HTTP client for the Derive REST API.
17//!
18//! The wire format mirrors `derive_client`'s upstream Python SDK:
19//!
20//! - Each method is addressed at `${base_url}/<method-name>` (e.g.
21//!   `/public/get_instruments`, `/private/order`).
22//! - Request bodies are the raw `params` object; the method is encoded by the
23//!   URL path, not by a wrapping envelope.
24//! - Successful responses carry `{ "id": <int>, "result": <T> }`; failures
25//!   carry `{ "id": <int>, "error": { "code", "message", "data" } }`. The
26//!   shared envelope types in [`models`] are reused by the WebSocket layer,
27//!   which speaks the full JSON-RPC framing on the wire.
28//!
29//! Private endpoints inject the EIP-191 session-key auth headers built by
30//! [`crate::signing::auth::build_rest_auth_headers`]; public endpoints carry
31//! no auth and may be called without credentials.
32
33pub mod client;
34pub mod error;
35pub mod models;
36pub mod parse;
37pub mod query;
38
39pub use client::{DeriveCredentials, DeriveHttpClient};
40pub use error::{DeriveHttpError, Result};
41pub use models::{JsonRpcError, JsonRpcRequest, JsonRpcResponse};