deribit_http/
constants.rs

1//! HTTP client constants
2
3/// Default timeout for HTTP requests in seconds
4pub const DEFAULT_TIMEOUT: u64 = 30;
5
6/// Maximum number of retries for failed requests
7pub const MAX_RETRIES: u32 = 3;
8
9/// Production base URL for Deribit API
10pub const PRODUCTION_BASE_URL: &str = "https://www.deribit.com/api/v2";
11
12/// Testnet base URL for Deribit API
13pub const TESTNET_BASE_URL: &str = "https://test.deribit.com/api/v2";
14
15/// API endpoints
16pub mod endpoints {
17    // Authentication endpoints
18    /// Public authentication endpoint
19    pub const AUTH: &str = "/public/auth";
20
21    // Public market data endpoints
22    /// Get ticker information for an instrument
23    pub const GET_TICKER: &str = "/public/ticker";
24    /// Get instrument information by name
25    pub const GET_INSTRUMENT: &str = "/public/get_instrument";
26    /// Get list of available instruments
27    pub const GET_INSTRUMENTS: &str = "/public/get_instruments";
28    /// Get order book for an instrument
29    pub const GET_ORDER_BOOK: &str = "/public/get_order_book";
30    /// Get book summary by currency
31    pub const GET_BOOK_SUMMARY_BY_CURRENCY: &str = "/public/get_book_summary_by_currency";
32    /// Get book summary by instrument
33    pub const GET_BOOK_SUMMARY_BY_INSTRUMENT: &str = "/public/get_book_summary_by_instrument";
34    /// Get contract size for an instrument
35    pub const GET_CONTRACT_SIZE: &str = "/public/get_contract_size";
36    /// Get list of available currencies
37    pub const GET_CURRENCIES: &str = "/public/get_currencies";
38    /// Get index information
39    pub const GET_INDEX: &str = "/public/get_index";
40    /// Get index price
41    pub const GET_INDEX_PRICE: &str = "/public/get_index_price";
42    /// Get index price names
43    pub const GET_INDEX_PRICE_NAMES: &str = "/public/get_index_price_names";
44    /// Get server time
45    pub const GET_SERVER_TIME: &str = "/public/get_time";
46    /// Test connection to the API
47    pub const TEST_CONNECTION: &str = "/public/test";
48    /// Get API status
49    pub const GET_STATUS: &str = "/public/status";
50    /// Get APR history
51    pub const GET_APR_HISTORY: &str = "/public/get_apr_history";
52    /// Get options information
53    pub const GET_OPTIONS: &str = "/public/get_options";
54    /// Get options pair information
55    pub const GET_OPTIONS_PAIR: &str = "/public/get_options_pair";
56    /// Get last trades by instrument
57    pub const GET_LAST_TRADES_BY_INSTRUMENT: &str = "/public/get_last_trades_by_instrument";
58    /// Get historical volatility data
59    pub const GET_HISTORICAL_VOLATILITY: &str = "/public/get_historical_volatility";
60    /// Get funding chart data
61    pub const GET_FUNDING_CHART_DATA: &str = "/public/get_funding_chart_data";
62    /// Get TradingView chart data
63    pub const GET_TRADINGVIEW_CHART_DATA: &str = "/public/get_tradingview_chart_data";
64    /// Get delivery prices
65    pub const GET_DELIVERY_PRICES: &str = "/public/get_delivery_prices";
66    /// Get expiration dates
67    pub const GET_EXPIRATIONS: &str = "/public/get_expirations";
68    /// Get funding rate history
69    pub const GET_FUNDING_RATE_HISTORY: &str = "/public/get_funding_rate_history";
70    /// Get current funding rate value
71    pub const GET_FUNDING_RATE_VALUE: &str = "/public/get_funding_rate_value";
72    /// Get last settlements by currency
73    pub const GET_LAST_SETTLEMENTS_BY_CURRENCY: &str = "/public/get_last_settlements_by_currency";
74    /// Get last settlements by instrument
75    pub const GET_LAST_SETTLEMENTS_BY_INSTRUMENT: &str =
76        "/public/get_last_settlements_by_instrument";
77    /// Get last trades by currency
78    pub const GET_LAST_TRADES_BY_CURRENCY: &str = "/public/get_last_trades_by_currency";
79    /// Get last trades by currency and time
80    pub const GET_LAST_TRADES_BY_CURRENCY_AND_TIME: &str =
81        "/public/get_last_trades_by_currency_and_time";
82    /// Get last trades by instrument and time
83    pub const GET_LAST_TRADES_BY_INSTRUMENT_AND_TIME: &str =
84        "/public/get_last_trades_by_instrument_and_time";
85    /// Get order book by instrument ID
86    pub const GET_ORDER_BOOK_BY_INSTRUMENT_ID: &str = "/public/get_order_book_by_instrument_id";
87
88    // Private trading endpoints
89    /// Place a buy order
90    pub const BUY: &str = "/private/buy";
91    /// Place a sell order
92    pub const SELL: &str = "/private/sell";
93    /// Cancel a specific order
94    pub const CANCEL: &str = "/private/cancel";
95    /// Cancel all orders
96    pub const CANCEL_ALL: &str = "/private/cancel_all";
97    /// Cancel all orders by currency
98    pub const CANCEL_ALL_BY_CURRENCY: &str = "/private/cancel_all_by_currency";
99    /// Cancel all orders by currency pair
100    pub const CANCEL_ALL_BY_CURRENCY_PAIR: &str = "/private/cancel_all_by_currency_pair";
101    /// Cancel all orders by instrument
102    pub const CANCEL_ALL_BY_INSTRUMENT: &str = "/private/cancel_all_by_instrument";
103    /// Cancel all orders by kind or type
104    pub const CANCEL_ALL_BY_KIND_OR_TYPE: &str = "/private/cancel_all_by_kind_or_type";
105    /// Cancel orders by label
106    pub const CANCEL_BY_LABEL: &str = "/private/cancel_by_label";
107    /// Edit order
108    pub const EDIT: &str = "/private/edit";
109    /// Cancel quotes
110    pub const CANCEL_QUOTES: &str = "/private/cancel_quotes";
111
112    // Private account endpoints
113    /// Get account summary information
114    pub const GET_ACCOUNT_SUMMARY: &str = "/private/get_account_summary";
115    /// Get position
116    pub const GET_POSITION: &str = "/private/get_position";
117    /// Get current positions
118    pub const GET_POSITIONS: &str = "/private/get_positions";
119    /// Get subaccount information
120    pub const GET_SUBACCOUNTS: &str = "/private/get_subaccounts";
121    /// Get transaction log
122    pub const GET_TRANSACTION_LOG: &str = "/private/get_transaction_log";
123    /// Get deposits
124    pub const GET_DEPOSITS: &str = "/private/get_deposits";
125    /// Get withdrawals
126    pub const GET_WITHDRAWALS: &str = "/private/get_withdrawals";
127    /// Submit transfer to subaccount
128    pub const SUBMIT_TRANSFER_TO_SUBACCOUNT: &str = "/private/submit_transfer_to_subaccount";
129    /// Submit transfer to user
130    pub const SUBMIT_TRANSFER_TO_USER: &str = "/private/submit_transfer_to_user";
131
132    // Private order endpoints
133    /// Get all open orders
134    pub const GET_OPEN_ORDERS: &str = "/private/get_open_orders";
135    /// Get open orders by label
136    pub const GET_OPEN_ORDERS_BY_LABEL: &str = "/private/get_open_orders_by_label";
137    /// Get order state
138    pub const GET_ORDER_STATE: &str = "/private/get_order_state";
139    /// Get open orders by currency
140    pub const GET_OPEN_ORDERS_BY_CURRENCY: &str = "/private/get_open_orders_by_currency";
141    /// Get open orders by instrument
142    pub const GET_OPEN_ORDERS_BY_INSTRUMENT: &str = "/private/get_open_orders_by_instrument";
143    /// Get order history by currency
144    pub const GET_ORDER_HISTORY_BY_CURRENCY: &str = "/private/get_order_history_by_currency";
145    /// Get order history by instrument
146    pub const GET_ORDER_HISTORY_BY_INSTRUMENT: &str = "/private/get_order_history_by_instrument";
147
148    // Private trade endpoints
149    /// Get user trades by instrument
150    pub const GET_USER_TRADES_BY_INSTRUMENT: &str = "/private/get_user_trades_by_instrument";
151    /// Get user trades by currency
152    pub const GET_USER_TRADES_BY_CURRENCY: &str = "/private/get_user_trades_by_currency";
153    /// Get user trades by currency and time
154    pub const GET_USER_TRADES_BY_CURRENCY_AND_TIME: &str =
155        "/private/get_user_trades_by_currency_and_time";
156    /// Get user trades by instrument and time
157    pub const GET_USER_TRADES_BY_INSTRUMENT_AND_TIME: &str =
158        "/private/get_user_trades_by_instrument_and_time";
159    /// Get user trades by order
160    pub const GET_USER_TRADES_BY_ORDER: &str = "/private/get_user_trades_by_order";
161}
162
163/// HTTP headers
164pub mod headers {
165    /// Content-Type header name
166    pub const CONTENT_TYPE: &str = "Content-Type";
167    /// JSON content type value
168    pub const APPLICATION_JSON: &str = "application/json";
169    /// Authorization header name
170    pub const AUTHORIZATION: &str = "Authorization";
171    /// User-Agent header name
172    pub const USER_AGENT: &str = "User-Agent";
173}