From 176f9064a6cc372e2f9388c31b7add84b2bdae53 Mon Sep 17 00:00:00 2001 From: zarathustra Date: Sat, 20 Sep 2025 22:54:20 +0200 Subject: [PATCH 1/6] feat: download OpenAPI specs --- scripts/generate-models.py | 70 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 scripts/generate-models.py diff --git a/scripts/generate-models.py b/scripts/generate-models.py new file mode 100644 index 00000000..e31432e0 --- /dev/null +++ b/scripts/generate-models.py @@ -0,0 +1,70 @@ +import json +import re +from pathlib import Path + +import requests +from requests.adapters import HTTPAdapter +from urllib3.util.retry import Retry + +TIMEOUT = 10 + + +def make_session_with_retries( + total: int = 3, + backoff_factor: float = 0.3, + status_forcelist: tuple = (500, 502, 504), + allowed_methods: tuple = ("GET", "POST"), +) -> requests.Session: + session = requests.Session() + retries = Retry( + total=total, + backoff_factor=backoff_factor, + status_forcelist=status_forcelist, + allowed_methods=allowed_methods, + raise_on_status=False, + ) + adapter = HTTPAdapter(max_retries=retries) + session.mount("https://", adapter) + session.mount("http://", adapter) + return session + + +def download_openapi_specs(base_url: str, dest_dir: Path) -> list[Path]: + dest_dir.mkdir(parents=True, exist_ok=True) + index_url = f"{base_url}/openapi" + + with make_session_with_retries() as session: + print(f"Fetching OpenAPI index: {index_url}") + resp = session.get(index_url, timeout=TIMEOUT) + resp.raise_for_status() + html = resp.text + + text_pattern = r']*href="(/openapi/[^"]+)"[^>]*>([^<]+)' + matches = re.findall(text_pattern, html) + + if not matches: + raise RuntimeError(f"No openapi links found at {index_url}") + + saved_files = [] + for href, text in matches: + spec_url = base_url + href + print(f"Downloading: {spec_url}") + resp = session.get(spec_url, timeout=TIMEOUT) + resp.raise_for_status() + file_name = text.replace(" ", "").replace(".", "_") + file_path = (openapi_specs_path / file_name).with_suffix(".json") + file_path.write_text(json.dumps(resp.json(), indent=2)) + saved_files.append(file_path) + print(f"Saved OpenAPI spec at: {file_path}") + + return saved_files + + +if __name__ == "__main__": + base_url = "https://docs.derive.xyz" + repo_root = Path(__file__).parent.parent + + openapi_specs_path = repo_root / "derive_client" / "data" / "openapi" + openapi_specs_path.mkdir(exist_ok=True) + + files = download_openapi_specs(base_url=base_url, dest_dir=openapi_specs_path) From 3e66ea316a1e5831a3b6103168fc2926730c81af Mon Sep 17 00:00:00 2001 From: zarathustra Date: Sat, 20 Sep 2025 22:56:43 +0200 Subject: [PATCH 2/6] feat: generate pydantic models from OpenAPI spec --- scripts/generate-models.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/scripts/generate-models.py b/scripts/generate-models.py index e31432e0..6bd030be 100644 --- a/scripts/generate-models.py +++ b/scripts/generate-models.py @@ -3,6 +3,7 @@ from pathlib import Path import requests +from datamodel_code_generator import DataModelType, InputFileType, PythonVersion, generate from requests.adapters import HTTPAdapter from urllib3.util.retry import Retry @@ -60,6 +61,23 @@ def download_openapi_specs(base_url: str, dest_dir: Path) -> list[Path]: return saved_files +def generate_models(input_path: Path, output_path: Path): + print(f"Generating models from {input_path.name} -> {output_path}") + generate( + input_=input_path, + input_file_type=InputFileType.OpenAPI, + output=output_path, + output_model_type=DataModelType.PydanticV2BaseModel, + target_python_version=PythonVersion.PY_310, + reuse_model=True, + use_subclass_enum=True, + strict_nullable=True, + use_double_quotes=True, + field_constraints=True, + ) + print(f"Models generated at: {output_path}") + + if __name__ == "__main__": base_url = "https://docs.derive.xyz" repo_root = Path(__file__).parent.parent @@ -68,3 +86,11 @@ def download_openapi_specs(base_url: str, dest_dir: Path) -> list[Path]: openapi_specs_path.mkdir(exist_ok=True) files = download_openapi_specs(base_url=base_url, dest_dir=openapi_specs_path) + + input_path = next((p for p in files if "latest" in p.stem.lower()), None) + if input_path is None: + available = ", ".join(p.name for p in files) + raise RuntimeError(f"No 'latest' spec found among downloaded files: {available}") + + output_path = repo_root / "derive_client" / "_clients" / "models.py" + generate_models(input_path=input_path, output_path=output_path) From 3152ac1125ed770f2dbcf258400c9cadcccb8f1e Mon Sep 17 00:00:00 2001 From: zarathustra Date: Sun, 21 Sep 2025 00:01:46 +0200 Subject: [PATCH 3/6] chore: generate pydantic models from OpenAPI spec --- derive_client/_clients/models.py | 5879 ++++++++++++++++++++++++++++++ 1 file changed, 5879 insertions(+) create mode 100644 derive_client/_clients/models.py diff --git a/derive_client/_clients/models.py b/derive_client/_clients/models.py new file mode 100644 index 00000000..9d04b27a --- /dev/null +++ b/derive_client/_clients/models.py @@ -0,0 +1,5879 @@ +# generated by datamodel-codegen: +# filename: RESTAPI-v2_0-latest.json +# timestamp: 2025-09-20T20:37:05+00:00 + +from __future__ import annotations + +from decimal import Decimal +from enum import Enum +from typing import Any, Dict, List, Optional, Union +from uuid import UUID + +from pydantic import BaseModel, ConfigDict, Field + + +class Status(Enum): + unseen = "unseen" + seen = "seen" + hidden = "hidden" + + +class TypeEnum(Enum): + deposit = "deposit" + withdraw = "withdraw" + transfer = "transfer" + trade = "trade" + settlement = "settlement" + liquidation = "liquidation" + custom = "custom" + + +class PrivateGetNotificationsParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + page: Optional[int] = Field(1, description="Page number of results to return", title="page") + page_size: Optional[int] = Field( + 50, + description="Number of results per page (must be between 0-50)", + title="page_size", + ) + status: Optional[Status] = Field(None, description="Status of the notification", title="status") + subaccount_id: Optional[int] = Field( + None, + description="Subaccount_id (must be set if wallet param is not set)", + title="subaccount_id", + ) + type: Optional[List[TypeEnum]] = Field(None, description="List of notification types to filter by", title="type") + wallet: Optional[str] = Field( + None, + description="Wallet address (if set, subaccount_id ignored)", + title="wallet", + ) + + +class NotificationResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + event: str = Field( + ..., + description="The specific event leading to the notification.", + title="event", + ) + event_details: Dict[str, Any] = Field( + ..., + description="A JSON-structured dictionary containing detailed data or context about the event.", + title="event_details", + ) + id: int = Field(..., description="The unique identifier for the notification.", title="id") + status: str = Field( + ..., + description="The status of the notification, indicating if it has been read, pending, or processed.", + title="status", + ) + subaccount_id: int = Field( + ..., + description="The subaccount_id associated with the notification.", + title="subaccount_id", + ) + timestamp: int = Field( + ..., + description="The timestamp indicating when the notification was created or triggered.", + title="timestamp", + ) + transaction_id: Optional[int] = Field( + None, + description="The transaction id associated with the notification.", + title="transaction_id", + ) + tx_hash: Optional[str] = Field( + None, + description="The transaction hash associated with the notification.", + title="tx_hash", + ) + + +class PaginationInfoSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + count: int = Field(..., description="Total number of items, across all pages", title="count") + num_pages: int = Field(..., description="Number of pages", title="num_pages") + + +class PublicGetCurrencyParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + currency: str = Field( + ..., + description="Underlying currency of asset (`ETH`, `BTC`, etc)", + title="currency", + ) + + +class InstrumentType(Enum): + erc20 = "erc20" + option = "option" + perp = "perp" + + +class MarketType(Enum): + ALL = "ALL" + SRM_BASE_ONLY = "SRM_BASE_ONLY" + SRM_OPTION_ONLY = "SRM_OPTION_ONLY" + SRM_PERP_ONLY = "SRM_PERP_ONLY" + CASH = "CASH" + + +class OpenInterestStatsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + current_open_interest: Decimal = Field( + ..., + description="Current open interest for the margin type", + title="current_open_interest", + ) + interest_cap: Decimal = Field(..., description="Total open interest cap", title="interest_cap") + manager_currency: Optional[str] = Field( + None, + description="Currency of the manager (only applies to Portfolio Margin)", + title="manager_currency", + ) + + +class MarginType(Enum): + PM = "PM" + SM = "SM" + PM2 = "PM2" + + +class ManagerContractResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + address: str = Field(..., description="Address of the manager", title="address") + currency: Optional[str] = Field( + None, + description="Currency of the manager (only applies to portfolio managers)", + title="currency", + ) + margin_type: MarginType = Field(..., description="Margin type of the manager", title="margin_type") + + +class PM2CollateralDiscountsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + im_discount: Decimal = Field( + ..., + description="Initial Margin discount for given collateral in PM2", + title="im_discount", + ) + manager_currency: str = Field(..., description="Currency of the manager", title="manager_currency") + mm_discount: Decimal = Field( + ..., + description="Maintenance Margin discount for given collateral in PM2", + title="mm_discount", + ) + + +class ProtocolAssetAddressesSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + option: Optional[str] = Field( + None, + description="Address of the Derive protocol option contract (none if not supported)", + title="option", + ) + perp: Optional[str] = Field( + None, + description="Address of the Derive protocol perp contract (none if not supported)", + title="perp", + ) + spot: Optional[str] = Field( + None, + description="Address of the Derive protocol spot contract (none if not supported)", + title="spot", + ) + underlying_erc20: Optional[str] = Field( + None, + description="Address of the erc20 asset on Derive chain. This is the asset that is deposited into the spot asset", + title="underlying_erc20", + ) + + +class PrivateSetMmpConfigParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + currency: str = Field(..., description="Currency of this mmp config", title="currency") + mmp_amount_limit: Decimal = Field( + "0", + description="Maximum total order amount that can be traded within the mmp_interval across all instruments of the provided currency. The amounts are not netted, so a filled bid of 1 and a filled ask of 2 would count as 3.
Default: 0 (no limit)", + title="mmp_amount_limit", + ) + mmp_delta_limit: Decimal = Field( + "0", + description="Maximum total delta that can be traded within the mmp_interval across all instruments of the provided currency. This quantity is netted, so a filled order with +1 delta and a filled order with -2 delta would count as -1
Default: 0 (no limit)", + title="mmp_delta_limit", + ) + mmp_frozen_time: int = Field( + ..., + description="Time interval in ms setting how long the subaccount is frozen after an mmp trigger, if 0 then a manual reset would be required via private/reset_mmp", + title="mmp_frozen_time", + ) + mmp_interval: int = Field( + ..., + description="Time interval in ms over which the limits are monotored, if 0 then mmp is disabled", + title="mmp_interval", + ) + subaccount_id: int = Field( + ..., + description="Subaccount_id for which to set the config", + title="subaccount_id", + ) + + +PrivateSetMmpConfigResultSchema = PrivateSetMmpConfigParamsSchema + + +class Direction(Enum): + buy = "buy" + sell = "sell" + + +class TradeModuleParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + amount: Decimal = Field(..., description="Order amount in units of the base", title="amount") + direction: Direction = Field(..., description="Order direction", title="direction") + instrument_name: str = Field(..., description="Instrument name", title="instrument_name") + limit_price: Decimal = Field( + ..., + description="Limit price in quote currency.
This field is still required for market orders because it is a component of the signature. However, market orders will not leave a resting order in the book in case of a partial fill.", + title="limit_price", + ) + max_fee: Decimal = Field( + ..., + description="Max fee per unit of volume, denominated in units of the quote currency (usually USDC).Order will be rejected if the supplied max fee is below the estimated fee for this order.", + title="max_fee", + ) + nonce: int = Field( + ..., + description="Unique nonce defined as (e.g. 1695836058725001, where 001 is the random number).Note, using a random number beyond 3 digits will cause JSON serialization to fail.", + title="nonce", + ) + signature: str = Field(..., description="Ethereum signature of the order", title="signature") + signature_expiry_sec: int = Field( + ..., + description="Unix timestamp in seconds. Order signature becomes invalid after this time, and the system will cancel the order.Expiry MUST be at least 5 min from now.", + title="signature_expiry_sec", + ) + signer: str = Field( + ..., + description="Owner wallet address or registered session key that signed order", + title="signer", + ) + subaccount_id: int = Field(..., description="Subaccount ID", title="subaccount_id") + + +class CancelReason(Enum): + field_ = "" + user_request = "user_request" + mmp_trigger = "mmp_trigger" + insufficient_margin = "insufficient_margin" + signed_max_fee_too_low = "signed_max_fee_too_low" + cancel_on_disconnect = "cancel_on_disconnect" + ioc_or_market_partial_fill = "ioc_or_market_partial_fill" + session_key_deregistered = "session_key_deregistered" + subaccount_withdrawn = "subaccount_withdrawn" + compliance = "compliance" + trigger_failed = "trigger_failed" + validation_failed = "validation_failed" + + +class OrderStatus(Enum): + open = "open" + filled = "filled" + cancelled = "cancelled" + expired = "expired" + untriggered = "untriggered" + + +class OrderType(Enum): + limit = "limit" + market = "market" + + +class TimeInForce(Enum): + gtc = "gtc" + post_only = "post_only" + fok = "fok" + ioc = "ioc" + + +class TriggerPriceType(Enum): + mark = "mark" + index = "index" + + +class TriggerType(Enum): + stoploss = "stoploss" + takeprofit = "takeprofit" + + +class OrderResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + amount: Decimal = Field(..., description="Order amount in units of the base", title="amount") + average_price: Decimal = Field(..., description="Average fill price", title="average_price") + cancel_reason: CancelReason = Field( + ..., + description="If cancelled, reason behind order cancellation", + title="cancel_reason", + ) + creation_timestamp: int = Field( + ..., + description="Creation timestamp (in ms since Unix epoch)", + title="creation_timestamp", + ) + direction: Direction = Field(..., description="Order direction", title="direction") + filled_amount: Decimal = Field(..., description="Total filled amount for the order", title="filled_amount") + instrument_name: str = Field(..., description="Instrument name", title="instrument_name") + is_transfer: bool = Field( + ..., + description="Whether the order was generated through `private/transfer_position`", + title="is_transfer", + ) + label: str = Field(..., description="Optional user-defined label for the order", title="label") + last_update_timestamp: int = Field( + ..., + description="Last update timestamp (in ms since Unix epoch)", + title="last_update_timestamp", + ) + limit_price: Decimal = Field(..., description="Limit price in quote currency", title="limit_price") + max_fee: Decimal = Field(..., description="Max fee in units of the quote currency", title="max_fee") + mmp: bool = Field( + ..., + description="Whether the order is tagged for market maker protections", + title="mmp", + ) + nonce: int = Field( + ..., + description="Unique nonce defined as (e.g. 1695836058725001, where 001 is the random number)", + title="nonce", + ) + order_fee: Decimal = Field(..., description="Total order fee paid so far", title="order_fee") + order_id: str = Field(..., description="Order ID", title="order_id") + order_status: OrderStatus = Field(..., description="Order status", title="order_status") + order_type: OrderType = Field(..., description="Order type", title="order_type") + quote_id: Optional[UUID] = Field(..., description="Quote ID if the trade was executed via RFQ", title="quote_id") + replaced_order_id: Optional[UUID] = Field( + None, + description="If replaced, ID of the order that was replaced", + title="replaced_order_id", + ) + signature: str = Field(..., description="Ethereum signature of the order", title="signature") + signature_expiry_sec: int = Field(..., description="Signature expiry timestamp", title="signature_expiry_sec") + signer: str = Field( + ..., + description="Owner wallet address or registered session key that signed order", + title="signer", + ) + subaccount_id: int = Field(..., description="Subaccount ID", title="subaccount_id") + time_in_force: TimeInForce = Field(..., description="Time in force", title="time_in_force") + trigger_price: Optional[Decimal] = Field( + None, + description="(Required for trigger orders) Index or Market price to trigger order at", + title="trigger_price", + ) + trigger_price_type: Optional[TriggerPriceType] = Field( + None, + description="(Required for trigger orders) Trigger with Index or Mark Price", + title="trigger_price_type", + ) + trigger_reject_message: Optional[str] = Field( + None, + description="(Required for trigger orders) Error message if error occured during trigger", + title="trigger_reject_message", + ) + trigger_type: Optional[TriggerType] = Field( + None, + description="(Required for trigger orders) Stop-loss or Take-profit.", + title="trigger_type", + ) + + +class LiquidityRole(Enum): + maker = "maker" + taker = "taker" + + +class TxStatus(Enum): + requested = "requested" + pending = "pending" + settled = "settled" + reverted = "reverted" + ignored = "ignored" + timed_out = "timed_out" + + +class TradeResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + direction: Direction = Field(..., description="Order direction", title="direction") + expected_rebate: Decimal = Field(..., description="Expected rebate for this trade", title="expected_rebate") + index_price: Decimal = Field( + ..., + description="Index price of the underlying at the time of the trade", + title="index_price", + ) + instrument_name: str = Field(..., description="Instrument name", title="instrument_name") + is_transfer: bool = Field( + ..., + description="Whether the trade was generated through `private/transfer_position`", + title="is_transfer", + ) + label: str = Field(..., description="Optional user-defined label for the order", title="label") + liquidity_role: LiquidityRole = Field(..., description="Role of the user in the trade", title="liquidity_role") + mark_price: Decimal = Field( + ..., + description="Mark price of the instrument at the time of the trade", + title="mark_price", + ) + order_id: str = Field(..., description="Order ID", title="order_id") + quote_id: Optional[UUID] = Field(..., description="Quote ID if the trade was executed via RFQ", title="quote_id") + realized_pnl: Decimal = Field(..., description="Realized PnL for this trade", title="realized_pnl") + realized_pnl_excl_fees: Decimal = Field( + ..., + description="Realized PnL for this trade using cost accounting that excludes fees", + title="realized_pnl_excl_fees", + ) + subaccount_id: int = Field(..., description="Subaccount ID", title="subaccount_id") + timestamp: int = Field(..., description="Trade timestamp (in ms since Unix epoch)", title="timestamp") + trade_amount: Decimal = Field(..., description="Amount filled in this trade", title="trade_amount") + trade_fee: Decimal = Field(..., description="Fee for this trade", title="trade_fee") + trade_id: str = Field(..., description="Trade ID", title="trade_id") + trade_price: Decimal = Field(..., description="Price at which the trade was filled", title="trade_price") + transaction_id: str = Field( + ..., + description="The transaction id of the related settlement transaction", + title="transaction_id", + ) + tx_hash: Optional[str] = Field(..., description="Blockchain transaction hash", title="tx_hash") + tx_status: TxStatus = Field(..., description="Blockchain transaction status", title="tx_status") + + +class PrivateCreateSubaccountParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + amount: Decimal = Field(..., description="Amount of the asset to deposit", title="amount") + asset_name: str = Field(..., description="Name of asset to deposit", title="asset_name") + currency: Optional[str] = Field( + None, + description="Base currency of the subaccount (only for `PM`)", + title="currency", + ) + margin_type: MarginType = Field( + ..., + description="`PM` (Portfolio Margin), `PM2 (Portfolio Margin 2), or `SM` (Standard Margin))", + title="margin_type", + ) + nonce: int = Field( + ..., + description="Unique nonce defined as (e.g. 1695836058725001, where 001 is the random number)", + title="nonce", + ) + signature: str = Field(..., description="Ethereum signature of the deposit", title="signature") + signature_expiry_sec: int = Field( + ..., + description="Unix timestamp in seconds. Expiry MUST be >5min from now", + title="signature_expiry_sec", + ) + signer: str = Field( + ..., + description="Ethereum wallet address that is signing the deposit", + title="signer", + ) + wallet: str = Field(..., description="Ethereum wallet address", title="wallet") + + +class PrivateCreateSubaccountResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + status: str = Field(..., description="`requested`", title="status") + transaction_id: UUID = Field(..., description="Transaction id of the request", title="transaction_id") + + +class LegUnpricedSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + amount: Decimal = Field(..., description="Amount in units of the base", title="amount") + direction: Direction = Field(..., description="Leg direction", title="direction") + instrument_name: str = Field(..., description="Instrument name", title="instrument_name") + + +class CancelReason1(Enum): + field_ = "" + user_request = "user_request" + insufficient_margin = "insufficient_margin" + signed_max_fee_too_low = "signed_max_fee_too_low" + mmp_trigger = "mmp_trigger" + cancel_on_disconnect = "cancel_on_disconnect" + session_key_deregistered = "session_key_deregistered" + subaccount_withdrawn = "subaccount_withdrawn" + rfq_no_longer_open = "rfq_no_longer_open" + compliance = "compliance" + + +class Status1(Enum): + open = "open" + filled = "filled" + cancelled = "cancelled" + expired = "expired" + + +class PrivateSendRfqResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + ask_total_cost: Optional[Decimal] = Field( + ..., + description="Ask total cost for the RFQ implied from orderbook (as `sell`)", + title="ask_total_cost", + ) + bid_total_cost: Optional[Decimal] = Field( + ..., + description="Bid total cost for the RFQ implied from orderbook (as `buy`)", + title="bid_total_cost", + ) + cancel_reason: CancelReason1 = Field(..., description="Cancel reason, if any", title="cancel_reason") + counterparties: Optional[List[str]] = Field( + ..., + description="List of requested counterparties, if applicable", + title="counterparties", + ) + creation_timestamp: int = Field( + ..., + description="Creation timestamp in ms since Unix epoch", + title="creation_timestamp", + ) + filled_direction: Optional[Direction] = Field( + ..., + description="Direction at which the RFQ was filled (only if filled)", + title="filled_direction", + ) + filled_pct: Decimal = Field( + ..., + description="Percentage of the RFQ that has been filled, from 0 to 1.", + title="filled_pct", + ) + label: str = Field(..., description="User-defined label, if any", title="label") + last_update_timestamp: int = Field( + ..., + description="Last update timestamp in ms since Unix epoch", + title="last_update_timestamp", + ) + legs: List[LegUnpricedSchema] = Field(..., description="RFQ legs", title="legs") + mark_total_cost: Optional[Decimal] = Field( + ..., + description="Mark total cost for the RFQ (assuming `buy` direction)", + title="mark_total_cost", + ) + max_total_cost: Optional[Decimal] = Field(..., description="Max total cost for the RFQ", title="max_total_cost") + min_total_cost: Optional[Decimal] = Field(..., description="Min total cost for the RFQ", title="min_total_cost") + partial_fill_step: Decimal = Field( + ..., + description="Step size for partial fills (default: 1)", + title="partial_fill_step", + ) + rfq_id: UUID = Field(..., description="RFQ ID", title="rfq_id") + status: Status1 = Field(..., description="Status", title="status") + subaccount_id: int = Field(..., description="Subaccount ID", title="subaccount_id") + total_cost: Optional[Decimal] = Field( + ..., description="Total cost for the RFQ (only if filled)", title="total_cost" + ) + valid_until: int = Field( + ..., + description="RFQ expiry timestamp in ms since Unix epoch", + title="valid_until", + ) + + +class PublicMarginWatchParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + force_onchain: bool = Field( + False, + description="Force the fetching of on-chain balances, default False.", + title="force_onchain", + ) + subaccount_id: int = Field(..., description="Subaccount ID to get margin for.", title="subaccount_id") + + +class CollateralPublicResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + amount: Decimal = Field(..., description="Asset amount of given collateral", title="amount") + asset_name: str = Field(..., description="Asset name", title="asset_name") + asset_type: InstrumentType = Field( + ..., + description="Type of asset collateral (currently always `erc20`)", + title="asset_type", + ) + initial_margin: Decimal = Field( + ..., + description="USD value of collateral that contributes to initial margin", + title="initial_margin", + ) + maintenance_margin: Decimal = Field( + ..., + description="USD value of collateral that contributes to maintenance margin", + title="maintenance_margin", + ) + mark_price: Decimal = Field(..., description="Current mark price of the asset", title="mark_price") + mark_value: Decimal = Field( + ..., + description="USD value of the collateral (amount * mark price)", + title="mark_value", + ) + + +class PositionPublicResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + amount: Decimal = Field(..., description="Position amount held by subaccount", title="amount") + delta: Decimal = Field( + ..., + description="Asset delta (w.r.t. forward price for options, `1.0` for perps)", + title="delta", + ) + gamma: Decimal = Field(..., description="Asset gamma (zero for non-options)", title="gamma") + index_price: Decimal = Field( + ..., + description="Current index (oracle) price for position's currency", + title="index_price", + ) + initial_margin: Decimal = Field( + ..., + description="USD initial margin requirement for this position", + title="initial_margin", + ) + instrument_name: str = Field( + ..., + description="Instrument name (same as the base Asset name)", + title="instrument_name", + ) + instrument_type: InstrumentType = Field(..., description="`erc20`, `option`, or `perp`", title="instrument_type") + liquidation_price: Optional[Decimal] = Field( + ..., + description="Index price at which position will be liquidated", + title="liquidation_price", + ) + maintenance_margin: Decimal = Field( + ..., + description="USD maintenance margin requirement for this position", + title="maintenance_margin", + ) + mark_price: Decimal = Field( + ..., + description="Current mark price for position's instrument", + title="mark_price", + ) + mark_value: Decimal = Field( + ..., + description="USD value of the position; this represents how much USD can be recieved by fully closing the position at the current oracle price", + title="mark_value", + ) + theta: Decimal = Field(..., description="Asset theta (zero for non-options)", title="theta") + vega: Decimal = Field(..., description="Asset vega (zero for non-options)", title="vega") + + +class PublicStatisticsParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + currency: Optional[str] = Field(None, description="Currency for stats", title="currency") + end_time: Optional[int] = Field(None, description="End time for statistics in ms", title="end_time") + instrument_name: str = Field( + ..., + description="Instrument name or 'ALL', 'OPTION', 'PERP', 'SPOT'", + title="instrument_name", + ) + + +class PublicStatisticsResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + daily_fees: Decimal = Field(..., description="24h Fees", title="daily_fees") + daily_notional_volume: Decimal = Field(..., description="24h Notional volume", title="daily_notional_volume") + daily_premium_volume: Decimal = Field(..., description="24h Premium volume", title="daily_premium_volume") + daily_trades: int = Field(..., description="24h Trades", title="daily_trades") + open_interest: Decimal = Field(..., description="Open interest", title="open_interest") + total_fees: Decimal = Field(..., description="Total fees", title="total_fees") + total_notional_volume: Decimal = Field(..., description="Total notional volume", title="total_notional_volume") + total_premium_volume: Decimal = Field(..., description="Total premium volume", title="total_premium_volume") + total_trades: int = Field(..., description="Total trades", title="total_trades") + + +class PublicLoginParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + signature: str = Field( + ..., + description="Signature of the timestamp, signed with the wallet's private key or a session key", + title="signature", + ) + timestamp: str = Field( + ..., + description="Message that was signed, in the form of a timestamp in ms since Unix epoch", + title="timestamp", + ) + wallet: str = Field(..., description="Public key (wallet) of the account", title="wallet") + + +class PublicLoginResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: List[int] = Field( + ..., + description="List of subaccount IDs that have been authenticated", + title="result", + ) + + +class PrivateCancelParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + instrument_name: str = Field(..., title="instrument_name") + order_id: UUID = Field(..., title="order_id") + subaccount_id: int = Field(..., title="subaccount_id") + + +PrivateCancelResultSchema = OrderResponseSchema + + +class LegPricedSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + amount: Decimal = Field(..., description="Amount in units of the base", title="amount") + direction: Direction = Field(..., description="Leg direction", title="direction") + instrument_name: str = Field(..., description="Instrument name", title="instrument_name") + price: Decimal = Field(..., description="Leg price", title="price") + + +class PrivateExecuteQuoteResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + cancel_reason: CancelReason1 = Field(..., description="Cancel reason, if any", title="cancel_reason") + creation_timestamp: int = Field( + ..., + description="Creation timestamp in ms since Unix epoch", + title="creation_timestamp", + ) + direction: Direction = Field(..., description="Quote direction", title="direction") + fee: Decimal = Field(..., description="Fee paid for this quote (if executed)", title="fee") + fill_pct: Decimal = Field( + ..., + description="Percentage of the RFQ that this quote would fill, from 0 to 1.", + title="fill_pct", + ) + is_transfer: bool = Field( + ..., + description="Whether the order was generated through `private/transfer_position`", + title="is_transfer", + ) + label: str = Field(..., description="User-defined label, if any", title="label") + last_update_timestamp: int = Field( + ..., + description="Last update timestamp in ms since Unix epoch", + title="last_update_timestamp", + ) + legs: List[LegPricedSchema] = Field(..., description="Quote legs", title="legs") + legs_hash: str = Field( + ..., + description="Hash of the legs of the best quote to be signed by the taker.", + title="legs_hash", + ) + liquidity_role: LiquidityRole = Field(..., description="Liquidity role", title="liquidity_role") + max_fee: Decimal = Field(..., description="Signed max fee", title="max_fee") + mmp: bool = Field( + ..., + description="Whether the quote is tagged for market maker protections (default false)", + title="mmp", + ) + nonce: int = Field(..., description="Nonce", title="nonce") + quote_id: UUID = Field(..., description="Quote ID", title="quote_id") + rfq_filled_pct: Decimal = Field( + ..., + description="Total percentage of the RFQ that has already been filled after this execution, from 0 to 1.", + title="rfq_filled_pct", + ) + rfq_id: UUID = Field(..., description="RFQ ID", title="rfq_id") + signature: str = Field(..., description="Ethereum signature of the quote", title="signature") + signature_expiry_sec: int = Field(..., description="Unix timestamp in seconds", title="signature_expiry_sec") + signer: str = Field( + ..., + description="Owner wallet address or registered session key that signed the quote", + title="signer", + ) + status: Status1 = Field(..., description="Status", title="status") + subaccount_id: int = Field(..., description="Subaccount ID", title="subaccount_id") + tx_hash: Optional[str] = Field( + ..., + description="Blockchain transaction hash (only for executed quotes)", + title="tx_hash", + ) + tx_status: Optional[TxStatus] = Field( + ..., + description="Blockchain transaction status (only for executed quotes)", + title="tx_status", + ) + + +class Period(Enum): + field_60 = 60 + field_300 = 300 + field_900 = 900 + field_1800 = 1800 + field_3600 = 3600 + field_14400 = 14400 + field_28800 = 28800 + field_86400 = 86400 + field_604800 = 604800 + + +class PublicGetSpotFeedHistoryCandlesParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + currency: str = Field(..., description="Currency", title="currency") + end_timestamp: int = Field(..., description="End timestamp", title="end_timestamp") + period: Period = Field(..., description="Period", title="period") + start_timestamp: int = Field(..., description="Start timestamp", title="start_timestamp") + + +class SpotFeedHistoryCandlesResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + close_price: Decimal = Field(..., description="Close price", title="close_price") + high_price: Decimal = Field(..., description="High price", title="high_price") + low_price: Decimal = Field(..., description="Low price", title="low_price") + open_price: Decimal = Field(..., description="Open price", title="open_price") + price: Decimal = Field(..., description="Spot price", title="price") + timestamp: int = Field( + ..., + description="Timestamp of when the spot price was recored into the database", + title="timestamp", + ) + timestamp_bucket: int = Field( + ..., + description="Timestamp bucket; this value is regularly spaced out with `period` seconds between data points, missing values are forward-filled from earlier data where possible, if no earlier data is available, values are back-filled from the first observed data point", + title="timestamp_bucket", + ) + + +class PrivatePollRfqsParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + from_timestamp: int = Field( + 0, + description="Earliest `last_update_timestamp` to filter by (in ms since Unix epoch). If not provied, defaults to 0.", + title="from_timestamp", + ) + page: int = Field( + 1, + description="Page number of results to return (default 1, returns last if above `num_pages`)", + title="page", + ) + page_size: int = Field( + 100, + description="Number of results per page (default 100, max 1000)", + title="page_size", + ) + rfq_id: Optional[UUID] = Field(None, description="RFQ ID filter, if applicable", title="rfq_id") + rfq_subaccount_id: Optional[int] = Field( + None, + description="Filter returned RFQs by rfq requestor subaccount", + title="rfq_subaccount_id", + ) + status: Optional[Status1] = Field(None, description="RFQ status filter, if applicable", title="status") + subaccount_id: int = Field( + ..., + description="Subaccount ID for auth purposes, returned data will be scoped to this subaccount.", + title="subaccount_id", + ) + to_timestamp: int = Field( + 18446744073709552000, + description="Latest `last_update_timestamp` to filter by (in ms since Unix epoch). If not provied, defaults to returning all data up to current time.", + title="to_timestamp", + ) + + +class RFQResultPublicSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + cancel_reason: CancelReason1 = Field(..., description="Cancel reason, if any", title="cancel_reason") + creation_timestamp: int = Field( + ..., + description="Creation timestamp in ms since Unix epoch", + title="creation_timestamp", + ) + filled_direction: Optional[Direction] = Field( + ..., + description="Direction at which the RFQ was filled (only if filled)", + title="filled_direction", + ) + filled_pct: Decimal = Field( + ..., + description="Percentage of the RFQ that has been filled, from 0 to 1.", + title="filled_pct", + ) + last_update_timestamp: int = Field( + ..., + description="Last update timestamp in ms since Unix epoch", + title="last_update_timestamp", + ) + legs: List[LegUnpricedSchema] = Field(..., description="RFQ legs", title="legs") + partial_fill_step: Decimal = Field( + ..., + description="Step size for partial fills (default: 1)", + title="partial_fill_step", + ) + rfq_id: UUID = Field(..., description="RFQ ID", title="rfq_id") + status: Status1 = Field(..., description="Status", title="status") + subaccount_id: int = Field(..., description="Subaccount ID", title="subaccount_id") + total_cost: Optional[Decimal] = Field( + ..., description="Total cost for the RFQ (only if filled)", title="total_cost" + ) + valid_until: int = Field( + ..., + description="RFQ expiry timestamp in ms since Unix epoch", + title="valid_until", + ) + + +class PrivateGetLiquidationHistoryParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + end_timestamp: int = Field( + 9223372036854776000, + description="End timestamp of the event history (default current time)", + title="end_timestamp", + ) + start_timestamp: int = Field( + 0, + description="Start timestamp of the event history (default 0)", + title="start_timestamp", + ) + subaccount_id: int = Field(..., description="Subaccount id", title="subaccount_id") + + +class AuctionType(Enum): + solvent = "solvent" + insolvent = "insolvent" + + +class AuctionBidEventSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + amounts_liquidated: Dict[str, Decimal] = Field( + ..., + description="Amounts of each asset that were closed", + title="amounts_liquidated", + ) + cash_received: Decimal = Field( + ..., + description="Cash received by the subaccount for the liquidation. For the liquidated accounts this is the amount the liquidator paid to buy out the percentage of the portfolio. For the liquidator account, this is the amount they received from the security module (if positive) or the amount they paid for the bid (if negative)", + title="cash_received", + ) + discount_pnl: Decimal = Field( + ..., + description="Realized PnL due to liquidating or being liquidated at a discount to mark portfolio value", + title="discount_pnl", + ) + percent_liquidated: Decimal = Field( + ..., + description="Percent of the subaccount that was liquidated", + title="percent_liquidated", + ) + positions_realized_pnl: Dict[str, Decimal] = Field( + ..., + description="Realized PnL of each position that was closed", + title="positions_realized_pnl", + ) + positions_realized_pnl_excl_fees: Dict[str, Decimal] = Field( + ..., + description="Realized PnL of each position that was closed, excluding fees from total cost basis", + title="positions_realized_pnl_excl_fees", + ) + realized_pnl: Decimal = Field( + ..., + description="Realized PnL of the auction bid, assuming positions are closed at mark price at the time of the liquidation", + title="realized_pnl", + ) + realized_pnl_excl_fees: Decimal = Field( + ..., + description="Realized PnL of the auction bid, excluding fees from total cost basis, assuming positions are closed at mark price at the time of the liquidation", + title="realized_pnl_excl_fees", + ) + timestamp: int = Field( + ..., + description="Timestamp of the bid (in ms since UNIX epoch)", + title="timestamp", + ) + tx_hash: str = Field(..., description="Hash of the bid transaction", title="tx_hash") + + +class PrivateOrderDebugParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + amount: Decimal = Field(..., description="Order amount in units of the base", title="amount") + direction: Direction = Field(..., description="Order direction", title="direction") + instrument_name: str = Field(..., description="Instrument name", title="instrument_name") + is_atomic_signing: Optional[bool] = Field( + False, + description="Used by vaults to determine whether the signature is an EIP-1271 signature.", + title="is_atomic_signing", + ) + label: str = Field("", description="Optional user-defined label for the order", title="label") + limit_price: Decimal = Field( + ..., + description="Limit price in quote currency.
This field is still required for market orders because it is a component of the signature. However, market orders will not leave a resting order in the book in case of a partial fill.", + title="limit_price", + ) + max_fee: Decimal = Field( + ..., + description="Max fee per unit of volume, denominated in units of the quote currency (usually USDC).Order will be rejected if the supplied max fee is below the estimated fee for this order.", + title="max_fee", + ) + mmp: bool = Field( + False, + description="Whether the order is tagged for market maker protections (default false)", + title="mmp", + ) + nonce: int = Field( + ..., + description="Unique nonce defined as (e.g. 1695836058725001, where 001 is the random number).Note, using a random number beyond 3 digits will cause JSON serialization to fail.", + title="nonce", + ) + order_type: OrderType = Field( + "limit", + description="Order type:
- `limit`: limit order (default)
- `market`: market order, note that limit_price is still required for market orders, but unfilled order portion will be marked as cancelled", + title="order_type", + ) + reduce_only: bool = Field( + False, + description="If true, the order will not be able to increase position's size (default false). If the order amount exceeds available position size, the order will be filled up to the position size and the remainder will be cancelled. This flag is only supported for market orders or non-resting limit orders (IOC or FOK)", + title="reduce_only", + ) + referral_code: str = Field("", description="Optional referral code for the order", title="referral_code") + reject_timestamp: int = Field( + 9223372036854776000, + description="UTC timestamp in ms, if provided the matching engine will reject the order with an error if `reject_timestamp` < `server_time`. Note that the timestamp must be consistent with the server time: use `public/get_time` method to obtain current server time.", + title="reject_timestamp", + ) + signature: str = Field(..., description="Ethereum signature of the order", title="signature") + signature_expiry_sec: int = Field( + ..., + description="Unix timestamp in seconds. Order signature becomes invalid after this time, and the system will cancel the order.Expiry MUST be at least 5 min from now.", + title="signature_expiry_sec", + ) + signer: str = Field( + ..., + description="Owner wallet address or registered session key that signed order", + title="signer", + ) + subaccount_id: int = Field(..., description="Subaccount ID", title="subaccount_id") + time_in_force: TimeInForce = Field( + "gtc", + description="Time in force behaviour:
- `gtc`: good til cancelled (default)
- `post_only`: a limit order that will be rejected if it crosses any order in the book, i.e. acts as a taker order
- `fok`: fill or kill, will be rejected if it is not fully filled
- `ioc`: immediate or cancel, fill at best bid/ask (market) or at limit price (limit), the unfilled portion is cancelled
Note that the order will still expire on the `signature_expiry_sec` timestamp.", + title="time_in_force", + ) + trigger_price: Optional[Decimal] = Field( + None, + description='(Required for trigger orders) "index" or "mark" price to trigger order at', + title="trigger_price", + ) + trigger_price_type: Optional[TriggerPriceType] = Field( + None, + description='(Required for trigger orders) Trigger with "mark" price as "index" price type not supported yet.', + title="trigger_price_type", + ) + trigger_type: Optional[TriggerType] = Field( + None, + description='(Required for trigger orders) "stoploss" or "takeprofit"', + title="trigger_type", + ) + + +class TradeModuleDataSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + asset: str = Field(..., title="asset") + desired_amount: Decimal = Field(..., title="desired_amount") + is_bid: bool = Field(..., title="is_bid") + limit_price: Decimal = Field(..., title="limit_price") + recipient_id: int = Field(..., title="recipient_id") + sub_id: int = Field(..., title="sub_id") + trade_id: str = Field(..., title="trade_id") + worst_fee: Decimal = Field(..., title="worst_fee") + + +class PrivateDepositParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + amount: Decimal = Field(..., description="Amount of the asset to deposit", title="amount") + asset_name: str = Field(..., description="Name of asset to deposit", title="asset_name") + is_atomic_signing: bool = Field( + False, + description="Used by vaults to determine whether the signature is an EIP-1271 signature", + title="is_atomic_signing", + ) + nonce: int = Field( + ..., + description="Unique nonce defined as (e.g. 1695836058725001, where 001 is the random number)", + title="nonce", + ) + signature: str = Field(..., description="Ethereum signature of the deposit", title="signature") + signature_expiry_sec: int = Field( + ..., + description="Unix timestamp in seconds. Expiry MUST be >5min from now", + title="signature_expiry_sec", + ) + signer: str = Field( + ..., + description="Ethereum wallet address that is signing the deposit", + title="signer", + ) + subaccount_id: int = Field(..., description="Subaccount_id", title="subaccount_id") + + +class PrivateDepositResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + status: str = Field(..., description="`requested`", title="status") + transaction_id: UUID = Field(..., description="Transaction id of the deposit", title="transaction_id") + + +class PrivateUpdateNotificationsParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + notification_ids: List[int] = Field( + ..., + description="List of notification IDs to be marked as seen", + title="notification_ids", + ) + status: Status = Field("seen", description="Status of the notification", title="status") + subaccount_id: int = Field(..., description="Subaccount_id", title="subaccount_id") + + +class PrivateUpdateNotificationsResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + updated_count: int = Field(..., description="Number of notifications marked as seen", title="updated_count") + + +class PrivateChangeSubaccountLabelParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + label: str = Field(..., description="User defined label", title="label") + subaccount_id: int = Field(..., description="Subaccount_id", title="subaccount_id") + + +PrivateChangeSubaccountLabelResultSchema = PrivateChangeSubaccountLabelParamsSchema + + +class SignedQuoteParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + direction: Direction = Field( + ..., + description="Quote direction, `buy` means trading each leg at its direction, `sell` means trading each leg in the opposite direction.", + title="direction", + ) + legs: List[LegPricedSchema] = Field(..., description="Quote legs", title="legs") + max_fee: Decimal = Field( + ..., + description="Max fee ($ for the full trade). Request will be rejected if the supplied max fee is below the estimated fee for this trade.", + title="max_fee", + ) + nonce: int = Field( + ..., + description="Unique nonce defined as a concatenated `UTC timestamp in ms` and `random number up to 6 digits` (e.g. 1695836058725001, where 001 is the random number)", + title="nonce", + ) + signature: str = Field(..., description="Ethereum signature of the quote", title="signature") + signature_expiry_sec: int = Field( + ..., + description="Unix timestamp in seconds. Expiry MUST be at least 310 seconds from now. Once time till signature expiry reaches 300 seconds, the quote will be considered expired. This buffer is meant to ensure the trade can settle on chain in case of a blockchain congestion.", + title="signature_expiry_sec", + ) + signer: str = Field( + ..., + description="Owner wallet address or registered session key that signed the quote", + title="signer", + ) + subaccount_id: int = Field(..., description="Subaccount ID", title="subaccount_id") + + +class QuoteResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + cancel_reason: CancelReason1 = Field(..., description="Cancel reason, if any", title="cancel_reason") + creation_timestamp: int = Field( + ..., + description="Creation timestamp in ms since Unix epoch", + title="creation_timestamp", + ) + direction: Direction = Field(..., description="Quote direction", title="direction") + fee: Decimal = Field(..., description="Fee paid for this quote (if executed)", title="fee") + fill_pct: Decimal = Field( + ..., + description="Percentage of the RFQ that this quote would fill, from 0 to 1.", + title="fill_pct", + ) + is_transfer: bool = Field( + ..., + description="Whether the order was generated through `private/transfer_position`", + title="is_transfer", + ) + label: str = Field(..., description="User-defined label, if any", title="label") + last_update_timestamp: int = Field( + ..., + description="Last update timestamp in ms since Unix epoch", + title="last_update_timestamp", + ) + legs: List[LegPricedSchema] = Field(..., description="Quote legs", title="legs") + legs_hash: str = Field( + ..., + description="Hash of the legs of the best quote to be signed by the taker.", + title="legs_hash", + ) + liquidity_role: LiquidityRole = Field(..., description="Liquidity role", title="liquidity_role") + max_fee: Decimal = Field(..., description="Signed max fee", title="max_fee") + mmp: bool = Field( + ..., + description="Whether the quote is tagged for market maker protections (default false)", + title="mmp", + ) + nonce: int = Field(..., description="Nonce", title="nonce") + quote_id: UUID = Field(..., description="Quote ID", title="quote_id") + rfq_id: UUID = Field(..., description="RFQ ID", title="rfq_id") + signature: str = Field(..., description="Ethereum signature of the quote", title="signature") + signature_expiry_sec: int = Field(..., description="Unix timestamp in seconds", title="signature_expiry_sec") + signer: str = Field( + ..., + description="Owner wallet address or registered session key that signed the quote", + title="signer", + ) + status: Status1 = Field(..., description="Status", title="status") + subaccount_id: int = Field(..., description="Subaccount ID", title="subaccount_id") + tx_hash: Optional[str] = Field( + ..., + description="Blockchain transaction hash (only for executed quotes)", + title="tx_hash", + ) + tx_status: Optional[TxStatus] = Field( + ..., + description="Blockchain transaction status (only for executed quotes)", + title="tx_status", + ) + + +class PublicGetMakerProgramsParamsSchema(BaseModel): + pass + model_config = ConfigDict( + extra="forbid", + ) + + +class ProgramResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + asset_types: List[str] = Field( + ..., + description="List of asset types covered by the program", + title="asset_types", + ) + currencies: List[str] = Field(..., description="List of currencies covered by the program", title="currencies") + end_timestamp: int = Field(..., description="End timestamp of the epoch", title="end_timestamp") + min_notional: Decimal = Field( + ..., + description="Minimum dollar notional to quote for eligibility", + title="min_notional", + ) + name: str = Field(..., description="Name of the program", title="name") + rewards: Dict[str, Decimal] = Field( + ..., + description="Rewards for the program as a token -> total reward amount mapping", + title="rewards", + ) + start_timestamp: int = Field(..., description="Start timestamp of the epoch", title="start_timestamp") + + +class SimulatedCollateralSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + amount: Decimal = Field(..., description="Collateral amount to simulate", title="amount") + asset_name: str = Field( + ..., + description="Collateral ERC20 asset name (e.g. ETH, USDC, WSTETH)", + title="asset_name", + ) + + +class SimulatedPositionSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + amount: Decimal = Field(..., description="Position amount to simulate", title="amount") + entry_price: Optional[Decimal] = Field( + None, + description="Only for perps. Entry price to use in the simulation. Mark price is used if not provided.", + title="entry_price", + ) + instrument_name: str = Field(..., description="Instrument name", title="instrument_name") + + +class PublicGetMarginResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + is_valid_trade: bool = Field( + ..., + description="True if trade passes margin requirement", + title="is_valid_trade", + ) + post_initial_margin: Decimal = Field( + ..., + description="Initial margin requirement post trade", + title="post_initial_margin", + ) + post_maintenance_margin: Decimal = Field( + ..., + description="Maintenance margin requirement post trade", + title="post_maintenance_margin", + ) + pre_initial_margin: Decimal = Field( + ..., + description="Initial margin requirement before trade", + title="pre_initial_margin", + ) + pre_maintenance_margin: Decimal = Field( + ..., + description="Maintenance margin requirement before trade", + title="pre_maintenance_margin", + ) + subaccount_id: int = Field(..., description="Subaccount_id", title="subaccount_id") + + +class PrivateCancelByNonceParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + instrument_name: str = Field(..., description="Instrument name", title="instrument_name") + nonce: int = Field(..., description="Cancel an order with this nonce", title="nonce") + subaccount_id: int = Field(..., description="Subaccount ID", title="subaccount_id") + wallet: str = Field(..., description="Wallet address", title="wallet") + + +class PrivateCancelByNonceResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + cancelled_orders: int = Field(..., description="Number of cancelled orders", title="cancelled_orders") + + +class PublicGetSpotFeedHistoryParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + currency: str = Field(..., description="Currency", title="currency") + end_timestamp: int = Field(..., description="End timestamp", title="end_timestamp") + period: int = Field(..., description="Period", title="period") + start_timestamp: int = Field(..., description="Start timestamp", title="start_timestamp") + + +class SpotFeedHistoryResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + price: Decimal = Field(..., description="Spot price", title="price") + timestamp: int = Field( + ..., + description="Timestamp of when the spot price was recored into the database", + title="timestamp", + ) + timestamp_bucket: int = Field( + ..., + description="Timestamp bucket; this value is regularly spaced out with `period` seconds between data points, missing values are forward-filled from earlier data where possible, if no earlier data is available, values are back-filled from the first observed data point", + title="timestamp_bucket", + ) + + +class PrivateGetSubaccountsParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + wallet: str = Field(..., description="Ethereum wallet address of account", title="wallet") + + +class PrivateGetSubaccountsResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + subaccount_ids: List[int] = Field( + ..., + description="List of subaccount_ids owned by the wallet in `SubAccounts.sol`", + title="subaccount_ids", + ) + wallet: str = Field(..., description="Ethereum wallet address", title="wallet") + + +PrivateGetDepositHistoryParamsSchema = PrivateGetLiquidationHistoryParamsSchema + + +class DepositSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + amount: Decimal = Field(..., description="Amount deposited by the subaccount", title="amount") + asset: str = Field(..., description="Asset deposited", title="asset") + error_log: Optional[Dict[str, Any]] = Field(..., description="If failed, error log for reason", title="error_log") + timestamp: int = Field( + ..., + description="Timestamp of the deposit (in ms since UNIX epoch)", + title="timestamp", + ) + transaction_id: UUID = Field(..., description="Transaction ID", title="transaction_id") + tx_hash: str = Field( + ..., + description="Hash of the transaction that deposited the funds", + title="tx_hash", + ) + tx_status: TxStatus = Field( + ..., + description="Status of the transaction that deposited the funds", + title="tx_status", + ) + + +class PrivateCancelByLabelParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + instrument_name: Optional[str] = Field( + None, + description="Instrument name. If not provided, all orders for all instruments with the label will be cancelled. If provided, request counts as a regular matching request for ratelimit purposes.", + title="instrument_name", + ) + label: str = Field(..., description="Cancel all orders for this label", title="label") + subaccount_id: int = Field(..., description="Subaccount ID", title="subaccount_id") + + +PrivateCancelByLabelResultSchema = PrivateCancelByNonceResultSchema + + +class PrivateGetMarginParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + simulated_collateral_changes: Optional[List[SimulatedCollateralSchema]] = Field( + None, + description="Optional, add collaterals to simulate deposits / withdrawals / spot trades", + title="simulated_collateral_changes", + ) + simulated_position_changes: Optional[List[SimulatedPositionSchema]] = Field( + None, + description="Optional, add positions to simulate perp / option trades", + title="simulated_position_changes", + ) + subaccount_id: int = Field(..., description="Subaccount_id", title="subaccount_id") + + +PrivateGetMarginResultSchema = PublicGetMarginResultSchema + + +class PublicCreateSubaccountDebugParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + amount: Decimal = Field(..., description="Amount of the asset to deposit", title="amount") + asset_name: str = Field(..., description="Name of asset to deposit", title="asset_name") + currency: Optional[str] = Field( + None, + description="Base currency of the subaccount (only for `PM`)", + title="currency", + ) + margin_type: MarginType = Field( + ..., + description="`PM` (Portfolio Margin), `PM2 (Portfolio Margin 2), or `SM` (Standard Margin))", + title="margin_type", + ) + nonce: int = Field( + ..., + description="Unique nonce defined as (e.g. 1695836058725001, where 001 is the random number)", + title="nonce", + ) + signature_expiry_sec: int = Field( + ..., + description="Unix timestamp in seconds. Expiry MUST be >5min from now", + title="signature_expiry_sec", + ) + signer: str = Field( + ..., + description="Ethereum wallet address that is signing the deposit", + title="signer", + ) + wallet: str = Field(..., description="Ethereum wallet address", title="wallet") + + +class PublicCreateSubaccountDebugResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + action_hash: str = Field(..., description="Keccak hashed action data", title="action_hash") + encoded_data: str = Field(..., description="ABI encoded deposit data", title="encoded_data") + encoded_data_hashed: str = Field(..., description="Keccak hashed encoded_data", title="encoded_data_hashed") + typed_data_hash: str = Field(..., description="EIP 712 typed data hash", title="typed_data_hash") + + +class PublicGetInstrumentParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + instrument_name: str = Field(..., description="Instrument name", title="instrument_name") + + +class ERC20PublicDetailsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + borrow_index: Decimal = Field( + "1", + description="Latest borrow index as per `CashAsset.sol` implementation", + title="borrow_index", + ) + decimals: int = Field( + ..., + description="Number of decimals of the underlying on-chain ERC20 token", + title="decimals", + ) + supply_index: Decimal = Field( + "1", + description="Latest supply index as per `CashAsset.sol` implementation", + title="supply_index", + ) + underlying_erc20_address: str = Field( + "", + description="Address of underlying on-chain ERC20 (not V2 asset)", + title="underlying_erc20_address", + ) + + +class OptionType(Enum): + C = "C" + P = "P" + + +class OptionPublicDetailsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + expiry: int = Field(..., description="Unix timestamp of expiry date (in seconds)", title="expiry") + index: str = Field(..., description="Underlying settlement price index", title="index") + option_type: OptionType = Field(..., title="option_type") + settlement_price: Optional[Decimal] = Field( + None, description="Settlement price of the option", title="settlement_price" + ) + strike: Decimal = Field(..., title="strike") + + +class PerpPublicDetailsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + aggregate_funding: Decimal = Field( + ..., + description="Latest aggregated funding as per `PerpAsset.sol`", + title="aggregate_funding", + ) + funding_rate: Decimal = Field( + ..., + description="Current hourly funding rate as per `PerpAsset.sol`", + title="funding_rate", + ) + index: str = Field(..., description="Underlying spot price index for funding rate", title="index") + max_rate_per_hour: Decimal = Field( + ..., + description="Max rate per hour as per `PerpAsset.sol`", + title="max_rate_per_hour", + ) + min_rate_per_hour: Decimal = Field( + ..., + description="Min rate per hour as per `PerpAsset.sol`", + title="min_rate_per_hour", + ) + static_interest_rate: Decimal = Field( + ..., + description="Static interest rate as per `PerpAsset.sol`", + title="static_interest_rate", + ) + + +class PrivateEditSessionKeyParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + disable: bool = Field( + False, + description="Flag whether or not to disable to session key. Defaulted to false. Only allowed for non-admin keys. Admin keys must go through `/deregister_session_key` for now.", + title="disable", + ) + ip_whitelist: Optional[List[str]] = Field( + None, + description="Optional list of whitelisted IPs, an empty list can be supplied to whitelist all IPs", + title="ip_whitelist", + ) + label: Optional[str] = Field(None, description="Optional new label for the session key", title="label") + public_session_key: str = Field( + ..., + description="Session key in the form of an Ethereum EOA", + title="public_session_key", + ) + wallet: str = Field(..., description="Ethereum wallet address of account", title="wallet") + + +class PrivateEditSessionKeyResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + expiry_sec: int = Field(..., description="Session key expiry timestamp in sec", title="expiry_sec") + ip_whitelist: List[str] = Field( + ..., + description="List of whitelisted IPs, if empty then any IP is allowed.", + title="ip_whitelist", + ) + label: str = Field(..., description="User-defined session key label", title="label") + public_session_key: str = Field( + ..., + description="Public session key address (Ethereum EOA)", + title="public_session_key", + ) + scope: str = Field(..., description="Session key permission level scope", title="scope") + + +class PrivateGetLiquidatorHistoryParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + end_timestamp: int = Field( + 9223372036854776000, + description="End timestamp of the event history (default current time)", + title="end_timestamp", + ) + page: int = Field( + 1, + description="Page number of results to return (default 1, returns last if above `num_pages`)", + title="page", + ) + page_size: int = Field( + 100, + description="Number of results per page (default 100, max 1000)", + title="page_size", + ) + start_timestamp: int = Field( + 0, + description="Start timestamp of the event history (default 0)", + title="start_timestamp", + ) + subaccount_id: int = Field(..., description="Subaccount ID", title="subaccount_id") + + +class PrivateGetLiquidatorHistoryResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + bids: List[AuctionBidEventSchema] = Field(..., description="List of auction bid events", title="bids") + pagination: PaginationInfoSchema + + +class PrivateGetPositionsParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + subaccount_id: int = Field(..., description="Subaccount_id", title="subaccount_id") + + +class PositionResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + amount: Decimal = Field(..., description="Position amount held by subaccount", title="amount") + amount_step: Decimal = Field(..., description="Minimum amount step for the position", title="amount_step") + average_price: Decimal = Field(..., description="Average price of whole position", title="average_price") + average_price_excl_fees: Decimal = Field( + ..., + description="Average price of whole position excluding fees", + title="average_price_excl_fees", + ) + creation_timestamp: int = Field( + ..., + description="Timestamp of when the position was opened (in ms since Unix epoch)", + title="creation_timestamp", + ) + cumulative_funding: Decimal = Field( + ..., + description="Cumulative funding for the position (only for perpetuals).", + title="cumulative_funding", + ) + delta: Decimal = Field( + ..., + description="Asset delta (w.r.t. forward price for options, `1.0` for perps)", + title="delta", + ) + gamma: Decimal = Field(..., description="Asset gamma (zero for non-options)", title="gamma") + index_price: Decimal = Field( + ..., + description="Current index (oracle) price for position's currency", + title="index_price", + ) + initial_margin: Decimal = Field( + ..., + description="USD initial margin requirement for this position", + title="initial_margin", + ) + instrument_name: str = Field( + ..., + description="Instrument name (same as the base Asset name)", + title="instrument_name", + ) + instrument_type: InstrumentType = Field(..., description="`erc20`, `option`, or `perp`", title="instrument_type") + leverage: Optional[Decimal] = Field( + ..., + description="Only for perps. Leverage of the position, defined as `abs(notional) / collateral net of options margin`", + title="leverage", + ) + liquidation_price: Optional[Decimal] = Field( + ..., + description="Index price at which position will be liquidated", + title="liquidation_price", + ) + maintenance_margin: Decimal = Field( + ..., + description="USD maintenance margin requirement for this position", + title="maintenance_margin", + ) + mark_price: Decimal = Field( + ..., + description="Current mark price for position's instrument", + title="mark_price", + ) + mark_value: Decimal = Field( + ..., + description="USD value of the position; this represents how much USD can be recieved by fully closing the position at the current oracle price", + title="mark_value", + ) + net_settlements: Decimal = Field( + ..., + description="Net amount of USD from position settlements that has been paid to the user's subaccount. This number is subtracted from the portfolio value for margin calculations purposes.
Positive values mean the user has recieved USD from settlements, or is awaiting settlement of USD losses. Negative values mean the user has paid USD for settlements, or is awaiting settlement of USD gains.", + title="net_settlements", + ) + open_orders_margin: Decimal = Field( + ..., + description="USD margin requirement for all open orders for this asset / instrument", + title="open_orders_margin", + ) + pending_funding: Decimal = Field( + ..., + description="A portion of funding payments that has not yet been settled into cash balance (only for perpetuals). This number is added to the portfolio value for margin calculations purposes.", + title="pending_funding", + ) + realized_pnl: Decimal = Field( + ..., + description="Realized trading profit or loss of the position.", + title="realized_pnl", + ) + realized_pnl_excl_fees: Decimal = Field( + ..., + description="Realized trading profit or loss of the position excluding fees", + title="realized_pnl_excl_fees", + ) + theta: Decimal = Field(..., description="Asset theta (zero for non-options)", title="theta") + total_fees: Decimal = Field( + ..., + description="Total fees paid for opening and changing the position", + title="total_fees", + ) + unrealized_pnl: Decimal = Field( + ..., + description="Unrealized trading profit or loss of the position.", + title="unrealized_pnl", + ) + unrealized_pnl_excl_fees: Decimal = Field( + ..., + description="Unrealized trading profit or loss of the position excluding fees", + title="unrealized_pnl_excl_fees", + ) + vega: Decimal = Field(..., description="Asset vega (zero for non-options)", title="vega") + + +class TxStatus4(Enum): + settled = "settled" + reverted = "reverted" + timed_out = "timed_out" + + +class PublicGetTradeHistoryParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + currency: Optional[str] = Field(None, description="Currency to filter by (defaults to all)", title="currency") + from_timestamp: int = Field( + 0, + description="Earliest timestamp to filter by (in ms since Unix epoch). If not provied, defaults to 0.", + title="from_timestamp", + ) + instrument_name: Optional[str] = Field( + None, + description="Instrument name to filter by (defaults to all)", + title="instrument_name", + ) + instrument_type: Optional[InstrumentType] = Field( + None, + description="Instrument type to filter by (defaults to all)", + title="instrument_type", + ) + page: int = Field( + 1, + description="Page number of results to return (default 1, returns last if above `num_pages`)", + title="page", + ) + page_size: int = Field( + 100, + description="Number of results per page (default 100, max 1000)", + title="page_size", + ) + subaccount_id: Optional[int] = Field(None, description="Subaccount ID to filter by", title="subaccount_id") + to_timestamp: int = Field( + 18446744073709552000, + description="Latest timestamp to filter by (in ms since Unix epoch). If not provied, defaults to returning all data up to current time.", + title="to_timestamp", + ) + trade_id: Optional[UUID] = Field( + None, + description="Trade ID to filter by. If set, all other filters are ignored", + title="trade_id", + ) + tx_hash: Optional[str] = Field( + None, + description="On-chain tx hash to filter by. If set, all other filters are ignored", + title="tx_hash", + ) + tx_status: TxStatus4 = Field( + "settled", + description="Transaction status to filter by (default `settled`).", + title="tx_status", + ) + + +class TradeSettledPublicResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + direction: Direction = Field(..., description="Order direction", title="direction") + expected_rebate: Decimal = Field(..., description="Expected rebate for this trade", title="expected_rebate") + index_price: Decimal = Field( + ..., + description="Index price of the underlying at the time of the trade", + title="index_price", + ) + instrument_name: str = Field(..., description="Instrument name", title="instrument_name") + liquidity_role: LiquidityRole = Field(..., description="Role of the user in the trade", title="liquidity_role") + mark_price: Decimal = Field( + ..., + description="Mark price of the instrument at the time of the trade", + title="mark_price", + ) + quote_id: Optional[UUID] = Field(..., description="Quote ID if the trade was executed via RFQ", title="quote_id") + realized_pnl: Decimal = Field(..., description="Realized PnL for this trade", title="realized_pnl") + realized_pnl_excl_fees: Decimal = Field( + ..., + description="Realized PnL for this trade using cost accounting that excludes fees", + title="realized_pnl_excl_fees", + ) + subaccount_id: int = Field(..., description="Subaccount ID", title="subaccount_id") + timestamp: int = Field(..., description="Trade timestamp (in ms since Unix epoch)", title="timestamp") + trade_amount: Decimal = Field(..., description="Amount filled in this trade", title="trade_amount") + trade_fee: Decimal = Field(..., description="Fee for this trade", title="trade_fee") + trade_id: str = Field(..., description="Trade ID", title="trade_id") + trade_price: Decimal = Field(..., description="Price at which the trade was filled", title="trade_price") + tx_hash: str = Field(..., description="Blockchain transaction hash", title="tx_hash") + tx_status: TxStatus4 = Field(..., description="Blockchain transaction status", title="tx_status") + wallet: str = Field(..., description="Wallet address (owner) of the subaccount", title="wallet") + + +class PrivateGetRfqsParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + from_timestamp: int = Field( + 0, + description="Earliest `last_update_timestamp` to filter by (in ms since Unix epoch). If not provied, defaults to 0.", + title="from_timestamp", + ) + page: int = Field( + 1, + description="Page number of results to return (default 1, returns last if above `num_pages`)", + title="page", + ) + page_size: int = Field( + 100, + description="Number of results per page (default 100, max 1000)", + title="page_size", + ) + rfq_id: Optional[UUID] = Field(None, description="RFQ ID filter, if applicable", title="rfq_id") + status: Optional[Status1] = Field(None, description="RFQ status filter, if applicable", title="status") + subaccount_id: int = Field( + ..., + description="Subaccount ID for auth purposes, returned data will be scoped to this subaccount.", + title="subaccount_id", + ) + to_timestamp: int = Field( + 18446744073709552000, + description="Latest `last_update_timestamp` to filter by (in ms since Unix epoch). If not provied, defaults to returning all data up to current time.", + title="to_timestamp", + ) + + +RFQResultSchema = PrivateSendRfqResultSchema + + +class SignatureDetailsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + nonce: int = Field( + ..., + description="Unique nonce defined as (e.g. 1695836058725001, where 001 is the random number)", + title="nonce", + ) + signature: str = Field(..., description="Ethereum signature of the transfer", title="signature") + signature_expiry_sec: int = Field( + ..., + description="Unix timestamp in seconds. Expiry MUST be >5min from now", + title="signature_expiry_sec", + ) + signer: str = Field( + ..., + description="Ethereum wallet address that is signing the transfer", + title="signer", + ) + + +class TransferDetailsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + address: str = Field( + ..., + description="Ethereum address of the asset being transferred", + title="address", + ) + amount: Decimal = Field(..., description="Amount to transfer", title="amount") + sub_id: int = Field(..., description="Sub ID of the asset being transferred", title="sub_id") + + +class PrivateTransferErc20ResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + status: str = Field(..., description="`requested`", title="status") + transaction_id: UUID = Field(..., description="Transaction id of the transfer", title="transaction_id") + + +class PrivateSendQuoteParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + direction: Direction = Field( + ..., + description="Quote direction, `buy` means trading each leg at its direction, `sell` means trading each leg in the opposite direction.", + title="direction", + ) + label: str = Field("", description="Optional user-defined label for the quote", title="label") + legs: List[LegPricedSchema] = Field(..., description="Quote legs", title="legs") + max_fee: Decimal = Field( + ..., + description="Max fee ($ for the full trade). Request will be rejected if the supplied max fee is below the estimated fee for this trade.", + title="max_fee", + ) + mmp: bool = Field( + False, + description="Whether the quote is tagged for market maker protections (default false)", + title="mmp", + ) + nonce: int = Field( + ..., + description="Unique nonce defined as a concatenated `UTC timestamp in ms` and `random number up to 6 digits` (e.g. 1695836058725001, where 001 is the random number)", + title="nonce", + ) + rfq_id: UUID = Field(..., description="RFQ ID the quote is for", title="rfq_id") + signature: str = Field(..., description="Ethereum signature of the quote", title="signature") + signature_expiry_sec: int = Field( + ..., + description="Unix timestamp in seconds. Expiry MUST be at least 310 seconds from now. Once time till signature expiry reaches 300 seconds, the quote will be considered expired. This buffer is meant to ensure the trade can settle on chain in case of a blockchain congestion.", + title="signature_expiry_sec", + ) + signer: str = Field( + ..., + description="Owner wallet address or registered session key that signed the quote", + title="signer", + ) + subaccount_id: int = Field(..., description="Subaccount ID", title="subaccount_id") + + +PrivateSendQuoteResultSchema = QuoteResultSchema + + +class PrivateCancelTriggerOrderParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + order_id: UUID = Field(..., title="order_id") + subaccount_id: int = Field(..., title="subaccount_id") + + +PrivateCancelTriggerOrderResultSchema = OrderResponseSchema + + +PrivateGetWithdrawalHistoryParamsSchema = PrivateGetLiquidationHistoryParamsSchema + + +class WithdrawalSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + amount: Decimal = Field(..., description="Amount withdrawn by the subaccount", title="amount") + asset: str = Field(..., description="Asset withdrawn", title="asset") + error_log: Optional[Dict[str, Any]] = Field(..., description="If failed, error log for reason", title="error_log") + timestamp: int = Field( + ..., + description="Timestamp of the withdrawal (in ms since UNIX epoch)", + title="timestamp", + ) + tx_hash: str = Field( + ..., + description="Hash of the transaction that withdrew the funds", + title="tx_hash", + ) + tx_status: TxStatus = Field( + ..., + description="Status of the transaction that deposited the funds", + title="tx_status", + ) + + +class PublicGetOptionSettlementPricesParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + currency: str = Field(..., description="Currency for which to show expiries", title="currency") + + +class ExpiryResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + expiry_date: str = Field(..., description="Expiry date in `YYYYMMDD` format", title="expiry_date") + price: Optional[Decimal] = Field( + ..., + description="Settlement price will show None if not yet settled onchain", + title="price", + ) + utc_expiry_sec: int = Field(..., description="UTC timestamp of expiry", title="utc_expiry_sec") + + +class PublicGetMakerProgramScoresParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + epoch_start_timestamp: int = Field( + ..., + description="Start timestamp of the program epoch", + title="epoch_start_timestamp", + ) + program_name: str = Field(..., description="Program name", title="program_name") + + +class ScoreBreakdownSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + coverage_score: Decimal = Field( + ..., + description="Coverag component of the score of the account for this program", + title="coverage_score", + ) + holder_boost: Decimal = Field( + ..., + description="A custom account multiplier for the score due to holding tokens", + title="holder_boost", + ) + quality_score: Decimal = Field( + ..., + description="Quality component of the score of the account for this program", + title="quality_score", + ) + total_score: Decimal = Field( + ..., + description="Total score of the account for this program", + title="total_score", + ) + volume: Decimal = Field(..., description="Volume traded by the account for this epoch", title="volume") + volume_multiplier: Decimal = Field( + ..., + description="Multiplier for the volume traded by the account", + title="volume_multiplier", + ) + wallet: str = Field(..., description="Wallet address of the account", title="wallet") + + +class PublicBuildRegisterSessionKeyTxParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + expiry_sec: int = Field(..., description="Expiry of the session key", title="expiry_sec") + gas: Optional[int] = Field( + ..., + description="Gas allowance for transaction. If none, will use estimateGas * 150%", + title="gas", + ) + nonce: Optional[int] = Field( + ..., + description="Wallet's transaction count, If none, will use eth.getTransactionCount()", + title="nonce", + ) + public_session_key: str = Field( + ..., + description="Session key in the form of an Ethereum EOA", + title="public_session_key", + ) + wallet: str = Field(..., description="Ethereum wallet address of account", title="wallet") + + +class PublicBuildRegisterSessionKeyTxResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + tx_params: Dict[str, Any] = Field( + ..., + description="Transaction params in dictionary form, same as `TxParams` in `web3.py`", + title="tx_params", + ) + + +class PublicRegisterSessionKeyParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + expiry_sec: int = Field(..., description="Expiry of the session key", title="expiry_sec") + label: str = Field(..., description="Ethereum wallet address", title="label") + public_session_key: str = Field( + ..., + description="Session key in the form of an Ethereum EOA", + title="public_session_key", + ) + signed_raw_tx: str = Field( + ..., + description="A signed RLP encoded ETH transaction in form of a hex string (same as `w3.eth.account.sign_transaction(unsigned_tx, private_key).rawTransaction.hex()`)", + title="signed_raw_tx", + ) + wallet: str = Field(..., description="Ethereum wallet address of account", title="wallet") + + +class PublicRegisterSessionKeyResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + label: str = Field(..., description="User-defined session key label", title="label") + public_session_key: str = Field( + ..., + description="Session key in the form of an Ethereum EOA", + title="public_session_key", + ) + transaction_id: UUID = Field(..., description="ID to lookup status of transaction", title="transaction_id") + + +class PrivateGetOrderHistoryParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + page: int = Field( + 1, + description="Page number of results to return (default 1, returns last if above `num_pages`)", + title="page", + ) + page_size: int = Field( + 100, + description="Number of results per page (default 100, max 1000)", + title="page_size", + ) + subaccount_id: int = Field( + ..., + description="Subaccount_id for which to get order history", + title="subaccount_id", + ) + + +class PrivateGetOrderHistoryResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + orders: List[OrderResponseSchema] = Field(..., description="List of open orders", title="orders") + pagination: PaginationInfoSchema + subaccount_id: int = Field( + ..., + description="Subaccount_id for which to get open orders", + title="subaccount_id", + ) + + +class PrivateCancelRfqParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + rfq_id: UUID = Field(..., description="RFQ ID to cancel", title="rfq_id") + subaccount_id: int = Field(..., description="Subaccount ID", title="subaccount_id") + + +class Result(Enum): + ok = "ok" + + +class PrivateCancelRfqResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: Result = Field( + ..., + description="The result of this method call, `ok` if successful", + title="result", + ) + + +class PrivateCancelBatchRfqsParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + label: Optional[str] = Field(None, description="Cancel RFQs with this label", title="label") + nonce: Optional[int] = Field(None, description="Cancel RFQ with this nonce", title="nonce") + rfq_id: Optional[UUID] = Field(None, description="RFQ ID to cancel", title="rfq_id") + subaccount_id: int = Field(..., description="Subaccount ID", title="subaccount_id") + + +class PrivateCancelBatchRfqsResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + cancelled_ids: List[UUID] = Field(..., description="RFQ IDs of the cancelled RFQs", title="cancelled_ids") + + +class PrivateCancelBatchQuotesParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + label: Optional[str] = Field(None, description="Cancel quotes with this label", title="label") + nonce: Optional[int] = Field(None, description="Cancel quote with this nonce", title="nonce") + quote_id: Optional[UUID] = Field(None, description="Quote ID to cancel", title="quote_id") + rfq_id: Optional[UUID] = Field(None, description="Cancel quotes for this RFQ ID", title="rfq_id") + subaccount_id: int = Field(..., description="Subaccount ID", title="subaccount_id") + + +class PrivateCancelBatchQuotesResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + cancelled_ids: List[UUID] = Field(..., description="Quote IDs of the cancelled quotes", title="cancelled_ids") + + +PublicGetTimeParamsSchema = PublicGetMakerProgramsParamsSchema + + +class PublicGetTimeResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: int = Field(..., description="Current time in milliseconds since UNIX epoch", title="result") + + +class PrivateGetFundingHistoryParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + end_timestamp: int = Field( + 9223372036854776000, + description="End timestamp of the event history (default current time)", + title="end_timestamp", + ) + instrument_name: Optional[str] = Field( + None, + description="Instrument name (returns history for all perpetuals if not provided)", + title="instrument_name", + ) + page: int = Field( + 1, + description="Page number of results to return (default 1, returns last if above `num_pages`)", + title="page", + ) + page_size: int = Field( + 100, + description="Number of results per page (default 100, max 1000)", + title="page_size", + ) + start_timestamp: int = Field( + 0, + description="Start timestamp of the event history (default 0)", + title="start_timestamp", + ) + subaccount_id: int = Field(..., description="Subaccount id", title="subaccount_id") + + +class FundingPaymentSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + funding: Decimal = Field( + ..., + description="Dollar funding paid (if negative) or received (if positive) by the subaccount", + title="funding", + ) + instrument_name: str = Field(..., description="Instrument name", title="instrument_name") + pnl: Decimal = Field(..., description="Cashflow from the perp PnL settlement", title="pnl") + timestamp: int = Field( + ..., + description="Timestamp of the funding payment (in ms since UNIX epoch)", + title="timestamp", + ) + + +class PrivateGetOpenOrdersParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + subaccount_id: int = Field( + ..., + description="Subaccount_id for which to get open orders", + title="subaccount_id", + ) + + +class PrivateGetOpenOrdersResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + orders: List[OrderResponseSchema] = Field(..., description="List of open orders", title="orders") + subaccount_id: int = Field( + ..., + description="Subaccount_id for which to get open orders", + title="subaccount_id", + ) + + +PrivateGetAccountParamsSchema = PrivateGetSubaccountsParamsSchema + + +class AccountFeeInfoSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + base_fee_discount: Decimal = Field(..., description="Base fee discount", title="base_fee_discount") + option_maker_fee: Optional[Decimal] = Field( + ..., + description="Option maker fee - uses default instrument fee rate if None", + title="option_maker_fee", + ) + option_taker_fee: Optional[Decimal] = Field( + ..., + description="Option taker fee - uses default instrument fee rate if None", + title="option_taker_fee", + ) + perp_maker_fee: Optional[Decimal] = Field( + ..., + description="Perp maker fee - uses default instrument fee rate if None", + title="perp_maker_fee", + ) + perp_taker_fee: Optional[Decimal] = Field( + ..., + description="Perp taker fee - uses default instrument fee rate if None", + title="perp_taker_fee", + ) + rfq_maker_discount: Decimal = Field(..., description="RFQ maker fee discount", title="rfq_maker_discount") + rfq_taker_discount: Decimal = Field(..., description="RFQ taker fee discount", title="rfq_taker_discount") + spot_maker_fee: Optional[Decimal] = Field( + ..., + description="Spot maker fee - uses default instrument fee rate if None", + title="spot_maker_fee", + ) + spot_taker_fee: Optional[Decimal] = Field( + ..., + description="Spot taker fee - uses default instrument fee rate if None", + title="spot_taker_fee", + ) + + +class PublicGetAllInstrumentsParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + currency: Optional[str] = Field( + None, + description="Underlying currency of asset (`ETH`, `BTC`, etc)", + title="currency", + ) + expired: bool = Field(..., description="If `True`: include expired instruments.", title="expired") + instrument_type: InstrumentType = Field(..., description="`erc20`, `option`, or `perp`", title="instrument_type") + page: int = Field( + 1, + description="Page number of results to return (default 1, returns last if above `num_pages`)", + title="page", + ) + page_size: int = Field( + 100, + description="Number of results per page (default 100, max 1000)", + title="page_size", + ) + + +class InstrumentPublicResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + amount_step: Decimal = Field(..., description="Minimum valid increment of order amount", title="amount_step") + base_asset_address: str = Field( + ..., + description="Blockchain address of the base asset", + title="base_asset_address", + ) + base_asset_sub_id: str = Field( + ..., + description="Sub ID of the specific base asset as defined in Asset.sol", + title="base_asset_sub_id", + ) + base_currency: str = Field( + ..., + description="Underlying currency of base asset (`ETH`, `BTC`, etc)", + title="base_currency", + ) + base_fee: Decimal = Field(..., description="$ base fee added to every taker order", title="base_fee") + erc20_details: Optional[ERC20PublicDetailsSchema] = Field(...) + fifo_min_allocation: Decimal = Field( + ..., + description="Minimum number of contracts that get filled using FIFO. Actual number of contracts that gets filled by FIFO will be the max between this value and (1 - pro_rata_fraction) x order_amount, plus any size leftovers due to rounding.", + title="fifo_min_allocation", + ) + instrument_name: str = Field(..., description="Instrument name", title="instrument_name") + instrument_type: InstrumentType = Field(..., description="`erc20`, `option`, or `perp`", title="instrument_type") + is_active: bool = Field( + ..., + description="If `True`: instrument is tradeable within `activation` and `deactivation` timestamps", + title="is_active", + ) + maker_fee_rate: Decimal = Field( + ..., + description="Percent of spot price fee rate for makers", + title="maker_fee_rate", + ) + mark_price_fee_rate_cap: Optional[Decimal] = Field( + None, + description="Percent of option price fee cap, e.g. 12.5%, null if not applicable", + title="mark_price_fee_rate_cap", + ) + maximum_amount: Decimal = Field( + ..., + description="Maximum valid amount of contracts / tokens per trade", + title="maximum_amount", + ) + minimum_amount: Decimal = Field( + ..., + description="Minimum valid amount of contracts / tokens per trade", + title="minimum_amount", + ) + option_details: Optional[OptionPublicDetailsSchema] = Field(...) + perp_details: Optional[PerpPublicDetailsSchema] = Field(...) + pro_rata_amount_step: Decimal = Field( + ..., + description="Pro-rata fill share of every order is rounded down to be a multiple of this number. Leftovers of the order due to rounding are filled FIFO.", + title="pro_rata_amount_step", + ) + pro_rata_fraction: Decimal = Field( + ..., + description="Fraction of order that gets filled using pro-rata matching. If zero, the matching is full FIFO.", + title="pro_rata_fraction", + ) + quote_currency: str = Field( + ..., + description="Quote currency (`USD` for perps, `USDC` for options)", + title="quote_currency", + ) + scheduled_activation: int = Field( + ..., + description="Timestamp at which became or will become active (if applicable)", + title="scheduled_activation", + ) + scheduled_deactivation: int = Field( + ..., + description="Scheduled deactivation time for instrument (if applicable)", + title="scheduled_deactivation", + ) + taker_fee_rate: Decimal = Field( + ..., + description="Percent of spot price fee rate for takers", + title="taker_fee_rate", + ) + tick_size: Decimal = Field( + ..., + description="Tick size of the instrument, i.e. minimum price increment", + title="tick_size", + ) + + +PublicGetTickerParamsSchema = PublicGetInstrumentParamsSchema + + +class OptionPricingSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + ask_iv: Decimal = Field(..., description="Implied volatility of the current best ask", title="ask_iv") + bid_iv: Decimal = Field(..., description="Implied volatility of the current best bid", title="bid_iv") + delta: Decimal = Field(..., description="Delta of the option", title="delta") + discount_factor: Decimal = Field( + ..., + description="Discount factor used to calculate option premium", + title="discount_factor", + ) + forward_price: Decimal = Field( + ..., + description="Forward price used to calculate option premium", + title="forward_price", + ) + gamma: Decimal = Field(..., description="Gamma of the option", title="gamma") + iv: Decimal = Field(..., description="Implied volatility of the option", title="iv") + mark_price: Decimal = Field(..., description="Mark price of the option", title="mark_price") + rho: Decimal = Field(..., description="Rho of the option", title="rho") + theta: Decimal = Field(..., description="Theta of the option", title="theta") + vega: Decimal = Field(..., description="Vega of the option", title="vega") + + +class AggregateTradingStatsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + contract_volume: Decimal = Field( + ..., + description="Number of contracts traded during last 24 hours", + title="contract_volume", + ) + high: Decimal = Field(..., description="Highest trade price during last 24h", title="high") + low: Decimal = Field(..., description="Lowest trade price during last 24h", title="low") + num_trades: Decimal = Field(..., description="Number of trades during last 24h ", title="num_trades") + open_interest: Decimal = Field(..., description="Current total open interest", title="open_interest") + percent_change: Decimal = Field( + ..., + description="24-hour price change expressed as a percentage. Options: percent change in vol; Perps: percent change in mark price", + title="percent_change", + ) + usd_change: Decimal = Field(..., description="24-hour price change in USD.", title="usd_change") + + +class PublicGetVaultShareParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + from_timestamp_sec: int = Field(..., description="From timestamp in seconds", title="from_timestamp_sec") + page: int = Field( + 1, + description="Page number of results to return (default 1, returns last if above `num_pages`)", + title="page", + ) + page_size: int = Field( + 100, + description="Number of results per page (default 100, max 1000)", + title="page_size", + ) + to_timestamp_sec: int = Field(..., description="To timestamp in seconds", title="to_timestamp_sec") + vault_name: str = Field(..., description="Name of the vault", title="vault_name") + + +class VaultShareResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + base_value: Decimal = Field( + ..., + description="The value of the vault's token against the base currency. Ex: rswETHC vs rswETH", + title="base_value", + ) + block_number: int = Field(..., description="The Derive chain block number", title="block_number") + block_timestamp: int = Field( + ..., + description="Timestamp of the Derive chain block number", + title="block_timestamp", + ) + underlying_value: Optional[Decimal] = Field( + ..., + description="The value of the vault's token against the underlying currency. Ex: rswETHC vs ETH", + title="underlying_value", + ) + usd_value: Decimal = Field(..., description="The value of the vault's token against USD", title="usd_value") + + +PrivateGetCollateralsParamsSchema = PrivateGetPositionsParamsSchema + + +class CollateralResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + amount: Decimal = Field(..., description="Asset amount of given collateral", title="amount") + amount_step: Decimal = Field(..., description="Minimum amount step for the collateral", title="amount_step") + asset_name: str = Field(..., description="Asset name", title="asset_name") + asset_type: InstrumentType = Field( + ..., + description="Type of asset collateral (currently always `erc20`)", + title="asset_type", + ) + average_price: Decimal = Field( + ..., + description="Average price of the collateral, 0 for USDC.", + title="average_price", + ) + average_price_excl_fees: Decimal = Field( + ..., + description="Average price of whole position excluding fees", + title="average_price_excl_fees", + ) + creation_timestamp: int = Field( + ..., + description="Timestamp of when the position was opened (in ms since Unix epoch)", + title="creation_timestamp", + ) + cumulative_interest: Decimal = Field( + ..., + description="Cumulative interest earned on supplying collateral or paid for borrowing", + title="cumulative_interest", + ) + currency: str = Field( + ..., + description="Underlying currency of asset (`ETH`, `BTC`, etc)", + title="currency", + ) + delta: Decimal = Field(..., description="Asset delta w.r.t. the delta currency", title="delta") + delta_currency: str = Field( + ..., + description="Currency with respect to which delta is reported.For example, LRTs like WEETH have their delta reported in ETH", + title="delta_currency", + ) + initial_margin: Decimal = Field( + ..., + description="USD value of collateral that contributes to initial margin", + title="initial_margin", + ) + maintenance_margin: Decimal = Field( + ..., + description="USD value of collateral that contributes to maintenance margin", + title="maintenance_margin", + ) + mark_price: Decimal = Field(..., description="Current mark price of the asset", title="mark_price") + mark_value: Decimal = Field( + ..., + description="USD value of the collateral (amount * mark price)", + title="mark_value", + ) + open_orders_margin: Decimal = Field( + ..., + description="USD margin requirement for all open orders for this asset / instrument", + title="open_orders_margin", + ) + pending_interest: Decimal = Field( + ..., + description="Portion of interest that has not yet been settled on-chain. This number is added to the portfolio value for margin calculations purposes.", + title="pending_interest", + ) + realized_pnl: Decimal = Field( + ..., + description="Realized trading profit or loss of the collateral, 0 for USDC.", + title="realized_pnl", + ) + realized_pnl_excl_fees: Decimal = Field( + ..., + description="Realized trading profit or loss of the position excluding fees", + title="realized_pnl_excl_fees", + ) + total_fees: Decimal = Field( + ..., + description="Total fees paid for opening and changing the position", + title="total_fees", + ) + unrealized_pnl: Decimal = Field( + ..., + description="Unrealized trading profit or loss of the collateral, 0 for USDC.", + title="unrealized_pnl", + ) + unrealized_pnl_excl_fees: Decimal = Field( + ..., + description="Unrealized trading profit or loss of the position excluding fees", + title="unrealized_pnl_excl_fees", + ) + + +class Scope(Enum): + admin = "admin" + account = "account" + read_only = "read_only" + + +class PrivateRegisterScopedSessionKeyParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + expiry_sec: int = Field(..., description="Expiry of the session key", title="expiry_sec") + ip_whitelist: Optional[List[str]] = Field( + None, + description="List of whitelisted IPs, if empty then any IP is allowed.", + title="ip_whitelist", + ) + label: Optional[str] = Field(None, description="User-defined session key label", title="label") + public_session_key: str = Field( + ..., + description="Session key in the form of an Ethereum EOA", + title="public_session_key", + ) + scope: Scope = Field( + "read_only", + description="Scope of the session key. Defaults to READ_ONLY level permissions. ", + title="scope", + ) + signed_raw_tx: Optional[str] = Field( + None, + description="A signed RLP encoded ETH transaction in form of a hex string (same as `w3.eth.account.sign_transaction(unsigned_tx, private_key).rawTransaction.hex()`) Must be included if the scope is ADMIN.", + title="signed_raw_tx", + ) + wallet: str = Field(..., description="Ethereum wallet address of account", title="wallet") + + +class PrivateRegisterScopedSessionKeyResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + expiry_sec: int = Field(..., description="Session key expiry timestamp in sec", title="expiry_sec") + ip_whitelist: Optional[List[str]] = Field( + ..., + description="List of whitelisted IPs, if empty then any IP is allowed.", + title="ip_whitelist", + ) + label: Optional[str] = Field(..., description="User-defined session key label", title="label") + public_session_key: str = Field( + ..., + description="Session key in the form of an Ethereum EOA", + title="public_session_key", + ) + scope: Scope = Field(..., description="Session key permission level scope", title="scope") + transaction_id: Optional[UUID] = Field( + ..., + description="ID to lookup status of transaction if signed_raw_tx is provided", + title="transaction_id", + ) + + +class PrivateExpiredAndCancelledHistoryParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + end_timestamp: int = Field(..., description="End Unix timestamp", title="end_timestamp") + expiry: int = Field( + ..., + description="Expiry of download link in seconds. Maximum of 604800.", + title="expiry", + ) + start_timestamp: int = Field(..., description="Start Unix timestamp", title="start_timestamp") + subaccount_id: int = Field(..., description="Subaccount to download data for", title="subaccount_id") + wallet: str = Field(..., description="Wallet to download data for", title="wallet") + + +class PrivateExpiredAndCancelledHistoryResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + presigned_urls: List[str] = Field( + ..., + description="List of presigned URLs to the snapshots", + title="presigned_urls", + ) + + +PrivateSessionKeysParamsSchema = PrivateGetSubaccountsParamsSchema + + +SessionKeyResponseSchema = PrivateEditSessionKeyResultSchema + + +class PrivateGetMmpConfigParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + currency: Optional[str] = Field( + None, + description="Currency to get the config for. If not provided, returns all configs for the subaccount", + title="currency", + ) + subaccount_id: int = Field( + ..., + description="Subaccount_id for which to get the config", + title="subaccount_id", + ) + + +class MMPConfigResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + currency: str = Field(..., description="Currency of this mmp config", title="currency") + is_frozen: bool = Field(..., description="Whether the subaccount is currently frozen", title="is_frozen") + mmp_amount_limit: Decimal = Field( + "0", + description="Maximum total order amount that can be traded within the mmp_interval across all instruments of the provided currency. The amounts are not netted, so a filled bid of 1 and a filled ask of 2 would count as 3.
Default: 0 (no limit)", + title="mmp_amount_limit", + ) + mmp_delta_limit: Decimal = Field( + "0", + description="Maximum total delta that can be traded within the mmp_interval across all instruments of the provided currency. This quantity is netted, so a filled order with +1 delta and a filled order with -2 delta would count as -1
Default: 0 (no limit)", + title="mmp_delta_limit", + ) + mmp_frozen_time: int = Field( + ..., + description="Time interval in ms setting how long the subaccount is frozen after an mmp trigger, if 0 then a manual reset would be required via private/reset_mmp", + title="mmp_frozen_time", + ) + mmp_interval: int = Field( + ..., + description="Time interval in ms over which the limits are monotored, if 0 then mmp is disabled", + title="mmp_interval", + ) + mmp_unfreeze_time: int = Field( + ..., + description="Timestamp in ms after which the subaccount will be unfrozen", + title="mmp_unfreeze_time", + ) + subaccount_id: int = Field( + ..., + description="Subaccount_id for which to set the config", + title="subaccount_id", + ) + + +PrivateOrderParamsSchema = PrivateOrderDebugParamsSchema + + +class PrivateOrderResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + order: OrderResponseSchema + trades: List[TradeResponseSchema] = Field(..., title="trades") + + +PrivateGetSubaccountParamsSchema = PrivateGetPositionsParamsSchema + + +class PrivateGetSubaccountResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + collaterals: List[CollateralResponseSchema] = Field( + ..., + description="All collaterals that count towards margin of subaccount", + title="collaterals", + ) + collaterals_initial_margin: Decimal = Field( + ..., + description="Total initial margin credit contributed by collaterals", + title="collaterals_initial_margin", + ) + collaterals_maintenance_margin: Decimal = Field( + ..., + description="Total maintenance margin credit contributed by collaterals", + title="collaterals_maintenance_margin", + ) + collaterals_value: Decimal = Field( + ..., + description="Total mark-to-market value of all collaterals", + title="collaterals_value", + ) + currency: str = Field(..., description="Currency of subaccount", title="currency") + initial_margin: Decimal = Field( + ..., + description="Total initial margin requirement of all positions and collaterals.Trades will be rejected if this value falls below zero after the trade.", + title="initial_margin", + ) + is_under_liquidation: bool = Field( + ..., + description="Whether the subaccount is undergoing a liquidation auction", + title="is_under_liquidation", + ) + label: str = Field(..., description="User defined label", title="label") + maintenance_margin: Decimal = Field( + ..., + description="Total maintenance margin requirement of all positions and collaterals.If this value falls below zero, the subaccount will be flagged for liquidation.", + title="maintenance_margin", + ) + margin_type: MarginType = Field( + ..., + description="Margin type of subaccount (`PM` (Portfolio Margin), `PM2 (Portfolio Margin 2), or `SM` (Standard Margin))", + title="margin_type", + ) + open_orders: List[OrderResponseSchema] = Field( + ..., description="All open orders of subaccount", title="open_orders" + ) + open_orders_margin: Decimal = Field( + ..., + description="Total margin requirement of all open orders.Orders will be rejected if this value plus initial margin are below zero after the order.", + title="open_orders_margin", + ) + positions: List[PositionResponseSchema] = Field( + ..., description="All active positions of subaccount", title="positions" + ) + positions_initial_margin: Decimal = Field( + ..., + description="Total initial margin requirement of all positions", + title="positions_initial_margin", + ) + positions_maintenance_margin: Decimal = Field( + ..., + description="Total maintenance margin requirement of all positions", + title="positions_maintenance_margin", + ) + positions_value: Decimal = Field( + ..., + description="Total mark-to-market value of all positions", + title="positions_value", + ) + projected_margin_change: Decimal = Field( + ..., + description="Projected change in maintenance margin requirement between now and projected margin at 8:01 UTC. If this value plus current maintenance margin ise below zero, the account is at risk of being flagged for liquidation right after the upcoming expiry.", + title="projected_margin_change", + ) + subaccount_id: int = Field(..., description="Subaccount_id", title="subaccount_id") + subaccount_value: Decimal = Field( + ..., + description="Total mark-to-market value of all positions and collaterals", + title="subaccount_value", + ) + + +class PublicGetInterestRateHistoryParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + from_timestamp_sec: int = Field(..., description="From timestamp in seconds", title="from_timestamp_sec") + page: int = Field( + 1, + description="Page number of results to return (default 1, returns last if above `num_pages`)", + title="page", + ) + page_size: int = Field( + 100, + description="Number of results per page (default 100, max 1000)", + title="page_size", + ) + to_timestamp_sec: int = Field(..., description="To timestamp in seconds", title="to_timestamp_sec") + + +class InterestRateHistoryResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + block: int = Field(..., description="Derive Chain block number", title="block") + borrow_apy: Decimal = Field(..., description="Borrow APY", title="borrow_apy") + supply_apy: Decimal = Field(..., description="Supply APY", title="supply_apy") + timestamp_sec: int = Field(..., description="Timestamp in seconds", title="timestamp_sec") + total_borrow: Decimal = Field(..., description="Total USDC borrowed", title="total_borrow") + total_supply: Decimal = Field(..., description="Total USDC supplied", title="total_supply") + + +class PrivateGetAllPortfoliosParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + wallet: str = Field(..., description="Wallet address", title="wallet") + + +class PrivateGetAllPortfoliosResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: List[PrivateGetSubaccountResultSchema] = Field(..., description="", title="result") + + +class PublicGetLiquidationHistoryParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + end_timestamp: int = Field( + 9223372036854776000, + description="End timestamp of the event history (default current time)", + title="end_timestamp", + ) + page: int = Field( + 1, + description="Page number of results to return (default 1, returns last if above `num_pages`)", + title="page", + ) + page_size: int = Field( + 100, + description="Number of results per page (default 100, max 1000)", + title="page_size", + ) + start_timestamp: int = Field( + 0, + description="Start timestamp of the event history (default 0)", + title="start_timestamp", + ) + subaccount_id: Optional[int] = Field(None, description="(Optional) Subaccount ID", title="subaccount_id") + + +class PublicDepositDebugParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + amount: Decimal = Field(..., description="Amount of the asset to deposit", title="amount") + asset_name: str = Field(..., description="Name of asset to deposit", title="asset_name") + is_atomic_signing: bool = Field( + False, + description="Used by vaults to determine whether the signature is an EIP-1271 signature", + title="is_atomic_signing", + ) + nonce: int = Field( + ..., + description="Unique nonce defined as (e.g. 1695836058725001, where 001 is the random number)", + title="nonce", + ) + signature_expiry_sec: int = Field( + ..., + description="Unix timestamp in seconds. Expiry MUST be >5min from now", + title="signature_expiry_sec", + ) + signer: str = Field( + ..., + description="Ethereum wallet address that is signing the deposit", + title="signer", + ) + subaccount_id: int = Field(..., description="Subaccount_id", title="subaccount_id") + + +PublicDepositDebugResultSchema = PublicCreateSubaccountDebugResultSchema + + +class PublicGetVaultBalancesParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + smart_contract_owner: Optional[str] = Field( + None, + description="If wallet not provided, can query balances by EOA that owns smart contract wallet", + title="smart_contract_owner", + ) + wallet: Optional[str] = Field(None, description="Ethereum wallet address of smart contract", title="wallet") + + +class VaultBalanceResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + address: str = Field(..., title="address") + amount: Decimal = Field(..., title="amount") + chain_id: int = Field(..., title="chain_id") + name: str = Field(..., title="name") + vault_asset_type: str = Field(..., title="vault_asset_type") + + +class PublicGetReferralPerformanceParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + end_ms: int = Field(..., description="End timestamp in UTC milliseconds", title="end_ms") + referral_code: Optional[str] = Field(None, description="(Optional) referral code", title="referral_code") + start_ms: int = Field(..., description="Start timestamp in UTC milliseconds", title="start_ms") + wallet: Optional[str] = Field(None, description="(Optional) wallet of the referrer", title="wallet") + + +class ReferralPerformanceByInstrumentTypeSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + fee_reward: Decimal = Field(..., description="Fee reward to referrer", title="fee_reward") + notional_volume: Decimal = Field(..., description="Notional volume", title="notional_volume") + referred_fee: Decimal = Field(..., description="Fees paid by referred trader", title="referred_fee") + + +class PrivateSetCancelOnDisconnectParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + enabled: bool = Field( + ..., + description="Whether to enable or disable cancel on disconnect", + title="enabled", + ) + wallet: str = Field(..., description="Public key (wallet) of the account", title="wallet") + + +class PrivateSetCancelOnDisconnectResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: Result = Field(..., description="", title="result") + + +class PrivateCancelQuoteParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + quote_id: UUID = Field(..., description="Quote ID to cancel", title="quote_id") + subaccount_id: int = Field(..., description="Subaccount ID", title="subaccount_id") + + +PrivateCancelQuoteResultSchema = QuoteResultSchema + + +class PrivateGetQuotesParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + from_timestamp: int = Field( + 0, + description="Earliest timestamp to filter by (in ms since Unix epoch). If not provied, defaults to 0.", + title="from_timestamp", + ) + page: int = Field( + 1, + description="Page number of results to return (default 1, returns last if above `num_pages`)", + title="page", + ) + page_size: int = Field( + 100, + description="Number of results per page (default 100, max 1000)", + title="page_size", + ) + quote_id: Optional[UUID] = Field(None, description="Quote ID filter, if applicable", title="quote_id") + rfq_id: Optional[UUID] = Field(None, description="RFQ ID filter, if applicable", title="rfq_id") + status: Optional[Status1] = Field(None, description="Quote status filter, if applicable", title="status") + subaccount_id: int = Field( + ..., + description="Subaccount ID for auth purposes, returned data will be scoped to this subaccount.", + title="subaccount_id", + ) + to_timestamp: int = Field( + 18446744073709552000, + description="Latest timestamp to filter by (in ms since Unix epoch). If not provied, defaults to returning all data up to current time.", + title="to_timestamp", + ) + + +class PrivateGetQuotesResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + pagination: PaginationInfoSchema + quotes: List[QuoteResultSchema] = Field(..., description="Quotes matching filter criteria", title="quotes") + + +class PublicExecuteQuoteDebugParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + direction: Direction = Field( + ..., + description="Quote direction, `buy` means trading each leg at its direction, `sell` means trading each leg in the opposite direction.", + title="direction", + ) + enable_taker_protection: bool = Field( + False, + description="Whether taker protection is enabled for the quote", + title="enable_taker_protection", + ) + label: str = Field("", description="Optional user-defined label for the quote", title="label") + legs: List[LegPricedSchema] = Field(..., description="Quote legs", title="legs") + max_fee: Decimal = Field( + ..., + description="Max fee ($ for the full trade). Request will be rejected if the supplied max fee is below the estimated fee for this trade.", + title="max_fee", + ) + nonce: int = Field( + ..., + description="Unique nonce defined as a concatenated `UTC timestamp in ms` and `random number up to 6 digits` (e.g. 1695836058725001, where 001 is the random number)", + title="nonce", + ) + quote_id: UUID = Field(..., description="Quote ID to execute against", title="quote_id") + rfq_id: UUID = Field( + ..., + description="RFQ ID to execute (must be sent by `subaccount_id`)", + title="rfq_id", + ) + signature: str = Field(..., description="Ethereum signature of the quote", title="signature") + signature_expiry_sec: int = Field( + ..., + description="Unix timestamp in seconds. Expiry MUST be at least 310 seconds from now. Once time till signature expiry reaches 300 seconds, the quote will be considered expired. This buffer is meant to ensure the trade can settle on chain in case of a blockchain congestion.", + title="signature_expiry_sec", + ) + signer: str = Field( + ..., + description="Owner wallet address or registered session key that signed the quote", + title="signer", + ) + subaccount_id: int = Field(..., description="Subaccount ID", title="subaccount_id") + + +class PublicExecuteQuoteDebugResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + action_hash: str = Field(..., description="Keccak hashed action data", title="action_hash") + encoded_data: str = Field(..., description="ABI encoded deposit data", title="encoded_data") + encoded_data_hashed: str = Field(..., description="Keccak hashed encoded_data", title="encoded_data_hashed") + encoded_legs: str = Field(..., description="ABI encoded legs data", title="encoded_legs") + legs_hash: str = Field(..., description="Keccak hashed legs data", title="legs_hash") + typed_data_hash: str = Field(..., description="EIP 712 typed data hash", title="typed_data_hash") + + +class PrivateGetOptionSettlementHistoryParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + subaccount_id: int = Field( + ..., + description="Subaccount ID for which to get expired option settlement history", + title="subaccount_id", + ) + + +class OptionSettlementResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + amount: Decimal = Field(..., description="Amount that was settled", title="amount") + expiry: int = Field(..., description="Expiry timestamp of the option", title="expiry") + instrument_name: str = Field(..., description="Instrument name", title="instrument_name") + option_settlement_pnl: Decimal = Field( + ..., + description="USD profit or loss from option settlements calculated as: settlement value - (average cost including fees x amount)", + title="option_settlement_pnl", + ) + option_settlement_pnl_excl_fees: Decimal = Field( + ..., + description="USD profit or loss from option settlements calculated as: settlement value - (average price excluding fees x amount)", + title="option_settlement_pnl_excl_fees", + ) + settlement_price: Decimal = Field(..., description="Price of option settlement", title="settlement_price") + subaccount_id: int = Field(..., description="Subaccount ID of the settlement event", title="subaccount_id") + + +class PrivateResetMmpParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + currency: Optional[str] = Field( + None, + description="Currency to reset the mmp for. If not provided, resets all configs for the subaccount", + title="currency", + ) + subaccount_id: int = Field( + ..., + description="Subaccount_id for which to reset the mmp state", + title="subaccount_id", + ) + + +PrivateResetMmpResponseSchema = PrivateCancelRfqResponseSchema + + +PrivateGetErc20TransferHistoryParamsSchema = PrivateGetLiquidationHistoryParamsSchema + + +class ERC20TransferSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + amount: Decimal = Field(..., description="Amount withdrawn by the subaccount", title="amount") + asset: str = Field(..., description="Asset withdrawn", title="asset") + counterparty_subaccount_id: int = Field( + ..., + description="Recipient or sender subaccount_id of transfer", + title="counterparty_subaccount_id", + ) + is_outgoing: bool = Field( + ..., + description="True if the transfer was initiated by the subaccount, False otherwise", + title="is_outgoing", + ) + timestamp: int = Field( + ..., + description="Timestamp of the transfer (in ms since UNIX epoch)", + title="timestamp", + ) + tx_hash: str = Field( + ..., + description="Hash of the transaction that withdrew the funds", + title="tx_hash", + ) + + +PublicGetAllCurrenciesParamsSchema = PublicGetMakerProgramsParamsSchema + + +class CurrencyDetailedResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + asset_cap_and_supply_per_manager: Dict[str, Dict[str, List[OpenInterestStatsSchema]]] = Field( + ..., + description="Current open interest and open interest cap by manager and asset type", + title="asset_cap_and_supply_per_manager", + ) + borrow_apy: Decimal = Field(..., description="Borrow APY (only for USDC)", title="borrow_apy") + currency: str = Field( + ..., + description="Underlying currency of asset (`ETH`, `BTC`, etc)", + title="currency", + ) + erc20_details: Optional[Dict[str, Optional[str]]] = Field( + None, + description="Details of the erc20 asset (if applicable)", + title="erc20_details", + ) + instrument_types: List[InstrumentType] = Field( + ..., + description="Instrument types supported for the currency", + title="instrument_types", + ) + managers: List[ManagerContractResponseSchema] = Field( + ..., description="Managers supported for the currency", title="managers" + ) + market_type: MarketType = Field(..., description="Market type of the currency", title="market_type") + pm2_collateral_discounts: List[PM2CollateralDiscountsSchema] = Field( + ..., + description="Initial and Maintenance Margin discounts for given collateral in PM2", + title="pm2_collateral_discounts", + ) + protocol_asset_addresses: ProtocolAssetAddressesSchema + spot_price: Decimal = Field(..., description="Spot price of the currency", title="spot_price") + spot_price_24h: Optional[Decimal] = Field( + None, + description="Spot price of the currency 24 hours ago", + title="spot_price_24h", + ) + srm_im_discount: Decimal = Field( + ..., + description="Initial Margin discount for given collateral in Standard Manager (e.g. LTV). Only the Standard Manager supports non-USDC collateral", + title="srm_im_discount", + ) + srm_mm_discount: Decimal = Field( + ..., + description="Maintenance Margin discount for given collateral in Standard Manager (e.g. liquidation threshold). Only the Standard Manager supports non-USDC collateral", + title="srm_mm_discount", + ) + supply_apy: Decimal = Field(..., description="Supply APY (only for USDC)", title="supply_apy") + total_borrow: Decimal = Field( + ..., + description="Total collateral borrowed in the protocol (only USDC is borrowable)", + title="total_borrow", + ) + total_supply: Decimal = Field( + ..., + description="Total collateral supplied in the protocol", + title="total_supply", + ) + + +class PrivateGetSubaccountValueHistoryParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + end_timestamp: int = Field(..., description="End timestamp", title="end_timestamp") + period: int = Field(..., description="Period", title="period") + start_timestamp: int = Field(..., description="Start timestamp", title="start_timestamp") + subaccount_id: int = Field(..., description="Subaccount_id", title="subaccount_id") + + +class SubAccountValueHistoryResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + subaccount_value: Decimal = Field( + ..., + description="Total mark-to-market value of all positions and collaterals", + title="subaccount_value", + ) + timestamp: int = Field( + ..., + description="Timestamp of when the subaccount value was recorded into the database", + title="timestamp", + ) + + +PublicSendQuoteDebugParamsSchema = PrivateSendQuoteParamsSchema + + +PublicSendQuoteDebugResultSchema = PublicCreateSubaccountDebugResultSchema + + +PublicGetLiveIncidentsParamsSchema = PublicGetMakerProgramsParamsSchema + + +class MonitorType(Enum): + manual = "manual" + auto = "auto" + + +class Severity(Enum): + low = "low" + medium = "medium" + high = "high" + + +class IncidentResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + creation_timestamp_sec: int = Field( + ..., + description="Timestamp of incident in UTC sec", + title="creation_timestamp_sec", + ) + label: str = Field(..., description="Incident label", title="label") + message: str = Field(..., description="Incident message", title="message") + monitor_type: MonitorType = Field(..., description="Incident trigger type", title="monitor_type") + severity: Severity = Field(..., description="Incident severity", title="severity") + + +class PublicGetTransactionParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + transaction_id: UUID = Field( + ..., + description="transaction_id of the transaction to get", + title="transaction_id", + ) + + +class PublicGetTransactionResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + data: str = Field(..., description="Data used to create transaction", title="data") + error_log: Optional[str] = Field(..., description="Error log if failed tx", title="error_log") + status: TxStatus = Field(..., description="Status of the transaction", title="status") + transaction_hash: Optional[str] = Field( + ..., description="Transaction hash of a pending tx", title="transaction_hash" + ) + + +class PrivateGetOrdersParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + instrument_name: Optional[str] = Field(None, description="Filter by instrument name", title="instrument_name") + label: Optional[str] = Field(None, description="Filter by label", title="label") + page: int = Field( + 1, + description="Page number of results to return (default 1, returns last if above `num_pages`)", + title="page", + ) + page_size: int = Field( + 100, + description="Number of results per page (default 100, max 1000)", + title="page_size", + ) + status: Optional[OrderStatus] = Field(None, description="Filter by order status", title="status") + subaccount_id: int = Field( + ..., + description="Subaccount_id for which to get open orders", + title="subaccount_id", + ) + + +PrivateGetOrdersResultSchema = PrivateGetOrderHistoryResultSchema + + +PrivateGetInterestHistoryParamsSchema = PrivateGetLiquidationHistoryParamsSchema + + +class InterestPaymentSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + interest: Decimal = Field( + ..., + description="Dollar interest paid (if negative) or received (if positive) by the subaccount", + title="interest", + ) + timestamp: int = Field( + ..., + description="Timestamp of the interest payment (in ms since UNIX epoch)", + title="timestamp", + ) + + +PrivatePollQuotesParamsSchema = PrivateGetQuotesParamsSchema + + +class QuoteResultPublicSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + cancel_reason: CancelReason1 = Field(..., description="Cancel reason, if any", title="cancel_reason") + creation_timestamp: int = Field( + ..., + description="Creation timestamp in ms since Unix epoch", + title="creation_timestamp", + ) + direction: Direction = Field(..., description="Quote direction", title="direction") + fill_pct: Decimal = Field( + ..., + description="Percentage of the RFQ that this quote would fill, from 0 to 1.", + title="fill_pct", + ) + last_update_timestamp: int = Field( + ..., + description="Last update timestamp in ms since Unix epoch", + title="last_update_timestamp", + ) + legs: List[LegPricedSchema] = Field(..., description="Quote legs", title="legs") + legs_hash: str = Field( + ..., + description="Hash of the legs of the best quote to be signed by the taker.", + title="legs_hash", + ) + liquidity_role: LiquidityRole = Field(..., description="Liquidity role", title="liquidity_role") + quote_id: UUID = Field(..., description="Quote ID", title="quote_id") + rfq_id: UUID = Field(..., description="RFQ ID", title="rfq_id") + status: Status1 = Field(..., description="Status", title="status") + subaccount_id: int = Field(..., description="Subaccount ID", title="subaccount_id") + tx_hash: Optional[str] = Field( + ..., + description="Blockchain transaction hash (only for executed quotes)", + title="tx_hash", + ) + tx_status: Optional[TxStatus] = Field( + ..., + description="Blockchain transaction status (only for executed quotes)", + title="tx_status", + ) + wallet: str = Field(..., description="Wallet address of the quote sender", title="wallet") + + +class PrivateGetOrderParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + order_id: str = Field(..., description="Order ID", title="order_id") + subaccount_id: int = Field(..., description="Subaccount ID", title="subaccount_id") + + +PrivateGetOrderResultSchema = OrderResponseSchema + + +PublicGetVaultStatisticsParamsSchema = PublicGetMakerProgramsParamsSchema + + +class VaultStatisticsResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + base_value: Decimal = Field( + ..., + description="The value of the vault's token against the base currency. Ex: rswETHC vs rswETH", + title="base_value", + ) + block_number: int = Field(..., description="The Derive chain block number", title="block_number") + block_timestamp: int = Field( + ..., + description="Timestamp of the Derive chain block number", + title="block_timestamp", + ) + subaccount_value_at_last_trade: Optional[Decimal] = Field( + ..., + description="Will return None before vault creates subaccount or if no trades found.", + title="subaccount_value_at_last_trade", + ) + total_supply: Decimal = Field( + ..., + description="Total supply of the vault's token on Derive chain", + title="total_supply", + ) + underlying_value: Optional[Decimal] = Field( + ..., + description="The value of the vault's token against the underlying currency. Ex: rswETHC vs ETH", + title="underlying_value", + ) + usd_tvl: Decimal = Field(..., description="Total USD TVL of the vault", title="usd_tvl") + usd_value: Decimal = Field(..., description="The value of the vault's token against USD", title="usd_value") + vault_name: str = Field(..., description="Name of the vault", title="vault_name") + + +class PublicWithdrawDebugParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + amount: Decimal = Field(..., description="Amount of the asset to withdraw", title="amount") + asset_name: str = Field(..., description="Name of asset to withdraw", title="asset_name") + is_atomic_signing: bool = Field( + False, + description="Used by vaults to determine whether the signature is an EIP-1271 signature", + title="is_atomic_signing", + ) + nonce: int = Field( + ..., + description="Unique nonce defined as (e.g. 1695836058725001, where 001 is the random number)", + title="nonce", + ) + signature_expiry_sec: int = Field( + ..., + description="Unix timestamp in seconds. Expiry MUST be >5min from now", + title="signature_expiry_sec", + ) + signer: str = Field( + ..., + description="Ethereum wallet address that is signing the withdraw", + title="signer", + ) + subaccount_id: int = Field(..., description="Subaccount_id", title="subaccount_id") + + +PublicWithdrawDebugResultSchema = PublicCreateSubaccountDebugResultSchema + + +class Period1(Enum): + field_900 = 900 + field_3600 = 3600 + field_14400 = 14400 + field_28800 = 28800 + field_86400 = 86400 + + +class PublicGetFundingRateHistoryParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + end_timestamp: int = Field( + 9223372036854776000, + description="End timestamp of the event history (default current time)", + title="end_timestamp", + ) + instrument_name: str = Field( + ..., + description="Instrument name to return funding history for", + title="instrument_name", + ) + period: Period1 = Field(3600, description="Period of the funding rate", title="period") + start_timestamp: int = Field( + 0, + description="Start timestamp of the event history (default 0)", + title="start_timestamp", + ) + + +class FundingRateSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + funding_rate: Decimal = Field( + ..., + description="Hourly funding rate value at the event time", + title="funding_rate", + ) + timestamp: int = Field( + ..., + description="Timestamp of the funding rate update (in ms since UNIX epoch)", + title="timestamp", + ) + + +class PrivateRfqGetBestQuoteParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + counterparties: Optional[List[str]] = Field( + None, + description="Optional list of market maker account addresses to request quotes from. If not supplied, all market makers who are approved as RFQ makers will be notified.", + title="counterparties", + ) + direction: Direction = Field( + "buy", + description="Planned execution direction (default `buy`)", + title="direction", + ) + label: str = Field("", description="Optional user-defined label for the RFQ", title="label") + legs: List[LegUnpricedSchema] = Field(..., description="RFQ legs", title="legs") + max_total_cost: Optional[Decimal] = Field( + None, + description="An optional max total cost for the RFQ. Only used when the RFQ sender executes as buyer. Polling endpoints and channels will ignore quotes where the total cost across all legs is above this value. Positive values mean the RFQ sender expects to pay $, negative mean the RFQ sender expects to receive $.This field is not disclosed to the market makers.", + title="max_total_cost", + ) + min_total_cost: Optional[Decimal] = Field( + None, + description="An optional min total cost for the RFQ. Only used when the RFQ sender executes as seller. Polling endpoints and channels will ignore quotes where the total cost across all legs is below this value. Positive values mean the RFQ sender expects to receive $, negative mean the RFQ sender expects to pay $.This field is not disclosed to the market makers.", + title="min_total_cost", + ) + partial_fill_step: Decimal = Field( + "1", + description="Optional step size for partial fills. If not supplied, the RFQ will not support partial fills.", + title="partial_fill_step", + ) + rfq_id: Optional[UUID] = Field( + None, + description="RFQ ID to get best quote for. If not provided, will return estimates based on mark prices", + title="rfq_id", + ) + subaccount_id: int = Field(..., description="Subaccount ID", title="subaccount_id") + + +class InvalidReason(Enum): + Account_is_currently_under_maintenance_margin_requirements__trading_is_frozen_ = ( + "Account is currently under maintenance margin requirements, trading is frozen." + ) + This_order_would_cause_account_to_fall_under_maintenance_margin_requirements_ = ( + "This order would cause account to fall under maintenance margin requirements." + ) + Insufficient_buying_power__only_a_single_risk_reducing_open_order_is_allowed_ = ( + "Insufficient buying power, only a single risk-reducing open order is allowed." + ) + Insufficient_buying_power__consider_reducing_order_size_ = ( + "Insufficient buying power, consider reducing order size." + ) + Insufficient_buying_power__consider_reducing_order_size_or_canceling_other_orders_ = ( + "Insufficient buying power, consider reducing order size or canceling other orders." + ) + Consider_canceling_other_limit_orders_or_using_IOC__FOK__or_market_orders__This_order_is_risk_reducing__but_if_filled_with_other_open_orders__buying_power_might_be_insufficient_ = "Consider canceling other limit orders or using IOC, FOK, or market orders. This order is risk-reducing, but if filled with other open orders, buying power might be insufficient." + Insufficient_buying_power_ = "Insufficient buying power." + + +class PrivateRfqGetBestQuoteResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + best_quote: Optional[QuoteResultPublicSchema] = Field(...) + direction: Direction = Field(..., description="RFQ direction.", title="direction") + down_liquidation_price: Optional[Decimal] = Field( + ..., + description="Liquidation price if the trade were to be filled and the market moves down.", + title="down_liquidation_price", + ) + estimated_fee: Decimal = Field( + ..., + description="An estimate for how much the user will pay in fees ($ for the whole trade).", + title="estimated_fee", + ) + estimated_realized_pnl: Decimal = Field( + ..., + description="An estimate for the realized PnL of the trade.", + title="estimated_realized_pnl", + ) + estimated_realized_pnl_excl_fees: Decimal = Field( + ..., + description="An estimate for the realized PnL of the trade. with cost basis calculated without considering fees.", + title="estimated_realized_pnl_excl_fees", + ) + estimated_total_cost: Decimal = Field( + ..., + description="An estimate for the total $ cost of the trade.", + title="estimated_total_cost", + ) + filled_pct: Decimal = Field( + ..., + description="Percentage of the RFQ that has already been filled, from 0 to 1.", + title="filled_pct", + ) + invalid_reason: Optional[InvalidReason] = Field( + ..., + description="Reason for the RFQ being invalid, if any.", + title="invalid_reason", + ) + is_valid: bool = Field( + ..., + description="`True` if RFQ is expected to pass margin requirements.", + title="is_valid", + ) + orderbook_total_cost: Optional[Decimal] = Field( + ..., + description="Total cost of the RFQ if it were to be filled at current orderbook prices (same direction as the RFQ). If lower than `estimated_total_cost`, the user may want to use the orderbook instead of RFQs for this order. Will return null if any of the legs do not have orderbook data or enough liquidity for the full fill.", + title="orderbook_total_cost", + ) + post_initial_margin: Decimal = Field( + ..., + description="User's hypothetical margin balance if the trade were to get executed.", + title="post_initial_margin", + ) + post_liquidation_price: Optional[Decimal] = Field( + ..., + description="Liquidation price if the trade were to be filled. If both upside and downside liquidation prices exist, returns the closest one to the current index price.", + title="post_liquidation_price", + ) + pre_initial_margin: Decimal = Field( + ..., + description="User's initial margin balance before the trade.", + title="pre_initial_margin", + ) + suggested_max_fee: Decimal = Field( + ..., + description="Recommended value for `max_fee` of the trade.", + title="suggested_max_fee", + ) + up_liquidation_price: Optional[Decimal] = Field( + ..., + description="Liquidation price if the trade were to be filled and the market moves up.", + title="up_liquidation_price", + ) + + +class PublicGetInstrumentsParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + currency: str = Field( + ..., + description="Underlying currency of asset (`ETH`, `BTC`, etc)", + title="currency", + ) + expired: bool = Field( + ..., + description="If `True`: include expired assets. Note: will soon be capped up to only 1 week in the past.", + title="expired", + ) + instrument_type: InstrumentType = Field(..., description="`erc20`, `option`, or `perp`", title="instrument_type") + + +class PublicGetInstrumentsResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: List[InstrumentPublicResponseSchema] = Field(..., description="", title="result") + + +class PublicGetOptionSettlementHistoryParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + page: int = Field( + 1, + description="Page number of results to return (default 1, returns last if above `num_pages`)", + title="page", + ) + page_size: int = Field( + 100, + description="Number of results per page (default 100, max 1000)", + title="page_size", + ) + subaccount_id: Optional[int] = Field( + None, + description="Subaccount ID filter (defaults to all if not provided)", + title="subaccount_id", + ) + + +class PublicGetOptionSettlementHistoryResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + pagination: PaginationInfoSchema + settlements: List[OptionSettlementResponseSchema] = Field( + ..., description="List of expired option settlements", title="settlements" + ) + + +class PrivateLiquidateParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + cash_transfer: Decimal = Field( + ..., + description="Amount of cash to transfer to a newly created subaccount for bidding. Must be non-negative.", + title="cash_transfer", + ) + last_seen_trade_id: int = Field( + ..., + description="Last seen trade ID for account being liquidated. Not checked if set to 0.", + title="last_seen_trade_id", + ) + liquidated_subaccount_id: int = Field( + ..., + description="Subaccount ID of the account to be liquidated.", + title="liquidated_subaccount_id", + ) + nonce: int = Field( + ..., + description="Unique nonce defined as (e.g. 1695836058725001, where 001 is the random number)", + title="nonce", + ) + percent_bid: Decimal = Field( + ..., + description="Percent of the liquidated position to bid for. Will bid for the maximum possible percent of the position if set to 1", + title="percent_bid", + ) + price_limit: Decimal = Field( + ..., + description="Maximum amount of cash to be paid from bidder to liquidated account (supports negative amounts for insolvent auctions). Not checked if set to 0.", + title="price_limit", + ) + signature: str = Field(..., description="Ethereum signature of the order", title="signature") + signature_expiry_sec: int = Field( + ..., + description="Unix timestamp in seconds. Order signature becomes invalid after this time, and the system will cancel the order.Expiry MUST be at least 5 min from now.", + title="signature_expiry_sec", + ) + signer: str = Field( + ..., + description="Owner wallet address or registered session key that signed order", + title="signer", + ) + subaccount_id: int = Field( + ..., + description="Subaccount ID owned by wallet, that will be doing the bidding.", + title="subaccount_id", + ) + + +class PrivateLiquidateResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + estimated_bid_price: Decimal = Field( + ..., + description="Estimated bid price for this liquidation", + title="estimated_bid_price", + ) + estimated_discount_pnl: Decimal = Field( + ..., + description="Estimated profit (increase in the subaccount mark value) if the liquidation is successful.", + title="estimated_discount_pnl", + ) + estimated_percent_bid: Decimal = Field( + ..., + description="Estimated percent of account the bid will aquire", + title="estimated_percent_bid", + ) + transaction_id: UUID = Field( + ..., + description="The transaction id of the related settlement transaction", + title="transaction_id", + ) + + +class PrivateGetTradeHistoryParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + from_timestamp: int = Field( + 0, + description="Earliest timestamp to filter by (in ms since Unix epoch). If not provied, defaults to 0.", + title="from_timestamp", + ) + instrument_name: Optional[str] = Field(None, description="Instrument name to filter by", title="instrument_name") + order_id: Optional[str] = Field(None, description="Order id to filter by", title="order_id") + page: int = Field( + 1, + description="Page number of results to return (default 1, returns last if above `num_pages`)", + title="page", + ) + page_size: int = Field( + 100, + description="Number of results per page (default 100, max 1000)", + title="page_size", + ) + quote_id: Optional[str] = Field( + None, + description="If supplied, quote id to filter by. Supports either a concrete UUID, or `is_quote` and `is_not_quote` enum", + title="quote_id", + ) + subaccount_id: Optional[int] = Field( + None, + description="Subaccount_id (must be set if wallet is blank)", + title="subaccount_id", + ) + to_timestamp: int = Field( + 18446744073709552000, + description="Latest timestamp to filter by (in ms since Unix epoch). If not provied, defaults to returning all data up to current time.", + title="to_timestamp", + ) + wallet: Optional[str] = Field( + None, + description="Wallet address (if set, subaccount_id ignored)", + title="wallet", + ) + + +class PrivateGetTradeHistoryResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + pagination: PaginationInfoSchema + subaccount_id: int = Field( + ..., + description="Subaccount ID requested, or 0 if not provided", + title="subaccount_id", + ) + trades: List[TradeResponseSchema] = Field(..., description="List of trades", title="trades") + + +class PublicGetLatestSignedFeedsParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + currency: Optional[str] = Field( + None, + description="Currency filter, (defaults to all currencies)", + title="currency", + ) + expiry: Optional[int] = Field( + None, + description="Expiry filter for options and forward data (defaults to all expiries). Use `0` to get data only for spot and perpetuals", + title="expiry", + ) + + +class OracleSignatureDataSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + signatures: Optional[List[str]] = Field(None, description="The signatures of the given signers", title="signatures") + signers: Optional[List[str]] = Field(None, description="The signers who verify the data integrity", title="signers") + + +class Type(Enum): + P = "P" + A = "A" + B = "B" + + +class PerpFeedDataSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + confidence: Decimal = Field(..., description="The confidence score of the price", title="confidence") + currency: str = Field( + ..., + description="The currency for which the spot feed represents", + title="currency", + ) + deadline: int = Field( + ..., + description="The latest time the data can be submitted on chain", + title="deadline", + ) + signatures: OracleSignatureDataSchema + spot_diff_value: Decimal = Field( + ..., + description="The difference between the spot price and the perp price", + title="spot_diff_value", + ) + timestamp: int = Field( + ..., + description="The timestamp for which the data was created", + title="timestamp", + ) + type: Type = Field( + ..., + description="The type of perp feed; mid price, ask impact or bid impact", + title="type", + ) + + +class RateFeedDataSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + confidence: Decimal = Field(..., description="The confidence score of the rate", title="confidence") + currency: str = Field( + ..., + description="The currency for which the spot feed represents", + title="currency", + ) + deadline: int = Field( + ..., + description="The latest time the data can be submitted on chain", + title="deadline", + ) + expiry: int = Field(..., description="The expiry for the rate feed", title="expiry") + rate: Decimal = Field(..., description="The implied rate for the currency/expiry", title="rate") + signatures: OracleSignatureDataSchema + timestamp: int = Field( + ..., + description="The timestamp for which the data was created", + title="timestamp", + ) + + +class FeedSourceType(Enum): + S = "S" + O = "O" + + +class SpotFeedDataSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + confidence: Decimal = Field(..., description="The confidence score of the price", title="confidence") + currency: str = Field( + ..., + description="The currency for which the spot feed represents", + title="currency", + ) + deadline: int = Field( + ..., + description="The latest time the data can be submitted on chain", + title="deadline", + ) + feed_source_type: FeedSourceType = Field("S", description="The source of the feed", title="feed_source_type") + price: Decimal = Field(..., description="The price of the currency in USD", title="price") + signatures: OracleSignatureDataSchema + timestamp: int = Field( + ..., + description="The timestamp for which the data was created", + title="timestamp", + ) + + +class VolSVIParamDataSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + SVI_a: Decimal = Field(..., title="SVI_a") + SVI_b: Decimal = Field(..., title="SVI_b") + SVI_fwd: Decimal = Field(..., title="SVI_fwd") + SVI_m: Decimal = Field(..., title="SVI_m") + SVI_refTau: Decimal = Field(..., title="SVI_refTau") + SVI_rho: Decimal = Field(..., title="SVI_rho") + SVI_sigma: Decimal = Field(..., title="SVI_sigma") + + +class PrivateReplaceParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + amount: Decimal = Field(..., description="Order amount in units of the base", title="amount") + direction: Direction = Field(..., description="Order direction", title="direction") + expected_filled_amount: Optional[Decimal] = Field( + None, + description="Optional check to only create new order if old order filled_amount is equal to this value.", + title="expected_filled_amount", + ) + instrument_name: str = Field(..., description="Instrument name", title="instrument_name") + is_atomic_signing: Optional[bool] = Field( + False, + description="Used by vaults to determine whether the signature is an EIP-1271 signature.", + title="is_atomic_signing", + ) + label: str = Field("", description="Optional user-defined label for the order", title="label") + limit_price: Decimal = Field( + ..., + description="Limit price in quote currency.
This field is still required for market orders because it is a component of the signature. However, market orders will not leave a resting order in the book in case of a partial fill.", + title="limit_price", + ) + max_fee: Decimal = Field( + ..., + description="Max fee per unit of volume, denominated in units of the quote currency (usually USDC).Order will be rejected if the supplied max fee is below the estimated fee for this order.", + title="max_fee", + ) + mmp: bool = Field( + False, + description="Whether the order is tagged for market maker protections (default false)", + title="mmp", + ) + nonce: int = Field( + ..., + description="Unique nonce defined as (e.g. 1695836058725001, where 001 is the random number).Note, using a random number beyond 3 digits will cause JSON serialization to fail.", + title="nonce", + ) + nonce_to_cancel: Optional[int] = Field( + None, + description="Cancel order by nonce (choose either order_id or nonce).", + title="nonce_to_cancel", + ) + order_id_to_cancel: Optional[UUID] = Field( + None, + description="Cancel order by order_id (choose either order_id or nonce).", + title="order_id_to_cancel", + ) + order_type: OrderType = Field( + "limit", + description="Order type:
- `limit`: limit order (default)
- `market`: market order, note that limit_price is still required for market orders, but unfilled order portion will be marked as cancelled", + title="order_type", + ) + reduce_only: bool = Field( + False, + description="If true, the order will not be able to increase position's size (default false). If the order amount exceeds available position size, the order will be filled up to the position size and the remainder will be cancelled. This flag is only supported for market orders or non-resting limit orders (IOC or FOK)", + title="reduce_only", + ) + referral_code: str = Field("", description="Optional referral code for the order", title="referral_code") + reject_timestamp: int = Field( + 9223372036854776000, + description="UTC timestamp in ms, if provided the matching engine will reject the order with an error if `reject_timestamp` < `server_time`. Note that the timestamp must be consistent with the server time: use `public/get_time` method to obtain current server time.", + title="reject_timestamp", + ) + signature: str = Field(..., description="Ethereum signature of the order", title="signature") + signature_expiry_sec: int = Field( + ..., + description="Unix timestamp in seconds. Order signature becomes invalid after this time, and the system will cancel the order.Expiry MUST be at least 5 min from now.", + title="signature_expiry_sec", + ) + signer: str = Field( + ..., + description="Owner wallet address or registered session key that signed order", + title="signer", + ) + subaccount_id: int = Field(..., description="Subaccount ID", title="subaccount_id") + time_in_force: TimeInForce = Field( + "gtc", + description="Time in force behaviour:
- `gtc`: good til cancelled (default)
- `post_only`: a limit order that will be rejected if it crosses any order in the book, i.e. acts as a taker order
- `fok`: fill or kill, will be rejected if it is not fully filled
- `ioc`: immediate or cancel, fill at best bid/ask (market) or at limit price (limit), the unfilled portion is cancelled
Note that the order will still expire on the `signature_expiry_sec` timestamp.", + title="time_in_force", + ) + trigger_price: Optional[Decimal] = Field( + None, + description='(Required for trigger orders) "index" or "mark" price to trigger order at', + title="trigger_price", + ) + trigger_price_type: Optional[TriggerPriceType] = Field( + None, + description='(Required for trigger orders) Trigger with "mark" price as "index" price type not supported yet.', + title="trigger_price_type", + ) + trigger_type: Optional[TriggerType] = Field( + None, + description='(Required for trigger orders) "stoploss" or "takeprofit"', + title="trigger_type", + ) + + +class RPCErrorFormatSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + code: int = Field(..., title="code") + data: Optional[str] = Field(None, title="data") + message: str = Field(..., title="message") + + +class PrivateCancelByInstrumentParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + instrument_name: str = Field( + ..., + description="Cancel all orders for this instrument", + title="instrument_name", + ) + subaccount_id: int = Field(..., description="Subaccount ID", title="subaccount_id") + + +PrivateCancelByInstrumentResultSchema = PrivateCancelByNonceResultSchema + + +class PrivateCancelAllParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + subaccount_id: int = Field(..., title="subaccount_id") + + +PrivateCancelAllResponseSchema = PrivateSetCancelOnDisconnectResponseSchema + + +class PublicDeregisterSessionKeyParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + public_session_key: str = Field( + ..., + description="Session key in the form of an Ethereum EOA", + title="public_session_key", + ) + signed_raw_tx: str = Field( + ..., + description="A signed RLP encoded ETH transaction in form of a hex string (same as `w3.eth.account.sign_transaction(unsigned_tx, private_key).rawTransaction.hex()`)", + title="signed_raw_tx", + ) + wallet: str = Field(..., description="Ethereum wallet address of account", title="wallet") + + +class PublicDeregisterSessionKeyResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + public_session_key: str = Field( + ..., + description="Session key in the form of an Ethereum EOA", + title="public_session_key", + ) + transaction_id: UUID = Field(..., description="ID to lookup status of transaction", title="transaction_id") + + +class PrivateWithdrawParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + amount: Decimal = Field(..., description="Amount of the asset to withdraw", title="amount") + asset_name: str = Field(..., description="Name of asset to withdraw", title="asset_name") + is_atomic_signing: bool = Field( + False, + description="Used by vaults to determine whether the signature is an EIP-1271 signature", + title="is_atomic_signing", + ) + nonce: int = Field( + ..., + description="Unique nonce defined as (e.g. 1695836058725001, where 001 is the random number)", + title="nonce", + ) + signature: str = Field(..., description="Ethereum signature of the withdraw", title="signature") + signature_expiry_sec: int = Field( + ..., + description="Unix timestamp in seconds. Expiry MUST be >5min from now", + title="signature_expiry_sec", + ) + signer: str = Field( + ..., + description="Ethereum wallet address that is signing the withdraw", + title="signer", + ) + subaccount_id: int = Field(..., description="Subaccount_id", title="subaccount_id") + + +class PrivateWithdrawResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + status: str = Field(..., description="`requested`", title="status") + transaction_id: UUID = Field(..., description="Transaction id of the withdrawal", title="transaction_id") + + +class PrivateGetNotificationsResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + notifications: List[NotificationResponseSchema] = Field( + ..., description="Notification response", title="notifications" + ) + pagination: PaginationInfoSchema + + +PublicGetCurrencyResultSchema = CurrencyDetailedResponseSchema + + +class PrivateSetMmpConfigResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PrivateSetMmpConfigResultSchema + + +class PrivateTransferPositionParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + maker_params: TradeModuleParamsSchema + taker_params: TradeModuleParamsSchema + wallet: str = Field(..., description="Public key (wallet) of the account", title="wallet") + + +class PrivateTransferPositionResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + maker_order: OrderResponseSchema + maker_trade: TradeResponseSchema + taker_order: OrderResponseSchema + taker_trade: TradeResponseSchema + + +class PrivateCreateSubaccountResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PrivateCreateSubaccountResultSchema + + +class PrivateSendRfqParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + counterparties: Optional[List[str]] = Field( + None, + description="Optional list of market maker account addresses to request quotes from. If not supplied, all market makers who are approved as RFQ makers will be notified.", + title="counterparties", + ) + label: str = Field("", description="Optional user-defined label for the RFQ", title="label") + legs: List[LegUnpricedSchema] = Field(..., description="RFQ legs", title="legs") + max_total_cost: Optional[Decimal] = Field( + None, + description="An optional max total cost for the RFQ. Only used when the RFQ sender executes as buyer. Polling endpoints and channels will ignore quotes where the total cost across all legs is above this value. Positive values mean the RFQ sender expects to pay $, negative mean the RFQ sender expects to receive $.This field is not disclosed to the market makers.", + title="max_total_cost", + ) + min_total_cost: Optional[Decimal] = Field( + None, + description="An optional min total cost for the RFQ. Only used when the RFQ sender executes as seller. Polling endpoints and channels will ignore quotes where the total cost across all legs is below this value. Positive values mean the RFQ sender expects to receive $, negative mean the RFQ sender expects to pay $.This field is not disclosed to the market makers.", + title="min_total_cost", + ) + partial_fill_step: Decimal = Field( + "1", + description="Optional step size for partial fills. If not supplied, the RFQ will not support partial fills.", + title="partial_fill_step", + ) + subaccount_id: int = Field(..., description="Subaccount ID", title="subaccount_id") + + +class PrivateSendRfqResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PrivateSendRfqResultSchema + + +class PublicMarginWatchResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + collaterals: List[CollateralPublicResponseSchema] = Field( + ..., + description="All collaterals that count towards margin of subaccount", + title="collaterals", + ) + currency: str = Field(..., description="Currency of subaccount", title="currency") + initial_margin: Decimal = Field( + ..., + description="Total initial margin requirement of all positions and collaterals.", + title="initial_margin", + ) + maintenance_margin: Decimal = Field( + ..., + description="Total maintenance margin requirement of all positions and collaterals.If this value falls below zero, the subaccount will be flagged for liquidation.", + title="maintenance_margin", + ) + margin_type: MarginType = Field( + ..., + description="Margin type of subaccount (`PM` (Portfolio Margin), `PM2 (Portfolio Margin 2), or `SM` (Standard Margin))", + title="margin_type", + ) + positions: List[PositionPublicResponseSchema] = Field( + ..., description="All active positions of subaccount", title="positions" + ) + subaccount_id: int = Field(..., description="Subaccount_id", title="subaccount_id") + subaccount_value: Decimal = Field( + ..., + description="Total mark-to-market value of all positions and collaterals", + title="subaccount_value", + ) + valuation_timestamp: int = Field( + ..., + description="Timestamp (in seconds since epoch) of when margin and MtM were computed.", + title="valuation_timestamp", + ) + + +class PublicStatisticsResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PublicStatisticsResultSchema + + +class PrivateCancelResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PrivateCancelResultSchema + + +PrivateExecuteQuoteParamsSchema = PublicExecuteQuoteDebugParamsSchema + + +class PrivateExecuteQuoteResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PrivateExecuteQuoteResultSchema + + +class PublicGetSpotFeedHistoryCandlesResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + currency: str = Field(..., description="Currency", title="currency") + spot_feed_history: List[SpotFeedHistoryCandlesResponseSchema] = Field( + ..., description="Spot feed history candles", title="spot_feed_history" + ) + + +class PrivatePollRfqsResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + pagination: PaginationInfoSchema + rfqs: List[RFQResultPublicSchema] = Field(..., description="RFQs matching filter criteria", title="rfqs") + + +class AuctionResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + auction_id: str = Field(..., description="Unique ID of the auction", title="auction_id") + auction_type: AuctionType = Field(..., description="Type of auction", title="auction_type") + bids: List[AuctionBidEventSchema] = Field(..., description="List of auction bid events", title="bids") + end_timestamp: Optional[int] = Field( + ..., + description="Timestamp of the auction end (in ms since UNIX epoch), or `null` if not ended", + title="end_timestamp", + ) + fee: Decimal = Field(..., description="Fee paid by the subaccount", title="fee") + start_timestamp: int = Field( + ..., + description="Timestamp of the auction start (in ms since UNIX epoch)", + title="start_timestamp", + ) + subaccount_id: int = Field(..., description="Liquidated subaccount ID", title="subaccount_id") + tx_hash: str = Field( + ..., + description="Hash of the transaction that started the auction", + title="tx_hash", + ) + + +class SignedTradeOrderSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + data: TradeModuleDataSchema + expiry: int = Field(..., title="expiry") + is_atomic_signing: bool = Field(..., title="is_atomic_signing") + module: str = Field(..., title="module") + nonce: int = Field(..., title="nonce") + owner: str = Field(..., title="owner") + signature: str = Field(..., title="signature") + signer: str = Field(..., title="signer") + subaccount_id: int = Field(..., title="subaccount_id") + + +class PrivateDepositResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PrivateDepositResultSchema + + +class PrivateUpdateNotificationsResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PrivateUpdateNotificationsResultSchema + + +class PrivateChangeSubaccountLabelResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PrivateChangeSubaccountLabelResultSchema + + +class PrivateTransferPositionsParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + maker_params: SignedQuoteParamsSchema + taker_params: SignedQuoteParamsSchema + wallet: str = Field(..., description="Public key (wallet) of the account", title="wallet") + + +class PrivateTransferPositionsResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + maker_quote: QuoteResultSchema + taker_quote: QuoteResultSchema + + +class PublicGetMakerProgramsResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: List[ProgramResponseSchema] = Field(..., description="", title="result") + + +class PublicGetMarginParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + margin_type: MarginType = Field( + ..., + description="`PM` (Portfolio Margin), `PM2 (Portfolio Margin 2), or `SM` (Standard Margin))", + title="margin_type", + ) + market: Optional[str] = Field(None, description="Must be defined for Portfolio Margin", title="market") + simulated_collateral_changes: Optional[List[SimulatedCollateralSchema]] = Field( + None, + description="Optional, add collaterals to simulate deposits / withdrawals / spot trades", + title="simulated_collateral_changes", + ) + simulated_collaterals: List[SimulatedCollateralSchema] = Field( + ..., + description="List of collaterals in a simulated portfolio", + title="simulated_collaterals", + ) + simulated_position_changes: Optional[List[SimulatedPositionSchema]] = Field( + None, + description="Optional, add positions to simulate perp / option trades", + title="simulated_position_changes", + ) + simulated_positions: List[SimulatedPositionSchema] = Field( + ..., + description="List of positions in a simulated portfolio", + title="simulated_positions", + ) + + +class PublicGetMarginResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PublicGetMarginResultSchema + + +class PrivateCancelByNonceResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PrivateCancelByNonceResultSchema + + +class PublicGetSpotFeedHistoryResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + currency: str = Field(..., description="Currency", title="currency") + spot_feed_history: List[SpotFeedHistoryResponseSchema] = Field( + ..., description="Spot feed history", title="spot_feed_history" + ) + + +class PrivateGetSubaccountsResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PrivateGetSubaccountsResultSchema + + +class PrivateGetDepositHistoryResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + events: List[DepositSchema] = Field(..., description="List of deposit payments", title="events") + + +class PrivateCancelByLabelResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PrivateCancelByLabelResultSchema + + +class PrivateGetMarginResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PrivateGetMarginResultSchema + + +class PublicCreateSubaccountDebugResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PublicCreateSubaccountDebugResultSchema + + +PublicGetInstrumentResultSchema = InstrumentPublicResponseSchema + + +class PrivateEditSessionKeyResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PrivateEditSessionKeyResultSchema + + +class PrivateGetLiquidatorHistoryResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PrivateGetLiquidatorHistoryResultSchema + + +class PrivateGetPositionsResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + positions: List[PositionResponseSchema] = Field( + ..., description="All active positions of subaccount", title="positions" + ) + subaccount_id: int = Field(..., description="Subaccount_id", title="subaccount_id") + + +class PublicGetTradeHistoryResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + pagination: PaginationInfoSchema + trades: List[TradeSettledPublicResponseSchema] = Field(..., description="List of trades", title="trades") + + +class PrivateGetRfqsResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + pagination: PaginationInfoSchema + rfqs: List[RFQResultSchema] = Field(..., description="RFQs matching filter criteria", title="rfqs") + + +class PrivateTransferErc20ParamsSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + recipient_details: SignatureDetailsSchema + recipient_subaccount_id: int = Field( + ..., + description="Subaccount_id of the recipient", + title="recipient_subaccount_id", + ) + sender_details: SignatureDetailsSchema + subaccount_id: int = Field(..., description="Subaccount_id", title="subaccount_id") + transfer: TransferDetailsSchema + + +class PrivateTransferErc20ResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PrivateTransferErc20ResultSchema + + +class PrivateSendQuoteResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PrivateSendQuoteResultSchema + + +class PrivateCancelTriggerOrderResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PrivateCancelTriggerOrderResultSchema + + +class PrivateGetWithdrawalHistoryResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + events: List[WithdrawalSchema] = Field(..., description="List of withdrawals", title="events") + + +class PublicGetOptionSettlementPricesResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + expiries: List[ExpiryResponseSchema] = Field(..., description="List of expiry details", title="expiries") + + +class PublicGetMakerProgramScoresResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + program: ProgramResponseSchema + scores: List[ScoreBreakdownSchema] = Field( + ..., + description="Scores breakdown of the program by market maker", + title="scores", + ) + total_score: Decimal = Field( + ..., + description="Total score across all market makers for the epoch", + title="total_score", + ) + total_volume: Decimal = Field( + ..., + description="Total volume across all market makers for the epoch", + title="total_volume", + ) + + +class PublicBuildRegisterSessionKeyTxResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PublicBuildRegisterSessionKeyTxResultSchema + + +class PublicRegisterSessionKeyResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PublicRegisterSessionKeyResultSchema + + +class PrivateGetOrderHistoryResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PrivateGetOrderHistoryResultSchema + + +class PrivateCancelBatchRfqsResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PrivateCancelBatchRfqsResultSchema + + +class PrivateCancelBatchQuotesResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PrivateCancelBatchQuotesResultSchema + + +class PrivateGetFundingHistoryResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + events: List[FundingPaymentSchema] = Field(..., description="List of funding payments", title="events") + pagination: PaginationInfoSchema + + +class PrivateGetOpenOrdersResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PrivateGetOpenOrdersResultSchema + + +class PrivateGetAccountResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + cancel_on_disconnect: bool = Field( + ..., + description="Whether cancel on disconnect is enabled for the account", + title="cancel_on_disconnect", + ) + fee_info: AccountFeeInfoSchema + is_rfq_maker: bool = Field( + ..., + description="Whether account allowed to market make RFQs", + title="is_rfq_maker", + ) + per_endpoint_tps: Dict[str, Any] = Field( + ..., + description="If a particular endpoint has a different max TPS, it will be specified here", + title="per_endpoint_tps", + ) + referral_code: Optional[str] = Field( + None, + description="Referral code for the account (must register with broker program first)", + title="referral_code", + ) + subaccount_ids: List[int] = Field( + ..., + description="List of subaccount_ids owned by the wallet in `SubAccounts.sol`", + title="subaccount_ids", + ) + wallet: str = Field(..., description="Ethereum wallet address", title="wallet") + websocket_matching_tps: int = Field( + ..., + description="Max transactions per second for matching requests over websocket (see `Rate Limiting` in docs)", + title="websocket_matching_tps", + ) + websocket_non_matching_tps: int = Field( + ..., + description="Max transactions per second for non-matching requests over websocket (see `Rate Limiting` in docs)", + title="websocket_non_matching_tps", + ) + websocket_option_tps: int = Field( + ..., + description="Max transactions per second for EACH option instrument over websocket (see `Rate Limiting` in docs)", + title="websocket_option_tps", + ) + websocket_perp_tps: int = Field( + ..., + description="Max transactions per second for EACH perp instrument over websocket (see `Rate Limiting` in docs)", + title="websocket_perp_tps", + ) + + +class PublicGetAllInstrumentsResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + instruments: List[InstrumentPublicResponseSchema] = Field( + ..., description="List of instruments", title="instruments" + ) + pagination: PaginationInfoSchema + + +class PublicGetTickerResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + amount_step: Decimal = Field(..., description="Minimum valid increment of order amount", title="amount_step") + base_asset_address: str = Field( + ..., + description="Blockchain address of the base asset", + title="base_asset_address", + ) + base_asset_sub_id: str = Field( + ..., + description="Sub ID of the specific base asset as defined in Asset.sol", + title="base_asset_sub_id", + ) + base_currency: str = Field( + ..., + description="Underlying currency of base asset (`ETH`, `BTC`, etc)", + title="base_currency", + ) + base_fee: Decimal = Field(..., description="$ base fee added to every taker order", title="base_fee") + best_ask_amount: Decimal = Field( + ..., + description="Amount of contracts / tokens available at best ask price", + title="best_ask_amount", + ) + best_ask_price: Decimal = Field(..., description="Best ask price", title="best_ask_price") + best_bid_amount: Decimal = Field( + ..., + description="Amount of contracts / tokens available at best bid price", + title="best_bid_amount", + ) + best_bid_price: Decimal = Field(..., description="Best bid price", title="best_bid_price") + erc20_details: Optional[ERC20PublicDetailsSchema] = Field(...) + fifo_min_allocation: Decimal = Field( + ..., + description="Minimum number of contracts that get filled using FIFO. Actual number of contracts that gets filled by FIFO will be the max between this value and (1 - pro_rata_fraction) x order_amount, plus any size leftovers due to rounding.", + title="fifo_min_allocation", + ) + five_percent_ask_depth: Decimal = Field( + ..., + description="Total amount of contracts / tokens available at 5 percent above best ask price", + title="five_percent_ask_depth", + ) + five_percent_bid_depth: Decimal = Field( + ..., + description="Total amount of contracts / tokens available at 5 percent below best bid price", + title="five_percent_bid_depth", + ) + index_price: Decimal = Field(..., description="Index price", title="index_price") + instrument_name: str = Field(..., description="Instrument name", title="instrument_name") + instrument_type: InstrumentType = Field(..., description="`erc20`, `option`, or `perp`", title="instrument_type") + is_active: bool = Field( + ..., + description="If `True`: instrument is tradeable within `activation` and `deactivation` timestamps", + title="is_active", + ) + maker_fee_rate: Decimal = Field( + ..., + description="Percent of spot price fee rate for makers", + title="maker_fee_rate", + ) + mark_price: Decimal = Field(..., description="Mark price", title="mark_price") + mark_price_fee_rate_cap: Optional[Decimal] = Field( + None, + description="Percent of option price fee cap, e.g. 12.5%, null if not applicable", + title="mark_price_fee_rate_cap", + ) + max_price: Decimal = Field( + ..., + description="Maximum price at which an agressive buyer can be matched. Any portion of a market order that would execute above this price will be cancelled. A limit buy order with limit price above this value is treated as post only (i.e. it will be rejected if it would cross any existing resting order).", + title="max_price", + ) + maximum_amount: Decimal = Field( + ..., + description="Maximum valid amount of contracts / tokens per trade", + title="maximum_amount", + ) + min_price: Decimal = Field( + ..., + description="Minimum price at which an agressive seller can be matched. Any portion of a market order that would execute below this price will be cancelled. A limit sell order with limit price below this value is treated as post only (i.e. it will be rejected if it would cross any existing resting order).", + title="min_price", + ) + minimum_amount: Decimal = Field( + ..., + description="Minimum valid amount of contracts / tokens per trade", + title="minimum_amount", + ) + open_interest: Dict[str, List[OpenInterestStatsSchema]] = Field( + ..., + description="Margin type of subaccount (`PM` (Portfolio Margin), `PM2 (Portfolio Margin 2), or `SM` (Standard Margin)) -> (current open interest, open interest cap, manager currency)", + title="open_interest", + ) + option_details: Optional[OptionPublicDetailsSchema] = Field(...) + option_pricing: Optional[OptionPricingSchema] = Field(...) + perp_details: Optional[PerpPublicDetailsSchema] = Field(...) + pro_rata_amount_step: Decimal = Field( + ..., + description="Pro-rata fill share of every order is rounded down to be a multiple of this number. Leftovers of the order due to rounding are filled FIFO.", + title="pro_rata_amount_step", + ) + pro_rata_fraction: Decimal = Field( + ..., + description="Fraction of order that gets filled using pro-rata matching. If zero, the matching is full FIFO.", + title="pro_rata_fraction", + ) + quote_currency: str = Field( + ..., + description="Quote currency (`USD` for perps, `USDC` for options)", + title="quote_currency", + ) + scheduled_activation: int = Field( + ..., + description="Timestamp at which became or will become active (if applicable)", + title="scheduled_activation", + ) + scheduled_deactivation: int = Field( + ..., + description="Scheduled deactivation time for instrument (if applicable)", + title="scheduled_deactivation", + ) + stats: AggregateTradingStatsSchema + taker_fee_rate: Decimal = Field( + ..., + description="Percent of spot price fee rate for takers", + title="taker_fee_rate", + ) + tick_size: Decimal = Field( + ..., + description="Tick size of the instrument, i.e. minimum price increment", + title="tick_size", + ) + timestamp: int = Field(..., description="Timestamp of the ticker feed snapshot", title="timestamp") + + +class PublicGetVaultShareResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + pagination: PaginationInfoSchema + vault_shares: List[VaultShareResponseSchema] = Field( + ..., + description="List of vault history shares, recent first", + title="vault_shares", + ) + + +class PrivateGetCollateralsResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + collaterals: List[CollateralResponseSchema] = Field( + ..., + description="All collaterals that count towards margin of subaccount", + title="collaterals", + ) + subaccount_id: int = Field(..., description="Subaccount_id", title="subaccount_id") + + +class PrivateRegisterScopedSessionKeyResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PrivateRegisterScopedSessionKeyResultSchema + + +class PrivateExpiredAndCancelledHistoryResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PrivateExpiredAndCancelledHistoryResultSchema + + +class PrivateSessionKeysResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + public_session_keys: List[SessionKeyResponseSchema] = Field( + ..., + description="List of session keys (includes unactivated and expired keys)", + title="public_session_keys", + ) + + +class PrivateGetMmpConfigResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: List[MMPConfigResultSchema] = Field(..., description="", title="result") + + +class PrivateOrderResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PrivateOrderResultSchema + + +class PrivateGetSubaccountResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PrivateGetSubaccountResultSchema + + +class PublicGetInterestRateHistoryResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + interest_rates: List[InterestRateHistoryResponseSchema] = Field( + ..., description="List of interest rates, recent first", title="interest_rates" + ) + pagination: PaginationInfoSchema + + +class PublicGetLiquidationHistoryResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + auctions: List[AuctionResultSchema] = Field(..., description="List of auction results", title="auctions") + pagination: PaginationInfoSchema + + +class PublicDepositDebugResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PublicDepositDebugResultSchema + + +class PublicGetVaultBalancesResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: List[VaultBalanceResponseSchema] = Field(..., description="", title="result") + + +class PublicGetReferralPerformanceResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + fee_share_percentage: Decimal = Field( + ..., + description="Fee share percentage rewarded to referrer", + title="fee_share_percentage", + ) + referral_code: str = Field(..., description="Referral code used to get performance", title="referral_code") + rewards: Dict[str, Dict[str, Dict[str, ReferralPerformanceByInstrumentTypeSchema]]] = Field( + ..., + description="Performance by liquidity role / currency / instrument type", + title="rewards", + ) + stdrv_balance: Decimal = Field( + ..., + description="Staked DRV held used to determine fee share percentage", + title="stdrv_balance", + ) + total_fee_rewards: Decimal = Field(..., description="Total fee rewards to referrers", title="total_fee_rewards") + total_notional_volume: Decimal = Field( + ..., description="Total referred notional volume", title="total_notional_volume" + ) + total_referred_fees: Decimal = Field( + ..., + description="Total fees paid by referred traders (double counts if both taker and maker of a trade with rebated fees)", + title="total_referred_fees", + ) + + +class PrivateCancelQuoteResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PrivateCancelQuoteResultSchema + + +class PrivateGetQuotesResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PrivateGetQuotesResultSchema + + +class PublicExecuteQuoteDebugResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PublicExecuteQuoteDebugResultSchema + + +class PrivateGetOptionSettlementHistoryResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + settlements: List[OptionSettlementResponseSchema] = Field( + ..., description="List of expired option settlements", title="settlements" + ) + subaccount_id: int = Field( + ..., + description="Subaccount_id for which to get expired option settlement history", + title="subaccount_id", + ) + + +class PrivateGetErc20TransferHistoryResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + events: List[ERC20TransferSchema] = Field(..., description="List of erc20 transfers", title="events") + + +class PublicGetAllCurrenciesResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: List[CurrencyDetailedResponseSchema] = Field(..., description="", title="result") + + +class PrivateGetSubaccountValueHistoryResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + subaccount_id: int = Field(..., description="Subaccount_id", title="subaccount_id") + subaccount_value_history: List[SubAccountValueHistoryResponseSchema] = Field( + ..., description="Subaccount value history", title="subaccount_value_history" + ) + + +class PublicSendQuoteDebugResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PublicSendQuoteDebugResultSchema + + +class PublicGetLiveIncidentsResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + incidents: List[IncidentResponseSchema] = Field(..., description="List of ongoing incidents", title="incidents") + + +class PublicGetTransactionResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PublicGetTransactionResultSchema + + +class PrivateGetOrdersResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PrivateGetOrdersResultSchema + + +class PrivateGetInterestHistoryResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + events: List[InterestPaymentSchema] = Field(..., description="List of interest payments", title="events") + + +class PrivatePollQuotesResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + pagination: PaginationInfoSchema + quotes: List[QuoteResultPublicSchema] = Field(..., description="Quotes matching filter criteria", title="quotes") + + +class PrivateGetOrderResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PrivateGetOrderResultSchema + + +class PublicGetVaultStatisticsResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: List[VaultStatisticsResponseSchema] = Field(..., description="", title="result") + + +class PublicWithdrawDebugResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PublicWithdrawDebugResultSchema + + +class PublicGetFundingRateHistoryResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + funding_rate_history: List[FundingRateSchema] = Field( + ..., description="List of funding rates", title="funding_rate_history" + ) + + +class PrivateRfqGetBestQuoteResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PrivateRfqGetBestQuoteResultSchema + + +class PublicGetOptionSettlementHistoryResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PublicGetOptionSettlementHistoryResultSchema + + +class PrivateLiquidateResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PrivateLiquidateResultSchema + + +class PrivateGetTradeHistoryResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PrivateGetTradeHistoryResultSchema + + +class ForwardFeedDataSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + confidence: Decimal = Field(..., description="The confidence score of the price", title="confidence") + currency: str = Field( + ..., + description="The currency for which the spot feed represents", + title="currency", + ) + deadline: int = Field( + ..., + description="The latest time the data can be submitted on chain", + title="deadline", + ) + expiry: int = Field(..., description="The expiry for the forward feed", title="expiry") + fwd_diff: Decimal = Field( + ..., + description="difference of forward price from current spot price", + title="fwd_diff", + ) + signatures: OracleSignatureDataSchema + spot_aggregate_latest: Decimal = Field( + ..., + description="expiry -> spot * time value at the latest timestamp", + title="spot_aggregate_latest", + ) + spot_aggregate_start: Decimal = Field( + ..., + description="spot * time value at the start of the settlement period", + title="spot_aggregate_start", + ) + timestamp: int = Field( + ..., + description="The timestamp for which the data was created", + title="timestamp", + ) + + +class VolFeedDataSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + confidence: Decimal = Field(..., description="The confidence score of the price", title="confidence") + currency: str = Field( + ..., + description="The currency for which the spot feed represents", + title="currency", + ) + deadline: int = Field( + ..., + description="The latest time the data can be submitted on chain", + title="deadline", + ) + expiry: int = Field(..., description="The expiry for the options for the vol feed", title="expiry") + signatures: OracleSignatureDataSchema + timestamp: int = Field( + ..., + description="The timestamp for which the data was created", + title="timestamp", + ) + vol_data: VolSVIParamDataSchema + + +class PrivateReplaceResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + cancelled_order: OrderResponseSchema + create_order_error: Optional[RPCErrorFormatSchema] = None + order: Optional[OrderResponseSchema] = None + trades: Optional[List[TradeResponseSchema]] = Field( + None, description="List of trades executed by the created order", title="trades" + ) + + +class PrivateCancelByInstrumentResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PrivateCancelByInstrumentResultSchema + + +class PublicDeregisterSessionKeyResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PublicDeregisterSessionKeyResultSchema + + +class PrivateWithdrawResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PrivateWithdrawResultSchema + + +class PrivateGetNotificationsResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PrivateGetNotificationsResultSchema + + +class PublicGetCurrencyResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PublicGetCurrencyResultSchema + + +class PrivateTransferPositionResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PrivateTransferPositionResultSchema + + +class PublicMarginWatchResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PublicMarginWatchResultSchema + + +class PublicGetSpotFeedHistoryCandlesResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PublicGetSpotFeedHistoryCandlesResultSchema + + +class PrivatePollRfqsResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PrivatePollRfqsResultSchema + + +class PrivateGetLiquidationHistoryResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: List[AuctionResultSchema] = Field(..., description="", title="result") + + +class PrivateOrderDebugResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + action_hash: str = Field(..., description="Keccak hashed action data", title="action_hash") + encoded_data: str = Field(..., description="ABI encoded order data", title="encoded_data") + encoded_data_hashed: str = Field(..., description="Keccak hashed encoded_data", title="encoded_data_hashed") + raw_data: SignedTradeOrderSchema + typed_data_hash: str = Field(..., description="EIP 712 typed data hash", title="typed_data_hash") + + +class PrivateTransferPositionsResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PrivateTransferPositionsResultSchema + + +class PublicGetSpotFeedHistoryResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PublicGetSpotFeedHistoryResultSchema + + +class PrivateGetDepositHistoryResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PrivateGetDepositHistoryResultSchema + + +class PublicGetInstrumentResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PublicGetInstrumentResultSchema + + +class PrivateGetPositionsResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PrivateGetPositionsResultSchema + + +class PublicGetTradeHistoryResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PublicGetTradeHistoryResultSchema + + +class PrivateGetRfqsResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PrivateGetRfqsResultSchema + + +class PrivateGetWithdrawalHistoryResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PrivateGetWithdrawalHistoryResultSchema + + +class PublicGetOptionSettlementPricesResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PublicGetOptionSettlementPricesResultSchema + + +class PublicGetMakerProgramScoresResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PublicGetMakerProgramScoresResultSchema + + +class PrivateGetFundingHistoryResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PrivateGetFundingHistoryResultSchema + + +class PrivateGetAccountResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PrivateGetAccountResultSchema + + +class PublicGetAllInstrumentsResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PublicGetAllInstrumentsResultSchema + + +class PublicGetTickerResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PublicGetTickerResultSchema + + +class PublicGetVaultShareResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PublicGetVaultShareResultSchema + + +class PrivateGetCollateralsResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PrivateGetCollateralsResultSchema + + +class PrivateSessionKeysResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PrivateSessionKeysResultSchema + + +class PublicGetInterestRateHistoryResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PublicGetInterestRateHistoryResultSchema + + +class PublicGetLiquidationHistoryResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PublicGetLiquidationHistoryResultSchema + + +class PublicGetReferralPerformanceResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PublicGetReferralPerformanceResultSchema + + +class PrivateGetOptionSettlementHistoryResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PrivateGetOptionSettlementHistoryResultSchema + + +class PrivateGetErc20TransferHistoryResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PrivateGetErc20TransferHistoryResultSchema + + +class PrivateGetSubaccountValueHistoryResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PrivateGetSubaccountValueHistoryResultSchema + + +class PublicGetLiveIncidentsResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PublicGetLiveIncidentsResultSchema + + +class PrivateGetInterestHistoryResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PrivateGetInterestHistoryResultSchema + + +class PrivatePollQuotesResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PrivatePollQuotesResultSchema + + +class PublicGetFundingRateHistoryResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PublicGetFundingRateHistoryResultSchema + + +class PublicGetLatestSignedFeedsResultSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + fwd_data: Dict[str, Dict[str, ForwardFeedDataSchema]] = Field( + ..., + description="currency -> expiry -> latest forward feed data", + title="fwd_data", + ) + perp_data: Dict[str, Dict[str, PerpFeedDataSchema]] = Field( + ..., + description="currency -> feed type -> latest perp feed data", + title="perp_data", + ) + rate_data: Dict[str, Dict[str, RateFeedDataSchema]] = Field( + ..., + description="currency -> expiry -> latest rate feed data", + title="rate_data", + ) + spot_data: Dict[str, SpotFeedDataSchema] = Field( + ..., description="currency -> latest spot feed data", title="spot_data" + ) + vol_data: Dict[str, Dict[str, VolFeedDataSchema]] = Field( + ..., description="currency -> expiry -> latest vol feed data", title="vol_data" + ) + + +class PrivateReplaceResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PrivateReplaceResultSchema + + +class PrivateOrderDebugResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PrivateOrderDebugResultSchema + + +class PublicGetLatestSignedFeedsResponseSchema(BaseModel): + model_config = ConfigDict( + extra="forbid", + ) + id: Union[str, int] + result: PublicGetLatestSignedFeedsResultSchema From c66a66efb7755caa8d9d3891b38a0add57f769b0 Mon Sep 17 00:00:00 2001 From: zarathustra Date: Wed, 1 Oct 2025 14:15:29 +0200 Subject: [PATCH 4/6] fix: generate regular dataclasses instead of pydantic models --- derive_client/_clients/models.py | 6973 +++++++++--------------------- scripts/generate-models.py | 2 +- 2 files changed, 2033 insertions(+), 4942 deletions(-) diff --git a/derive_client/_clients/models.py b/derive_client/_clients/models.py index 9d04b27a..26ddf95d 100644 --- a/derive_client/_clients/models.py +++ b/derive_client/_clients/models.py @@ -1,24 +1,22 @@ # generated by datamodel-codegen: # filename: RESTAPI-v2_0-latest.json -# timestamp: 2025-09-20T20:37:05+00:00 +# timestamp: 2025-10-01T12:11:13+00:00 from __future__ import annotations +from dataclasses import dataclass from decimal import Decimal from enum import Enum from typing import Any, Dict, List, Optional, Union -from uuid import UUID -from pydantic import BaseModel, ConfigDict, Field - -class Status(Enum): +class Status(str, Enum): unseen = "unseen" seen = "seen" hidden = "hidden" -class TypeEnum(Enum): +class TypeEnum(str, Enum): deposit = "deposit" withdraw = "withdraw" transfer = "transfer" @@ -28,98 +26,46 @@ class TypeEnum(Enum): custom = "custom" -class PrivateGetNotificationsParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - page: Optional[int] = Field(1, description="Page number of results to return", title="page") - page_size: Optional[int] = Field( - 50, - description="Number of results per page (must be between 0-50)", - title="page_size", - ) - status: Optional[Status] = Field(None, description="Status of the notification", title="status") - subaccount_id: Optional[int] = Field( - None, - description="Subaccount_id (must be set if wallet param is not set)", - title="subaccount_id", - ) - type: Optional[List[TypeEnum]] = Field(None, description="List of notification types to filter by", title="type") - wallet: Optional[str] = Field( - None, - description="Wallet address (if set, subaccount_id ignored)", - title="wallet", - ) +@dataclass +class PrivateGetNotificationsParamsSchema: + page: Optional[int] = 1 + page_size: Optional[int] = 50 + status: Optional[Status] = None + subaccount_id: Optional[int] = None + type: Optional[List[TypeEnum]] = None + wallet: Optional[str] = None -class NotificationResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - event: str = Field( - ..., - description="The specific event leading to the notification.", - title="event", - ) - event_details: Dict[str, Any] = Field( - ..., - description="A JSON-structured dictionary containing detailed data or context about the event.", - title="event_details", - ) - id: int = Field(..., description="The unique identifier for the notification.", title="id") - status: str = Field( - ..., - description="The status of the notification, indicating if it has been read, pending, or processed.", - title="status", - ) - subaccount_id: int = Field( - ..., - description="The subaccount_id associated with the notification.", - title="subaccount_id", - ) - timestamp: int = Field( - ..., - description="The timestamp indicating when the notification was created or triggered.", - title="timestamp", - ) - transaction_id: Optional[int] = Field( - None, - description="The transaction id associated with the notification.", - title="transaction_id", - ) - tx_hash: Optional[str] = Field( - None, - description="The transaction hash associated with the notification.", - title="tx_hash", - ) +@dataclass +class NotificationResponseSchema: + event: str + event_details: Dict[str, Any] + id: int + status: str + subaccount_id: int + timestamp: int + transaction_id: Optional[int] = None + tx_hash: Optional[str] = None -class PaginationInfoSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - count: int = Field(..., description="Total number of items, across all pages", title="count") - num_pages: int = Field(..., description="Number of pages", title="num_pages") +@dataclass +class PaginationInfoSchema: + count: int + num_pages: int -class PublicGetCurrencyParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - currency: str = Field( - ..., - description="Underlying currency of asset (`ETH`, `BTC`, etc)", - title="currency", - ) +@dataclass +class PublicGetCurrencyParamsSchema: + currency: str -class InstrumentType(Enum): +class InstrumentType(str, Enum): erc20 = "erc20" option = "option" perp = "perp" -class MarketType(Enum): +class MarketType(str, Enum): ALL = "ALL" SRM_BASE_ONLY = "SRM_BASE_ONLY" SRM_OPTION_ONLY = "SRM_OPTION_ONLY" @@ -127,162 +73,76 @@ class MarketType(Enum): CASH = "CASH" -class OpenInterestStatsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - current_open_interest: Decimal = Field( - ..., - description="Current open interest for the margin type", - title="current_open_interest", - ) - interest_cap: Decimal = Field(..., description="Total open interest cap", title="interest_cap") - manager_currency: Optional[str] = Field( - None, - description="Currency of the manager (only applies to Portfolio Margin)", - title="manager_currency", - ) +@dataclass +class OpenInterestStatsSchema: + current_open_interest: Decimal + interest_cap: Decimal + manager_currency: Optional[str] = None -class MarginType(Enum): +class MarginType(str, Enum): PM = "PM" SM = "SM" PM2 = "PM2" -class ManagerContractResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - address: str = Field(..., description="Address of the manager", title="address") - currency: Optional[str] = Field( - None, - description="Currency of the manager (only applies to portfolio managers)", - title="currency", - ) - margin_type: MarginType = Field(..., description="Margin type of the manager", title="margin_type") +@dataclass +class ManagerContractResponseSchema: + address: str + margin_type: MarginType + currency: Optional[str] = None -class PM2CollateralDiscountsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - im_discount: Decimal = Field( - ..., - description="Initial Margin discount for given collateral in PM2", - title="im_discount", - ) - manager_currency: str = Field(..., description="Currency of the manager", title="manager_currency") - mm_discount: Decimal = Field( - ..., - description="Maintenance Margin discount for given collateral in PM2", - title="mm_discount", - ) +@dataclass +class PM2CollateralDiscountsSchema: + im_discount: Decimal + manager_currency: str + mm_discount: Decimal -class ProtocolAssetAddressesSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - option: Optional[str] = Field( - None, - description="Address of the Derive protocol option contract (none if not supported)", - title="option", - ) - perp: Optional[str] = Field( - None, - description="Address of the Derive protocol perp contract (none if not supported)", - title="perp", - ) - spot: Optional[str] = Field( - None, - description="Address of the Derive protocol spot contract (none if not supported)", - title="spot", - ) - underlying_erc20: Optional[str] = Field( - None, - description="Address of the erc20 asset on Derive chain. This is the asset that is deposited into the spot asset", - title="underlying_erc20", - ) +@dataclass +class ProtocolAssetAddressesSchema: + option: Optional[str] = None + perp: Optional[str] = None + spot: Optional[str] = None + underlying_erc20: Optional[str] = None -class PrivateSetMmpConfigParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - currency: str = Field(..., description="Currency of this mmp config", title="currency") - mmp_amount_limit: Decimal = Field( - "0", - description="Maximum total order amount that can be traded within the mmp_interval across all instruments of the provided currency. The amounts are not netted, so a filled bid of 1 and a filled ask of 2 would count as 3.
Default: 0 (no limit)", - title="mmp_amount_limit", - ) - mmp_delta_limit: Decimal = Field( - "0", - description="Maximum total delta that can be traded within the mmp_interval across all instruments of the provided currency. This quantity is netted, so a filled order with +1 delta and a filled order with -2 delta would count as -1
Default: 0 (no limit)", - title="mmp_delta_limit", - ) - mmp_frozen_time: int = Field( - ..., - description="Time interval in ms setting how long the subaccount is frozen after an mmp trigger, if 0 then a manual reset would be required via private/reset_mmp", - title="mmp_frozen_time", - ) - mmp_interval: int = Field( - ..., - description="Time interval in ms over which the limits are monotored, if 0 then mmp is disabled", - title="mmp_interval", - ) - subaccount_id: int = Field( - ..., - description="Subaccount_id for which to set the config", - title="subaccount_id", - ) +@dataclass +class PrivateSetMmpConfigParamsSchema: + currency: str + mmp_frozen_time: int + mmp_interval: int + subaccount_id: int + mmp_amount_limit: Decimal = "0" + mmp_delta_limit: Decimal = "0" -PrivateSetMmpConfigResultSchema = PrivateSetMmpConfigParamsSchema +@dataclass +class PrivateSetMmpConfigResultSchema(PrivateSetMmpConfigParamsSchema): + pass -class Direction(Enum): +class Direction(str, Enum): buy = "buy" sell = "sell" -class TradeModuleParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - amount: Decimal = Field(..., description="Order amount in units of the base", title="amount") - direction: Direction = Field(..., description="Order direction", title="direction") - instrument_name: str = Field(..., description="Instrument name", title="instrument_name") - limit_price: Decimal = Field( - ..., - description="Limit price in quote currency.
This field is still required for market orders because it is a component of the signature. However, market orders will not leave a resting order in the book in case of a partial fill.", - title="limit_price", - ) - max_fee: Decimal = Field( - ..., - description="Max fee per unit of volume, denominated in units of the quote currency (usually USDC).Order will be rejected if the supplied max fee is below the estimated fee for this order.", - title="max_fee", - ) - nonce: int = Field( - ..., - description="Unique nonce defined as (e.g. 1695836058725001, where 001 is the random number).Note, using a random number beyond 3 digits will cause JSON serialization to fail.", - title="nonce", - ) - signature: str = Field(..., description="Ethereum signature of the order", title="signature") - signature_expiry_sec: int = Field( - ..., - description="Unix timestamp in seconds. Order signature becomes invalid after this time, and the system will cancel the order.Expiry MUST be at least 5 min from now.", - title="signature_expiry_sec", - ) - signer: str = Field( - ..., - description="Owner wallet address or registered session key that signed order", - title="signer", - ) - subaccount_id: int = Field(..., description="Subaccount ID", title="subaccount_id") +@dataclass +class TradeModuleParamsSchema: + amount: Decimal + direction: Direction + instrument_name: str + limit_price: Decimal + max_fee: Decimal + nonce: int + signature: str + signature_expiry_sec: int + signer: str + subaccount_id: int -class CancelReason(Enum): +class CancelReason(str, Enum): field_ = "" user_request = "user_request" mmp_trigger = "mmp_trigger" @@ -297,7 +157,7 @@ class CancelReason(Enum): validation_failed = "validation_failed" -class OrderStatus(Enum): +class OrderStatus(str, Enum): open = "open" filled = "filled" cancelled = "cancelled" @@ -305,117 +165,67 @@ class OrderStatus(Enum): untriggered = "untriggered" -class OrderType(Enum): +class OrderType(str, Enum): limit = "limit" market = "market" -class TimeInForce(Enum): +class TimeInForce(str, Enum): gtc = "gtc" post_only = "post_only" fok = "fok" ioc = "ioc" -class TriggerPriceType(Enum): +class TriggerPriceType(str, Enum): mark = "mark" index = "index" -class TriggerType(Enum): +class TriggerType(str, Enum): stoploss = "stoploss" takeprofit = "takeprofit" -class OrderResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - amount: Decimal = Field(..., description="Order amount in units of the base", title="amount") - average_price: Decimal = Field(..., description="Average fill price", title="average_price") - cancel_reason: CancelReason = Field( - ..., - description="If cancelled, reason behind order cancellation", - title="cancel_reason", - ) - creation_timestamp: int = Field( - ..., - description="Creation timestamp (in ms since Unix epoch)", - title="creation_timestamp", - ) - direction: Direction = Field(..., description="Order direction", title="direction") - filled_amount: Decimal = Field(..., description="Total filled amount for the order", title="filled_amount") - instrument_name: str = Field(..., description="Instrument name", title="instrument_name") - is_transfer: bool = Field( - ..., - description="Whether the order was generated through `private/transfer_position`", - title="is_transfer", - ) - label: str = Field(..., description="Optional user-defined label for the order", title="label") - last_update_timestamp: int = Field( - ..., - description="Last update timestamp (in ms since Unix epoch)", - title="last_update_timestamp", - ) - limit_price: Decimal = Field(..., description="Limit price in quote currency", title="limit_price") - max_fee: Decimal = Field(..., description="Max fee in units of the quote currency", title="max_fee") - mmp: bool = Field( - ..., - description="Whether the order is tagged for market maker protections", - title="mmp", - ) - nonce: int = Field( - ..., - description="Unique nonce defined as (e.g. 1695836058725001, where 001 is the random number)", - title="nonce", - ) - order_fee: Decimal = Field(..., description="Total order fee paid so far", title="order_fee") - order_id: str = Field(..., description="Order ID", title="order_id") - order_status: OrderStatus = Field(..., description="Order status", title="order_status") - order_type: OrderType = Field(..., description="Order type", title="order_type") - quote_id: Optional[UUID] = Field(..., description="Quote ID if the trade was executed via RFQ", title="quote_id") - replaced_order_id: Optional[UUID] = Field( - None, - description="If replaced, ID of the order that was replaced", - title="replaced_order_id", - ) - signature: str = Field(..., description="Ethereum signature of the order", title="signature") - signature_expiry_sec: int = Field(..., description="Signature expiry timestamp", title="signature_expiry_sec") - signer: str = Field( - ..., - description="Owner wallet address or registered session key that signed order", - title="signer", - ) - subaccount_id: int = Field(..., description="Subaccount ID", title="subaccount_id") - time_in_force: TimeInForce = Field(..., description="Time in force", title="time_in_force") - trigger_price: Optional[Decimal] = Field( - None, - description="(Required for trigger orders) Index or Market price to trigger order at", - title="trigger_price", - ) - trigger_price_type: Optional[TriggerPriceType] = Field( - None, - description="(Required for trigger orders) Trigger with Index or Mark Price", - title="trigger_price_type", - ) - trigger_reject_message: Optional[str] = Field( - None, - description="(Required for trigger orders) Error message if error occured during trigger", - title="trigger_reject_message", - ) - trigger_type: Optional[TriggerType] = Field( - None, - description="(Required for trigger orders) Stop-loss or Take-profit.", - title="trigger_type", - ) - - -class LiquidityRole(Enum): +@dataclass +class OrderResponseSchema: + amount: Decimal + average_price: Decimal + cancel_reason: CancelReason + creation_timestamp: int + direction: Direction + filled_amount: Decimal + instrument_name: str + is_transfer: bool + label: str + last_update_timestamp: int + limit_price: Decimal + max_fee: Decimal + mmp: bool + nonce: int + order_fee: Decimal + order_id: str + order_status: OrderStatus + order_type: OrderType + quote_id: Optional[str] + signature: str + signature_expiry_sec: int + signer: str + subaccount_id: int + time_in_force: TimeInForce + replaced_order_id: Optional[str] = None + trigger_price: Optional[Decimal] = None + trigger_price_type: Optional[TriggerPriceType] = None + trigger_reject_message: Optional[str] = None + trigger_type: Optional[TriggerType] = None + + +class LiquidityRole(str, Enum): maker = "maker" taker = "taker" -class TxStatus(Enum): +class TxStatus(str, Enum): requested = "requested" pending = "pending" settled = "settled" @@ -424,106 +234,58 @@ class TxStatus(Enum): timed_out = "timed_out" -class TradeResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - direction: Direction = Field(..., description="Order direction", title="direction") - expected_rebate: Decimal = Field(..., description="Expected rebate for this trade", title="expected_rebate") - index_price: Decimal = Field( - ..., - description="Index price of the underlying at the time of the trade", - title="index_price", - ) - instrument_name: str = Field(..., description="Instrument name", title="instrument_name") - is_transfer: bool = Field( - ..., - description="Whether the trade was generated through `private/transfer_position`", - title="is_transfer", - ) - label: str = Field(..., description="Optional user-defined label for the order", title="label") - liquidity_role: LiquidityRole = Field(..., description="Role of the user in the trade", title="liquidity_role") - mark_price: Decimal = Field( - ..., - description="Mark price of the instrument at the time of the trade", - title="mark_price", - ) - order_id: str = Field(..., description="Order ID", title="order_id") - quote_id: Optional[UUID] = Field(..., description="Quote ID if the trade was executed via RFQ", title="quote_id") - realized_pnl: Decimal = Field(..., description="Realized PnL for this trade", title="realized_pnl") - realized_pnl_excl_fees: Decimal = Field( - ..., - description="Realized PnL for this trade using cost accounting that excludes fees", - title="realized_pnl_excl_fees", - ) - subaccount_id: int = Field(..., description="Subaccount ID", title="subaccount_id") - timestamp: int = Field(..., description="Trade timestamp (in ms since Unix epoch)", title="timestamp") - trade_amount: Decimal = Field(..., description="Amount filled in this trade", title="trade_amount") - trade_fee: Decimal = Field(..., description="Fee for this trade", title="trade_fee") - trade_id: str = Field(..., description="Trade ID", title="trade_id") - trade_price: Decimal = Field(..., description="Price at which the trade was filled", title="trade_price") - transaction_id: str = Field( - ..., - description="The transaction id of the related settlement transaction", - title="transaction_id", - ) - tx_hash: Optional[str] = Field(..., description="Blockchain transaction hash", title="tx_hash") - tx_status: TxStatus = Field(..., description="Blockchain transaction status", title="tx_status") - - -class PrivateCreateSubaccountParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - amount: Decimal = Field(..., description="Amount of the asset to deposit", title="amount") - asset_name: str = Field(..., description="Name of asset to deposit", title="asset_name") - currency: Optional[str] = Field( - None, - description="Base currency of the subaccount (only for `PM`)", - title="currency", - ) - margin_type: MarginType = Field( - ..., - description="`PM` (Portfolio Margin), `PM2 (Portfolio Margin 2), or `SM` (Standard Margin))", - title="margin_type", - ) - nonce: int = Field( - ..., - description="Unique nonce defined as (e.g. 1695836058725001, where 001 is the random number)", - title="nonce", - ) - signature: str = Field(..., description="Ethereum signature of the deposit", title="signature") - signature_expiry_sec: int = Field( - ..., - description="Unix timestamp in seconds. Expiry MUST be >5min from now", - title="signature_expiry_sec", - ) - signer: str = Field( - ..., - description="Ethereum wallet address that is signing the deposit", - title="signer", - ) - wallet: str = Field(..., description="Ethereum wallet address", title="wallet") - - -class PrivateCreateSubaccountResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - status: str = Field(..., description="`requested`", title="status") - transaction_id: UUID = Field(..., description="Transaction id of the request", title="transaction_id") - - -class LegUnpricedSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - amount: Decimal = Field(..., description="Amount in units of the base", title="amount") - direction: Direction = Field(..., description="Leg direction", title="direction") - instrument_name: str = Field(..., description="Instrument name", title="instrument_name") - - -class CancelReason1(Enum): +@dataclass +class TradeResponseSchema: + direction: Direction + expected_rebate: Decimal + index_price: Decimal + instrument_name: str + is_transfer: bool + label: str + liquidity_role: LiquidityRole + mark_price: Decimal + order_id: str + quote_id: Optional[str] + realized_pnl: Decimal + realized_pnl_excl_fees: Decimal + subaccount_id: int + timestamp: int + trade_amount: Decimal + trade_fee: Decimal + trade_id: str + trade_price: Decimal + transaction_id: str + tx_hash: Optional[str] + tx_status: TxStatus + + +@dataclass +class PrivateCreateSubaccountParamsSchema: + amount: Decimal + asset_name: str + margin_type: MarginType + nonce: int + signature: str + signature_expiry_sec: int + signer: str + wallet: str + currency: Optional[str] = None + + +@dataclass +class PrivateCreateSubaccountResultSchema: + status: str + transaction_id: str + + +@dataclass +class LegUnpricedSchema: + amount: Decimal + direction: Direction + instrument_name: str + + +class CancelReason1(str, Enum): field_ = "" user_request = "user_request" insufficient_margin = "insufficient_margin" @@ -536,3167 +298,1492 @@ class CancelReason1(Enum): compliance = "compliance" -class Status1(Enum): +class Status1(str, Enum): open = "open" filled = "filled" cancelled = "cancelled" expired = "expired" -class PrivateSendRfqResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - ask_total_cost: Optional[Decimal] = Field( - ..., - description="Ask total cost for the RFQ implied from orderbook (as `sell`)", - title="ask_total_cost", - ) - bid_total_cost: Optional[Decimal] = Field( - ..., - description="Bid total cost for the RFQ implied from orderbook (as `buy`)", - title="bid_total_cost", - ) - cancel_reason: CancelReason1 = Field(..., description="Cancel reason, if any", title="cancel_reason") - counterparties: Optional[List[str]] = Field( - ..., - description="List of requested counterparties, if applicable", - title="counterparties", - ) - creation_timestamp: int = Field( - ..., - description="Creation timestamp in ms since Unix epoch", - title="creation_timestamp", - ) - filled_direction: Optional[Direction] = Field( - ..., - description="Direction at which the RFQ was filled (only if filled)", - title="filled_direction", - ) - filled_pct: Decimal = Field( - ..., - description="Percentage of the RFQ that has been filled, from 0 to 1.", - title="filled_pct", - ) - label: str = Field(..., description="User-defined label, if any", title="label") - last_update_timestamp: int = Field( - ..., - description="Last update timestamp in ms since Unix epoch", - title="last_update_timestamp", - ) - legs: List[LegUnpricedSchema] = Field(..., description="RFQ legs", title="legs") - mark_total_cost: Optional[Decimal] = Field( - ..., - description="Mark total cost for the RFQ (assuming `buy` direction)", - title="mark_total_cost", - ) - max_total_cost: Optional[Decimal] = Field(..., description="Max total cost for the RFQ", title="max_total_cost") - min_total_cost: Optional[Decimal] = Field(..., description="Min total cost for the RFQ", title="min_total_cost") - partial_fill_step: Decimal = Field( - ..., - description="Step size for partial fills (default: 1)", - title="partial_fill_step", - ) - rfq_id: UUID = Field(..., description="RFQ ID", title="rfq_id") - status: Status1 = Field(..., description="Status", title="status") - subaccount_id: int = Field(..., description="Subaccount ID", title="subaccount_id") - total_cost: Optional[Decimal] = Field( - ..., description="Total cost for the RFQ (only if filled)", title="total_cost" - ) - valid_until: int = Field( - ..., - description="RFQ expiry timestamp in ms since Unix epoch", - title="valid_until", - ) +@dataclass +class PrivateSendRfqResultSchema: + ask_total_cost: Optional[Decimal] + bid_total_cost: Optional[Decimal] + cancel_reason: CancelReason1 + counterparties: Optional[List[str]] + creation_timestamp: int + filled_direction: Optional[Direction] + filled_pct: Decimal + label: str + last_update_timestamp: int + legs: List[LegUnpricedSchema] + mark_total_cost: Optional[Decimal] + max_total_cost: Optional[Decimal] + min_total_cost: Optional[Decimal] + partial_fill_step: Decimal + rfq_id: str + status: Status1 + subaccount_id: int + total_cost: Optional[Decimal] + valid_until: int + + +@dataclass +class PublicMarginWatchParamsSchema: + subaccount_id: int + force_onchain: bool = False + + +@dataclass +class CollateralPublicResponseSchema: + amount: Decimal + asset_name: str + asset_type: InstrumentType + initial_margin: Decimal + maintenance_margin: Decimal + mark_price: Decimal + mark_value: Decimal + + +@dataclass +class PositionPublicResponseSchema: + amount: Decimal + delta: Decimal + gamma: Decimal + index_price: Decimal + initial_margin: Decimal + instrument_name: str + instrument_type: InstrumentType + liquidation_price: Optional[Decimal] + maintenance_margin: Decimal + mark_price: Decimal + mark_value: Decimal + theta: Decimal + vega: Decimal + + +@dataclass +class PublicStatisticsParamsSchema: + instrument_name: str + currency: Optional[str] = None + end_time: Optional[int] = None + + +@dataclass +class PublicStatisticsResultSchema: + daily_fees: Decimal + daily_notional_volume: Decimal + daily_premium_volume: Decimal + daily_trades: int + open_interest: Decimal + total_fees: Decimal + total_notional_volume: Decimal + total_premium_volume: Decimal + total_trades: int + + +@dataclass +class PublicLoginParamsSchema: + signature: str + timestamp: str + wallet: str + + +@dataclass +class PublicLoginResponseSchema: + id: Union[str, int] + result: List[int] + + +@dataclass +class PrivateCancelParamsSchema: + instrument_name: str + order_id: str + subaccount_id: int + + +@dataclass +class PrivateCancelResultSchema(OrderResponseSchema): + pass -class PublicMarginWatchParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - force_onchain: bool = Field( - False, - description="Force the fetching of on-chain balances, default False.", - title="force_onchain", - ) - subaccount_id: int = Field(..., description="Subaccount ID to get margin for.", title="subaccount_id") +@dataclass +class LegPricedSchema: + amount: Decimal + direction: Direction + instrument_name: str + price: Decimal + + +@dataclass +class PrivateExecuteQuoteResultSchema: + cancel_reason: CancelReason1 + creation_timestamp: int + direction: Direction + fee: Decimal + fill_pct: Decimal + is_transfer: bool + label: str + last_update_timestamp: int + legs: List[LegPricedSchema] + legs_hash: str + liquidity_role: LiquidityRole + max_fee: Decimal + mmp: bool + nonce: int + quote_id: str + rfq_filled_pct: Decimal + rfq_id: str + signature: str + signature_expiry_sec: int + signer: str + status: Status1 + subaccount_id: int + tx_hash: Optional[str] + tx_status: Optional[TxStatus] + + +class Period(str, Enum): + field_60 = 60 + field_300 = 300 + field_900 = 900 + field_1800 = 1800 + field_3600 = 3600 + field_14400 = 14400 + field_28800 = 28800 + field_86400 = 86400 + field_604800 = 604800 -class CollateralPublicResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - amount: Decimal = Field(..., description="Asset amount of given collateral", title="amount") - asset_name: str = Field(..., description="Asset name", title="asset_name") - asset_type: InstrumentType = Field( - ..., - description="Type of asset collateral (currently always `erc20`)", - title="asset_type", - ) - initial_margin: Decimal = Field( - ..., - description="USD value of collateral that contributes to initial margin", - title="initial_margin", - ) - maintenance_margin: Decimal = Field( - ..., - description="USD value of collateral that contributes to maintenance margin", - title="maintenance_margin", - ) - mark_price: Decimal = Field(..., description="Current mark price of the asset", title="mark_price") - mark_value: Decimal = Field( - ..., - description="USD value of the collateral (amount * mark price)", - title="mark_value", - ) +@dataclass +class PublicGetSpotFeedHistoryCandlesParamsSchema: + currency: str + end_timestamp: int + period: Period + start_timestamp: int + + +@dataclass +class SpotFeedHistoryCandlesResponseSchema: + close_price: Decimal + high_price: Decimal + low_price: Decimal + open_price: Decimal + price: Decimal + timestamp: int + timestamp_bucket: int + + +@dataclass +class PrivatePollRfqsParamsSchema: + subaccount_id: int + from_timestamp: int = 0 + page: int = 1 + page_size: int = 100 + rfq_id: Optional[str] = None + rfq_subaccount_id: Optional[int] = None + status: Optional[Status1] = None + to_timestamp: int = 18446744073709552000 + + +@dataclass +class RFQResultPublicSchema: + cancel_reason: CancelReason1 + creation_timestamp: int + filled_direction: Optional[Direction] + filled_pct: Decimal + last_update_timestamp: int + legs: List[LegUnpricedSchema] + partial_fill_step: Decimal + rfq_id: str + status: Status1 + subaccount_id: int + total_cost: Optional[Decimal] + valid_until: int + + +@dataclass +class PrivateGetLiquidationHistoryParamsSchema: + subaccount_id: int + end_timestamp: int = 9223372036854776000 + start_timestamp: int = 0 + + +class AuctionType(str, Enum): + solvent = "solvent" + insolvent = "insolvent" -class PositionPublicResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - amount: Decimal = Field(..., description="Position amount held by subaccount", title="amount") - delta: Decimal = Field( - ..., - description="Asset delta (w.r.t. forward price for options, `1.0` for perps)", - title="delta", - ) - gamma: Decimal = Field(..., description="Asset gamma (zero for non-options)", title="gamma") - index_price: Decimal = Field( - ..., - description="Current index (oracle) price for position's currency", - title="index_price", - ) - initial_margin: Decimal = Field( - ..., - description="USD initial margin requirement for this position", - title="initial_margin", - ) - instrument_name: str = Field( - ..., - description="Instrument name (same as the base Asset name)", - title="instrument_name", - ) - instrument_type: InstrumentType = Field(..., description="`erc20`, `option`, or `perp`", title="instrument_type") - liquidation_price: Optional[Decimal] = Field( - ..., - description="Index price at which position will be liquidated", - title="liquidation_price", - ) - maintenance_margin: Decimal = Field( - ..., - description="USD maintenance margin requirement for this position", - title="maintenance_margin", - ) - mark_price: Decimal = Field( - ..., - description="Current mark price for position's instrument", - title="mark_price", - ) - mark_value: Decimal = Field( - ..., - description="USD value of the position; this represents how much USD can be recieved by fully closing the position at the current oracle price", - title="mark_value", - ) - theta: Decimal = Field(..., description="Asset theta (zero for non-options)", title="theta") - vega: Decimal = Field(..., description="Asset vega (zero for non-options)", title="vega") +@dataclass +class AuctionBidEventSchema: + amounts_liquidated: Dict[str, Decimal] + cash_received: Decimal + discount_pnl: Decimal + percent_liquidated: Decimal + positions_realized_pnl: Dict[str, Decimal] + positions_realized_pnl_excl_fees: Dict[str, Decimal] + realized_pnl: Decimal + realized_pnl_excl_fees: Decimal + timestamp: int + tx_hash: str + + +@dataclass +class PrivateOrderDebugParamsSchema: + amount: Decimal + direction: Direction + instrument_name: str + limit_price: Decimal + max_fee: Decimal + nonce: int + signature: str + signature_expiry_sec: int + signer: str + subaccount_id: int + is_atomic_signing: Optional[bool] = False + label: str = "" + mmp: bool = False + order_type: OrderType = OrderType.limit + reduce_only: bool = False + referral_code: str = "" + reject_timestamp: int = 9223372036854776000 + time_in_force: TimeInForce = TimeInForce.gtc + trigger_price: Optional[Decimal] = None + trigger_price_type: Optional[TriggerPriceType] = None + trigger_type: Optional[TriggerType] = None + + +@dataclass +class TradeModuleDataSchema: + asset: str + desired_amount: Decimal + is_bid: bool + limit_price: Decimal + recipient_id: int + sub_id: int + trade_id: str + worst_fee: Decimal + + +@dataclass +class PrivateDepositParamsSchema: + amount: Decimal + asset_name: str + nonce: int + signature: str + signature_expiry_sec: int + signer: str + subaccount_id: int + is_atomic_signing: bool = False + + +@dataclass +class PrivateDepositResultSchema(PrivateCreateSubaccountResultSchema): + pass -class PublicStatisticsParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - currency: Optional[str] = Field(None, description="Currency for stats", title="currency") - end_time: Optional[int] = Field(None, description="End time for statistics in ms", title="end_time") - instrument_name: str = Field( - ..., - description="Instrument name or 'ALL', 'OPTION', 'PERP', 'SPOT'", - title="instrument_name", - ) +@dataclass +class PrivateUpdateNotificationsParamsSchema: + notification_ids: List[int] + subaccount_id: int + status: Status = Status.seen -class PublicStatisticsResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - daily_fees: Decimal = Field(..., description="24h Fees", title="daily_fees") - daily_notional_volume: Decimal = Field(..., description="24h Notional volume", title="daily_notional_volume") - daily_premium_volume: Decimal = Field(..., description="24h Premium volume", title="daily_premium_volume") - daily_trades: int = Field(..., description="24h Trades", title="daily_trades") - open_interest: Decimal = Field(..., description="Open interest", title="open_interest") - total_fees: Decimal = Field(..., description="Total fees", title="total_fees") - total_notional_volume: Decimal = Field(..., description="Total notional volume", title="total_notional_volume") - total_premium_volume: Decimal = Field(..., description="Total premium volume", title="total_premium_volume") - total_trades: int = Field(..., description="Total trades", title="total_trades") - - -class PublicLoginParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - signature: str = Field( - ..., - description="Signature of the timestamp, signed with the wallet's private key or a session key", - title="signature", - ) - timestamp: str = Field( - ..., - description="Message that was signed, in the form of a timestamp in ms since Unix epoch", - title="timestamp", - ) - wallet: str = Field(..., description="Public key (wallet) of the account", title="wallet") +@dataclass +class PrivateUpdateNotificationsResultSchema: + updated_count: int -class PublicLoginResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - id: Union[str, int] - result: List[int] = Field( - ..., - description="List of subaccount IDs that have been authenticated", - title="result", - ) +@dataclass +class PrivateChangeSubaccountLabelParamsSchema: + label: str + subaccount_id: int -class PrivateCancelParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - instrument_name: str = Field(..., title="instrument_name") - order_id: UUID = Field(..., title="order_id") - subaccount_id: int = Field(..., title="subaccount_id") +@dataclass +class PrivateChangeSubaccountLabelResultSchema( + PrivateChangeSubaccountLabelParamsSchema +): + pass -PrivateCancelResultSchema = OrderResponseSchema +@dataclass +class SignedQuoteParamsSchema: + direction: Direction + legs: List[LegPricedSchema] + max_fee: Decimal + nonce: int + signature: str + signature_expiry_sec: int + signer: str + subaccount_id: int + + +@dataclass +class QuoteResultSchema: + cancel_reason: CancelReason1 + creation_timestamp: int + direction: Direction + fee: Decimal + fill_pct: Decimal + is_transfer: bool + label: str + last_update_timestamp: int + legs: List[LegPricedSchema] + legs_hash: str + liquidity_role: LiquidityRole + max_fee: Decimal + mmp: bool + nonce: int + quote_id: str + rfq_id: str + signature: str + signature_expiry_sec: int + signer: str + status: Status1 + subaccount_id: int + tx_hash: Optional[str] + tx_status: Optional[TxStatus] + + +@dataclass +class PublicGetMakerProgramsParamsSchema: + pass -class LegPricedSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - amount: Decimal = Field(..., description="Amount in units of the base", title="amount") - direction: Direction = Field(..., description="Leg direction", title="direction") - instrument_name: str = Field(..., description="Instrument name", title="instrument_name") - price: Decimal = Field(..., description="Leg price", title="price") +@dataclass +class ProgramResponseSchema: + asset_types: List[str] + currencies: List[str] + end_timestamp: int + min_notional: Decimal + name: str + rewards: Dict[str, Decimal] + start_timestamp: int -class PrivateExecuteQuoteResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - cancel_reason: CancelReason1 = Field(..., description="Cancel reason, if any", title="cancel_reason") - creation_timestamp: int = Field( - ..., - description="Creation timestamp in ms since Unix epoch", - title="creation_timestamp", - ) - direction: Direction = Field(..., description="Quote direction", title="direction") - fee: Decimal = Field(..., description="Fee paid for this quote (if executed)", title="fee") - fill_pct: Decimal = Field( - ..., - description="Percentage of the RFQ that this quote would fill, from 0 to 1.", - title="fill_pct", - ) - is_transfer: bool = Field( - ..., - description="Whether the order was generated through `private/transfer_position`", - title="is_transfer", - ) - label: str = Field(..., description="User-defined label, if any", title="label") - last_update_timestamp: int = Field( - ..., - description="Last update timestamp in ms since Unix epoch", - title="last_update_timestamp", - ) - legs: List[LegPricedSchema] = Field(..., description="Quote legs", title="legs") - legs_hash: str = Field( - ..., - description="Hash of the legs of the best quote to be signed by the taker.", - title="legs_hash", - ) - liquidity_role: LiquidityRole = Field(..., description="Liquidity role", title="liquidity_role") - max_fee: Decimal = Field(..., description="Signed max fee", title="max_fee") - mmp: bool = Field( - ..., - description="Whether the quote is tagged for market maker protections (default false)", - title="mmp", - ) - nonce: int = Field(..., description="Nonce", title="nonce") - quote_id: UUID = Field(..., description="Quote ID", title="quote_id") - rfq_filled_pct: Decimal = Field( - ..., - description="Total percentage of the RFQ that has already been filled after this execution, from 0 to 1.", - title="rfq_filled_pct", - ) - rfq_id: UUID = Field(..., description="RFQ ID", title="rfq_id") - signature: str = Field(..., description="Ethereum signature of the quote", title="signature") - signature_expiry_sec: int = Field(..., description="Unix timestamp in seconds", title="signature_expiry_sec") - signer: str = Field( - ..., - description="Owner wallet address or registered session key that signed the quote", - title="signer", - ) - status: Status1 = Field(..., description="Status", title="status") - subaccount_id: int = Field(..., description="Subaccount ID", title="subaccount_id") - tx_hash: Optional[str] = Field( - ..., - description="Blockchain transaction hash (only for executed quotes)", - title="tx_hash", - ) - tx_status: Optional[TxStatus] = Field( - ..., - description="Blockchain transaction status (only for executed quotes)", - title="tx_status", - ) +@dataclass +class SimulatedCollateralSchema: + amount: Decimal + asset_name: str -class Period(Enum): - field_60 = 60 - field_300 = 300 - field_900 = 900 - field_1800 = 1800 - field_3600 = 3600 - field_14400 = 14400 - field_28800 = 28800 - field_86400 = 86400 - field_604800 = 604800 +@dataclass +class SimulatedPositionSchema: + amount: Decimal + instrument_name: str + entry_price: Optional[Decimal] = None -class PublicGetSpotFeedHistoryCandlesParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - currency: str = Field(..., description="Currency", title="currency") - end_timestamp: int = Field(..., description="End timestamp", title="end_timestamp") - period: Period = Field(..., description="Period", title="period") - start_timestamp: int = Field(..., description="Start timestamp", title="start_timestamp") +@dataclass +class PublicGetMarginResultSchema: + is_valid_trade: bool + post_initial_margin: Decimal + post_maintenance_margin: Decimal + pre_initial_margin: Decimal + pre_maintenance_margin: Decimal + subaccount_id: int -class SpotFeedHistoryCandlesResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - close_price: Decimal = Field(..., description="Close price", title="close_price") - high_price: Decimal = Field(..., description="High price", title="high_price") - low_price: Decimal = Field(..., description="Low price", title="low_price") - open_price: Decimal = Field(..., description="Open price", title="open_price") - price: Decimal = Field(..., description="Spot price", title="price") - timestamp: int = Field( - ..., - description="Timestamp of when the spot price was recored into the database", - title="timestamp", - ) - timestamp_bucket: int = Field( - ..., - description="Timestamp bucket; this value is regularly spaced out with `period` seconds between data points, missing values are forward-filled from earlier data where possible, if no earlier data is available, values are back-filled from the first observed data point", - title="timestamp_bucket", - ) +@dataclass +class PrivateCancelByNonceParamsSchema: + instrument_name: str + nonce: int + subaccount_id: int + wallet: str -class PrivatePollRfqsParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - from_timestamp: int = Field( - 0, - description="Earliest `last_update_timestamp` to filter by (in ms since Unix epoch). If not provied, defaults to 0.", - title="from_timestamp", - ) - page: int = Field( - 1, - description="Page number of results to return (default 1, returns last if above `num_pages`)", - title="page", - ) - page_size: int = Field( - 100, - description="Number of results per page (default 100, max 1000)", - title="page_size", - ) - rfq_id: Optional[UUID] = Field(None, description="RFQ ID filter, if applicable", title="rfq_id") - rfq_subaccount_id: Optional[int] = Field( - None, - description="Filter returned RFQs by rfq requestor subaccount", - title="rfq_subaccount_id", - ) - status: Optional[Status1] = Field(None, description="RFQ status filter, if applicable", title="status") - subaccount_id: int = Field( - ..., - description="Subaccount ID for auth purposes, returned data will be scoped to this subaccount.", - title="subaccount_id", - ) - to_timestamp: int = Field( - 18446744073709552000, - description="Latest `last_update_timestamp` to filter by (in ms since Unix epoch). If not provied, defaults to returning all data up to current time.", - title="to_timestamp", - ) +@dataclass +class PrivateCancelByNonceResultSchema: + cancelled_orders: int -class RFQResultPublicSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - cancel_reason: CancelReason1 = Field(..., description="Cancel reason, if any", title="cancel_reason") - creation_timestamp: int = Field( - ..., - description="Creation timestamp in ms since Unix epoch", - title="creation_timestamp", - ) - filled_direction: Optional[Direction] = Field( - ..., - description="Direction at which the RFQ was filled (only if filled)", - title="filled_direction", - ) - filled_pct: Decimal = Field( - ..., - description="Percentage of the RFQ that has been filled, from 0 to 1.", - title="filled_pct", - ) - last_update_timestamp: int = Field( - ..., - description="Last update timestamp in ms since Unix epoch", - title="last_update_timestamp", - ) - legs: List[LegUnpricedSchema] = Field(..., description="RFQ legs", title="legs") - partial_fill_step: Decimal = Field( - ..., - description="Step size for partial fills (default: 1)", - title="partial_fill_step", - ) - rfq_id: UUID = Field(..., description="RFQ ID", title="rfq_id") - status: Status1 = Field(..., description="Status", title="status") - subaccount_id: int = Field(..., description="Subaccount ID", title="subaccount_id") - total_cost: Optional[Decimal] = Field( - ..., description="Total cost for the RFQ (only if filled)", title="total_cost" - ) - valid_until: int = Field( - ..., - description="RFQ expiry timestamp in ms since Unix epoch", - title="valid_until", - ) +@dataclass +class PublicGetSpotFeedHistoryParamsSchema: + currency: str + end_timestamp: int + period: int + start_timestamp: int -class PrivateGetLiquidationHistoryParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - end_timestamp: int = Field( - 9223372036854776000, - description="End timestamp of the event history (default current time)", - title="end_timestamp", - ) - start_timestamp: int = Field( - 0, - description="Start timestamp of the event history (default 0)", - title="start_timestamp", - ) - subaccount_id: int = Field(..., description="Subaccount id", title="subaccount_id") +@dataclass +class SpotFeedHistoryResponseSchema: + price: Decimal + timestamp: int + timestamp_bucket: int -class AuctionType(Enum): - solvent = "solvent" - insolvent = "insolvent" +@dataclass +class PrivateGetSubaccountsParamsSchema: + wallet: str -class AuctionBidEventSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - amounts_liquidated: Dict[str, Decimal] = Field( - ..., - description="Amounts of each asset that were closed", - title="amounts_liquidated", - ) - cash_received: Decimal = Field( - ..., - description="Cash received by the subaccount for the liquidation. For the liquidated accounts this is the amount the liquidator paid to buy out the percentage of the portfolio. For the liquidator account, this is the amount they received from the security module (if positive) or the amount they paid for the bid (if negative)", - title="cash_received", - ) - discount_pnl: Decimal = Field( - ..., - description="Realized PnL due to liquidating or being liquidated at a discount to mark portfolio value", - title="discount_pnl", - ) - percent_liquidated: Decimal = Field( - ..., - description="Percent of the subaccount that was liquidated", - title="percent_liquidated", - ) - positions_realized_pnl: Dict[str, Decimal] = Field( - ..., - description="Realized PnL of each position that was closed", - title="positions_realized_pnl", - ) - positions_realized_pnl_excl_fees: Dict[str, Decimal] = Field( - ..., - description="Realized PnL of each position that was closed, excluding fees from total cost basis", - title="positions_realized_pnl_excl_fees", - ) - realized_pnl: Decimal = Field( - ..., - description="Realized PnL of the auction bid, assuming positions are closed at mark price at the time of the liquidation", - title="realized_pnl", - ) - realized_pnl_excl_fees: Decimal = Field( - ..., - description="Realized PnL of the auction bid, excluding fees from total cost basis, assuming positions are closed at mark price at the time of the liquidation", - title="realized_pnl_excl_fees", - ) - timestamp: int = Field( - ..., - description="Timestamp of the bid (in ms since UNIX epoch)", - title="timestamp", - ) - tx_hash: str = Field(..., description="Hash of the bid transaction", title="tx_hash") +@dataclass +class PrivateGetSubaccountsResultSchema: + subaccount_ids: List[int] + wallet: str -class PrivateOrderDebugParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - amount: Decimal = Field(..., description="Order amount in units of the base", title="amount") - direction: Direction = Field(..., description="Order direction", title="direction") - instrument_name: str = Field(..., description="Instrument name", title="instrument_name") - is_atomic_signing: Optional[bool] = Field( - False, - description="Used by vaults to determine whether the signature is an EIP-1271 signature.", - title="is_atomic_signing", - ) - label: str = Field("", description="Optional user-defined label for the order", title="label") - limit_price: Decimal = Field( - ..., - description="Limit price in quote currency.
This field is still required for market orders because it is a component of the signature. However, market orders will not leave a resting order in the book in case of a partial fill.", - title="limit_price", - ) - max_fee: Decimal = Field( - ..., - description="Max fee per unit of volume, denominated in units of the quote currency (usually USDC).Order will be rejected if the supplied max fee is below the estimated fee for this order.", - title="max_fee", - ) - mmp: bool = Field( - False, - description="Whether the order is tagged for market maker protections (default false)", - title="mmp", - ) - nonce: int = Field( - ..., - description="Unique nonce defined as (e.g. 1695836058725001, where 001 is the random number).Note, using a random number beyond 3 digits will cause JSON serialization to fail.", - title="nonce", - ) - order_type: OrderType = Field( - "limit", - description="Order type:
- `limit`: limit order (default)
- `market`: market order, note that limit_price is still required for market orders, but unfilled order portion will be marked as cancelled", - title="order_type", - ) - reduce_only: bool = Field( - False, - description="If true, the order will not be able to increase position's size (default false). If the order amount exceeds available position size, the order will be filled up to the position size and the remainder will be cancelled. This flag is only supported for market orders or non-resting limit orders (IOC or FOK)", - title="reduce_only", - ) - referral_code: str = Field("", description="Optional referral code for the order", title="referral_code") - reject_timestamp: int = Field( - 9223372036854776000, - description="UTC timestamp in ms, if provided the matching engine will reject the order with an error if `reject_timestamp` < `server_time`. Note that the timestamp must be consistent with the server time: use `public/get_time` method to obtain current server time.", - title="reject_timestamp", - ) - signature: str = Field(..., description="Ethereum signature of the order", title="signature") - signature_expiry_sec: int = Field( - ..., - description="Unix timestamp in seconds. Order signature becomes invalid after this time, and the system will cancel the order.Expiry MUST be at least 5 min from now.", - title="signature_expiry_sec", - ) - signer: str = Field( - ..., - description="Owner wallet address or registered session key that signed order", - title="signer", - ) - subaccount_id: int = Field(..., description="Subaccount ID", title="subaccount_id") - time_in_force: TimeInForce = Field( - "gtc", - description="Time in force behaviour:
- `gtc`: good til cancelled (default)
- `post_only`: a limit order that will be rejected if it crosses any order in the book, i.e. acts as a taker order
- `fok`: fill or kill, will be rejected if it is not fully filled
- `ioc`: immediate or cancel, fill at best bid/ask (market) or at limit price (limit), the unfilled portion is cancelled
Note that the order will still expire on the `signature_expiry_sec` timestamp.", - title="time_in_force", - ) - trigger_price: Optional[Decimal] = Field( - None, - description='(Required for trigger orders) "index" or "mark" price to trigger order at', - title="trigger_price", - ) - trigger_price_type: Optional[TriggerPriceType] = Field( - None, - description='(Required for trigger orders) Trigger with "mark" price as "index" price type not supported yet.', - title="trigger_price_type", - ) - trigger_type: Optional[TriggerType] = Field( - None, - description='(Required for trigger orders) "stoploss" or "takeprofit"', - title="trigger_type", - ) +@dataclass +class PrivateGetDepositHistoryParamsSchema(PrivateGetLiquidationHistoryParamsSchema): + pass -class TradeModuleDataSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - asset: str = Field(..., title="asset") - desired_amount: Decimal = Field(..., title="desired_amount") - is_bid: bool = Field(..., title="is_bid") - limit_price: Decimal = Field(..., title="limit_price") - recipient_id: int = Field(..., title="recipient_id") - sub_id: int = Field(..., title="sub_id") - trade_id: str = Field(..., title="trade_id") - worst_fee: Decimal = Field(..., title="worst_fee") - - -class PrivateDepositParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - amount: Decimal = Field(..., description="Amount of the asset to deposit", title="amount") - asset_name: str = Field(..., description="Name of asset to deposit", title="asset_name") - is_atomic_signing: bool = Field( - False, - description="Used by vaults to determine whether the signature is an EIP-1271 signature", - title="is_atomic_signing", - ) - nonce: int = Field( - ..., - description="Unique nonce defined as (e.g. 1695836058725001, where 001 is the random number)", - title="nonce", - ) - signature: str = Field(..., description="Ethereum signature of the deposit", title="signature") - signature_expiry_sec: int = Field( - ..., - description="Unix timestamp in seconds. Expiry MUST be >5min from now", - title="signature_expiry_sec", - ) - signer: str = Field( - ..., - description="Ethereum wallet address that is signing the deposit", - title="signer", - ) - subaccount_id: int = Field(..., description="Subaccount_id", title="subaccount_id") +@dataclass +class DepositSchema: + amount: Decimal + asset: str + error_log: Optional[Dict[str, Any]] + timestamp: int + transaction_id: str + tx_hash: str + tx_status: TxStatus -class PrivateDepositResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - status: str = Field(..., description="`requested`", title="status") - transaction_id: UUID = Field(..., description="Transaction id of the deposit", title="transaction_id") +@dataclass +class PrivateCancelByLabelParamsSchema: + label: str + subaccount_id: int + instrument_name: Optional[str] = None -class PrivateUpdateNotificationsParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - notification_ids: List[int] = Field( - ..., - description="List of notification IDs to be marked as seen", - title="notification_ids", - ) - status: Status = Field("seen", description="Status of the notification", title="status") - subaccount_id: int = Field(..., description="Subaccount_id", title="subaccount_id") +@dataclass +class PrivateCancelByLabelResultSchema(PrivateCancelByNonceResultSchema): + pass -class PrivateUpdateNotificationsResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - updated_count: int = Field(..., description="Number of notifications marked as seen", title="updated_count") +@dataclass +class PrivateGetMarginParamsSchema: + subaccount_id: int + simulated_collateral_changes: Optional[List[SimulatedCollateralSchema]] = None + simulated_position_changes: Optional[List[SimulatedPositionSchema]] = None -class PrivateChangeSubaccountLabelParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - label: str = Field(..., description="User defined label", title="label") - subaccount_id: int = Field(..., description="Subaccount_id", title="subaccount_id") +@dataclass +class PrivateGetMarginResultSchema(PublicGetMarginResultSchema): + pass -PrivateChangeSubaccountLabelResultSchema = PrivateChangeSubaccountLabelParamsSchema +@dataclass +class PublicCreateSubaccountDebugParamsSchema: + amount: Decimal + asset_name: str + margin_type: MarginType + nonce: int + signature_expiry_sec: int + signer: str + wallet: str + currency: Optional[str] = None -class SignedQuoteParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - direction: Direction = Field( - ..., - description="Quote direction, `buy` means trading each leg at its direction, `sell` means trading each leg in the opposite direction.", - title="direction", - ) - legs: List[LegPricedSchema] = Field(..., description="Quote legs", title="legs") - max_fee: Decimal = Field( - ..., - description="Max fee ($ for the full trade). Request will be rejected if the supplied max fee is below the estimated fee for this trade.", - title="max_fee", - ) - nonce: int = Field( - ..., - description="Unique nonce defined as a concatenated `UTC timestamp in ms` and `random number up to 6 digits` (e.g. 1695836058725001, where 001 is the random number)", - title="nonce", - ) - signature: str = Field(..., description="Ethereum signature of the quote", title="signature") - signature_expiry_sec: int = Field( - ..., - description="Unix timestamp in seconds. Expiry MUST be at least 310 seconds from now. Once time till signature expiry reaches 300 seconds, the quote will be considered expired. This buffer is meant to ensure the trade can settle on chain in case of a blockchain congestion.", - title="signature_expiry_sec", - ) - signer: str = Field( - ..., - description="Owner wallet address or registered session key that signed the quote", - title="signer", - ) - subaccount_id: int = Field(..., description="Subaccount ID", title="subaccount_id") +@dataclass +class PublicCreateSubaccountDebugResultSchema: + action_hash: str + encoded_data: str + encoded_data_hashed: str + typed_data_hash: str -class QuoteResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - cancel_reason: CancelReason1 = Field(..., description="Cancel reason, if any", title="cancel_reason") - creation_timestamp: int = Field( - ..., - description="Creation timestamp in ms since Unix epoch", - title="creation_timestamp", - ) - direction: Direction = Field(..., description="Quote direction", title="direction") - fee: Decimal = Field(..., description="Fee paid for this quote (if executed)", title="fee") - fill_pct: Decimal = Field( - ..., - description="Percentage of the RFQ that this quote would fill, from 0 to 1.", - title="fill_pct", - ) - is_transfer: bool = Field( - ..., - description="Whether the order was generated through `private/transfer_position`", - title="is_transfer", - ) - label: str = Field(..., description="User-defined label, if any", title="label") - last_update_timestamp: int = Field( - ..., - description="Last update timestamp in ms since Unix epoch", - title="last_update_timestamp", - ) - legs: List[LegPricedSchema] = Field(..., description="Quote legs", title="legs") - legs_hash: str = Field( - ..., - description="Hash of the legs of the best quote to be signed by the taker.", - title="legs_hash", - ) - liquidity_role: LiquidityRole = Field(..., description="Liquidity role", title="liquidity_role") - max_fee: Decimal = Field(..., description="Signed max fee", title="max_fee") - mmp: bool = Field( - ..., - description="Whether the quote is tagged for market maker protections (default false)", - title="mmp", - ) - nonce: int = Field(..., description="Nonce", title="nonce") - quote_id: UUID = Field(..., description="Quote ID", title="quote_id") - rfq_id: UUID = Field(..., description="RFQ ID", title="rfq_id") - signature: str = Field(..., description="Ethereum signature of the quote", title="signature") - signature_expiry_sec: int = Field(..., description="Unix timestamp in seconds", title="signature_expiry_sec") - signer: str = Field( - ..., - description="Owner wallet address or registered session key that signed the quote", - title="signer", - ) - status: Status1 = Field(..., description="Status", title="status") - subaccount_id: int = Field(..., description="Subaccount ID", title="subaccount_id") - tx_hash: Optional[str] = Field( - ..., - description="Blockchain transaction hash (only for executed quotes)", - title="tx_hash", - ) - tx_status: Optional[TxStatus] = Field( - ..., - description="Blockchain transaction status (only for executed quotes)", - title="tx_status", - ) +@dataclass +class PublicGetInstrumentParamsSchema: + instrument_name: str -class PublicGetMakerProgramsParamsSchema(BaseModel): - pass - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class ERC20PublicDetailsSchema: + decimals: int + borrow_index: Decimal = "1" + supply_index: Decimal = "1" + underlying_erc20_address: str = "" -class ProgramResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - asset_types: List[str] = Field( - ..., - description="List of asset types covered by the program", - title="asset_types", - ) - currencies: List[str] = Field(..., description="List of currencies covered by the program", title="currencies") - end_timestamp: int = Field(..., description="End timestamp of the epoch", title="end_timestamp") - min_notional: Decimal = Field( - ..., - description="Minimum dollar notional to quote for eligibility", - title="min_notional", - ) - name: str = Field(..., description="Name of the program", title="name") - rewards: Dict[str, Decimal] = Field( - ..., - description="Rewards for the program as a token -> total reward amount mapping", - title="rewards", - ) - start_timestamp: int = Field(..., description="Start timestamp of the epoch", title="start_timestamp") +class OptionType(str, Enum): + C = "C" + P = "P" -class SimulatedCollateralSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - amount: Decimal = Field(..., description="Collateral amount to simulate", title="amount") - asset_name: str = Field( - ..., - description="Collateral ERC20 asset name (e.g. ETH, USDC, WSTETH)", - title="asset_name", - ) +@dataclass +class OptionPublicDetailsSchema: + expiry: int + index: str + option_type: OptionType + strike: Decimal + settlement_price: Optional[Decimal] = None -class SimulatedPositionSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - amount: Decimal = Field(..., description="Position amount to simulate", title="amount") - entry_price: Optional[Decimal] = Field( - None, - description="Only for perps. Entry price to use in the simulation. Mark price is used if not provided.", - title="entry_price", - ) - instrument_name: str = Field(..., description="Instrument name", title="instrument_name") +@dataclass +class PerpPublicDetailsSchema: + aggregate_funding: Decimal + funding_rate: Decimal + index: str + max_rate_per_hour: Decimal + min_rate_per_hour: Decimal + static_interest_rate: Decimal -class PublicGetMarginResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - is_valid_trade: bool = Field( - ..., - description="True if trade passes margin requirement", - title="is_valid_trade", - ) - post_initial_margin: Decimal = Field( - ..., - description="Initial margin requirement post trade", - title="post_initial_margin", - ) - post_maintenance_margin: Decimal = Field( - ..., - description="Maintenance margin requirement post trade", - title="post_maintenance_margin", - ) - pre_initial_margin: Decimal = Field( - ..., - description="Initial margin requirement before trade", - title="pre_initial_margin", - ) - pre_maintenance_margin: Decimal = Field( - ..., - description="Maintenance margin requirement before trade", - title="pre_maintenance_margin", - ) - subaccount_id: int = Field(..., description="Subaccount_id", title="subaccount_id") +@dataclass +class PrivateEditSessionKeyParamsSchema: + public_session_key: str + wallet: str + disable: bool = False + ip_whitelist: Optional[List[str]] = None + label: Optional[str] = None -class PrivateCancelByNonceParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - instrument_name: str = Field(..., description="Instrument name", title="instrument_name") - nonce: int = Field(..., description="Cancel an order with this nonce", title="nonce") - subaccount_id: int = Field(..., description="Subaccount ID", title="subaccount_id") - wallet: str = Field(..., description="Wallet address", title="wallet") +@dataclass +class PrivateEditSessionKeyResultSchema: + expiry_sec: int + ip_whitelist: List[str] + label: str + public_session_key: str + scope: str -class PrivateCancelByNonceResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - cancelled_orders: int = Field(..., description="Number of cancelled orders", title="cancelled_orders") +@dataclass +class PrivateGetLiquidatorHistoryParamsSchema: + subaccount_id: int + end_timestamp: int = 9223372036854776000 + page: int = 1 + page_size: int = 100 + start_timestamp: int = 0 -class PublicGetSpotFeedHistoryParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - currency: str = Field(..., description="Currency", title="currency") - end_timestamp: int = Field(..., description="End timestamp", title="end_timestamp") - period: int = Field(..., description="Period", title="period") - start_timestamp: int = Field(..., description="Start timestamp", title="start_timestamp") +@dataclass +class PrivateGetLiquidatorHistoryResultSchema: + bids: List[AuctionBidEventSchema] + pagination: PaginationInfoSchema -class SpotFeedHistoryResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - price: Decimal = Field(..., description="Spot price", title="price") - timestamp: int = Field( - ..., - description="Timestamp of when the spot price was recored into the database", - title="timestamp", - ) - timestamp_bucket: int = Field( - ..., - description="Timestamp bucket; this value is regularly spaced out with `period` seconds between data points, missing values are forward-filled from earlier data where possible, if no earlier data is available, values are back-filled from the first observed data point", - title="timestamp_bucket", - ) - - -class PrivateGetSubaccountsParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - wallet: str = Field(..., description="Ethereum wallet address of account", title="wallet") - - -class PrivateGetSubaccountsResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - subaccount_ids: List[int] = Field( - ..., - description="List of subaccount_ids owned by the wallet in `SubAccounts.sol`", - title="subaccount_ids", - ) - wallet: str = Field(..., description="Ethereum wallet address", title="wallet") - - -PrivateGetDepositHistoryParamsSchema = PrivateGetLiquidationHistoryParamsSchema - - -class DepositSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - amount: Decimal = Field(..., description="Amount deposited by the subaccount", title="amount") - asset: str = Field(..., description="Asset deposited", title="asset") - error_log: Optional[Dict[str, Any]] = Field(..., description="If failed, error log for reason", title="error_log") - timestamp: int = Field( - ..., - description="Timestamp of the deposit (in ms since UNIX epoch)", - title="timestamp", - ) - transaction_id: UUID = Field(..., description="Transaction ID", title="transaction_id") - tx_hash: str = Field( - ..., - description="Hash of the transaction that deposited the funds", - title="tx_hash", - ) - tx_status: TxStatus = Field( - ..., - description="Status of the transaction that deposited the funds", - title="tx_status", - ) - - -class PrivateCancelByLabelParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - instrument_name: Optional[str] = Field( - None, - description="Instrument name. If not provided, all orders for all instruments with the label will be cancelled. If provided, request counts as a regular matching request for ratelimit purposes.", - title="instrument_name", - ) - label: str = Field(..., description="Cancel all orders for this label", title="label") - subaccount_id: int = Field(..., description="Subaccount ID", title="subaccount_id") - - -PrivateCancelByLabelResultSchema = PrivateCancelByNonceResultSchema - - -class PrivateGetMarginParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - simulated_collateral_changes: Optional[List[SimulatedCollateralSchema]] = Field( - None, - description="Optional, add collaterals to simulate deposits / withdrawals / spot trades", - title="simulated_collateral_changes", - ) - simulated_position_changes: Optional[List[SimulatedPositionSchema]] = Field( - None, - description="Optional, add positions to simulate perp / option trades", - title="simulated_position_changes", - ) - subaccount_id: int = Field(..., description="Subaccount_id", title="subaccount_id") - - -PrivateGetMarginResultSchema = PublicGetMarginResultSchema - - -class PublicCreateSubaccountDebugParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - amount: Decimal = Field(..., description="Amount of the asset to deposit", title="amount") - asset_name: str = Field(..., description="Name of asset to deposit", title="asset_name") - currency: Optional[str] = Field( - None, - description="Base currency of the subaccount (only for `PM`)", - title="currency", - ) - margin_type: MarginType = Field( - ..., - description="`PM` (Portfolio Margin), `PM2 (Portfolio Margin 2), or `SM` (Standard Margin))", - title="margin_type", - ) - nonce: int = Field( - ..., - description="Unique nonce defined as (e.g. 1695836058725001, where 001 is the random number)", - title="nonce", - ) - signature_expiry_sec: int = Field( - ..., - description="Unix timestamp in seconds. Expiry MUST be >5min from now", - title="signature_expiry_sec", - ) - signer: str = Field( - ..., - description="Ethereum wallet address that is signing the deposit", - title="signer", - ) - wallet: str = Field(..., description="Ethereum wallet address", title="wallet") - - -class PublicCreateSubaccountDebugResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - action_hash: str = Field(..., description="Keccak hashed action data", title="action_hash") - encoded_data: str = Field(..., description="ABI encoded deposit data", title="encoded_data") - encoded_data_hashed: str = Field(..., description="Keccak hashed encoded_data", title="encoded_data_hashed") - typed_data_hash: str = Field(..., description="EIP 712 typed data hash", title="typed_data_hash") - - -class PublicGetInstrumentParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - instrument_name: str = Field(..., description="Instrument name", title="instrument_name") - - -class ERC20PublicDetailsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - borrow_index: Decimal = Field( - "1", - description="Latest borrow index as per `CashAsset.sol` implementation", - title="borrow_index", - ) - decimals: int = Field( - ..., - description="Number of decimals of the underlying on-chain ERC20 token", - title="decimals", - ) - supply_index: Decimal = Field( - "1", - description="Latest supply index as per `CashAsset.sol` implementation", - title="supply_index", - ) - underlying_erc20_address: str = Field( - "", - description="Address of underlying on-chain ERC20 (not V2 asset)", - title="underlying_erc20_address", - ) - - -class OptionType(Enum): - C = "C" - P = "P" - - -class OptionPublicDetailsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - expiry: int = Field(..., description="Unix timestamp of expiry date (in seconds)", title="expiry") - index: str = Field(..., description="Underlying settlement price index", title="index") - option_type: OptionType = Field(..., title="option_type") - settlement_price: Optional[Decimal] = Field( - None, description="Settlement price of the option", title="settlement_price" - ) - strike: Decimal = Field(..., title="strike") - - -class PerpPublicDetailsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - aggregate_funding: Decimal = Field( - ..., - description="Latest aggregated funding as per `PerpAsset.sol`", - title="aggregate_funding", - ) - funding_rate: Decimal = Field( - ..., - description="Current hourly funding rate as per `PerpAsset.sol`", - title="funding_rate", - ) - index: str = Field(..., description="Underlying spot price index for funding rate", title="index") - max_rate_per_hour: Decimal = Field( - ..., - description="Max rate per hour as per `PerpAsset.sol`", - title="max_rate_per_hour", - ) - min_rate_per_hour: Decimal = Field( - ..., - description="Min rate per hour as per `PerpAsset.sol`", - title="min_rate_per_hour", - ) - static_interest_rate: Decimal = Field( - ..., - description="Static interest rate as per `PerpAsset.sol`", - title="static_interest_rate", - ) - - -class PrivateEditSessionKeyParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - disable: bool = Field( - False, - description="Flag whether or not to disable to session key. Defaulted to false. Only allowed for non-admin keys. Admin keys must go through `/deregister_session_key` for now.", - title="disable", - ) - ip_whitelist: Optional[List[str]] = Field( - None, - description="Optional list of whitelisted IPs, an empty list can be supplied to whitelist all IPs", - title="ip_whitelist", - ) - label: Optional[str] = Field(None, description="Optional new label for the session key", title="label") - public_session_key: str = Field( - ..., - description="Session key in the form of an Ethereum EOA", - title="public_session_key", - ) - wallet: str = Field(..., description="Ethereum wallet address of account", title="wallet") - - -class PrivateEditSessionKeyResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - expiry_sec: int = Field(..., description="Session key expiry timestamp in sec", title="expiry_sec") - ip_whitelist: List[str] = Field( - ..., - description="List of whitelisted IPs, if empty then any IP is allowed.", - title="ip_whitelist", - ) - label: str = Field(..., description="User-defined session key label", title="label") - public_session_key: str = Field( - ..., - description="Public session key address (Ethereum EOA)", - title="public_session_key", - ) - scope: str = Field(..., description="Session key permission level scope", title="scope") - - -class PrivateGetLiquidatorHistoryParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - end_timestamp: int = Field( - 9223372036854776000, - description="End timestamp of the event history (default current time)", - title="end_timestamp", - ) - page: int = Field( - 1, - description="Page number of results to return (default 1, returns last if above `num_pages`)", - title="page", - ) - page_size: int = Field( - 100, - description="Number of results per page (default 100, max 1000)", - title="page_size", - ) - start_timestamp: int = Field( - 0, - description="Start timestamp of the event history (default 0)", - title="start_timestamp", - ) - subaccount_id: int = Field(..., description="Subaccount ID", title="subaccount_id") - - -class PrivateGetLiquidatorHistoryResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - bids: List[AuctionBidEventSchema] = Field(..., description="List of auction bid events", title="bids") - pagination: PaginationInfoSchema - - -class PrivateGetPositionsParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - subaccount_id: int = Field(..., description="Subaccount_id", title="subaccount_id") - - -class PositionResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - amount: Decimal = Field(..., description="Position amount held by subaccount", title="amount") - amount_step: Decimal = Field(..., description="Minimum amount step for the position", title="amount_step") - average_price: Decimal = Field(..., description="Average price of whole position", title="average_price") - average_price_excl_fees: Decimal = Field( - ..., - description="Average price of whole position excluding fees", - title="average_price_excl_fees", - ) - creation_timestamp: int = Field( - ..., - description="Timestamp of when the position was opened (in ms since Unix epoch)", - title="creation_timestamp", - ) - cumulative_funding: Decimal = Field( - ..., - description="Cumulative funding for the position (only for perpetuals).", - title="cumulative_funding", - ) - delta: Decimal = Field( - ..., - description="Asset delta (w.r.t. forward price for options, `1.0` for perps)", - title="delta", - ) - gamma: Decimal = Field(..., description="Asset gamma (zero for non-options)", title="gamma") - index_price: Decimal = Field( - ..., - description="Current index (oracle) price for position's currency", - title="index_price", - ) - initial_margin: Decimal = Field( - ..., - description="USD initial margin requirement for this position", - title="initial_margin", - ) - instrument_name: str = Field( - ..., - description="Instrument name (same as the base Asset name)", - title="instrument_name", - ) - instrument_type: InstrumentType = Field(..., description="`erc20`, `option`, or `perp`", title="instrument_type") - leverage: Optional[Decimal] = Field( - ..., - description="Only for perps. Leverage of the position, defined as `abs(notional) / collateral net of options margin`", - title="leverage", - ) - liquidation_price: Optional[Decimal] = Field( - ..., - description="Index price at which position will be liquidated", - title="liquidation_price", - ) - maintenance_margin: Decimal = Field( - ..., - description="USD maintenance margin requirement for this position", - title="maintenance_margin", - ) - mark_price: Decimal = Field( - ..., - description="Current mark price for position's instrument", - title="mark_price", - ) - mark_value: Decimal = Field( - ..., - description="USD value of the position; this represents how much USD can be recieved by fully closing the position at the current oracle price", - title="mark_value", - ) - net_settlements: Decimal = Field( - ..., - description="Net amount of USD from position settlements that has been paid to the user's subaccount. This number is subtracted from the portfolio value for margin calculations purposes.
Positive values mean the user has recieved USD from settlements, or is awaiting settlement of USD losses. Negative values mean the user has paid USD for settlements, or is awaiting settlement of USD gains.", - title="net_settlements", - ) - open_orders_margin: Decimal = Field( - ..., - description="USD margin requirement for all open orders for this asset / instrument", - title="open_orders_margin", - ) - pending_funding: Decimal = Field( - ..., - description="A portion of funding payments that has not yet been settled into cash balance (only for perpetuals). This number is added to the portfolio value for margin calculations purposes.", - title="pending_funding", - ) - realized_pnl: Decimal = Field( - ..., - description="Realized trading profit or loss of the position.", - title="realized_pnl", - ) - realized_pnl_excl_fees: Decimal = Field( - ..., - description="Realized trading profit or loss of the position excluding fees", - title="realized_pnl_excl_fees", - ) - theta: Decimal = Field(..., description="Asset theta (zero for non-options)", title="theta") - total_fees: Decimal = Field( - ..., - description="Total fees paid for opening and changing the position", - title="total_fees", - ) - unrealized_pnl: Decimal = Field( - ..., - description="Unrealized trading profit or loss of the position.", - title="unrealized_pnl", - ) - unrealized_pnl_excl_fees: Decimal = Field( - ..., - description="Unrealized trading profit or loss of the position excluding fees", - title="unrealized_pnl_excl_fees", - ) - vega: Decimal = Field(..., description="Asset vega (zero for non-options)", title="vega") - - -class TxStatus4(Enum): +@dataclass +class PrivateGetPositionsParamsSchema: + subaccount_id: int + + +@dataclass +class PositionResponseSchema: + amount: Decimal + amount_step: Decimal + average_price: Decimal + average_price_excl_fees: Decimal + creation_timestamp: int + cumulative_funding: Decimal + delta: Decimal + gamma: Decimal + index_price: Decimal + initial_margin: Decimal + instrument_name: str + instrument_type: InstrumentType + leverage: Optional[Decimal] + liquidation_price: Optional[Decimal] + maintenance_margin: Decimal + mark_price: Decimal + mark_value: Decimal + net_settlements: Decimal + open_orders_margin: Decimal + pending_funding: Decimal + realized_pnl: Decimal + realized_pnl_excl_fees: Decimal + theta: Decimal + total_fees: Decimal + unrealized_pnl: Decimal + unrealized_pnl_excl_fees: Decimal + vega: Decimal + + +class TxStatus4(str, Enum): settled = "settled" reverted = "reverted" timed_out = "timed_out" -class PublicGetTradeHistoryParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - currency: Optional[str] = Field(None, description="Currency to filter by (defaults to all)", title="currency") - from_timestamp: int = Field( - 0, - description="Earliest timestamp to filter by (in ms since Unix epoch). If not provied, defaults to 0.", - title="from_timestamp", - ) - instrument_name: Optional[str] = Field( - None, - description="Instrument name to filter by (defaults to all)", - title="instrument_name", - ) - instrument_type: Optional[InstrumentType] = Field( - None, - description="Instrument type to filter by (defaults to all)", - title="instrument_type", - ) - page: int = Field( - 1, - description="Page number of results to return (default 1, returns last if above `num_pages`)", - title="page", - ) - page_size: int = Field( - 100, - description="Number of results per page (default 100, max 1000)", - title="page_size", - ) - subaccount_id: Optional[int] = Field(None, description="Subaccount ID to filter by", title="subaccount_id") - to_timestamp: int = Field( - 18446744073709552000, - description="Latest timestamp to filter by (in ms since Unix epoch). If not provied, defaults to returning all data up to current time.", - title="to_timestamp", - ) - trade_id: Optional[UUID] = Field( - None, - description="Trade ID to filter by. If set, all other filters are ignored", - title="trade_id", - ) - tx_hash: Optional[str] = Field( - None, - description="On-chain tx hash to filter by. If set, all other filters are ignored", - title="tx_hash", - ) - tx_status: TxStatus4 = Field( - "settled", - description="Transaction status to filter by (default `settled`).", - title="tx_status", - ) +@dataclass +class PublicGetTradeHistoryParamsSchema: + currency: Optional[str] = None + from_timestamp: int = 0 + instrument_name: Optional[str] = None + instrument_type: Optional[InstrumentType] = None + page: int = 1 + page_size: int = 100 + subaccount_id: Optional[int] = None + to_timestamp: int = 18446744073709552000 + trade_id: Optional[str] = None + tx_hash: Optional[str] = None + tx_status: TxStatus4 = TxStatus4.settled + + +@dataclass +class TradeSettledPublicResponseSchema: + direction: Direction + expected_rebate: Decimal + index_price: Decimal + instrument_name: str + liquidity_role: LiquidityRole + mark_price: Decimal + quote_id: Optional[str] + realized_pnl: Decimal + realized_pnl_excl_fees: Decimal + subaccount_id: int + timestamp: int + trade_amount: Decimal + trade_fee: Decimal + trade_id: str + trade_price: Decimal + tx_hash: str + tx_status: TxStatus4 + wallet: str + + +@dataclass +class PrivateGetRfqsParamsSchema: + subaccount_id: int + from_timestamp: int = 0 + page: int = 1 + page_size: int = 100 + rfq_id: Optional[str] = None + status: Optional[Status1] = None + to_timestamp: int = 18446744073709552000 + + +@dataclass +class RFQResultSchema(PrivateSendRfqResultSchema): + pass -class TradeSettledPublicResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - direction: Direction = Field(..., description="Order direction", title="direction") - expected_rebate: Decimal = Field(..., description="Expected rebate for this trade", title="expected_rebate") - index_price: Decimal = Field( - ..., - description="Index price of the underlying at the time of the trade", - title="index_price", - ) - instrument_name: str = Field(..., description="Instrument name", title="instrument_name") - liquidity_role: LiquidityRole = Field(..., description="Role of the user in the trade", title="liquidity_role") - mark_price: Decimal = Field( - ..., - description="Mark price of the instrument at the time of the trade", - title="mark_price", - ) - quote_id: Optional[UUID] = Field(..., description="Quote ID if the trade was executed via RFQ", title="quote_id") - realized_pnl: Decimal = Field(..., description="Realized PnL for this trade", title="realized_pnl") - realized_pnl_excl_fees: Decimal = Field( - ..., - description="Realized PnL for this trade using cost accounting that excludes fees", - title="realized_pnl_excl_fees", - ) - subaccount_id: int = Field(..., description="Subaccount ID", title="subaccount_id") - timestamp: int = Field(..., description="Trade timestamp (in ms since Unix epoch)", title="timestamp") - trade_amount: Decimal = Field(..., description="Amount filled in this trade", title="trade_amount") - trade_fee: Decimal = Field(..., description="Fee for this trade", title="trade_fee") - trade_id: str = Field(..., description="Trade ID", title="trade_id") - trade_price: Decimal = Field(..., description="Price at which the trade was filled", title="trade_price") - tx_hash: str = Field(..., description="Blockchain transaction hash", title="tx_hash") - tx_status: TxStatus4 = Field(..., description="Blockchain transaction status", title="tx_status") - wallet: str = Field(..., description="Wallet address (owner) of the subaccount", title="wallet") - - -class PrivateGetRfqsParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - from_timestamp: int = Field( - 0, - description="Earliest `last_update_timestamp` to filter by (in ms since Unix epoch). If not provied, defaults to 0.", - title="from_timestamp", - ) - page: int = Field( - 1, - description="Page number of results to return (default 1, returns last if above `num_pages`)", - title="page", - ) - page_size: int = Field( - 100, - description="Number of results per page (default 100, max 1000)", - title="page_size", - ) - rfq_id: Optional[UUID] = Field(None, description="RFQ ID filter, if applicable", title="rfq_id") - status: Optional[Status1] = Field(None, description="RFQ status filter, if applicable", title="status") - subaccount_id: int = Field( - ..., - description="Subaccount ID for auth purposes, returned data will be scoped to this subaccount.", - title="subaccount_id", - ) - to_timestamp: int = Field( - 18446744073709552000, - description="Latest `last_update_timestamp` to filter by (in ms since Unix epoch). If not provied, defaults to returning all data up to current time.", - title="to_timestamp", - ) +@dataclass +class SignatureDetailsSchema: + nonce: int + signature: str + signature_expiry_sec: int + signer: str -RFQResultSchema = PrivateSendRfqResultSchema +@dataclass +class TransferDetailsSchema: + address: str + amount: Decimal + sub_id: int -class SignatureDetailsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - nonce: int = Field( - ..., - description="Unique nonce defined as (e.g. 1695836058725001, where 001 is the random number)", - title="nonce", - ) - signature: str = Field(..., description="Ethereum signature of the transfer", title="signature") - signature_expiry_sec: int = Field( - ..., - description="Unix timestamp in seconds. Expiry MUST be >5min from now", - title="signature_expiry_sec", - ) - signer: str = Field( - ..., - description="Ethereum wallet address that is signing the transfer", - title="signer", - ) +@dataclass +class PrivateTransferErc20ResultSchema(PrivateCreateSubaccountResultSchema): + pass -class TransferDetailsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - address: str = Field( - ..., - description="Ethereum address of the asset being transferred", - title="address", - ) - amount: Decimal = Field(..., description="Amount to transfer", title="amount") - sub_id: int = Field(..., description="Sub ID of the asset being transferred", title="sub_id") +@dataclass +class PrivateSendQuoteParamsSchema: + direction: Direction + legs: List[LegPricedSchema] + max_fee: Decimal + nonce: int + rfq_id: str + signature: str + signature_expiry_sec: int + signer: str + subaccount_id: int + label: str = "" + mmp: bool = False -class PrivateTransferErc20ResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - status: str = Field(..., description="`requested`", title="status") - transaction_id: UUID = Field(..., description="Transaction id of the transfer", title="transaction_id") +@dataclass +class PrivateSendQuoteResultSchema(QuoteResultSchema): + pass -class PrivateSendQuoteParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - direction: Direction = Field( - ..., - description="Quote direction, `buy` means trading each leg at its direction, `sell` means trading each leg in the opposite direction.", - title="direction", - ) - label: str = Field("", description="Optional user-defined label for the quote", title="label") - legs: List[LegPricedSchema] = Field(..., description="Quote legs", title="legs") - max_fee: Decimal = Field( - ..., - description="Max fee ($ for the full trade). Request will be rejected if the supplied max fee is below the estimated fee for this trade.", - title="max_fee", - ) - mmp: bool = Field( - False, - description="Whether the quote is tagged for market maker protections (default false)", - title="mmp", - ) - nonce: int = Field( - ..., - description="Unique nonce defined as a concatenated `UTC timestamp in ms` and `random number up to 6 digits` (e.g. 1695836058725001, where 001 is the random number)", - title="nonce", - ) - rfq_id: UUID = Field(..., description="RFQ ID the quote is for", title="rfq_id") - signature: str = Field(..., description="Ethereum signature of the quote", title="signature") - signature_expiry_sec: int = Field( - ..., - description="Unix timestamp in seconds. Expiry MUST be at least 310 seconds from now. Once time till signature expiry reaches 300 seconds, the quote will be considered expired. This buffer is meant to ensure the trade can settle on chain in case of a blockchain congestion.", - title="signature_expiry_sec", - ) - signer: str = Field( - ..., - description="Owner wallet address or registered session key that signed the quote", - title="signer", - ) - subaccount_id: int = Field(..., description="Subaccount ID", title="subaccount_id") +@dataclass +class PrivateCancelTriggerOrderParamsSchema: + order_id: str + subaccount_id: int -PrivateSendQuoteResultSchema = QuoteResultSchema +@dataclass +class PrivateCancelTriggerOrderResultSchema(OrderResponseSchema): + pass -class PrivateCancelTriggerOrderParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - order_id: UUID = Field(..., title="order_id") - subaccount_id: int = Field(..., title="subaccount_id") +@dataclass +class PrivateGetWithdrawalHistoryParamsSchema(PrivateGetLiquidationHistoryParamsSchema): + pass -PrivateCancelTriggerOrderResultSchema = OrderResponseSchema +@dataclass +class WithdrawalSchema: + amount: Decimal + asset: str + error_log: Optional[Dict[str, Any]] + timestamp: int + tx_hash: str + tx_status: TxStatus -PrivateGetWithdrawalHistoryParamsSchema = PrivateGetLiquidationHistoryParamsSchema +@dataclass +class PublicGetOptionSettlementPricesParamsSchema(PublicGetCurrencyParamsSchema): + pass -class WithdrawalSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - amount: Decimal = Field(..., description="Amount withdrawn by the subaccount", title="amount") - asset: str = Field(..., description="Asset withdrawn", title="asset") - error_log: Optional[Dict[str, Any]] = Field(..., description="If failed, error log for reason", title="error_log") - timestamp: int = Field( - ..., - description="Timestamp of the withdrawal (in ms since UNIX epoch)", - title="timestamp", - ) - tx_hash: str = Field( - ..., - description="Hash of the transaction that withdrew the funds", - title="tx_hash", - ) - tx_status: TxStatus = Field( - ..., - description="Status of the transaction that deposited the funds", - title="tx_status", - ) +@dataclass +class ExpiryResponseSchema: + expiry_date: str + price: Optional[Decimal] + utc_expiry_sec: int -class PublicGetOptionSettlementPricesParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - currency: str = Field(..., description="Currency for which to show expiries", title="currency") +@dataclass +class PublicGetMakerProgramScoresParamsSchema: + epoch_start_timestamp: int + program_name: str -class ExpiryResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - expiry_date: str = Field(..., description="Expiry date in `YYYYMMDD` format", title="expiry_date") - price: Optional[Decimal] = Field( - ..., - description="Settlement price will show None if not yet settled onchain", - title="price", - ) - utc_expiry_sec: int = Field(..., description="UTC timestamp of expiry", title="utc_expiry_sec") +@dataclass +class ScoreBreakdownSchema: + coverage_score: Decimal + holder_boost: Decimal + quality_score: Decimal + total_score: Decimal + volume: Decimal + volume_multiplier: Decimal + wallet: str -class PublicGetMakerProgramScoresParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - epoch_start_timestamp: int = Field( - ..., - description="Start timestamp of the program epoch", - title="epoch_start_timestamp", - ) - program_name: str = Field(..., description="Program name", title="program_name") +@dataclass +class PublicBuildRegisterSessionKeyTxParamsSchema: + expiry_sec: int + gas: Optional[int] + nonce: Optional[int] + public_session_key: str + wallet: str -class ScoreBreakdownSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - coverage_score: Decimal = Field( - ..., - description="Coverag component of the score of the account for this program", - title="coverage_score", - ) - holder_boost: Decimal = Field( - ..., - description="A custom account multiplier for the score due to holding tokens", - title="holder_boost", - ) - quality_score: Decimal = Field( - ..., - description="Quality component of the score of the account for this program", - title="quality_score", - ) - total_score: Decimal = Field( - ..., - description="Total score of the account for this program", - title="total_score", - ) - volume: Decimal = Field(..., description="Volume traded by the account for this epoch", title="volume") - volume_multiplier: Decimal = Field( - ..., - description="Multiplier for the volume traded by the account", - title="volume_multiplier", - ) - wallet: str = Field(..., description="Wallet address of the account", title="wallet") +@dataclass +class PublicBuildRegisterSessionKeyTxResultSchema: + tx_params: Dict[str, Any] -class PublicBuildRegisterSessionKeyTxParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - expiry_sec: int = Field(..., description="Expiry of the session key", title="expiry_sec") - gas: Optional[int] = Field( - ..., - description="Gas allowance for transaction. If none, will use estimateGas * 150%", - title="gas", - ) - nonce: Optional[int] = Field( - ..., - description="Wallet's transaction count, If none, will use eth.getTransactionCount()", - title="nonce", - ) - public_session_key: str = Field( - ..., - description="Session key in the form of an Ethereum EOA", - title="public_session_key", - ) - wallet: str = Field(..., description="Ethereum wallet address of account", title="wallet") +@dataclass +class PublicRegisterSessionKeyParamsSchema: + expiry_sec: int + label: str + public_session_key: str + signed_raw_tx: str + wallet: str -class PublicBuildRegisterSessionKeyTxResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - tx_params: Dict[str, Any] = Field( - ..., - description="Transaction params in dictionary form, same as `TxParams` in `web3.py`", - title="tx_params", - ) +@dataclass +class PublicRegisterSessionKeyResultSchema: + label: str + public_session_key: str + transaction_id: str -class PublicRegisterSessionKeyParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - expiry_sec: int = Field(..., description="Expiry of the session key", title="expiry_sec") - label: str = Field(..., description="Ethereum wallet address", title="label") - public_session_key: str = Field( - ..., - description="Session key in the form of an Ethereum EOA", - title="public_session_key", - ) - signed_raw_tx: str = Field( - ..., - description="A signed RLP encoded ETH transaction in form of a hex string (same as `w3.eth.account.sign_transaction(unsigned_tx, private_key).rawTransaction.hex()`)", - title="signed_raw_tx", - ) - wallet: str = Field(..., description="Ethereum wallet address of account", title="wallet") - - -class PublicRegisterSessionKeyResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - label: str = Field(..., description="User-defined session key label", title="label") - public_session_key: str = Field( - ..., - description="Session key in the form of an Ethereum EOA", - title="public_session_key", - ) - transaction_id: UUID = Field(..., description="ID to lookup status of transaction", title="transaction_id") - - -class PrivateGetOrderHistoryParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - page: int = Field( - 1, - description="Page number of results to return (default 1, returns last if above `num_pages`)", - title="page", - ) - page_size: int = Field( - 100, - description="Number of results per page (default 100, max 1000)", - title="page_size", - ) - subaccount_id: int = Field( - ..., - description="Subaccount_id for which to get order history", - title="subaccount_id", - ) +@dataclass +class PrivateGetOrderHistoryParamsSchema: + subaccount_id: int + page: int = 1 + page_size: int = 100 -class PrivateGetOrderHistoryResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - orders: List[OrderResponseSchema] = Field(..., description="List of open orders", title="orders") +@dataclass +class PrivateGetOrderHistoryResultSchema: + orders: List[OrderResponseSchema] pagination: PaginationInfoSchema - subaccount_id: int = Field( - ..., - description="Subaccount_id for which to get open orders", - title="subaccount_id", - ) + subaccount_id: int -class PrivateCancelRfqParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - rfq_id: UUID = Field(..., description="RFQ ID to cancel", title="rfq_id") - subaccount_id: int = Field(..., description="Subaccount ID", title="subaccount_id") +@dataclass +class PrivateCancelRfqParamsSchema: + rfq_id: str + subaccount_id: int -class Result(Enum): +class Result(str, Enum): ok = "ok" -class PrivateCancelRfqResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PrivateCancelRfqResponseSchema: id: Union[str, int] - result: Result = Field( - ..., - description="The result of this method call, `ok` if successful", - title="result", - ) + result: Result -class PrivateCancelBatchRfqsParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - label: Optional[str] = Field(None, description="Cancel RFQs with this label", title="label") - nonce: Optional[int] = Field(None, description="Cancel RFQ with this nonce", title="nonce") - rfq_id: Optional[UUID] = Field(None, description="RFQ ID to cancel", title="rfq_id") - subaccount_id: int = Field(..., description="Subaccount ID", title="subaccount_id") +@dataclass +class PrivateCancelBatchRfqsParamsSchema: + subaccount_id: int + label: Optional[str] = None + nonce: Optional[int] = None + rfq_id: Optional[str] = None -class PrivateCancelBatchRfqsResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - cancelled_ids: List[UUID] = Field(..., description="RFQ IDs of the cancelled RFQs", title="cancelled_ids") +@dataclass +class PrivateCancelBatchRfqsResultSchema: + cancelled_ids: List[str] -class PrivateCancelBatchQuotesParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - label: Optional[str] = Field(None, description="Cancel quotes with this label", title="label") - nonce: Optional[int] = Field(None, description="Cancel quote with this nonce", title="nonce") - quote_id: Optional[UUID] = Field(None, description="Quote ID to cancel", title="quote_id") - rfq_id: Optional[UUID] = Field(None, description="Cancel quotes for this RFQ ID", title="rfq_id") - subaccount_id: int = Field(..., description="Subaccount ID", title="subaccount_id") +@dataclass +class PrivateCancelBatchQuotesParamsSchema: + subaccount_id: int + label: Optional[str] = None + nonce: Optional[int] = None + quote_id: Optional[str] = None + rfq_id: Optional[str] = None -class PrivateCancelBatchQuotesResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - cancelled_ids: List[UUID] = Field(..., description="Quote IDs of the cancelled quotes", title="cancelled_ids") +@dataclass +class PrivateCancelBatchQuotesResultSchema(PrivateCancelBatchRfqsResultSchema): + pass -PublicGetTimeParamsSchema = PublicGetMakerProgramsParamsSchema +@dataclass +class PublicGetTimeParamsSchema(PublicGetMakerProgramsParamsSchema): + pass -class PublicGetTimeResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PublicGetTimeResponseSchema: id: Union[str, int] - result: int = Field(..., description="Current time in milliseconds since UNIX epoch", title="result") - - -class PrivateGetFundingHistoryParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - end_timestamp: int = Field( - 9223372036854776000, - description="End timestamp of the event history (default current time)", - title="end_timestamp", - ) - instrument_name: Optional[str] = Field( - None, - description="Instrument name (returns history for all perpetuals if not provided)", - title="instrument_name", - ) - page: int = Field( - 1, - description="Page number of results to return (default 1, returns last if above `num_pages`)", - title="page", - ) - page_size: int = Field( - 100, - description="Number of results per page (default 100, max 1000)", - title="page_size", - ) - start_timestamp: int = Field( - 0, - description="Start timestamp of the event history (default 0)", - title="start_timestamp", - ) - subaccount_id: int = Field(..., description="Subaccount id", title="subaccount_id") - - -class FundingPaymentSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - funding: Decimal = Field( - ..., - description="Dollar funding paid (if negative) or received (if positive) by the subaccount", - title="funding", - ) - instrument_name: str = Field(..., description="Instrument name", title="instrument_name") - pnl: Decimal = Field(..., description="Cashflow from the perp PnL settlement", title="pnl") - timestamp: int = Field( - ..., - description="Timestamp of the funding payment (in ms since UNIX epoch)", - title="timestamp", - ) + result: int -class PrivateGetOpenOrdersParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - subaccount_id: int = Field( - ..., - description="Subaccount_id for which to get open orders", - title="subaccount_id", - ) +@dataclass +class PrivateGetFundingHistoryParamsSchema: + subaccount_id: int + end_timestamp: int = 9223372036854776000 + instrument_name: Optional[str] = None + page: int = 1 + page_size: int = 100 + start_timestamp: int = 0 -class PrivateGetOpenOrdersResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - orders: List[OrderResponseSchema] = Field(..., description="List of open orders", title="orders") - subaccount_id: int = Field( - ..., - description="Subaccount_id for which to get open orders", - title="subaccount_id", - ) - - -PrivateGetAccountParamsSchema = PrivateGetSubaccountsParamsSchema +@dataclass +class FundingPaymentSchema: + funding: Decimal + instrument_name: str + pnl: Decimal + timestamp: int -class AccountFeeInfoSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - base_fee_discount: Decimal = Field(..., description="Base fee discount", title="base_fee_discount") - option_maker_fee: Optional[Decimal] = Field( - ..., - description="Option maker fee - uses default instrument fee rate if None", - title="option_maker_fee", - ) - option_taker_fee: Optional[Decimal] = Field( - ..., - description="Option taker fee - uses default instrument fee rate if None", - title="option_taker_fee", - ) - perp_maker_fee: Optional[Decimal] = Field( - ..., - description="Perp maker fee - uses default instrument fee rate if None", - title="perp_maker_fee", - ) - perp_taker_fee: Optional[Decimal] = Field( - ..., - description="Perp taker fee - uses default instrument fee rate if None", - title="perp_taker_fee", - ) - rfq_maker_discount: Decimal = Field(..., description="RFQ maker fee discount", title="rfq_maker_discount") - rfq_taker_discount: Decimal = Field(..., description="RFQ taker fee discount", title="rfq_taker_discount") - spot_maker_fee: Optional[Decimal] = Field( - ..., - description="Spot maker fee - uses default instrument fee rate if None", - title="spot_maker_fee", - ) - spot_taker_fee: Optional[Decimal] = Field( - ..., - description="Spot taker fee - uses default instrument fee rate if None", - title="spot_taker_fee", - ) - - -class PublicGetAllInstrumentsParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - currency: Optional[str] = Field( - None, - description="Underlying currency of asset (`ETH`, `BTC`, etc)", - title="currency", - ) - expired: bool = Field(..., description="If `True`: include expired instruments.", title="expired") - instrument_type: InstrumentType = Field(..., description="`erc20`, `option`, or `perp`", title="instrument_type") - page: int = Field( - 1, - description="Page number of results to return (default 1, returns last if above `num_pages`)", - title="page", - ) - page_size: int = Field( - 100, - description="Number of results per page (default 100, max 1000)", - title="page_size", - ) - - -class InstrumentPublicResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - amount_step: Decimal = Field(..., description="Minimum valid increment of order amount", title="amount_step") - base_asset_address: str = Field( - ..., - description="Blockchain address of the base asset", - title="base_asset_address", - ) - base_asset_sub_id: str = Field( - ..., - description="Sub ID of the specific base asset as defined in Asset.sol", - title="base_asset_sub_id", - ) - base_currency: str = Field( - ..., - description="Underlying currency of base asset (`ETH`, `BTC`, etc)", - title="base_currency", - ) - base_fee: Decimal = Field(..., description="$ base fee added to every taker order", title="base_fee") - erc20_details: Optional[ERC20PublicDetailsSchema] = Field(...) - fifo_min_allocation: Decimal = Field( - ..., - description="Minimum number of contracts that get filled using FIFO. Actual number of contracts that gets filled by FIFO will be the max between this value and (1 - pro_rata_fraction) x order_amount, plus any size leftovers due to rounding.", - title="fifo_min_allocation", - ) - instrument_name: str = Field(..., description="Instrument name", title="instrument_name") - instrument_type: InstrumentType = Field(..., description="`erc20`, `option`, or `perp`", title="instrument_type") - is_active: bool = Field( - ..., - description="If `True`: instrument is tradeable within `activation` and `deactivation` timestamps", - title="is_active", - ) - maker_fee_rate: Decimal = Field( - ..., - description="Percent of spot price fee rate for makers", - title="maker_fee_rate", - ) - mark_price_fee_rate_cap: Optional[Decimal] = Field( - None, - description="Percent of option price fee cap, e.g. 12.5%, null if not applicable", - title="mark_price_fee_rate_cap", - ) - maximum_amount: Decimal = Field( - ..., - description="Maximum valid amount of contracts / tokens per trade", - title="maximum_amount", - ) - minimum_amount: Decimal = Field( - ..., - description="Minimum valid amount of contracts / tokens per trade", - title="minimum_amount", - ) - option_details: Optional[OptionPublicDetailsSchema] = Field(...) - perp_details: Optional[PerpPublicDetailsSchema] = Field(...) - pro_rata_amount_step: Decimal = Field( - ..., - description="Pro-rata fill share of every order is rounded down to be a multiple of this number. Leftovers of the order due to rounding are filled FIFO.", - title="pro_rata_amount_step", - ) - pro_rata_fraction: Decimal = Field( - ..., - description="Fraction of order that gets filled using pro-rata matching. If zero, the matching is full FIFO.", - title="pro_rata_fraction", - ) - quote_currency: str = Field( - ..., - description="Quote currency (`USD` for perps, `USDC` for options)", - title="quote_currency", - ) - scheduled_activation: int = Field( - ..., - description="Timestamp at which became or will become active (if applicable)", - title="scheduled_activation", - ) - scheduled_deactivation: int = Field( - ..., - description="Scheduled deactivation time for instrument (if applicable)", - title="scheduled_deactivation", - ) - taker_fee_rate: Decimal = Field( - ..., - description="Percent of spot price fee rate for takers", - title="taker_fee_rate", - ) - tick_size: Decimal = Field( - ..., - description="Tick size of the instrument, i.e. minimum price increment", - title="tick_size", - ) - - -PublicGetTickerParamsSchema = PublicGetInstrumentParamsSchema - - -class OptionPricingSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - ask_iv: Decimal = Field(..., description="Implied volatility of the current best ask", title="ask_iv") - bid_iv: Decimal = Field(..., description="Implied volatility of the current best bid", title="bid_iv") - delta: Decimal = Field(..., description="Delta of the option", title="delta") - discount_factor: Decimal = Field( - ..., - description="Discount factor used to calculate option premium", - title="discount_factor", - ) - forward_price: Decimal = Field( - ..., - description="Forward price used to calculate option premium", - title="forward_price", - ) - gamma: Decimal = Field(..., description="Gamma of the option", title="gamma") - iv: Decimal = Field(..., description="Implied volatility of the option", title="iv") - mark_price: Decimal = Field(..., description="Mark price of the option", title="mark_price") - rho: Decimal = Field(..., description="Rho of the option", title="rho") - theta: Decimal = Field(..., description="Theta of the option", title="theta") - vega: Decimal = Field(..., description="Vega of the option", title="vega") - - -class AggregateTradingStatsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - contract_volume: Decimal = Field( - ..., - description="Number of contracts traded during last 24 hours", - title="contract_volume", - ) - high: Decimal = Field(..., description="Highest trade price during last 24h", title="high") - low: Decimal = Field(..., description="Lowest trade price during last 24h", title="low") - num_trades: Decimal = Field(..., description="Number of trades during last 24h ", title="num_trades") - open_interest: Decimal = Field(..., description="Current total open interest", title="open_interest") - percent_change: Decimal = Field( - ..., - description="24-hour price change expressed as a percentage. Options: percent change in vol; Perps: percent change in mark price", - title="percent_change", - ) - usd_change: Decimal = Field(..., description="24-hour price change in USD.", title="usd_change") +@dataclass +class PrivateGetOpenOrdersParamsSchema(PrivateGetPositionsParamsSchema): + pass -class PublicGetVaultShareParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - from_timestamp_sec: int = Field(..., description="From timestamp in seconds", title="from_timestamp_sec") - page: int = Field( - 1, - description="Page number of results to return (default 1, returns last if above `num_pages`)", - title="page", - ) - page_size: int = Field( - 100, - description="Number of results per page (default 100, max 1000)", - title="page_size", - ) - to_timestamp_sec: int = Field(..., description="To timestamp in seconds", title="to_timestamp_sec") - vault_name: str = Field(..., description="Name of the vault", title="vault_name") +@dataclass +class PrivateGetOpenOrdersResultSchema: + orders: List[OrderResponseSchema] + subaccount_id: int -class VaultShareResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - base_value: Decimal = Field( - ..., - description="The value of the vault's token against the base currency. Ex: rswETHC vs rswETH", - title="base_value", - ) - block_number: int = Field(..., description="The Derive chain block number", title="block_number") - block_timestamp: int = Field( - ..., - description="Timestamp of the Derive chain block number", - title="block_timestamp", - ) - underlying_value: Optional[Decimal] = Field( - ..., - description="The value of the vault's token against the underlying currency. Ex: rswETHC vs ETH", - title="underlying_value", - ) - usd_value: Decimal = Field(..., description="The value of the vault's token against USD", title="usd_value") +@dataclass +class PrivateGetAccountParamsSchema(PrivateGetSubaccountsParamsSchema): + pass -PrivateGetCollateralsParamsSchema = PrivateGetPositionsParamsSchema +@dataclass +class AccountFeeInfoSchema: + base_fee_discount: Decimal + option_maker_fee: Optional[Decimal] + option_taker_fee: Optional[Decimal] + perp_maker_fee: Optional[Decimal] + perp_taker_fee: Optional[Decimal] + rfq_maker_discount: Decimal + rfq_taker_discount: Decimal + spot_maker_fee: Optional[Decimal] + spot_taker_fee: Optional[Decimal] + + +@dataclass +class PublicGetAllInstrumentsParamsSchema: + expired: bool + instrument_type: InstrumentType + currency: Optional[str] = None + page: int = 1 + page_size: int = 100 + + +@dataclass +class InstrumentPublicResponseSchema: + amount_step: Decimal + base_asset_address: str + base_asset_sub_id: str + base_currency: str + base_fee: Decimal + erc20_details: Optional[ERC20PublicDetailsSchema] + fifo_min_allocation: Decimal + instrument_name: str + instrument_type: InstrumentType + is_active: bool + maker_fee_rate: Decimal + maximum_amount: Decimal + minimum_amount: Decimal + option_details: Optional[OptionPublicDetailsSchema] + perp_details: Optional[PerpPublicDetailsSchema] + pro_rata_amount_step: Decimal + pro_rata_fraction: Decimal + quote_currency: str + scheduled_activation: int + scheduled_deactivation: int + taker_fee_rate: Decimal + tick_size: Decimal + mark_price_fee_rate_cap: Optional[Decimal] = None + + +@dataclass +class PublicGetTickerParamsSchema(PublicGetInstrumentParamsSchema): + pass -class CollateralResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - amount: Decimal = Field(..., description="Asset amount of given collateral", title="amount") - amount_step: Decimal = Field(..., description="Minimum amount step for the collateral", title="amount_step") - asset_name: str = Field(..., description="Asset name", title="asset_name") - asset_type: InstrumentType = Field( - ..., - description="Type of asset collateral (currently always `erc20`)", - title="asset_type", - ) - average_price: Decimal = Field( - ..., - description="Average price of the collateral, 0 for USDC.", - title="average_price", - ) - average_price_excl_fees: Decimal = Field( - ..., - description="Average price of whole position excluding fees", - title="average_price_excl_fees", - ) - creation_timestamp: int = Field( - ..., - description="Timestamp of when the position was opened (in ms since Unix epoch)", - title="creation_timestamp", - ) - cumulative_interest: Decimal = Field( - ..., - description="Cumulative interest earned on supplying collateral or paid for borrowing", - title="cumulative_interest", - ) - currency: str = Field( - ..., - description="Underlying currency of asset (`ETH`, `BTC`, etc)", - title="currency", - ) - delta: Decimal = Field(..., description="Asset delta w.r.t. the delta currency", title="delta") - delta_currency: str = Field( - ..., - description="Currency with respect to which delta is reported.For example, LRTs like WEETH have their delta reported in ETH", - title="delta_currency", - ) - initial_margin: Decimal = Field( - ..., - description="USD value of collateral that contributes to initial margin", - title="initial_margin", - ) - maintenance_margin: Decimal = Field( - ..., - description="USD value of collateral that contributes to maintenance margin", - title="maintenance_margin", - ) - mark_price: Decimal = Field(..., description="Current mark price of the asset", title="mark_price") - mark_value: Decimal = Field( - ..., - description="USD value of the collateral (amount * mark price)", - title="mark_value", - ) - open_orders_margin: Decimal = Field( - ..., - description="USD margin requirement for all open orders for this asset / instrument", - title="open_orders_margin", - ) - pending_interest: Decimal = Field( - ..., - description="Portion of interest that has not yet been settled on-chain. This number is added to the portfolio value for margin calculations purposes.", - title="pending_interest", - ) - realized_pnl: Decimal = Field( - ..., - description="Realized trading profit or loss of the collateral, 0 for USDC.", - title="realized_pnl", - ) - realized_pnl_excl_fees: Decimal = Field( - ..., - description="Realized trading profit or loss of the position excluding fees", - title="realized_pnl_excl_fees", - ) - total_fees: Decimal = Field( - ..., - description="Total fees paid for opening and changing the position", - title="total_fees", - ) - unrealized_pnl: Decimal = Field( - ..., - description="Unrealized trading profit or loss of the collateral, 0 for USDC.", - title="unrealized_pnl", - ) - unrealized_pnl_excl_fees: Decimal = Field( - ..., - description="Unrealized trading profit or loss of the position excluding fees", - title="unrealized_pnl_excl_fees", - ) +@dataclass +class OptionPricingSchema: + ask_iv: Decimal + bid_iv: Decimal + delta: Decimal + discount_factor: Decimal + forward_price: Decimal + gamma: Decimal + iv: Decimal + mark_price: Decimal + rho: Decimal + theta: Decimal + vega: Decimal + + +@dataclass +class AggregateTradingStatsSchema: + contract_volume: Decimal + high: Decimal + low: Decimal + num_trades: Decimal + open_interest: Decimal + percent_change: Decimal + usd_change: Decimal + + +@dataclass +class PublicGetVaultShareParamsSchema: + from_timestamp_sec: int + to_timestamp_sec: int + vault_name: str + page: int = 1 + page_size: int = 100 + + +@dataclass +class VaultShareResponseSchema: + base_value: Decimal + block_number: int + block_timestamp: int + underlying_value: Optional[Decimal] + usd_value: Decimal + + +@dataclass +class PrivateGetCollateralsParamsSchema(PrivateGetPositionsParamsSchema): + pass -class Scope(Enum): +@dataclass +class CollateralResponseSchema: + amount: Decimal + amount_step: Decimal + asset_name: str + asset_type: InstrumentType + average_price: Decimal + average_price_excl_fees: Decimal + creation_timestamp: int + cumulative_interest: Decimal + currency: str + delta: Decimal + delta_currency: str + initial_margin: Decimal + maintenance_margin: Decimal + mark_price: Decimal + mark_value: Decimal + open_orders_margin: Decimal + pending_interest: Decimal + realized_pnl: Decimal + realized_pnl_excl_fees: Decimal + total_fees: Decimal + unrealized_pnl: Decimal + unrealized_pnl_excl_fees: Decimal + + +class Scope(str, Enum): admin = "admin" account = "account" read_only = "read_only" -class PrivateRegisterScopedSessionKeyParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - expiry_sec: int = Field(..., description="Expiry of the session key", title="expiry_sec") - ip_whitelist: Optional[List[str]] = Field( - None, - description="List of whitelisted IPs, if empty then any IP is allowed.", - title="ip_whitelist", - ) - label: Optional[str] = Field(None, description="User-defined session key label", title="label") - public_session_key: str = Field( - ..., - description="Session key in the form of an Ethereum EOA", - title="public_session_key", - ) - scope: Scope = Field( - "read_only", - description="Scope of the session key. Defaults to READ_ONLY level permissions. ", - title="scope", - ) - signed_raw_tx: Optional[str] = Field( - None, - description="A signed RLP encoded ETH transaction in form of a hex string (same as `w3.eth.account.sign_transaction(unsigned_tx, private_key).rawTransaction.hex()`) Must be included if the scope is ADMIN.", - title="signed_raw_tx", - ) - wallet: str = Field(..., description="Ethereum wallet address of account", title="wallet") - - -class PrivateRegisterScopedSessionKeyResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - expiry_sec: int = Field(..., description="Session key expiry timestamp in sec", title="expiry_sec") - ip_whitelist: Optional[List[str]] = Field( - ..., - description="List of whitelisted IPs, if empty then any IP is allowed.", - title="ip_whitelist", - ) - label: Optional[str] = Field(..., description="User-defined session key label", title="label") - public_session_key: str = Field( - ..., - description="Session key in the form of an Ethereum EOA", - title="public_session_key", - ) - scope: Scope = Field(..., description="Session key permission level scope", title="scope") - transaction_id: Optional[UUID] = Field( - ..., - description="ID to lookup status of transaction if signed_raw_tx is provided", - title="transaction_id", - ) +@dataclass +class PrivateRegisterScopedSessionKeyParamsSchema: + expiry_sec: int + public_session_key: str + wallet: str + ip_whitelist: Optional[List[str]] = None + label: Optional[str] = None + scope: Scope = Scope.read_only + signed_raw_tx: Optional[str] = None -class PrivateExpiredAndCancelledHistoryParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - end_timestamp: int = Field(..., description="End Unix timestamp", title="end_timestamp") - expiry: int = Field( - ..., - description="Expiry of download link in seconds. Maximum of 604800.", - title="expiry", - ) - start_timestamp: int = Field(..., description="Start Unix timestamp", title="start_timestamp") - subaccount_id: int = Field(..., description="Subaccount to download data for", title="subaccount_id") - wallet: str = Field(..., description="Wallet to download data for", title="wallet") +@dataclass +class PrivateRegisterScopedSessionKeyResultSchema: + expiry_sec: int + ip_whitelist: Optional[List[str]] + label: Optional[str] + public_session_key: str + scope: Scope + transaction_id: Optional[str] -class PrivateExpiredAndCancelledHistoryResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - presigned_urls: List[str] = Field( - ..., - description="List of presigned URLs to the snapshots", - title="presigned_urls", - ) - +@dataclass +class PrivateExpiredAndCancelledHistoryParamsSchema: + end_timestamp: int + expiry: int + start_timestamp: int + subaccount_id: int + wallet: str -PrivateSessionKeysParamsSchema = PrivateGetSubaccountsParamsSchema +@dataclass +class PrivateExpiredAndCancelledHistoryResultSchema: + presigned_urls: List[str] -SessionKeyResponseSchema = PrivateEditSessionKeyResultSchema - -class PrivateGetMmpConfigParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - currency: Optional[str] = Field( - None, - description="Currency to get the config for. If not provided, returns all configs for the subaccount", - title="currency", - ) - subaccount_id: int = Field( - ..., - description="Subaccount_id for which to get the config", - title="subaccount_id", - ) - - -class MMPConfigResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - currency: str = Field(..., description="Currency of this mmp config", title="currency") - is_frozen: bool = Field(..., description="Whether the subaccount is currently frozen", title="is_frozen") - mmp_amount_limit: Decimal = Field( - "0", - description="Maximum total order amount that can be traded within the mmp_interval across all instruments of the provided currency. The amounts are not netted, so a filled bid of 1 and a filled ask of 2 would count as 3.
Default: 0 (no limit)", - title="mmp_amount_limit", - ) - mmp_delta_limit: Decimal = Field( - "0", - description="Maximum total delta that can be traded within the mmp_interval across all instruments of the provided currency. This quantity is netted, so a filled order with +1 delta and a filled order with -2 delta would count as -1
Default: 0 (no limit)", - title="mmp_delta_limit", - ) - mmp_frozen_time: int = Field( - ..., - description="Time interval in ms setting how long the subaccount is frozen after an mmp trigger, if 0 then a manual reset would be required via private/reset_mmp", - title="mmp_frozen_time", - ) - mmp_interval: int = Field( - ..., - description="Time interval in ms over which the limits are monotored, if 0 then mmp is disabled", - title="mmp_interval", - ) - mmp_unfreeze_time: int = Field( - ..., - description="Timestamp in ms after which the subaccount will be unfrozen", - title="mmp_unfreeze_time", - ) - subaccount_id: int = Field( - ..., - description="Subaccount_id for which to set the config", - title="subaccount_id", - ) - - -PrivateOrderParamsSchema = PrivateOrderDebugParamsSchema - - -class PrivateOrderResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - order: OrderResponseSchema - trades: List[TradeResponseSchema] = Field(..., title="trades") - - -PrivateGetSubaccountParamsSchema = PrivateGetPositionsParamsSchema +@dataclass +class PrivateSessionKeysParamsSchema(PrivateGetSubaccountsParamsSchema): + pass -class PrivateGetSubaccountResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - collaterals: List[CollateralResponseSchema] = Field( - ..., - description="All collaterals that count towards margin of subaccount", - title="collaterals", - ) - collaterals_initial_margin: Decimal = Field( - ..., - description="Total initial margin credit contributed by collaterals", - title="collaterals_initial_margin", - ) - collaterals_maintenance_margin: Decimal = Field( - ..., - description="Total maintenance margin credit contributed by collaterals", - title="collaterals_maintenance_margin", - ) - collaterals_value: Decimal = Field( - ..., - description="Total mark-to-market value of all collaterals", - title="collaterals_value", - ) - currency: str = Field(..., description="Currency of subaccount", title="currency") - initial_margin: Decimal = Field( - ..., - description="Total initial margin requirement of all positions and collaterals.Trades will be rejected if this value falls below zero after the trade.", - title="initial_margin", - ) - is_under_liquidation: bool = Field( - ..., - description="Whether the subaccount is undergoing a liquidation auction", - title="is_under_liquidation", - ) - label: str = Field(..., description="User defined label", title="label") - maintenance_margin: Decimal = Field( - ..., - description="Total maintenance margin requirement of all positions and collaterals.If this value falls below zero, the subaccount will be flagged for liquidation.", - title="maintenance_margin", - ) - margin_type: MarginType = Field( - ..., - description="Margin type of subaccount (`PM` (Portfolio Margin), `PM2 (Portfolio Margin 2), or `SM` (Standard Margin))", - title="margin_type", - ) - open_orders: List[OrderResponseSchema] = Field( - ..., description="All open orders of subaccount", title="open_orders" - ) - open_orders_margin: Decimal = Field( - ..., - description="Total margin requirement of all open orders.Orders will be rejected if this value plus initial margin are below zero after the order.", - title="open_orders_margin", - ) - positions: List[PositionResponseSchema] = Field( - ..., description="All active positions of subaccount", title="positions" - ) - positions_initial_margin: Decimal = Field( - ..., - description="Total initial margin requirement of all positions", - title="positions_initial_margin", - ) - positions_maintenance_margin: Decimal = Field( - ..., - description="Total maintenance margin requirement of all positions", - title="positions_maintenance_margin", - ) - positions_value: Decimal = Field( - ..., - description="Total mark-to-market value of all positions", - title="positions_value", - ) - projected_margin_change: Decimal = Field( - ..., - description="Projected change in maintenance margin requirement between now and projected margin at 8:01 UTC. If this value plus current maintenance margin ise below zero, the account is at risk of being flagged for liquidation right after the upcoming expiry.", - title="projected_margin_change", - ) - subaccount_id: int = Field(..., description="Subaccount_id", title="subaccount_id") - subaccount_value: Decimal = Field( - ..., - description="Total mark-to-market value of all positions and collaterals", - title="subaccount_value", - ) +@dataclass +class SessionKeyResponseSchema(PrivateEditSessionKeyResultSchema): + pass -class PublicGetInterestRateHistoryParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - from_timestamp_sec: int = Field(..., description="From timestamp in seconds", title="from_timestamp_sec") - page: int = Field( - 1, - description="Page number of results to return (default 1, returns last if above `num_pages`)", - title="page", - ) - page_size: int = Field( - 100, - description="Number of results per page (default 100, max 1000)", - title="page_size", - ) - to_timestamp_sec: int = Field(..., description="To timestamp in seconds", title="to_timestamp_sec") +@dataclass +class PrivateGetMmpConfigParamsSchema: + subaccount_id: int + currency: Optional[str] = None -class InterestRateHistoryResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - block: int = Field(..., description="Derive Chain block number", title="block") - borrow_apy: Decimal = Field(..., description="Borrow APY", title="borrow_apy") - supply_apy: Decimal = Field(..., description="Supply APY", title="supply_apy") - timestamp_sec: int = Field(..., description="Timestamp in seconds", title="timestamp_sec") - total_borrow: Decimal = Field(..., description="Total USDC borrowed", title="total_borrow") - total_supply: Decimal = Field(..., description="Total USDC supplied", title="total_supply") +@dataclass +class MMPConfigResultSchema: + currency: str + is_frozen: bool + mmp_frozen_time: int + mmp_interval: int + mmp_unfreeze_time: int + subaccount_id: int + mmp_amount_limit: Decimal = "0" + mmp_delta_limit: Decimal = "0" -class PrivateGetAllPortfoliosParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - wallet: str = Field(..., description="Wallet address", title="wallet") +@dataclass +class PrivateOrderParamsSchema(PrivateOrderDebugParamsSchema): + pass -class PrivateGetAllPortfoliosResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - id: Union[str, int] - result: List[PrivateGetSubaccountResultSchema] = Field(..., description="", title="result") +@dataclass +class PrivateOrderResultSchema: + order: OrderResponseSchema + trades: List[TradeResponseSchema] -class PublicGetLiquidationHistoryParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - end_timestamp: int = Field( - 9223372036854776000, - description="End timestamp of the event history (default current time)", - title="end_timestamp", - ) - page: int = Field( - 1, - description="Page number of results to return (default 1, returns last if above `num_pages`)", - title="page", - ) - page_size: int = Field( - 100, - description="Number of results per page (default 100, max 1000)", - title="page_size", - ) - start_timestamp: int = Field( - 0, - description="Start timestamp of the event history (default 0)", - title="start_timestamp", - ) - subaccount_id: Optional[int] = Field(None, description="(Optional) Subaccount ID", title="subaccount_id") +@dataclass +class PrivateGetSubaccountParamsSchema(PrivateGetPositionsParamsSchema): + pass -class PublicDepositDebugParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - amount: Decimal = Field(..., description="Amount of the asset to deposit", title="amount") - asset_name: str = Field(..., description="Name of asset to deposit", title="asset_name") - is_atomic_signing: bool = Field( - False, - description="Used by vaults to determine whether the signature is an EIP-1271 signature", - title="is_atomic_signing", - ) - nonce: int = Field( - ..., - description="Unique nonce defined as (e.g. 1695836058725001, where 001 is the random number)", - title="nonce", - ) - signature_expiry_sec: int = Field( - ..., - description="Unix timestamp in seconds. Expiry MUST be >5min from now", - title="signature_expiry_sec", - ) - signer: str = Field( - ..., - description="Ethereum wallet address that is signing the deposit", - title="signer", - ) - subaccount_id: int = Field(..., description="Subaccount_id", title="subaccount_id") +@dataclass +class PrivateGetSubaccountResultSchema: + collaterals: List[CollateralResponseSchema] + collaterals_initial_margin: Decimal + collaterals_maintenance_margin: Decimal + collaterals_value: Decimal + currency: str + initial_margin: Decimal + is_under_liquidation: bool + label: str + maintenance_margin: Decimal + margin_type: MarginType + open_orders: List[OrderResponseSchema] + open_orders_margin: Decimal + positions: List[PositionResponseSchema] + positions_initial_margin: Decimal + positions_maintenance_margin: Decimal + positions_value: Decimal + projected_margin_change: Decimal + subaccount_id: int + subaccount_value: Decimal + + +@dataclass +class PublicGetInterestRateHistoryParamsSchema: + from_timestamp_sec: int + to_timestamp_sec: int + page: int = 1 + page_size: int = 100 + + +@dataclass +class InterestRateHistoryResponseSchema: + block: int + borrow_apy: Decimal + supply_apy: Decimal + timestamp_sec: int + total_borrow: Decimal + total_supply: Decimal + + +@dataclass +class PrivateGetAllPortfoliosParamsSchema(PrivateGetSubaccountsParamsSchema): + pass -PublicDepositDebugResultSchema = PublicCreateSubaccountDebugResultSchema +@dataclass +class PrivateGetAllPortfoliosResponseSchema: + id: Union[str, int] + result: List[PrivateGetSubaccountResultSchema] -class PublicGetVaultBalancesParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - smart_contract_owner: Optional[str] = Field( - None, - description="If wallet not provided, can query balances by EOA that owns smart contract wallet", - title="smart_contract_owner", - ) - wallet: Optional[str] = Field(None, description="Ethereum wallet address of smart contract", title="wallet") +@dataclass +class PublicGetLiquidationHistoryParamsSchema: + end_timestamp: int = 9223372036854776000 + page: int = 1 + page_size: int = 100 + start_timestamp: int = 0 + subaccount_id: Optional[int] = None -class VaultBalanceResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - address: str = Field(..., title="address") - amount: Decimal = Field(..., title="amount") - chain_id: int = Field(..., title="chain_id") - name: str = Field(..., title="name") - vault_asset_type: str = Field(..., title="vault_asset_type") +@dataclass +class PublicDepositDebugParamsSchema: + amount: Decimal + asset_name: str + nonce: int + signature_expiry_sec: int + signer: str + subaccount_id: int + is_atomic_signing: bool = False -class PublicGetReferralPerformanceParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - end_ms: int = Field(..., description="End timestamp in UTC milliseconds", title="end_ms") - referral_code: Optional[str] = Field(None, description="(Optional) referral code", title="referral_code") - start_ms: int = Field(..., description="Start timestamp in UTC milliseconds", title="start_ms") - wallet: Optional[str] = Field(None, description="(Optional) wallet of the referrer", title="wallet") +@dataclass +class PublicDepositDebugResultSchema(PublicCreateSubaccountDebugResultSchema): + pass -class ReferralPerformanceByInstrumentTypeSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - fee_reward: Decimal = Field(..., description="Fee reward to referrer", title="fee_reward") - notional_volume: Decimal = Field(..., description="Notional volume", title="notional_volume") - referred_fee: Decimal = Field(..., description="Fees paid by referred trader", title="referred_fee") +@dataclass +class PublicGetVaultBalancesParamsSchema: + smart_contract_owner: Optional[str] = None + wallet: Optional[str] = None -class PrivateSetCancelOnDisconnectParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - enabled: bool = Field( - ..., - description="Whether to enable or disable cancel on disconnect", - title="enabled", - ) - wallet: str = Field(..., description="Public key (wallet) of the account", title="wallet") +@dataclass +class VaultBalanceResponseSchema: + address: str + amount: Decimal + chain_id: int + name: str + vault_asset_type: str -class PrivateSetCancelOnDisconnectResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - id: Union[str, int] - result: Result = Field(..., description="", title="result") +@dataclass +class PublicGetReferralPerformanceParamsSchema: + end_ms: int + start_ms: int + referral_code: Optional[str] = None + wallet: Optional[str] = None -class PrivateCancelQuoteParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - quote_id: UUID = Field(..., description="Quote ID to cancel", title="quote_id") - subaccount_id: int = Field(..., description="Subaccount ID", title="subaccount_id") +@dataclass +class ReferralPerformanceByInstrumentTypeSchema: + fee_reward: Decimal + notional_volume: Decimal + referred_fee: Decimal -PrivateCancelQuoteResultSchema = QuoteResultSchema +@dataclass +class PrivateSetCancelOnDisconnectParamsSchema: + enabled: bool + wallet: str -class PrivateGetQuotesParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - from_timestamp: int = Field( - 0, - description="Earliest timestamp to filter by (in ms since Unix epoch). If not provied, defaults to 0.", - title="from_timestamp", - ) - page: int = Field( - 1, - description="Page number of results to return (default 1, returns last if above `num_pages`)", - title="page", - ) - page_size: int = Field( - 100, - description="Number of results per page (default 100, max 1000)", - title="page_size", - ) - quote_id: Optional[UUID] = Field(None, description="Quote ID filter, if applicable", title="quote_id") - rfq_id: Optional[UUID] = Field(None, description="RFQ ID filter, if applicable", title="rfq_id") - status: Optional[Status1] = Field(None, description="Quote status filter, if applicable", title="status") - subaccount_id: int = Field( - ..., - description="Subaccount ID for auth purposes, returned data will be scoped to this subaccount.", - title="subaccount_id", - ) - to_timestamp: int = Field( - 18446744073709552000, - description="Latest timestamp to filter by (in ms since Unix epoch). If not provied, defaults to returning all data up to current time.", - title="to_timestamp", - ) +@dataclass +class PrivateSetCancelOnDisconnectResponseSchema(PrivateCancelRfqResponseSchema): + pass -class PrivateGetQuotesResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - pagination: PaginationInfoSchema - quotes: List[QuoteResultSchema] = Field(..., description="Quotes matching filter criteria", title="quotes") +@dataclass +class PrivateCancelQuoteParamsSchema: + quote_id: str + subaccount_id: int -class PublicExecuteQuoteDebugParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - direction: Direction = Field( - ..., - description="Quote direction, `buy` means trading each leg at its direction, `sell` means trading each leg in the opposite direction.", - title="direction", - ) - enable_taker_protection: bool = Field( - False, - description="Whether taker protection is enabled for the quote", - title="enable_taker_protection", - ) - label: str = Field("", description="Optional user-defined label for the quote", title="label") - legs: List[LegPricedSchema] = Field(..., description="Quote legs", title="legs") - max_fee: Decimal = Field( - ..., - description="Max fee ($ for the full trade). Request will be rejected if the supplied max fee is below the estimated fee for this trade.", - title="max_fee", - ) - nonce: int = Field( - ..., - description="Unique nonce defined as a concatenated `UTC timestamp in ms` and `random number up to 6 digits` (e.g. 1695836058725001, where 001 is the random number)", - title="nonce", - ) - quote_id: UUID = Field(..., description="Quote ID to execute against", title="quote_id") - rfq_id: UUID = Field( - ..., - description="RFQ ID to execute (must be sent by `subaccount_id`)", - title="rfq_id", - ) - signature: str = Field(..., description="Ethereum signature of the quote", title="signature") - signature_expiry_sec: int = Field( - ..., - description="Unix timestamp in seconds. Expiry MUST be at least 310 seconds from now. Once time till signature expiry reaches 300 seconds, the quote will be considered expired. This buffer is meant to ensure the trade can settle on chain in case of a blockchain congestion.", - title="signature_expiry_sec", - ) - signer: str = Field( - ..., - description="Owner wallet address or registered session key that signed the quote", - title="signer", - ) - subaccount_id: int = Field(..., description="Subaccount ID", title="subaccount_id") +@dataclass +class PrivateCancelQuoteResultSchema(QuoteResultSchema): + pass -class PublicExecuteQuoteDebugResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - action_hash: str = Field(..., description="Keccak hashed action data", title="action_hash") - encoded_data: str = Field(..., description="ABI encoded deposit data", title="encoded_data") - encoded_data_hashed: str = Field(..., description="Keccak hashed encoded_data", title="encoded_data_hashed") - encoded_legs: str = Field(..., description="ABI encoded legs data", title="encoded_legs") - legs_hash: str = Field(..., description="Keccak hashed legs data", title="legs_hash") - typed_data_hash: str = Field(..., description="EIP 712 typed data hash", title="typed_data_hash") +@dataclass +class PrivateGetQuotesParamsSchema: + subaccount_id: int + from_timestamp: int = 0 + page: int = 1 + page_size: int = 100 + quote_id: Optional[str] = None + rfq_id: Optional[str] = None + status: Optional[Status1] = None + to_timestamp: int = 18446744073709552000 -class PrivateGetOptionSettlementHistoryParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - subaccount_id: int = Field( - ..., - description="Subaccount ID for which to get expired option settlement history", - title="subaccount_id", - ) +@dataclass +class PrivateGetQuotesResultSchema: + pagination: PaginationInfoSchema + quotes: List[QuoteResultSchema] + + +@dataclass +class PublicExecuteQuoteDebugParamsSchema: + direction: Direction + legs: List[LegPricedSchema] + max_fee: Decimal + nonce: int + quote_id: str + rfq_id: str + signature: str + signature_expiry_sec: int + signer: str + subaccount_id: int + enable_taker_protection: bool = False + label: str = "" + + +@dataclass +class PublicExecuteQuoteDebugResultSchema: + action_hash: str + encoded_data: str + encoded_data_hashed: str + encoded_legs: str + legs_hash: str + typed_data_hash: str + + +@dataclass +class PrivateGetOptionSettlementHistoryParamsSchema(PrivateGetPositionsParamsSchema): + pass -class OptionSettlementResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - amount: Decimal = Field(..., description="Amount that was settled", title="amount") - expiry: int = Field(..., description="Expiry timestamp of the option", title="expiry") - instrument_name: str = Field(..., description="Instrument name", title="instrument_name") - option_settlement_pnl: Decimal = Field( - ..., - description="USD profit or loss from option settlements calculated as: settlement value - (average cost including fees x amount)", - title="option_settlement_pnl", - ) - option_settlement_pnl_excl_fees: Decimal = Field( - ..., - description="USD profit or loss from option settlements calculated as: settlement value - (average price excluding fees x amount)", - title="option_settlement_pnl_excl_fees", - ) - settlement_price: Decimal = Field(..., description="Price of option settlement", title="settlement_price") - subaccount_id: int = Field(..., description="Subaccount ID of the settlement event", title="subaccount_id") +@dataclass +class OptionSettlementResponseSchema: + amount: Decimal + expiry: int + instrument_name: str + option_settlement_pnl: Decimal + option_settlement_pnl_excl_fees: Decimal + settlement_price: Decimal + subaccount_id: int -class PrivateResetMmpParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - currency: Optional[str] = Field( - None, - description="Currency to reset the mmp for. If not provided, resets all configs for the subaccount", - title="currency", - ) - subaccount_id: int = Field( - ..., - description="Subaccount_id for which to reset the mmp state", - title="subaccount_id", - ) +@dataclass +class PrivateResetMmpParamsSchema(PrivateGetMmpConfigParamsSchema): + pass -PrivateResetMmpResponseSchema = PrivateCancelRfqResponseSchema +@dataclass +class PrivateResetMmpResponseSchema(PrivateCancelRfqResponseSchema): + pass -PrivateGetErc20TransferHistoryParamsSchema = PrivateGetLiquidationHistoryParamsSchema +@dataclass +class PrivateGetErc20TransferHistoryParamsSchema( + PrivateGetLiquidationHistoryParamsSchema +): + pass -class ERC20TransferSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - amount: Decimal = Field(..., description="Amount withdrawn by the subaccount", title="amount") - asset: str = Field(..., description="Asset withdrawn", title="asset") - counterparty_subaccount_id: int = Field( - ..., - description="Recipient or sender subaccount_id of transfer", - title="counterparty_subaccount_id", - ) - is_outgoing: bool = Field( - ..., - description="True if the transfer was initiated by the subaccount, False otherwise", - title="is_outgoing", - ) - timestamp: int = Field( - ..., - description="Timestamp of the transfer (in ms since UNIX epoch)", - title="timestamp", - ) - tx_hash: str = Field( - ..., - description="Hash of the transaction that withdrew the funds", - title="tx_hash", - ) +@dataclass +class ERC20TransferSchema: + amount: Decimal + asset: str + counterparty_subaccount_id: int + is_outgoing: bool + timestamp: int + tx_hash: str -PublicGetAllCurrenciesParamsSchema = PublicGetMakerProgramsParamsSchema +@dataclass +class PublicGetAllCurrenciesParamsSchema(PublicGetMakerProgramsParamsSchema): + pass -class CurrencyDetailedResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - asset_cap_and_supply_per_manager: Dict[str, Dict[str, List[OpenInterestStatsSchema]]] = Field( - ..., - description="Current open interest and open interest cap by manager and asset type", - title="asset_cap_and_supply_per_manager", - ) - borrow_apy: Decimal = Field(..., description="Borrow APY (only for USDC)", title="borrow_apy") - currency: str = Field( - ..., - description="Underlying currency of asset (`ETH`, `BTC`, etc)", - title="currency", - ) - erc20_details: Optional[Dict[str, Optional[str]]] = Field( - None, - description="Details of the erc20 asset (if applicable)", - title="erc20_details", - ) - instrument_types: List[InstrumentType] = Field( - ..., - description="Instrument types supported for the currency", - title="instrument_types", - ) - managers: List[ManagerContractResponseSchema] = Field( - ..., description="Managers supported for the currency", title="managers" - ) - market_type: MarketType = Field(..., description="Market type of the currency", title="market_type") - pm2_collateral_discounts: List[PM2CollateralDiscountsSchema] = Field( - ..., - description="Initial and Maintenance Margin discounts for given collateral in PM2", - title="pm2_collateral_discounts", - ) +@dataclass +class CurrencyDetailedResponseSchema: + asset_cap_and_supply_per_manager: Dict[ + str, Dict[str, List[OpenInterestStatsSchema]] + ] + borrow_apy: Decimal + currency: str + instrument_types: List[InstrumentType] + managers: List[ManagerContractResponseSchema] + market_type: MarketType + pm2_collateral_discounts: List[PM2CollateralDiscountsSchema] protocol_asset_addresses: ProtocolAssetAddressesSchema - spot_price: Decimal = Field(..., description="Spot price of the currency", title="spot_price") - spot_price_24h: Optional[Decimal] = Field( - None, - description="Spot price of the currency 24 hours ago", - title="spot_price_24h", - ) - srm_im_discount: Decimal = Field( - ..., - description="Initial Margin discount for given collateral in Standard Manager (e.g. LTV). Only the Standard Manager supports non-USDC collateral", - title="srm_im_discount", - ) - srm_mm_discount: Decimal = Field( - ..., - description="Maintenance Margin discount for given collateral in Standard Manager (e.g. liquidation threshold). Only the Standard Manager supports non-USDC collateral", - title="srm_mm_discount", - ) - supply_apy: Decimal = Field(..., description="Supply APY (only for USDC)", title="supply_apy") - total_borrow: Decimal = Field( - ..., - description="Total collateral borrowed in the protocol (only USDC is borrowable)", - title="total_borrow", - ) - total_supply: Decimal = Field( - ..., - description="Total collateral supplied in the protocol", - title="total_supply", - ) + spot_price: Decimal + srm_im_discount: Decimal + srm_mm_discount: Decimal + supply_apy: Decimal + total_borrow: Decimal + total_supply: Decimal + erc20_details: Optional[Dict[str, Optional[str]]] = None + spot_price_24h: Optional[Decimal] = None -class PrivateGetSubaccountValueHistoryParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - end_timestamp: int = Field(..., description="End timestamp", title="end_timestamp") - period: int = Field(..., description="Period", title="period") - start_timestamp: int = Field(..., description="Start timestamp", title="start_timestamp") - subaccount_id: int = Field(..., description="Subaccount_id", title="subaccount_id") +@dataclass +class PrivateGetSubaccountValueHistoryParamsSchema: + end_timestamp: int + period: int + start_timestamp: int + subaccount_id: int -class SubAccountValueHistoryResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - subaccount_value: Decimal = Field( - ..., - description="Total mark-to-market value of all positions and collaterals", - title="subaccount_value", - ) - timestamp: int = Field( - ..., - description="Timestamp of when the subaccount value was recorded into the database", - title="timestamp", - ) +@dataclass +class SubAccountValueHistoryResponseSchema: + subaccount_value: Decimal + timestamp: int -PublicSendQuoteDebugParamsSchema = PrivateSendQuoteParamsSchema +@dataclass +class PublicSendQuoteDebugParamsSchema(PrivateSendQuoteParamsSchema): + pass -PublicSendQuoteDebugResultSchema = PublicCreateSubaccountDebugResultSchema +@dataclass +class PublicSendQuoteDebugResultSchema(PublicCreateSubaccountDebugResultSchema): + pass -PublicGetLiveIncidentsParamsSchema = PublicGetMakerProgramsParamsSchema +@dataclass +class PublicGetLiveIncidentsParamsSchema(PublicGetMakerProgramsParamsSchema): + pass -class MonitorType(Enum): +class MonitorType(str, Enum): manual = "manual" auto = "auto" -class Severity(Enum): +class Severity(str, Enum): low = "low" medium = "medium" high = "high" -class IncidentResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - creation_timestamp_sec: int = Field( - ..., - description="Timestamp of incident in UTC sec", - title="creation_timestamp_sec", - ) - label: str = Field(..., description="Incident label", title="label") - message: str = Field(..., description="Incident message", title="message") - monitor_type: MonitorType = Field(..., description="Incident trigger type", title="monitor_type") - severity: Severity = Field(..., description="Incident severity", title="severity") - - -class PublicGetTransactionParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - transaction_id: UUID = Field( - ..., - description="transaction_id of the transaction to get", - title="transaction_id", - ) +@dataclass +class IncidentResponseSchema: + creation_timestamp_sec: int + label: str + message: str + monitor_type: MonitorType + severity: Severity -class PublicGetTransactionResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - data: str = Field(..., description="Data used to create transaction", title="data") - error_log: Optional[str] = Field(..., description="Error log if failed tx", title="error_log") - status: TxStatus = Field(..., description="Status of the transaction", title="status") - transaction_hash: Optional[str] = Field( - ..., description="Transaction hash of a pending tx", title="transaction_hash" - ) +@dataclass +class PublicGetTransactionParamsSchema: + transaction_id: str -class PrivateGetOrdersParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - instrument_name: Optional[str] = Field(None, description="Filter by instrument name", title="instrument_name") - label: Optional[str] = Field(None, description="Filter by label", title="label") - page: int = Field( - 1, - description="Page number of results to return (default 1, returns last if above `num_pages`)", - title="page", - ) - page_size: int = Field( - 100, - description="Number of results per page (default 100, max 1000)", - title="page_size", - ) - status: Optional[OrderStatus] = Field(None, description="Filter by order status", title="status") - subaccount_id: int = Field( - ..., - description="Subaccount_id for which to get open orders", - title="subaccount_id", - ) +@dataclass +class PublicGetTransactionResultSchema: + data: str + error_log: Optional[str] + status: TxStatus + transaction_hash: Optional[str] -PrivateGetOrdersResultSchema = PrivateGetOrderHistoryResultSchema +@dataclass +class PrivateGetOrdersParamsSchema: + subaccount_id: int + instrument_name: Optional[str] = None + label: Optional[str] = None + page: int = 1 + page_size: int = 100 + status: Optional[OrderStatus] = None -PrivateGetInterestHistoryParamsSchema = PrivateGetLiquidationHistoryParamsSchema +@dataclass +class PrivateGetOrdersResultSchema(PrivateGetOrderHistoryResultSchema): + pass -class InterestPaymentSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - interest: Decimal = Field( - ..., - description="Dollar interest paid (if negative) or received (if positive) by the subaccount", - title="interest", - ) - timestamp: int = Field( - ..., - description="Timestamp of the interest payment (in ms since UNIX epoch)", - title="timestamp", - ) +@dataclass +class PrivateGetInterestHistoryParamsSchema(PrivateGetLiquidationHistoryParamsSchema): + pass -PrivatePollQuotesParamsSchema = PrivateGetQuotesParamsSchema +@dataclass +class InterestPaymentSchema: + interest: Decimal + timestamp: int -class QuoteResultPublicSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - cancel_reason: CancelReason1 = Field(..., description="Cancel reason, if any", title="cancel_reason") - creation_timestamp: int = Field( - ..., - description="Creation timestamp in ms since Unix epoch", - title="creation_timestamp", - ) - direction: Direction = Field(..., description="Quote direction", title="direction") - fill_pct: Decimal = Field( - ..., - description="Percentage of the RFQ that this quote would fill, from 0 to 1.", - title="fill_pct", - ) - last_update_timestamp: int = Field( - ..., - description="Last update timestamp in ms since Unix epoch", - title="last_update_timestamp", - ) - legs: List[LegPricedSchema] = Field(..., description="Quote legs", title="legs") - legs_hash: str = Field( - ..., - description="Hash of the legs of the best quote to be signed by the taker.", - title="legs_hash", - ) - liquidity_role: LiquidityRole = Field(..., description="Liquidity role", title="liquidity_role") - quote_id: UUID = Field(..., description="Quote ID", title="quote_id") - rfq_id: UUID = Field(..., description="RFQ ID", title="rfq_id") - status: Status1 = Field(..., description="Status", title="status") - subaccount_id: int = Field(..., description="Subaccount ID", title="subaccount_id") - tx_hash: Optional[str] = Field( - ..., - description="Blockchain transaction hash (only for executed quotes)", - title="tx_hash", - ) - tx_status: Optional[TxStatus] = Field( - ..., - description="Blockchain transaction status (only for executed quotes)", - title="tx_status", - ) - wallet: str = Field(..., description="Wallet address of the quote sender", title="wallet") +@dataclass +class PrivatePollQuotesParamsSchema(PrivateGetQuotesParamsSchema): + pass -class PrivateGetOrderParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - order_id: str = Field(..., description="Order ID", title="order_id") - subaccount_id: int = Field(..., description="Subaccount ID", title="subaccount_id") +@dataclass +class QuoteResultPublicSchema: + cancel_reason: CancelReason1 + creation_timestamp: int + direction: Direction + fill_pct: Decimal + last_update_timestamp: int + legs: List[LegPricedSchema] + legs_hash: str + liquidity_role: LiquidityRole + quote_id: str + rfq_id: str + status: Status1 + subaccount_id: int + tx_hash: Optional[str] + tx_status: Optional[TxStatus] + wallet: str + + +@dataclass +class PrivateGetOrderParamsSchema(PrivateCancelTriggerOrderParamsSchema): + pass -PrivateGetOrderResultSchema = OrderResponseSchema +@dataclass +class PrivateGetOrderResultSchema(OrderResponseSchema): + pass -PublicGetVaultStatisticsParamsSchema = PublicGetMakerProgramsParamsSchema +@dataclass +class PublicGetVaultStatisticsParamsSchema(PublicGetMakerProgramsParamsSchema): + pass -class VaultStatisticsResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - base_value: Decimal = Field( - ..., - description="The value of the vault's token against the base currency. Ex: rswETHC vs rswETH", - title="base_value", - ) - block_number: int = Field(..., description="The Derive chain block number", title="block_number") - block_timestamp: int = Field( - ..., - description="Timestamp of the Derive chain block number", - title="block_timestamp", - ) - subaccount_value_at_last_trade: Optional[Decimal] = Field( - ..., - description="Will return None before vault creates subaccount or if no trades found.", - title="subaccount_value_at_last_trade", - ) - total_supply: Decimal = Field( - ..., - description="Total supply of the vault's token on Derive chain", - title="total_supply", - ) - underlying_value: Optional[Decimal] = Field( - ..., - description="The value of the vault's token against the underlying currency. Ex: rswETHC vs ETH", - title="underlying_value", - ) - usd_tvl: Decimal = Field(..., description="Total USD TVL of the vault", title="usd_tvl") - usd_value: Decimal = Field(..., description="The value of the vault's token against USD", title="usd_value") - vault_name: str = Field(..., description="Name of the vault", title="vault_name") +@dataclass +class VaultStatisticsResponseSchema: + base_value: Decimal + block_number: int + block_timestamp: int + subaccount_value_at_last_trade: Optional[Decimal] + total_supply: Decimal + underlying_value: Optional[Decimal] + usd_tvl: Decimal + usd_value: Decimal + vault_name: str -class PublicWithdrawDebugParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - amount: Decimal = Field(..., description="Amount of the asset to withdraw", title="amount") - asset_name: str = Field(..., description="Name of asset to withdraw", title="asset_name") - is_atomic_signing: bool = Field( - False, - description="Used by vaults to determine whether the signature is an EIP-1271 signature", - title="is_atomic_signing", - ) - nonce: int = Field( - ..., - description="Unique nonce defined as (e.g. 1695836058725001, where 001 is the random number)", - title="nonce", - ) - signature_expiry_sec: int = Field( - ..., - description="Unix timestamp in seconds. Expiry MUST be >5min from now", - title="signature_expiry_sec", - ) - signer: str = Field( - ..., - description="Ethereum wallet address that is signing the withdraw", - title="signer", - ) - subaccount_id: int = Field(..., description="Subaccount_id", title="subaccount_id") +@dataclass +class PublicWithdrawDebugParamsSchema(PublicDepositDebugParamsSchema): + pass -PublicWithdrawDebugResultSchema = PublicCreateSubaccountDebugResultSchema +@dataclass +class PublicWithdrawDebugResultSchema(PublicCreateSubaccountDebugResultSchema): + pass -class Period1(Enum): +class Period1(str, Enum): field_900 = 900 field_3600 = 3600 field_14400 = 14400 @@ -3704,84 +1791,34 @@ class Period1(Enum): field_86400 = 86400 -class PublicGetFundingRateHistoryParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - end_timestamp: int = Field( - 9223372036854776000, - description="End timestamp of the event history (default current time)", - title="end_timestamp", - ) - instrument_name: str = Field( - ..., - description="Instrument name to return funding history for", - title="instrument_name", - ) - period: Period1 = Field(3600, description="Period of the funding rate", title="period") - start_timestamp: int = Field( - 0, - description="Start timestamp of the event history (default 0)", - title="start_timestamp", - ) +@dataclass +class PublicGetFundingRateHistoryParamsSchema: + instrument_name: str + end_timestamp: int = 9223372036854776000 + period: Period1 = Period1.field_3600 + start_timestamp: int = 0 -class FundingRateSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - funding_rate: Decimal = Field( - ..., - description="Hourly funding rate value at the event time", - title="funding_rate", - ) - timestamp: int = Field( - ..., - description="Timestamp of the funding rate update (in ms since UNIX epoch)", - title="timestamp", - ) +@dataclass +class FundingRateSchema: + funding_rate: Decimal + timestamp: int -class PrivateRfqGetBestQuoteParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - counterparties: Optional[List[str]] = Field( - None, - description="Optional list of market maker account addresses to request quotes from. If not supplied, all market makers who are approved as RFQ makers will be notified.", - title="counterparties", - ) - direction: Direction = Field( - "buy", - description="Planned execution direction (default `buy`)", - title="direction", - ) - label: str = Field("", description="Optional user-defined label for the RFQ", title="label") - legs: List[LegUnpricedSchema] = Field(..., description="RFQ legs", title="legs") - max_total_cost: Optional[Decimal] = Field( - None, - description="An optional max total cost for the RFQ. Only used when the RFQ sender executes as buyer. Polling endpoints and channels will ignore quotes where the total cost across all legs is above this value. Positive values mean the RFQ sender expects to pay $, negative mean the RFQ sender expects to receive $.This field is not disclosed to the market makers.", - title="max_total_cost", - ) - min_total_cost: Optional[Decimal] = Field( - None, - description="An optional min total cost for the RFQ. Only used when the RFQ sender executes as seller. Polling endpoints and channels will ignore quotes where the total cost across all legs is below this value. Positive values mean the RFQ sender expects to receive $, negative mean the RFQ sender expects to pay $.This field is not disclosed to the market makers.", - title="min_total_cost", - ) - partial_fill_step: Decimal = Field( - "1", - description="Optional step size for partial fills. If not supplied, the RFQ will not support partial fills.", - title="partial_fill_step", - ) - rfq_id: Optional[UUID] = Field( - None, - description="RFQ ID to get best quote for. If not provided, will return estimates based on mark prices", - title="rfq_id", - ) - subaccount_id: int = Field(..., description="Subaccount ID", title="subaccount_id") +@dataclass +class PrivateRfqGetBestQuoteParamsSchema: + legs: List[LegUnpricedSchema] + subaccount_id: int + counterparties: Optional[List[str]] = None + direction: Direction = Direction.buy + label: str = "" + max_total_cost: Optional[Decimal] = None + min_total_cost: Optional[Decimal] = None + partial_fill_step: Decimal = "1" + rfq_id: Optional[str] = None -class InvalidReason(Enum): +class InvalidReason(str, Enum): Account_is_currently_under_maintenance_margin_requirements__trading_is_frozen_ = ( "Account is currently under maintenance margin requirements, trading is frozen." ) @@ -3794,2086 +1831,1140 @@ class InvalidReason(Enum): Insufficient_buying_power__consider_reducing_order_size_ = ( "Insufficient buying power, consider reducing order size." ) - Insufficient_buying_power__consider_reducing_order_size_or_canceling_other_orders_ = ( - "Insufficient buying power, consider reducing order size or canceling other orders." - ) + Insufficient_buying_power__consider_reducing_order_size_or_canceling_other_orders_ = "Insufficient buying power, consider reducing order size or canceling other orders." Consider_canceling_other_limit_orders_or_using_IOC__FOK__or_market_orders__This_order_is_risk_reducing__but_if_filled_with_other_open_orders__buying_power_might_be_insufficient_ = "Consider canceling other limit orders or using IOC, FOK, or market orders. This order is risk-reducing, but if filled with other open orders, buying power might be insufficient." Insufficient_buying_power_ = "Insufficient buying power." -class PrivateRfqGetBestQuoteResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - best_quote: Optional[QuoteResultPublicSchema] = Field(...) - direction: Direction = Field(..., description="RFQ direction.", title="direction") - down_liquidation_price: Optional[Decimal] = Field( - ..., - description="Liquidation price if the trade were to be filled and the market moves down.", - title="down_liquidation_price", - ) - estimated_fee: Decimal = Field( - ..., - description="An estimate for how much the user will pay in fees ($ for the whole trade).", - title="estimated_fee", - ) - estimated_realized_pnl: Decimal = Field( - ..., - description="An estimate for the realized PnL of the trade.", - title="estimated_realized_pnl", - ) - estimated_realized_pnl_excl_fees: Decimal = Field( - ..., - description="An estimate for the realized PnL of the trade. with cost basis calculated without considering fees.", - title="estimated_realized_pnl_excl_fees", - ) - estimated_total_cost: Decimal = Field( - ..., - description="An estimate for the total $ cost of the trade.", - title="estimated_total_cost", - ) - filled_pct: Decimal = Field( - ..., - description="Percentage of the RFQ that has already been filled, from 0 to 1.", - title="filled_pct", - ) - invalid_reason: Optional[InvalidReason] = Field( - ..., - description="Reason for the RFQ being invalid, if any.", - title="invalid_reason", - ) - is_valid: bool = Field( - ..., - description="`True` if RFQ is expected to pass margin requirements.", - title="is_valid", - ) - orderbook_total_cost: Optional[Decimal] = Field( - ..., - description="Total cost of the RFQ if it were to be filled at current orderbook prices (same direction as the RFQ). If lower than `estimated_total_cost`, the user may want to use the orderbook instead of RFQs for this order. Will return null if any of the legs do not have orderbook data or enough liquidity for the full fill.", - title="orderbook_total_cost", - ) - post_initial_margin: Decimal = Field( - ..., - description="User's hypothetical margin balance if the trade were to get executed.", - title="post_initial_margin", - ) - post_liquidation_price: Optional[Decimal] = Field( - ..., - description="Liquidation price if the trade were to be filled. If both upside and downside liquidation prices exist, returns the closest one to the current index price.", - title="post_liquidation_price", - ) - pre_initial_margin: Decimal = Field( - ..., - description="User's initial margin balance before the trade.", - title="pre_initial_margin", - ) - suggested_max_fee: Decimal = Field( - ..., - description="Recommended value for `max_fee` of the trade.", - title="suggested_max_fee", - ) - up_liquidation_price: Optional[Decimal] = Field( - ..., - description="Liquidation price if the trade were to be filled and the market moves up.", - title="up_liquidation_price", - ) +@dataclass +class PrivateRfqGetBestQuoteResultSchema: + best_quote: Optional[QuoteResultPublicSchema] + direction: Direction + down_liquidation_price: Optional[Decimal] + estimated_fee: Decimal + estimated_realized_pnl: Decimal + estimated_realized_pnl_excl_fees: Decimal + estimated_total_cost: Decimal + filled_pct: Decimal + invalid_reason: Optional[InvalidReason] + is_valid: bool + orderbook_total_cost: Optional[Decimal] + post_initial_margin: Decimal + post_liquidation_price: Optional[Decimal] + pre_initial_margin: Decimal + suggested_max_fee: Decimal + up_liquidation_price: Optional[Decimal] -class PublicGetInstrumentsParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - currency: str = Field( - ..., - description="Underlying currency of asset (`ETH`, `BTC`, etc)", - title="currency", - ) - expired: bool = Field( - ..., - description="If `True`: include expired assets. Note: will soon be capped up to only 1 week in the past.", - title="expired", - ) - instrument_type: InstrumentType = Field(..., description="`erc20`, `option`, or `perp`", title="instrument_type") +@dataclass +class PublicGetInstrumentsParamsSchema: + currency: str + expired: bool + instrument_type: InstrumentType -class PublicGetInstrumentsResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PublicGetInstrumentsResponseSchema: id: Union[str, int] - result: List[InstrumentPublicResponseSchema] = Field(..., description="", title="result") + result: List[InstrumentPublicResponseSchema] -class PublicGetOptionSettlementHistoryParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - page: int = Field( - 1, - description="Page number of results to return (default 1, returns last if above `num_pages`)", - title="page", - ) - page_size: int = Field( - 100, - description="Number of results per page (default 100, max 1000)", - title="page_size", - ) - subaccount_id: Optional[int] = Field( - None, - description="Subaccount ID filter (defaults to all if not provided)", - title="subaccount_id", - ) +@dataclass +class PublicGetOptionSettlementHistoryParamsSchema: + page: int = 1 + page_size: int = 100 + subaccount_id: Optional[int] = None -class PublicGetOptionSettlementHistoryResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PublicGetOptionSettlementHistoryResultSchema: pagination: PaginationInfoSchema - settlements: List[OptionSettlementResponseSchema] = Field( - ..., description="List of expired option settlements", title="settlements" - ) - - -class PrivateLiquidateParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - cash_transfer: Decimal = Field( - ..., - description="Amount of cash to transfer to a newly created subaccount for bidding. Must be non-negative.", - title="cash_transfer", - ) - last_seen_trade_id: int = Field( - ..., - description="Last seen trade ID for account being liquidated. Not checked if set to 0.", - title="last_seen_trade_id", - ) - liquidated_subaccount_id: int = Field( - ..., - description="Subaccount ID of the account to be liquidated.", - title="liquidated_subaccount_id", - ) - nonce: int = Field( - ..., - description="Unique nonce defined as (e.g. 1695836058725001, where 001 is the random number)", - title="nonce", - ) - percent_bid: Decimal = Field( - ..., - description="Percent of the liquidated position to bid for. Will bid for the maximum possible percent of the position if set to 1", - title="percent_bid", - ) - price_limit: Decimal = Field( - ..., - description="Maximum amount of cash to be paid from bidder to liquidated account (supports negative amounts for insolvent auctions). Not checked if set to 0.", - title="price_limit", - ) - signature: str = Field(..., description="Ethereum signature of the order", title="signature") - signature_expiry_sec: int = Field( - ..., - description="Unix timestamp in seconds. Order signature becomes invalid after this time, and the system will cancel the order.Expiry MUST be at least 5 min from now.", - title="signature_expiry_sec", - ) - signer: str = Field( - ..., - description="Owner wallet address or registered session key that signed order", - title="signer", - ) - subaccount_id: int = Field( - ..., - description="Subaccount ID owned by wallet, that will be doing the bidding.", - title="subaccount_id", - ) - - -class PrivateLiquidateResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - estimated_bid_price: Decimal = Field( - ..., - description="Estimated bid price for this liquidation", - title="estimated_bid_price", - ) - estimated_discount_pnl: Decimal = Field( - ..., - description="Estimated profit (increase in the subaccount mark value) if the liquidation is successful.", - title="estimated_discount_pnl", - ) - estimated_percent_bid: Decimal = Field( - ..., - description="Estimated percent of account the bid will aquire", - title="estimated_percent_bid", - ) - transaction_id: UUID = Field( - ..., - description="The transaction id of the related settlement transaction", - title="transaction_id", - ) - - -class PrivateGetTradeHistoryParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - from_timestamp: int = Field( - 0, - description="Earliest timestamp to filter by (in ms since Unix epoch). If not provied, defaults to 0.", - title="from_timestamp", - ) - instrument_name: Optional[str] = Field(None, description="Instrument name to filter by", title="instrument_name") - order_id: Optional[str] = Field(None, description="Order id to filter by", title="order_id") - page: int = Field( - 1, - description="Page number of results to return (default 1, returns last if above `num_pages`)", - title="page", - ) - page_size: int = Field( - 100, - description="Number of results per page (default 100, max 1000)", - title="page_size", - ) - quote_id: Optional[str] = Field( - None, - description="If supplied, quote id to filter by. Supports either a concrete UUID, or `is_quote` and `is_not_quote` enum", - title="quote_id", - ) - subaccount_id: Optional[int] = Field( - None, - description="Subaccount_id (must be set if wallet is blank)", - title="subaccount_id", - ) - to_timestamp: int = Field( - 18446744073709552000, - description="Latest timestamp to filter by (in ms since Unix epoch). If not provied, defaults to returning all data up to current time.", - title="to_timestamp", - ) - wallet: Optional[str] = Field( - None, - description="Wallet address (if set, subaccount_id ignored)", - title="wallet", - ) - - -class PrivateGetTradeHistoryResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) + settlements: List[OptionSettlementResponseSchema] + + +@dataclass +class PrivateLiquidateParamsSchema: + cash_transfer: Decimal + last_seen_trade_id: int + liquidated_subaccount_id: int + nonce: int + percent_bid: Decimal + price_limit: Decimal + signature: str + signature_expiry_sec: int + signer: str + subaccount_id: int + + +@dataclass +class PrivateLiquidateResultSchema: + estimated_bid_price: Decimal + estimated_discount_pnl: Decimal + estimated_percent_bid: Decimal + transaction_id: str + + +@dataclass +class PrivateGetTradeHistoryParamsSchema: + from_timestamp: int = 0 + instrument_name: Optional[str] = None + order_id: Optional[str] = None + page: int = 1 + page_size: int = 100 + quote_id: Optional[str] = None + subaccount_id: Optional[int] = None + to_timestamp: int = 18446744073709552000 + wallet: Optional[str] = None + + +@dataclass +class PrivateGetTradeHistoryResultSchema: pagination: PaginationInfoSchema - subaccount_id: int = Field( - ..., - description="Subaccount ID requested, or 0 if not provided", - title="subaccount_id", - ) - trades: List[TradeResponseSchema] = Field(..., description="List of trades", title="trades") - - -class PublicGetLatestSignedFeedsParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - currency: Optional[str] = Field( - None, - description="Currency filter, (defaults to all currencies)", - title="currency", - ) - expiry: Optional[int] = Field( - None, - description="Expiry filter for options and forward data (defaults to all expiries). Use `0` to get data only for spot and perpetuals", - title="expiry", - ) - - -class OracleSignatureDataSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - signatures: Optional[List[str]] = Field(None, description="The signatures of the given signers", title="signatures") - signers: Optional[List[str]] = Field(None, description="The signers who verify the data integrity", title="signers") - - -class Type(Enum): - P = "P" - A = "A" - B = "B" - - -class PerpFeedDataSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - confidence: Decimal = Field(..., description="The confidence score of the price", title="confidence") - currency: str = Field( - ..., - description="The currency for which the spot feed represents", - title="currency", - ) - deadline: int = Field( - ..., - description="The latest time the data can be submitted on chain", - title="deadline", - ) - signatures: OracleSignatureDataSchema - spot_diff_value: Decimal = Field( - ..., - description="The difference between the spot price and the perp price", - title="spot_diff_value", - ) - timestamp: int = Field( - ..., - description="The timestamp for which the data was created", - title="timestamp", - ) - type: Type = Field( - ..., - description="The type of perp feed; mid price, ask impact or bid impact", - title="type", - ) - - -class RateFeedDataSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - confidence: Decimal = Field(..., description="The confidence score of the rate", title="confidence") - currency: str = Field( - ..., - description="The currency for which the spot feed represents", - title="currency", - ) - deadline: int = Field( - ..., - description="The latest time the data can be submitted on chain", - title="deadline", - ) - expiry: int = Field(..., description="The expiry for the rate feed", title="expiry") - rate: Decimal = Field(..., description="The implied rate for the currency/expiry", title="rate") - signatures: OracleSignatureDataSchema - timestamp: int = Field( - ..., - description="The timestamp for which the data was created", - title="timestamp", - ) - - -class FeedSourceType(Enum): - S = "S" - O = "O" + subaccount_id: int + trades: List[TradeResponseSchema] -class SpotFeedDataSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - confidence: Decimal = Field(..., description="The confidence score of the price", title="confidence") - currency: str = Field( - ..., - description="The currency for which the spot feed represents", - title="currency", - ) - deadline: int = Field( - ..., - description="The latest time the data can be submitted on chain", - title="deadline", - ) - feed_source_type: FeedSourceType = Field("S", description="The source of the feed", title="feed_source_type") - price: Decimal = Field(..., description="The price of the currency in USD", title="price") - signatures: OracleSignatureDataSchema - timestamp: int = Field( - ..., - description="The timestamp for which the data was created", - title="timestamp", - ) +@dataclass +class PublicGetLatestSignedFeedsParamsSchema: + currency: Optional[str] = None + expiry: Optional[int] = None -class VolSVIParamDataSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - SVI_a: Decimal = Field(..., title="SVI_a") - SVI_b: Decimal = Field(..., title="SVI_b") - SVI_fwd: Decimal = Field(..., title="SVI_fwd") - SVI_m: Decimal = Field(..., title="SVI_m") - SVI_refTau: Decimal = Field(..., title="SVI_refTau") - SVI_rho: Decimal = Field(..., title="SVI_rho") - SVI_sigma: Decimal = Field(..., title="SVI_sigma") - - -class PrivateReplaceParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - amount: Decimal = Field(..., description="Order amount in units of the base", title="amount") - direction: Direction = Field(..., description="Order direction", title="direction") - expected_filled_amount: Optional[Decimal] = Field( - None, - description="Optional check to only create new order if old order filled_amount is equal to this value.", - title="expected_filled_amount", - ) - instrument_name: str = Field(..., description="Instrument name", title="instrument_name") - is_atomic_signing: Optional[bool] = Field( - False, - description="Used by vaults to determine whether the signature is an EIP-1271 signature.", - title="is_atomic_signing", - ) - label: str = Field("", description="Optional user-defined label for the order", title="label") - limit_price: Decimal = Field( - ..., - description="Limit price in quote currency.
This field is still required for market orders because it is a component of the signature. However, market orders will not leave a resting order in the book in case of a partial fill.", - title="limit_price", - ) - max_fee: Decimal = Field( - ..., - description="Max fee per unit of volume, denominated in units of the quote currency (usually USDC).Order will be rejected if the supplied max fee is below the estimated fee for this order.", - title="max_fee", - ) - mmp: bool = Field( - False, - description="Whether the order is tagged for market maker protections (default false)", - title="mmp", - ) - nonce: int = Field( - ..., - description="Unique nonce defined as (e.g. 1695836058725001, where 001 is the random number).Note, using a random number beyond 3 digits will cause JSON serialization to fail.", - title="nonce", - ) - nonce_to_cancel: Optional[int] = Field( - None, - description="Cancel order by nonce (choose either order_id or nonce).", - title="nonce_to_cancel", - ) - order_id_to_cancel: Optional[UUID] = Field( - None, - description="Cancel order by order_id (choose either order_id or nonce).", - title="order_id_to_cancel", - ) - order_type: OrderType = Field( - "limit", - description="Order type:
- `limit`: limit order (default)
- `market`: market order, note that limit_price is still required for market orders, but unfilled order portion will be marked as cancelled", - title="order_type", - ) - reduce_only: bool = Field( - False, - description="If true, the order will not be able to increase position's size (default false). If the order amount exceeds available position size, the order will be filled up to the position size and the remainder will be cancelled. This flag is only supported for market orders or non-resting limit orders (IOC or FOK)", - title="reduce_only", - ) - referral_code: str = Field("", description="Optional referral code for the order", title="referral_code") - reject_timestamp: int = Field( - 9223372036854776000, - description="UTC timestamp in ms, if provided the matching engine will reject the order with an error if `reject_timestamp` < `server_time`. Note that the timestamp must be consistent with the server time: use `public/get_time` method to obtain current server time.", - title="reject_timestamp", - ) - signature: str = Field(..., description="Ethereum signature of the order", title="signature") - signature_expiry_sec: int = Field( - ..., - description="Unix timestamp in seconds. Order signature becomes invalid after this time, and the system will cancel the order.Expiry MUST be at least 5 min from now.", - title="signature_expiry_sec", - ) - signer: str = Field( - ..., - description="Owner wallet address or registered session key that signed order", - title="signer", - ) - subaccount_id: int = Field(..., description="Subaccount ID", title="subaccount_id") - time_in_force: TimeInForce = Field( - "gtc", - description="Time in force behaviour:
- `gtc`: good til cancelled (default)
- `post_only`: a limit order that will be rejected if it crosses any order in the book, i.e. acts as a taker order
- `fok`: fill or kill, will be rejected if it is not fully filled
- `ioc`: immediate or cancel, fill at best bid/ask (market) or at limit price (limit), the unfilled portion is cancelled
Note that the order will still expire on the `signature_expiry_sec` timestamp.", - title="time_in_force", - ) - trigger_price: Optional[Decimal] = Field( - None, - description='(Required for trigger orders) "index" or "mark" price to trigger order at', - title="trigger_price", - ) - trigger_price_type: Optional[TriggerPriceType] = Field( - None, - description='(Required for trigger orders) Trigger with "mark" price as "index" price type not supported yet.', - title="trigger_price_type", - ) - trigger_type: Optional[TriggerType] = Field( - None, - description='(Required for trigger orders) "stoploss" or "takeprofit"', - title="trigger_type", - ) +@dataclass +class OracleSignatureDataSchema: + signatures: Optional[List[str]] = None + signers: Optional[List[str]] = None -class RPCErrorFormatSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - code: int = Field(..., title="code") - data: Optional[str] = Field(None, title="data") - message: str = Field(..., title="message") +class Type(str, Enum): + P = "P" + A = "A" + B = "B" -class PrivateCancelByInstrumentParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - instrument_name: str = Field( - ..., - description="Cancel all orders for this instrument", - title="instrument_name", - ) - subaccount_id: int = Field(..., description="Subaccount ID", title="subaccount_id") +@dataclass +class PerpFeedDataSchema: + confidence: Decimal + currency: str + deadline: int + signatures: OracleSignatureDataSchema + spot_diff_value: Decimal + timestamp: int + type: Type + + +@dataclass +class RateFeedDataSchema: + confidence: Decimal + currency: str + deadline: int + expiry: int + rate: Decimal + signatures: OracleSignatureDataSchema + timestamp: int -PrivateCancelByInstrumentResultSchema = PrivateCancelByNonceResultSchema +class FeedSourceType(str, Enum): + S = "S" + O = "O" -class PrivateCancelAllParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - subaccount_id: int = Field(..., title="subaccount_id") +@dataclass +class SpotFeedDataSchema: + confidence: Decimal + currency: str + deadline: int + price: Decimal + signatures: OracleSignatureDataSchema + timestamp: int + feed_source_type: FeedSourceType = FeedSourceType.S + + +@dataclass +class VolSVIParamDataSchema: + SVI_a: Decimal + SVI_b: Decimal + SVI_fwd: Decimal + SVI_m: Decimal + SVI_refTau: Decimal + SVI_rho: Decimal + SVI_sigma: Decimal + + +@dataclass +class PrivateReplaceParamsSchema: + amount: Decimal + direction: Direction + instrument_name: str + limit_price: Decimal + max_fee: Decimal + nonce: int + signature: str + signature_expiry_sec: int + signer: str + subaccount_id: int + expected_filled_amount: Optional[Decimal] = None + is_atomic_signing: Optional[bool] = False + label: str = "" + mmp: bool = False + nonce_to_cancel: Optional[int] = None + order_id_to_cancel: Optional[str] = None + order_type: OrderType = OrderType.limit + reduce_only: bool = False + referral_code: str = "" + reject_timestamp: int = 9223372036854776000 + time_in_force: TimeInForce = TimeInForce.gtc + trigger_price: Optional[Decimal] = None + trigger_price_type: Optional[TriggerPriceType] = None + trigger_type: Optional[TriggerType] = None + + +@dataclass +class RPCErrorFormatSchema: + code: int + message: str + data: Optional[str] = None + + +@dataclass +class PrivateCancelByInstrumentParamsSchema: + instrument_name: str + subaccount_id: int + + +@dataclass +class PrivateCancelByInstrumentResultSchema(PrivateCancelByNonceResultSchema): + pass -PrivateCancelAllResponseSchema = PrivateSetCancelOnDisconnectResponseSchema +@dataclass +class PrivateCancelAllParamsSchema(PrivateGetPositionsParamsSchema): + pass -class PublicDeregisterSessionKeyParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - public_session_key: str = Field( - ..., - description="Session key in the form of an Ethereum EOA", - title="public_session_key", - ) - signed_raw_tx: str = Field( - ..., - description="A signed RLP encoded ETH transaction in form of a hex string (same as `w3.eth.account.sign_transaction(unsigned_tx, private_key).rawTransaction.hex()`)", - title="signed_raw_tx", - ) - wallet: str = Field(..., description="Ethereum wallet address of account", title="wallet") +@dataclass +class PrivateCancelAllResponseSchema(PrivateCancelRfqResponseSchema): + pass -class PublicDeregisterSessionKeyResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - public_session_key: str = Field( - ..., - description="Session key in the form of an Ethereum EOA", - title="public_session_key", - ) - transaction_id: UUID = Field(..., description="ID to lookup status of transaction", title="transaction_id") +@dataclass +class PublicDeregisterSessionKeyParamsSchema: + public_session_key: str + signed_raw_tx: str + wallet: str -class PrivateWithdrawParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - amount: Decimal = Field(..., description="Amount of the asset to withdraw", title="amount") - asset_name: str = Field(..., description="Name of asset to withdraw", title="asset_name") - is_atomic_signing: bool = Field( - False, - description="Used by vaults to determine whether the signature is an EIP-1271 signature", - title="is_atomic_signing", - ) - nonce: int = Field( - ..., - description="Unique nonce defined as (e.g. 1695836058725001, where 001 is the random number)", - title="nonce", - ) - signature: str = Field(..., description="Ethereum signature of the withdraw", title="signature") - signature_expiry_sec: int = Field( - ..., - description="Unix timestamp in seconds. Expiry MUST be >5min from now", - title="signature_expiry_sec", - ) - signer: str = Field( - ..., - description="Ethereum wallet address that is signing the withdraw", - title="signer", - ) - subaccount_id: int = Field(..., description="Subaccount_id", title="subaccount_id") +@dataclass +class PublicDeregisterSessionKeyResultSchema: + public_session_key: str + transaction_id: str -class PrivateWithdrawResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - status: str = Field(..., description="`requested`", title="status") - transaction_id: UUID = Field(..., description="Transaction id of the withdrawal", title="transaction_id") +@dataclass +class PrivateWithdrawParamsSchema(PrivateDepositParamsSchema): + pass -class PrivateGetNotificationsResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - notifications: List[NotificationResponseSchema] = Field( - ..., description="Notification response", title="notifications" - ) +@dataclass +class PrivateWithdrawResultSchema(PrivateCreateSubaccountResultSchema): + pass + + +@dataclass +class PrivateGetNotificationsResultSchema: + notifications: List[NotificationResponseSchema] pagination: PaginationInfoSchema -PublicGetCurrencyResultSchema = CurrencyDetailedResponseSchema +@dataclass +class PublicGetCurrencyResultSchema(CurrencyDetailedResponseSchema): + pass -class PrivateSetMmpConfigResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PrivateSetMmpConfigResponseSchema: id: Union[str, int] result: PrivateSetMmpConfigResultSchema -class PrivateTransferPositionParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PrivateTransferPositionParamsSchema: maker_params: TradeModuleParamsSchema taker_params: TradeModuleParamsSchema - wallet: str = Field(..., description="Public key (wallet) of the account", title="wallet") + wallet: str -class PrivateTransferPositionResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PrivateTransferPositionResultSchema: maker_order: OrderResponseSchema maker_trade: TradeResponseSchema taker_order: OrderResponseSchema taker_trade: TradeResponseSchema -class PrivateCreateSubaccountResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PrivateCreateSubaccountResponseSchema: id: Union[str, int] result: PrivateCreateSubaccountResultSchema -class PrivateSendRfqParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - counterparties: Optional[List[str]] = Field( - None, - description="Optional list of market maker account addresses to request quotes from. If not supplied, all market makers who are approved as RFQ makers will be notified.", - title="counterparties", - ) - label: str = Field("", description="Optional user-defined label for the RFQ", title="label") - legs: List[LegUnpricedSchema] = Field(..., description="RFQ legs", title="legs") - max_total_cost: Optional[Decimal] = Field( - None, - description="An optional max total cost for the RFQ. Only used when the RFQ sender executes as buyer. Polling endpoints and channels will ignore quotes where the total cost across all legs is above this value. Positive values mean the RFQ sender expects to pay $, negative mean the RFQ sender expects to receive $.This field is not disclosed to the market makers.", - title="max_total_cost", - ) - min_total_cost: Optional[Decimal] = Field( - None, - description="An optional min total cost for the RFQ. Only used when the RFQ sender executes as seller. Polling endpoints and channels will ignore quotes where the total cost across all legs is below this value. Positive values mean the RFQ sender expects to receive $, negative mean the RFQ sender expects to pay $.This field is not disclosed to the market makers.", - title="min_total_cost", - ) - partial_fill_step: Decimal = Field( - "1", - description="Optional step size for partial fills. If not supplied, the RFQ will not support partial fills.", - title="partial_fill_step", - ) - subaccount_id: int = Field(..., description="Subaccount ID", title="subaccount_id") +@dataclass +class PrivateSendRfqParamsSchema: + legs: List[LegUnpricedSchema] + subaccount_id: int + counterparties: Optional[List[str]] = None + label: str = "" + max_total_cost: Optional[Decimal] = None + min_total_cost: Optional[Decimal] = None + partial_fill_step: Decimal = "1" -class PrivateSendRfqResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PrivateSendRfqResponseSchema: id: Union[str, int] result: PrivateSendRfqResultSchema -class PublicMarginWatchResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - collaterals: List[CollateralPublicResponseSchema] = Field( - ..., - description="All collaterals that count towards margin of subaccount", - title="collaterals", - ) - currency: str = Field(..., description="Currency of subaccount", title="currency") - initial_margin: Decimal = Field( - ..., - description="Total initial margin requirement of all positions and collaterals.", - title="initial_margin", - ) - maintenance_margin: Decimal = Field( - ..., - description="Total maintenance margin requirement of all positions and collaterals.If this value falls below zero, the subaccount will be flagged for liquidation.", - title="maintenance_margin", - ) - margin_type: MarginType = Field( - ..., - description="Margin type of subaccount (`PM` (Portfolio Margin), `PM2 (Portfolio Margin 2), or `SM` (Standard Margin))", - title="margin_type", - ) - positions: List[PositionPublicResponseSchema] = Field( - ..., description="All active positions of subaccount", title="positions" - ) - subaccount_id: int = Field(..., description="Subaccount_id", title="subaccount_id") - subaccount_value: Decimal = Field( - ..., - description="Total mark-to-market value of all positions and collaterals", - title="subaccount_value", - ) - valuation_timestamp: int = Field( - ..., - description="Timestamp (in seconds since epoch) of when margin and MtM were computed.", - title="valuation_timestamp", - ) +@dataclass +class PublicMarginWatchResultSchema: + collaterals: List[CollateralPublicResponseSchema] + currency: str + initial_margin: Decimal + maintenance_margin: Decimal + margin_type: MarginType + positions: List[PositionPublicResponseSchema] + subaccount_id: int + subaccount_value: Decimal + valuation_timestamp: int -class PublicStatisticsResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PublicStatisticsResponseSchema: id: Union[str, int] result: PublicStatisticsResultSchema -class PrivateCancelResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PrivateCancelResponseSchema: id: Union[str, int] result: PrivateCancelResultSchema -PrivateExecuteQuoteParamsSchema = PublicExecuteQuoteDebugParamsSchema +@dataclass +class PrivateExecuteQuoteParamsSchema(PublicExecuteQuoteDebugParamsSchema): + pass -class PrivateExecuteQuoteResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PrivateExecuteQuoteResponseSchema: id: Union[str, int] result: PrivateExecuteQuoteResultSchema -class PublicGetSpotFeedHistoryCandlesResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - currency: str = Field(..., description="Currency", title="currency") - spot_feed_history: List[SpotFeedHistoryCandlesResponseSchema] = Field( - ..., description="Spot feed history candles", title="spot_feed_history" - ) +@dataclass +class PublicGetSpotFeedHistoryCandlesResultSchema: + currency: str + spot_feed_history: List[SpotFeedHistoryCandlesResponseSchema] -class PrivatePollRfqsResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PrivatePollRfqsResultSchema: pagination: PaginationInfoSchema - rfqs: List[RFQResultPublicSchema] = Field(..., description="RFQs matching filter criteria", title="rfqs") + rfqs: List[RFQResultPublicSchema] -class AuctionResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - auction_id: str = Field(..., description="Unique ID of the auction", title="auction_id") - auction_type: AuctionType = Field(..., description="Type of auction", title="auction_type") - bids: List[AuctionBidEventSchema] = Field(..., description="List of auction bid events", title="bids") - end_timestamp: Optional[int] = Field( - ..., - description="Timestamp of the auction end (in ms since UNIX epoch), or `null` if not ended", - title="end_timestamp", - ) - fee: Decimal = Field(..., description="Fee paid by the subaccount", title="fee") - start_timestamp: int = Field( - ..., - description="Timestamp of the auction start (in ms since UNIX epoch)", - title="start_timestamp", - ) - subaccount_id: int = Field(..., description="Liquidated subaccount ID", title="subaccount_id") - tx_hash: str = Field( - ..., - description="Hash of the transaction that started the auction", - title="tx_hash", - ) +@dataclass +class AuctionResultSchema: + auction_id: str + auction_type: AuctionType + bids: List[AuctionBidEventSchema] + end_timestamp: Optional[int] + fee: Decimal + start_timestamp: int + subaccount_id: int + tx_hash: str -class SignedTradeOrderSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class SignedTradeOrderSchema: data: TradeModuleDataSchema - expiry: int = Field(..., title="expiry") - is_atomic_signing: bool = Field(..., title="is_atomic_signing") - module: str = Field(..., title="module") - nonce: int = Field(..., title="nonce") - owner: str = Field(..., title="owner") - signature: str = Field(..., title="signature") - signer: str = Field(..., title="signer") - subaccount_id: int = Field(..., title="subaccount_id") - - -class PrivateDepositResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) + expiry: int + is_atomic_signing: bool + module: str + nonce: int + owner: str + signature: str + signer: str + subaccount_id: int + + +@dataclass +class PrivateDepositResponseSchema: id: Union[str, int] result: PrivateDepositResultSchema -class PrivateUpdateNotificationsResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PrivateUpdateNotificationsResponseSchema: id: Union[str, int] result: PrivateUpdateNotificationsResultSchema -class PrivateChangeSubaccountLabelResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PrivateChangeSubaccountLabelResponseSchema: id: Union[str, int] result: PrivateChangeSubaccountLabelResultSchema -class PrivateTransferPositionsParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PrivateTransferPositionsParamsSchema: maker_params: SignedQuoteParamsSchema taker_params: SignedQuoteParamsSchema - wallet: str = Field(..., description="Public key (wallet) of the account", title="wallet") + wallet: str -class PrivateTransferPositionsResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PrivateTransferPositionsResultSchema: maker_quote: QuoteResultSchema taker_quote: QuoteResultSchema -class PublicGetMakerProgramsResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PublicGetMakerProgramsResponseSchema: id: Union[str, int] - result: List[ProgramResponseSchema] = Field(..., description="", title="result") + result: List[ProgramResponseSchema] -class PublicGetMarginParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - margin_type: MarginType = Field( - ..., - description="`PM` (Portfolio Margin), `PM2 (Portfolio Margin 2), or `SM` (Standard Margin))", - title="margin_type", - ) - market: Optional[str] = Field(None, description="Must be defined for Portfolio Margin", title="market") - simulated_collateral_changes: Optional[List[SimulatedCollateralSchema]] = Field( - None, - description="Optional, add collaterals to simulate deposits / withdrawals / spot trades", - title="simulated_collateral_changes", - ) - simulated_collaterals: List[SimulatedCollateralSchema] = Field( - ..., - description="List of collaterals in a simulated portfolio", - title="simulated_collaterals", - ) - simulated_position_changes: Optional[List[SimulatedPositionSchema]] = Field( - None, - description="Optional, add positions to simulate perp / option trades", - title="simulated_position_changes", - ) - simulated_positions: List[SimulatedPositionSchema] = Field( - ..., - description="List of positions in a simulated portfolio", - title="simulated_positions", - ) +@dataclass +class PublicGetMarginParamsSchema: + margin_type: MarginType + simulated_collaterals: List[SimulatedCollateralSchema] + simulated_positions: List[SimulatedPositionSchema] + market: Optional[str] = None + simulated_collateral_changes: Optional[List[SimulatedCollateralSchema]] = None + simulated_position_changes: Optional[List[SimulatedPositionSchema]] = None -class PublicGetMarginResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PublicGetMarginResponseSchema: id: Union[str, int] result: PublicGetMarginResultSchema -class PrivateCancelByNonceResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PrivateCancelByNonceResponseSchema: id: Union[str, int] result: PrivateCancelByNonceResultSchema -class PublicGetSpotFeedHistoryResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - currency: str = Field(..., description="Currency", title="currency") - spot_feed_history: List[SpotFeedHistoryResponseSchema] = Field( - ..., description="Spot feed history", title="spot_feed_history" - ) +@dataclass +class PublicGetSpotFeedHistoryResultSchema: + currency: str + spot_feed_history: List[SpotFeedHistoryResponseSchema] -class PrivateGetSubaccountsResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PrivateGetSubaccountsResponseSchema: id: Union[str, int] result: PrivateGetSubaccountsResultSchema -class PrivateGetDepositHistoryResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - events: List[DepositSchema] = Field(..., description="List of deposit payments", title="events") +@dataclass +class PrivateGetDepositHistoryResultSchema: + events: List[DepositSchema] -class PrivateCancelByLabelResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PrivateCancelByLabelResponseSchema: id: Union[str, int] result: PrivateCancelByLabelResultSchema -class PrivateGetMarginResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PrivateGetMarginResponseSchema: id: Union[str, int] result: PrivateGetMarginResultSchema -class PublicCreateSubaccountDebugResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PublicCreateSubaccountDebugResponseSchema: id: Union[str, int] result: PublicCreateSubaccountDebugResultSchema -PublicGetInstrumentResultSchema = InstrumentPublicResponseSchema +@dataclass +class PublicGetInstrumentResultSchema(InstrumentPublicResponseSchema): + pass -class PrivateEditSessionKeyResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PrivateEditSessionKeyResponseSchema: id: Union[str, int] result: PrivateEditSessionKeyResultSchema -class PrivateGetLiquidatorHistoryResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PrivateGetLiquidatorHistoryResponseSchema: id: Union[str, int] result: PrivateGetLiquidatorHistoryResultSchema -class PrivateGetPositionsResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - positions: List[PositionResponseSchema] = Field( - ..., description="All active positions of subaccount", title="positions" - ) - subaccount_id: int = Field(..., description="Subaccount_id", title="subaccount_id") +@dataclass +class PrivateGetPositionsResultSchema: + positions: List[PositionResponseSchema] + subaccount_id: int -class PublicGetTradeHistoryResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PublicGetTradeHistoryResultSchema: pagination: PaginationInfoSchema - trades: List[TradeSettledPublicResponseSchema] = Field(..., description="List of trades", title="trades") + trades: List[TradeSettledPublicResponseSchema] -class PrivateGetRfqsResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PrivateGetRfqsResultSchema: pagination: PaginationInfoSchema - rfqs: List[RFQResultSchema] = Field(..., description="RFQs matching filter criteria", title="rfqs") + rfqs: List[RFQResultSchema] -class PrivateTransferErc20ParamsSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PrivateTransferErc20ParamsSchema: recipient_details: SignatureDetailsSchema - recipient_subaccount_id: int = Field( - ..., - description="Subaccount_id of the recipient", - title="recipient_subaccount_id", - ) + recipient_subaccount_id: int sender_details: SignatureDetailsSchema - subaccount_id: int = Field(..., description="Subaccount_id", title="subaccount_id") + subaccount_id: int transfer: TransferDetailsSchema -class PrivateTransferErc20ResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PrivateTransferErc20ResponseSchema: id: Union[str, int] result: PrivateTransferErc20ResultSchema -class PrivateSendQuoteResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PrivateSendQuoteResponseSchema: id: Union[str, int] result: PrivateSendQuoteResultSchema -class PrivateCancelTriggerOrderResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PrivateCancelTriggerOrderResponseSchema: id: Union[str, int] result: PrivateCancelTriggerOrderResultSchema -class PrivateGetWithdrawalHistoryResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - events: List[WithdrawalSchema] = Field(..., description="List of withdrawals", title="events") +@dataclass +class PrivateGetWithdrawalHistoryResultSchema: + events: List[WithdrawalSchema] -class PublicGetOptionSettlementPricesResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - expiries: List[ExpiryResponseSchema] = Field(..., description="List of expiry details", title="expiries") +@dataclass +class PublicGetOptionSettlementPricesResultSchema: + expiries: List[ExpiryResponseSchema] -class PublicGetMakerProgramScoresResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PublicGetMakerProgramScoresResultSchema: program: ProgramResponseSchema - scores: List[ScoreBreakdownSchema] = Field( - ..., - description="Scores breakdown of the program by market maker", - title="scores", - ) - total_score: Decimal = Field( - ..., - description="Total score across all market makers for the epoch", - title="total_score", - ) - total_volume: Decimal = Field( - ..., - description="Total volume across all market makers for the epoch", - title="total_volume", - ) + scores: List[ScoreBreakdownSchema] + total_score: Decimal + total_volume: Decimal -class PublicBuildRegisterSessionKeyTxResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PublicBuildRegisterSessionKeyTxResponseSchema: id: Union[str, int] result: PublicBuildRegisterSessionKeyTxResultSchema -class PublicRegisterSessionKeyResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PublicRegisterSessionKeyResponseSchema: id: Union[str, int] result: PublicRegisterSessionKeyResultSchema -class PrivateGetOrderHistoryResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PrivateGetOrderHistoryResponseSchema: id: Union[str, int] result: PrivateGetOrderHistoryResultSchema -class PrivateCancelBatchRfqsResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PrivateCancelBatchRfqsResponseSchema: id: Union[str, int] result: PrivateCancelBatchRfqsResultSchema -class PrivateCancelBatchQuotesResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PrivateCancelBatchQuotesResponseSchema: id: Union[str, int] result: PrivateCancelBatchQuotesResultSchema -class PrivateGetFundingHistoryResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - events: List[FundingPaymentSchema] = Field(..., description="List of funding payments", title="events") +@dataclass +class PrivateGetFundingHistoryResultSchema: + events: List[FundingPaymentSchema] pagination: PaginationInfoSchema -class PrivateGetOpenOrdersResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PrivateGetOpenOrdersResponseSchema: id: Union[str, int] result: PrivateGetOpenOrdersResultSchema -class PrivateGetAccountResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - cancel_on_disconnect: bool = Field( - ..., - description="Whether cancel on disconnect is enabled for the account", - title="cancel_on_disconnect", - ) +@dataclass +class PrivateGetAccountResultSchema: + cancel_on_disconnect: bool fee_info: AccountFeeInfoSchema - is_rfq_maker: bool = Field( - ..., - description="Whether account allowed to market make RFQs", - title="is_rfq_maker", - ) - per_endpoint_tps: Dict[str, Any] = Field( - ..., - description="If a particular endpoint has a different max TPS, it will be specified here", - title="per_endpoint_tps", - ) - referral_code: Optional[str] = Field( - None, - description="Referral code for the account (must register with broker program first)", - title="referral_code", - ) - subaccount_ids: List[int] = Field( - ..., - description="List of subaccount_ids owned by the wallet in `SubAccounts.sol`", - title="subaccount_ids", - ) - wallet: str = Field(..., description="Ethereum wallet address", title="wallet") - websocket_matching_tps: int = Field( - ..., - description="Max transactions per second for matching requests over websocket (see `Rate Limiting` in docs)", - title="websocket_matching_tps", - ) - websocket_non_matching_tps: int = Field( - ..., - description="Max transactions per second for non-matching requests over websocket (see `Rate Limiting` in docs)", - title="websocket_non_matching_tps", - ) - websocket_option_tps: int = Field( - ..., - description="Max transactions per second for EACH option instrument over websocket (see `Rate Limiting` in docs)", - title="websocket_option_tps", - ) - websocket_perp_tps: int = Field( - ..., - description="Max transactions per second for EACH perp instrument over websocket (see `Rate Limiting` in docs)", - title="websocket_perp_tps", - ) - - -class PublicGetAllInstrumentsResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - instruments: List[InstrumentPublicResponseSchema] = Field( - ..., description="List of instruments", title="instruments" - ) + is_rfq_maker: bool + per_endpoint_tps: Dict[str, Any] + subaccount_ids: List[int] + wallet: str + websocket_matching_tps: int + websocket_non_matching_tps: int + websocket_option_tps: int + websocket_perp_tps: int + referral_code: Optional[str] = None + + +@dataclass +class PublicGetAllInstrumentsResultSchema: + instruments: List[InstrumentPublicResponseSchema] pagination: PaginationInfoSchema -class PublicGetTickerResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - amount_step: Decimal = Field(..., description="Minimum valid increment of order amount", title="amount_step") - base_asset_address: str = Field( - ..., - description="Blockchain address of the base asset", - title="base_asset_address", - ) - base_asset_sub_id: str = Field( - ..., - description="Sub ID of the specific base asset as defined in Asset.sol", - title="base_asset_sub_id", - ) - base_currency: str = Field( - ..., - description="Underlying currency of base asset (`ETH`, `BTC`, etc)", - title="base_currency", - ) - base_fee: Decimal = Field(..., description="$ base fee added to every taker order", title="base_fee") - best_ask_amount: Decimal = Field( - ..., - description="Amount of contracts / tokens available at best ask price", - title="best_ask_amount", - ) - best_ask_price: Decimal = Field(..., description="Best ask price", title="best_ask_price") - best_bid_amount: Decimal = Field( - ..., - description="Amount of contracts / tokens available at best bid price", - title="best_bid_amount", - ) - best_bid_price: Decimal = Field(..., description="Best bid price", title="best_bid_price") - erc20_details: Optional[ERC20PublicDetailsSchema] = Field(...) - fifo_min_allocation: Decimal = Field( - ..., - description="Minimum number of contracts that get filled using FIFO. Actual number of contracts that gets filled by FIFO will be the max between this value and (1 - pro_rata_fraction) x order_amount, plus any size leftovers due to rounding.", - title="fifo_min_allocation", - ) - five_percent_ask_depth: Decimal = Field( - ..., - description="Total amount of contracts / tokens available at 5 percent above best ask price", - title="five_percent_ask_depth", - ) - five_percent_bid_depth: Decimal = Field( - ..., - description="Total amount of contracts / tokens available at 5 percent below best bid price", - title="five_percent_bid_depth", - ) - index_price: Decimal = Field(..., description="Index price", title="index_price") - instrument_name: str = Field(..., description="Instrument name", title="instrument_name") - instrument_type: InstrumentType = Field(..., description="`erc20`, `option`, or `perp`", title="instrument_type") - is_active: bool = Field( - ..., - description="If `True`: instrument is tradeable within `activation` and `deactivation` timestamps", - title="is_active", - ) - maker_fee_rate: Decimal = Field( - ..., - description="Percent of spot price fee rate for makers", - title="maker_fee_rate", - ) - mark_price: Decimal = Field(..., description="Mark price", title="mark_price") - mark_price_fee_rate_cap: Optional[Decimal] = Field( - None, - description="Percent of option price fee cap, e.g. 12.5%, null if not applicable", - title="mark_price_fee_rate_cap", - ) - max_price: Decimal = Field( - ..., - description="Maximum price at which an agressive buyer can be matched. Any portion of a market order that would execute above this price will be cancelled. A limit buy order with limit price above this value is treated as post only (i.e. it will be rejected if it would cross any existing resting order).", - title="max_price", - ) - maximum_amount: Decimal = Field( - ..., - description="Maximum valid amount of contracts / tokens per trade", - title="maximum_amount", - ) - min_price: Decimal = Field( - ..., - description="Minimum price at which an agressive seller can be matched. Any portion of a market order that would execute below this price will be cancelled. A limit sell order with limit price below this value is treated as post only (i.e. it will be rejected if it would cross any existing resting order).", - title="min_price", - ) - minimum_amount: Decimal = Field( - ..., - description="Minimum valid amount of contracts / tokens per trade", - title="minimum_amount", - ) - open_interest: Dict[str, List[OpenInterestStatsSchema]] = Field( - ..., - description="Margin type of subaccount (`PM` (Portfolio Margin), `PM2 (Portfolio Margin 2), or `SM` (Standard Margin)) -> (current open interest, open interest cap, manager currency)", - title="open_interest", - ) - option_details: Optional[OptionPublicDetailsSchema] = Field(...) - option_pricing: Optional[OptionPricingSchema] = Field(...) - perp_details: Optional[PerpPublicDetailsSchema] = Field(...) - pro_rata_amount_step: Decimal = Field( - ..., - description="Pro-rata fill share of every order is rounded down to be a multiple of this number. Leftovers of the order due to rounding are filled FIFO.", - title="pro_rata_amount_step", - ) - pro_rata_fraction: Decimal = Field( - ..., - description="Fraction of order that gets filled using pro-rata matching. If zero, the matching is full FIFO.", - title="pro_rata_fraction", - ) - quote_currency: str = Field( - ..., - description="Quote currency (`USD` for perps, `USDC` for options)", - title="quote_currency", - ) - scheduled_activation: int = Field( - ..., - description="Timestamp at which became or will become active (if applicable)", - title="scheduled_activation", - ) - scheduled_deactivation: int = Field( - ..., - description="Scheduled deactivation time for instrument (if applicable)", - title="scheduled_deactivation", - ) +@dataclass +class PublicGetTickerResultSchema: + amount_step: Decimal + base_asset_address: str + base_asset_sub_id: str + base_currency: str + base_fee: Decimal + best_ask_amount: Decimal + best_ask_price: Decimal + best_bid_amount: Decimal + best_bid_price: Decimal + erc20_details: Optional[ERC20PublicDetailsSchema] + fifo_min_allocation: Decimal + five_percent_ask_depth: Decimal + five_percent_bid_depth: Decimal + index_price: Decimal + instrument_name: str + instrument_type: InstrumentType + is_active: bool + maker_fee_rate: Decimal + mark_price: Decimal + max_price: Decimal + maximum_amount: Decimal + min_price: Decimal + minimum_amount: Decimal + open_interest: Dict[str, List[OpenInterestStatsSchema]] + option_details: Optional[OptionPublicDetailsSchema] + option_pricing: Optional[OptionPricingSchema] + perp_details: Optional[PerpPublicDetailsSchema] + pro_rata_amount_step: Decimal + pro_rata_fraction: Decimal + quote_currency: str + scheduled_activation: int + scheduled_deactivation: int stats: AggregateTradingStatsSchema - taker_fee_rate: Decimal = Field( - ..., - description="Percent of spot price fee rate for takers", - title="taker_fee_rate", - ) - tick_size: Decimal = Field( - ..., - description="Tick size of the instrument, i.e. minimum price increment", - title="tick_size", - ) - timestamp: int = Field(..., description="Timestamp of the ticker feed snapshot", title="timestamp") + taker_fee_rate: Decimal + tick_size: Decimal + timestamp: int + mark_price_fee_rate_cap: Optional[Decimal] = None -class PublicGetVaultShareResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PublicGetVaultShareResultSchema: pagination: PaginationInfoSchema - vault_shares: List[VaultShareResponseSchema] = Field( - ..., - description="List of vault history shares, recent first", - title="vault_shares", - ) + vault_shares: List[VaultShareResponseSchema] -class PrivateGetCollateralsResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - collaterals: List[CollateralResponseSchema] = Field( - ..., - description="All collaterals that count towards margin of subaccount", - title="collaterals", - ) - subaccount_id: int = Field(..., description="Subaccount_id", title="subaccount_id") +@dataclass +class PrivateGetCollateralsResultSchema: + collaterals: List[CollateralResponseSchema] + subaccount_id: int -class PrivateRegisterScopedSessionKeyResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PrivateRegisterScopedSessionKeyResponseSchema: id: Union[str, int] result: PrivateRegisterScopedSessionKeyResultSchema -class PrivateExpiredAndCancelledHistoryResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PrivateExpiredAndCancelledHistoryResponseSchema: id: Union[str, int] result: PrivateExpiredAndCancelledHistoryResultSchema -class PrivateSessionKeysResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - public_session_keys: List[SessionKeyResponseSchema] = Field( - ..., - description="List of session keys (includes unactivated and expired keys)", - title="public_session_keys", - ) +@dataclass +class PrivateSessionKeysResultSchema: + public_session_keys: List[SessionKeyResponseSchema] -class PrivateGetMmpConfigResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PrivateGetMmpConfigResponseSchema: id: Union[str, int] - result: List[MMPConfigResultSchema] = Field(..., description="", title="result") + result: List[MMPConfigResultSchema] -class PrivateOrderResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PrivateOrderResponseSchema: id: Union[str, int] result: PrivateOrderResultSchema -class PrivateGetSubaccountResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PrivateGetSubaccountResponseSchema: id: Union[str, int] result: PrivateGetSubaccountResultSchema -class PublicGetInterestRateHistoryResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - interest_rates: List[InterestRateHistoryResponseSchema] = Field( - ..., description="List of interest rates, recent first", title="interest_rates" - ) +@dataclass +class PublicGetInterestRateHistoryResultSchema: + interest_rates: List[InterestRateHistoryResponseSchema] pagination: PaginationInfoSchema -class PublicGetLiquidationHistoryResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - auctions: List[AuctionResultSchema] = Field(..., description="List of auction results", title="auctions") +@dataclass +class PublicGetLiquidationHistoryResultSchema: + auctions: List[AuctionResultSchema] pagination: PaginationInfoSchema -class PublicDepositDebugResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PublicDepositDebugResponseSchema: id: Union[str, int] result: PublicDepositDebugResultSchema -class PublicGetVaultBalancesResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PublicGetVaultBalancesResponseSchema: id: Union[str, int] - result: List[VaultBalanceResponseSchema] = Field(..., description="", title="result") + result: List[VaultBalanceResponseSchema] -class PublicGetReferralPerformanceResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - fee_share_percentage: Decimal = Field( - ..., - description="Fee share percentage rewarded to referrer", - title="fee_share_percentage", - ) - referral_code: str = Field(..., description="Referral code used to get performance", title="referral_code") - rewards: Dict[str, Dict[str, Dict[str, ReferralPerformanceByInstrumentTypeSchema]]] = Field( - ..., - description="Performance by liquidity role / currency / instrument type", - title="rewards", - ) - stdrv_balance: Decimal = Field( - ..., - description="Staked DRV held used to determine fee share percentage", - title="stdrv_balance", - ) - total_fee_rewards: Decimal = Field(..., description="Total fee rewards to referrers", title="total_fee_rewards") - total_notional_volume: Decimal = Field( - ..., description="Total referred notional volume", title="total_notional_volume" - ) - total_referred_fees: Decimal = Field( - ..., - description="Total fees paid by referred traders (double counts if both taker and maker of a trade with rebated fees)", - title="total_referred_fees", - ) +@dataclass +class PublicGetReferralPerformanceResultSchema: + fee_share_percentage: Decimal + referral_code: str + rewards: Dict[str, Dict[str, Dict[str, ReferralPerformanceByInstrumentTypeSchema]]] + stdrv_balance: Decimal + total_fee_rewards: Decimal + total_notional_volume: Decimal + total_referred_fees: Decimal -class PrivateCancelQuoteResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PrivateCancelQuoteResponseSchema: id: Union[str, int] result: PrivateCancelQuoteResultSchema -class PrivateGetQuotesResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PrivateGetQuotesResponseSchema: id: Union[str, int] result: PrivateGetQuotesResultSchema -class PublicExecuteQuoteDebugResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PublicExecuteQuoteDebugResponseSchema: id: Union[str, int] result: PublicExecuteQuoteDebugResultSchema -class PrivateGetOptionSettlementHistoryResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - settlements: List[OptionSettlementResponseSchema] = Field( - ..., description="List of expired option settlements", title="settlements" - ) - subaccount_id: int = Field( - ..., - description="Subaccount_id for which to get expired option settlement history", - title="subaccount_id", - ) +@dataclass +class PrivateGetOptionSettlementHistoryResultSchema: + settlements: List[OptionSettlementResponseSchema] + subaccount_id: int -class PrivateGetErc20TransferHistoryResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - events: List[ERC20TransferSchema] = Field(..., description="List of erc20 transfers", title="events") +@dataclass +class PrivateGetErc20TransferHistoryResultSchema: + events: List[ERC20TransferSchema] -class PublicGetAllCurrenciesResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PublicGetAllCurrenciesResponseSchema: id: Union[str, int] - result: List[CurrencyDetailedResponseSchema] = Field(..., description="", title="result") + result: List[CurrencyDetailedResponseSchema] -class PrivateGetSubaccountValueHistoryResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - subaccount_id: int = Field(..., description="Subaccount_id", title="subaccount_id") - subaccount_value_history: List[SubAccountValueHistoryResponseSchema] = Field( - ..., description="Subaccount value history", title="subaccount_value_history" - ) +@dataclass +class PrivateGetSubaccountValueHistoryResultSchema: + subaccount_id: int + subaccount_value_history: List[SubAccountValueHistoryResponseSchema] -class PublicSendQuoteDebugResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PublicSendQuoteDebugResponseSchema: id: Union[str, int] result: PublicSendQuoteDebugResultSchema -class PublicGetLiveIncidentsResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - incidents: List[IncidentResponseSchema] = Field(..., description="List of ongoing incidents", title="incidents") +@dataclass +class PublicGetLiveIncidentsResultSchema: + incidents: List[IncidentResponseSchema] -class PublicGetTransactionResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PublicGetTransactionResponseSchema: id: Union[str, int] result: PublicGetTransactionResultSchema -class PrivateGetOrdersResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PrivateGetOrdersResponseSchema: id: Union[str, int] result: PrivateGetOrdersResultSchema -class PrivateGetInterestHistoryResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - events: List[InterestPaymentSchema] = Field(..., description="List of interest payments", title="events") +@dataclass +class PrivateGetInterestHistoryResultSchema: + events: List[InterestPaymentSchema] -class PrivatePollQuotesResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PrivatePollQuotesResultSchema: pagination: PaginationInfoSchema - quotes: List[QuoteResultPublicSchema] = Field(..., description="Quotes matching filter criteria", title="quotes") + quotes: List[QuoteResultPublicSchema] -class PrivateGetOrderResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PrivateGetOrderResponseSchema: id: Union[str, int] result: PrivateGetOrderResultSchema -class PublicGetVaultStatisticsResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PublicGetVaultStatisticsResponseSchema: id: Union[str, int] - result: List[VaultStatisticsResponseSchema] = Field(..., description="", title="result") + result: List[VaultStatisticsResponseSchema] -class PublicWithdrawDebugResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PublicWithdrawDebugResponseSchema: id: Union[str, int] result: PublicWithdrawDebugResultSchema -class PublicGetFundingRateHistoryResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - funding_rate_history: List[FundingRateSchema] = Field( - ..., description="List of funding rates", title="funding_rate_history" - ) +@dataclass +class PublicGetFundingRateHistoryResultSchema: + funding_rate_history: List[FundingRateSchema] -class PrivateRfqGetBestQuoteResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PrivateRfqGetBestQuoteResponseSchema: id: Union[str, int] result: PrivateRfqGetBestQuoteResultSchema -class PublicGetOptionSettlementHistoryResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PublicGetOptionSettlementHistoryResponseSchema: id: Union[str, int] result: PublicGetOptionSettlementHistoryResultSchema -class PrivateLiquidateResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PrivateLiquidateResponseSchema: id: Union[str, int] result: PrivateLiquidateResultSchema -class PrivateGetTradeHistoryResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PrivateGetTradeHistoryResponseSchema: id: Union[str, int] result: PrivateGetTradeHistoryResultSchema -class ForwardFeedDataSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - confidence: Decimal = Field(..., description="The confidence score of the price", title="confidence") - currency: str = Field( - ..., - description="The currency for which the spot feed represents", - title="currency", - ) - deadline: int = Field( - ..., - description="The latest time the data can be submitted on chain", - title="deadline", - ) - expiry: int = Field(..., description="The expiry for the forward feed", title="expiry") - fwd_diff: Decimal = Field( - ..., - description="difference of forward price from current spot price", - title="fwd_diff", - ) +@dataclass +class ForwardFeedDataSchema: + confidence: Decimal + currency: str + deadline: int + expiry: int + fwd_diff: Decimal signatures: OracleSignatureDataSchema - spot_aggregate_latest: Decimal = Field( - ..., - description="expiry -> spot * time value at the latest timestamp", - title="spot_aggregate_latest", - ) - spot_aggregate_start: Decimal = Field( - ..., - description="spot * time value at the start of the settlement period", - title="spot_aggregate_start", - ) - timestamp: int = Field( - ..., - description="The timestamp for which the data was created", - title="timestamp", - ) + spot_aggregate_latest: Decimal + spot_aggregate_start: Decimal + timestamp: int -class VolFeedDataSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - confidence: Decimal = Field(..., description="The confidence score of the price", title="confidence") - currency: str = Field( - ..., - description="The currency for which the spot feed represents", - title="currency", - ) - deadline: int = Field( - ..., - description="The latest time the data can be submitted on chain", - title="deadline", - ) - expiry: int = Field(..., description="The expiry for the options for the vol feed", title="expiry") +@dataclass +class VolFeedDataSchema: + confidence: Decimal + currency: str + deadline: int + expiry: int signatures: OracleSignatureDataSchema - timestamp: int = Field( - ..., - description="The timestamp for which the data was created", - title="timestamp", - ) + timestamp: int vol_data: VolSVIParamDataSchema -class PrivateReplaceResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PrivateReplaceResultSchema: cancelled_order: OrderResponseSchema create_order_error: Optional[RPCErrorFormatSchema] = None order: Optional[OrderResponseSchema] = None - trades: Optional[List[TradeResponseSchema]] = Field( - None, description="List of trades executed by the created order", title="trades" - ) + trades: Optional[List[TradeResponseSchema]] = None -class PrivateCancelByInstrumentResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PrivateCancelByInstrumentResponseSchema: id: Union[str, int] result: PrivateCancelByInstrumentResultSchema -class PublicDeregisterSessionKeyResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PublicDeregisterSessionKeyResponseSchema: id: Union[str, int] result: PublicDeregisterSessionKeyResultSchema -class PrivateWithdrawResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PrivateWithdrawResponseSchema: id: Union[str, int] result: PrivateWithdrawResultSchema -class PrivateGetNotificationsResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PrivateGetNotificationsResponseSchema: id: Union[str, int] result: PrivateGetNotificationsResultSchema -class PublicGetCurrencyResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PublicGetCurrencyResponseSchema: id: Union[str, int] result: PublicGetCurrencyResultSchema -class PrivateTransferPositionResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PrivateTransferPositionResponseSchema: id: Union[str, int] result: PrivateTransferPositionResultSchema -class PublicMarginWatchResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PublicMarginWatchResponseSchema: id: Union[str, int] result: PublicMarginWatchResultSchema -class PublicGetSpotFeedHistoryCandlesResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PublicGetSpotFeedHistoryCandlesResponseSchema: id: Union[str, int] result: PublicGetSpotFeedHistoryCandlesResultSchema -class PrivatePollRfqsResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PrivatePollRfqsResponseSchema: id: Union[str, int] result: PrivatePollRfqsResultSchema -class PrivateGetLiquidationHistoryResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PrivateGetLiquidationHistoryResponseSchema: id: Union[str, int] - result: List[AuctionResultSchema] = Field(..., description="", title="result") + result: List[AuctionResultSchema] -class PrivateOrderDebugResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - action_hash: str = Field(..., description="Keccak hashed action data", title="action_hash") - encoded_data: str = Field(..., description="ABI encoded order data", title="encoded_data") - encoded_data_hashed: str = Field(..., description="Keccak hashed encoded_data", title="encoded_data_hashed") +@dataclass +class PrivateOrderDebugResultSchema: + action_hash: str + encoded_data: str + encoded_data_hashed: str raw_data: SignedTradeOrderSchema - typed_data_hash: str = Field(..., description="EIP 712 typed data hash", title="typed_data_hash") + typed_data_hash: str -class PrivateTransferPositionsResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PrivateTransferPositionsResponseSchema: id: Union[str, int] result: PrivateTransferPositionsResultSchema -class PublicGetSpotFeedHistoryResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PublicGetSpotFeedHistoryResponseSchema: id: Union[str, int] result: PublicGetSpotFeedHistoryResultSchema -class PrivateGetDepositHistoryResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PrivateGetDepositHistoryResponseSchema: id: Union[str, int] result: PrivateGetDepositHistoryResultSchema -class PublicGetInstrumentResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PublicGetInstrumentResponseSchema: id: Union[str, int] result: PublicGetInstrumentResultSchema -class PrivateGetPositionsResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PrivateGetPositionsResponseSchema: id: Union[str, int] result: PrivateGetPositionsResultSchema -class PublicGetTradeHistoryResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PublicGetTradeHistoryResponseSchema: id: Union[str, int] result: PublicGetTradeHistoryResultSchema -class PrivateGetRfqsResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PrivateGetRfqsResponseSchema: id: Union[str, int] result: PrivateGetRfqsResultSchema -class PrivateGetWithdrawalHistoryResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PrivateGetWithdrawalHistoryResponseSchema: id: Union[str, int] result: PrivateGetWithdrawalHistoryResultSchema -class PublicGetOptionSettlementPricesResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PublicGetOptionSettlementPricesResponseSchema: id: Union[str, int] result: PublicGetOptionSettlementPricesResultSchema -class PublicGetMakerProgramScoresResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PublicGetMakerProgramScoresResponseSchema: id: Union[str, int] result: PublicGetMakerProgramScoresResultSchema -class PrivateGetFundingHistoryResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PrivateGetFundingHistoryResponseSchema: id: Union[str, int] result: PrivateGetFundingHistoryResultSchema -class PrivateGetAccountResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PrivateGetAccountResponseSchema: id: Union[str, int] result: PrivateGetAccountResultSchema -class PublicGetAllInstrumentsResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PublicGetAllInstrumentsResponseSchema: id: Union[str, int] result: PublicGetAllInstrumentsResultSchema -class PublicGetTickerResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PublicGetTickerResponseSchema: id: Union[str, int] result: PublicGetTickerResultSchema -class PublicGetVaultShareResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PublicGetVaultShareResponseSchema: id: Union[str, int] result: PublicGetVaultShareResultSchema -class PrivateGetCollateralsResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PrivateGetCollateralsResponseSchema: id: Union[str, int] result: PrivateGetCollateralsResultSchema -class PrivateSessionKeysResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PrivateSessionKeysResponseSchema: id: Union[str, int] result: PrivateSessionKeysResultSchema -class PublicGetInterestRateHistoryResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PublicGetInterestRateHistoryResponseSchema: id: Union[str, int] result: PublicGetInterestRateHistoryResultSchema -class PublicGetLiquidationHistoryResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PublicGetLiquidationHistoryResponseSchema: id: Union[str, int] result: PublicGetLiquidationHistoryResultSchema -class PublicGetReferralPerformanceResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PublicGetReferralPerformanceResponseSchema: id: Union[str, int] result: PublicGetReferralPerformanceResultSchema -class PrivateGetOptionSettlementHistoryResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PrivateGetOptionSettlementHistoryResponseSchema: id: Union[str, int] result: PrivateGetOptionSettlementHistoryResultSchema -class PrivateGetErc20TransferHistoryResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PrivateGetErc20TransferHistoryResponseSchema: id: Union[str, int] result: PrivateGetErc20TransferHistoryResultSchema -class PrivateGetSubaccountValueHistoryResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PrivateGetSubaccountValueHistoryResponseSchema: id: Union[str, int] result: PrivateGetSubaccountValueHistoryResultSchema -class PublicGetLiveIncidentsResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PublicGetLiveIncidentsResponseSchema: id: Union[str, int] result: PublicGetLiveIncidentsResultSchema -class PrivateGetInterestHistoryResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PrivateGetInterestHistoryResponseSchema: id: Union[str, int] result: PrivateGetInterestHistoryResultSchema -class PrivatePollQuotesResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PrivatePollQuotesResponseSchema: id: Union[str, int] result: PrivatePollQuotesResultSchema -class PublicGetFundingRateHistoryResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PublicGetFundingRateHistoryResponseSchema: id: Union[str, int] result: PublicGetFundingRateHistoryResultSchema -class PublicGetLatestSignedFeedsResultSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) - fwd_data: Dict[str, Dict[str, ForwardFeedDataSchema]] = Field( - ..., - description="currency -> expiry -> latest forward feed data", - title="fwd_data", - ) - perp_data: Dict[str, Dict[str, PerpFeedDataSchema]] = Field( - ..., - description="currency -> feed type -> latest perp feed data", - title="perp_data", - ) - rate_data: Dict[str, Dict[str, RateFeedDataSchema]] = Field( - ..., - description="currency -> expiry -> latest rate feed data", - title="rate_data", - ) - spot_data: Dict[str, SpotFeedDataSchema] = Field( - ..., description="currency -> latest spot feed data", title="spot_data" - ) - vol_data: Dict[str, Dict[str, VolFeedDataSchema]] = Field( - ..., description="currency -> expiry -> latest vol feed data", title="vol_data" - ) +@dataclass +class PublicGetLatestSignedFeedsResultSchema: + fwd_data: Dict[str, Dict[str, ForwardFeedDataSchema]] + perp_data: Dict[str, Dict[str, PerpFeedDataSchema]] + rate_data: Dict[str, Dict[str, RateFeedDataSchema]] + spot_data: Dict[str, SpotFeedDataSchema] + vol_data: Dict[str, Dict[str, VolFeedDataSchema]] -class PrivateReplaceResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PrivateReplaceResponseSchema: id: Union[str, int] result: PrivateReplaceResultSchema -class PrivateOrderDebugResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PrivateOrderDebugResponseSchema: id: Union[str, int] result: PrivateOrderDebugResultSchema -class PublicGetLatestSignedFeedsResponseSchema(BaseModel): - model_config = ConfigDict( - extra="forbid", - ) +@dataclass +class PublicGetLatestSignedFeedsResponseSchema: id: Union[str, int] result: PublicGetLatestSignedFeedsResultSchema diff --git a/scripts/generate-models.py b/scripts/generate-models.py index 6bd030be..6a72ef30 100644 --- a/scripts/generate-models.py +++ b/scripts/generate-models.py @@ -67,7 +67,7 @@ def generate_models(input_path: Path, output_path: Path): input_=input_path, input_file_type=InputFileType.OpenAPI, output=output_path, - output_model_type=DataModelType.PydanticV2BaseModel, + output_model_type=DataModelType.DataclassesDataclass, target_python_version=PythonVersion.PY_310, reuse_model=True, use_subclass_enum=True, From d2f0e705bec3ca378cf18f81873d66b720ceb2b8 Mon Sep 17 00:00:00 2001 From: zarathustra Date: Wed, 1 Oct 2025 14:18:52 +0200 Subject: [PATCH 5/6] chore: add datamodel-code-generator to dev packages --- poetry.lock | 344 ++++++++++++++++++++++++++++++++++++++++++++++--- pyproject.toml | 1 + 2 files changed, 326 insertions(+), 19 deletions(-) diff --git a/poetry.lock b/poetry.lock index 73109b5d..961fda23 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand. +# This file is automatically @generated by Poetry 2.1.1 and should not be changed by hand. [[package]] name = "aiohappyeyeballs" @@ -6,6 +6,7 @@ version = "2.6.1" description = "Happy Eyeballs for asyncio" optional = false python-versions = ">=3.9" +groups = ["main"] files = [ {file = "aiohappyeyeballs-2.6.1-py3-none-any.whl", hash = "sha256:f349ba8f4b75cb25c99c5c2d84e997e485204d2902a9597802b0371f09331fb8"}, {file = "aiohappyeyeballs-2.6.1.tar.gz", hash = "sha256:c3f9d0113123803ccadfdf3f0faa505bc78e6a72d1cc4806cbd719826e943558"}, @@ -17,6 +18,7 @@ version = "3.12.15" description = "Async http client/server framework (asyncio)" optional = false python-versions = ">=3.9" +groups = ["main"] files = [ {file = "aiohttp-3.12.15-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:b6fc902bff74d9b1879ad55f5404153e2b33a82e72a95c89cec5eb6cc9e92fbc"}, {file = "aiohttp-3.12.15-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:098e92835b8119b54c693f2f88a1dec690e20798ca5f5fe5f0520245253ee0af"}, @@ -117,7 +119,7 @@ propcache = ">=0.2.0" yarl = ">=1.17.0,<2.0" [package.extras] -speedups = ["Brotli", "aiodns (>=3.3.0)", "brotlicffi"] +speedups = ["Brotli ; platform_python_implementation == \"CPython\"", "aiodns (>=3.3.0)", "brotlicffi ; platform_python_implementation != \"CPython\""] [[package]] name = "aiolimiter" @@ -125,6 +127,7 @@ version = "1.2.1" description = "asyncio rate limiter, a leaky bucket implementation" optional = false python-versions = "<4.0,>=3.8" +groups = ["main"] files = [ {file = "aiolimiter-1.2.1-py3-none-any.whl", hash = "sha256:d3f249e9059a20badcb56b61601a83556133655c11d1eb3dd3e04ff069e5f3c7"}, {file = "aiolimiter-1.2.1.tar.gz", hash = "sha256:e02a37ea1a855d9e832252a105420ad4d15011505512a1a1d814647451b5cca9"}, @@ -136,6 +139,7 @@ version = "1.4.0" description = "aiosignal: a list of registered asynchronous callbacks" optional = false python-versions = ">=3.9" +groups = ["main"] files = [ {file = "aiosignal-1.4.0-py3-none-any.whl", hash = "sha256:053243f8b92b990551949e63930a839ff0cf0b0ebbe0597b0f3fb19e1a0fe82e"}, {file = "aiosignal-1.4.0.tar.gz", hash = "sha256:f47eecd9468083c2029cc99945502cb7708b082c232f9aca65da147157b251c7"}, @@ -151,17 +155,35 @@ version = "0.7.0" description = "Reusable constraint types to use with typing.Annotated" optional = false python-versions = ">=3.8" +groups = ["main", "dev"] files = [ {file = "annotated_types-0.7.0-py3-none-any.whl", hash = "sha256:1f02e8b43a8fbbc3f3e0d4f0f4bfc8131bcb4eebe8849b8e5c773f3a1c582a53"}, {file = "annotated_types-0.7.0.tar.gz", hash = "sha256:aff07c09a53a08bc8cfccb9c85b05f1aa9a2a6f23728d790723543408344ce89"}, ] +[[package]] +name = "argcomplete" +version = "3.6.2" +description = "Bash tab completion for argparse" +optional = false +python-versions = ">=3.8" +groups = ["dev"] +files = [ + {file = "argcomplete-3.6.2-py3-none-any.whl", hash = "sha256:65b3133a29ad53fb42c48cf5114752c7ab66c1c38544fdf6460f450c09b42591"}, + {file = "argcomplete-3.6.2.tar.gz", hash = "sha256:d0519b1bc867f5f4f4713c41ad0aba73a4a5f007449716b16f385f2166dc6adf"}, +] + +[package.extras] +test = ["coverage", "mypy", "pexpect", "ruff", "wheel"] + [[package]] name = "async-timeout" version = "5.0.1" description = "Timeout context manager for asyncio programs" optional = false python-versions = ">=3.8" +groups = ["main"] +markers = "python_version < \"3.11\"" files = [ {file = "async_timeout-5.0.1-py3-none-any.whl", hash = "sha256:39e3809566ff85354557ec2398b55e096c8364bacac9405a7a1fa429e77fe76c"}, {file = "async_timeout-5.0.1.tar.gz", hash = "sha256:d9321a7a3d5a6a5e187e824d2fa0793ce379a202935782d555d6e9d2735677d3"}, @@ -173,18 +195,19 @@ version = "25.3.0" description = "Classes Without Boilerplate" optional = false python-versions = ">=3.8" +groups = ["main"] files = [ {file = "attrs-25.3.0-py3-none-any.whl", hash = "sha256:427318ce031701fea540783410126f03899a97ffc6f61596ad581ac2e40e3bc3"}, {file = "attrs-25.3.0.tar.gz", hash = "sha256:75d7cefc7fb576747b2c81b4442d4d4a1ce0900973527c011d1030fd3bf4af1b"}, ] [package.extras] -benchmark = ["cloudpickle", "hypothesis", "mypy (>=1.11.1)", "pympler", "pytest (>=4.3.0)", "pytest-codspeed", "pytest-mypy-plugins", "pytest-xdist[psutil]"] -cov = ["cloudpickle", "coverage[toml] (>=5.3)", "hypothesis", "mypy (>=1.11.1)", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "pytest-xdist[psutil]"] -dev = ["cloudpickle", "hypothesis", "mypy (>=1.11.1)", "pre-commit-uv", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "pytest-xdist[psutil]"] +benchmark = ["cloudpickle ; platform_python_implementation == \"CPython\"", "hypothesis", "mypy (>=1.11.1) ; platform_python_implementation == \"CPython\" and python_version >= \"3.10\"", "pympler", "pytest (>=4.3.0)", "pytest-codspeed", "pytest-mypy-plugins ; platform_python_implementation == \"CPython\" and python_version >= \"3.10\"", "pytest-xdist[psutil]"] +cov = ["cloudpickle ; platform_python_implementation == \"CPython\"", "coverage[toml] (>=5.3)", "hypothesis", "mypy (>=1.11.1) ; platform_python_implementation == \"CPython\" and python_version >= \"3.10\"", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins ; platform_python_implementation == \"CPython\" and python_version >= \"3.10\"", "pytest-xdist[psutil]"] +dev = ["cloudpickle ; platform_python_implementation == \"CPython\"", "hypothesis", "mypy (>=1.11.1) ; platform_python_implementation == \"CPython\" and python_version >= \"3.10\"", "pre-commit-uv", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins ; platform_python_implementation == \"CPython\" and python_version >= \"3.10\"", "pytest-xdist[psutil]"] docs = ["cogapp", "furo", "myst-parser", "sphinx", "sphinx-notfound-page", "sphinxcontrib-towncrier", "towncrier"] -tests = ["cloudpickle", "hypothesis", "mypy (>=1.11.1)", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "pytest-xdist[psutil]"] -tests-mypy = ["mypy (>=1.11.1)", "pytest-mypy-plugins"] +tests = ["cloudpickle ; platform_python_implementation == \"CPython\"", "hypothesis", "mypy (>=1.11.1) ; platform_python_implementation == \"CPython\" and python_version >= \"3.10\"", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins ; platform_python_implementation == \"CPython\" and python_version >= \"3.10\"", "pytest-xdist[psutil]"] +tests-mypy = ["mypy (>=1.11.1) ; platform_python_implementation == \"CPython\" and python_version >= \"3.10\"", "pytest-mypy-plugins ; platform_python_implementation == \"CPython\" and python_version >= \"3.10\""] [[package]] name = "bitarray" @@ -192,6 +215,7 @@ version = "3.7.1" description = "efficient arrays of booleans -- C extension" optional = false python-versions = "*" +groups = ["main"] files = [ {file = "bitarray-3.7.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:a05982bb49c73463cb0f0f4bed2d8da82631708a2c2d1926107ba99651b419ec"}, {file = "bitarray-3.7.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:d30e7daaf228e3d69cdd8b02c0dd4199cec034c4b93c80109f56f4675a6db957"}, @@ -329,12 +353,61 @@ files = [ {file = "bitarray-3.7.1.tar.gz", hash = "sha256:795b1760418ab750826420ae24f06f392c08e21dc234f0a369a69cc00444f8ec"}, ] +[[package]] +name = "black" +version = "25.9.0" +description = "The uncompromising code formatter." +optional = false +python-versions = ">=3.9" +groups = ["dev"] +files = [ + {file = "black-25.9.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:ce41ed2614b706fd55fd0b4a6909d06b5bab344ffbfadc6ef34ae50adba3d4f7"}, + {file = "black-25.9.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:2ab0ce111ef026790e9b13bd216fa7bc48edd934ffc4cbf78808b235793cbc92"}, + {file = "black-25.9.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:f96b6726d690c96c60ba682955199f8c39abc1ae0c3a494a9c62c0184049a713"}, + {file = "black-25.9.0-cp310-cp310-win_amd64.whl", hash = "sha256:d119957b37cc641596063cd7db2656c5be3752ac17877017b2ffcdb9dfc4d2b1"}, + {file = "black-25.9.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:456386fe87bad41b806d53c062e2974615825c7a52159cde7ccaeb0695fa28fa"}, + {file = "black-25.9.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:a16b14a44c1af60a210d8da28e108e13e75a284bf21a9afa6b4571f96ab8bb9d"}, + {file = "black-25.9.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:aaf319612536d502fdd0e88ce52d8f1352b2c0a955cc2798f79eeca9d3af0608"}, + {file = "black-25.9.0-cp311-cp311-win_amd64.whl", hash = "sha256:c0372a93e16b3954208417bfe448e09b0de5cc721d521866cd9e0acac3c04a1f"}, + {file = "black-25.9.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:1b9dc70c21ef8b43248f1d86aedd2aaf75ae110b958a7909ad8463c4aa0880b0"}, + {file = "black-25.9.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:8e46eecf65a095fa62e53245ae2795c90bdecabd53b50c448d0a8bcd0d2e74c4"}, + {file = "black-25.9.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:9101ee58ddc2442199a25cb648d46ba22cd580b00ca4b44234a324e3ec7a0f7e"}, + {file = "black-25.9.0-cp312-cp312-win_amd64.whl", hash = "sha256:77e7060a00c5ec4b3367c55f39cf9b06e68965a4f2e61cecacd6d0d9b7ec945a"}, + {file = "black-25.9.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:0172a012f725b792c358d57fe7b6b6e8e67375dd157f64fa7a3097b3ed3e2175"}, + {file = "black-25.9.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:3bec74ee60f8dfef564b573a96b8930f7b6a538e846123d5ad77ba14a8d7a64f"}, + {file = "black-25.9.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:b756fc75871cb1bcac5499552d771822fd9db5a2bb8db2a7247936ca48f39831"}, + {file = "black-25.9.0-cp313-cp313-win_amd64.whl", hash = "sha256:846d58e3ce7879ec1ffe816bb9df6d006cd9590515ed5d17db14e17666b2b357"}, + {file = "black-25.9.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:ef69351df3c84485a8beb6f7b8f9721e2009e20ef80a8d619e2d1788b7816d47"}, + {file = "black-25.9.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:e3c1f4cd5e93842774d9ee4ef6cd8d17790e65f44f7cdbaab5f2cf8ccf22a823"}, + {file = "black-25.9.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:154b06d618233fe468236ba1f0e40823d4eb08b26f5e9261526fde34916b9140"}, + {file = "black-25.9.0-cp39-cp39-win_amd64.whl", hash = "sha256:e593466de7b998374ea2585a471ba90553283fb9beefcfa430d84a2651ed5933"}, + {file = "black-25.9.0-py3-none-any.whl", hash = "sha256:474b34c1342cdc157d307b56c4c65bce916480c4a8f6551fdc6bf9b486a7c4ae"}, + {file = "black-25.9.0.tar.gz", hash = "sha256:0474bca9a0dd1b51791fcc507a4e02078a1c63f6d4e4ae5544b9848c7adfb619"}, +] + +[package.dependencies] +click = ">=8.0.0" +mypy-extensions = ">=0.4.3" +packaging = ">=22.0" +pathspec = ">=0.9.0" +platformdirs = ">=2" +pytokens = ">=0.1.10" +tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""} +typing-extensions = {version = ">=4.0.1", markers = "python_version < \"3.11\""} + +[package.extras] +colorama = ["colorama (>=0.4.3)"] +d = ["aiohttp (>=3.10)"] +jupyter = ["ipython (>=7.8.0)", "tokenize-rt (>=3.2.0)"] +uvloop = ["uvloop (>=0.15.2)"] + [[package]] name = "certifi" version = "2025.8.3" description = "Python package for providing Mozilla's CA Bundle." optional = false python-versions = ">=3.7" +groups = ["main", "dev"] files = [ {file = "certifi-2025.8.3-py3-none-any.whl", hash = "sha256:f6c12493cfb1b06ba2ff328595af9350c65d6644968e5d3a2ffd78699af217a5"}, {file = "certifi-2025.8.3.tar.gz", hash = "sha256:e564105f78ded564e3ae7c923924435e1daa7463faeab5bb932bc53ffae63407"}, @@ -346,6 +419,7 @@ version = "3.4.3" description = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet." optional = false python-versions = ">=3.7" +groups = ["main", "dev"] files = [ {file = "charset_normalizer-3.4.3-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:fb7f67a1bfa6e40b438170ebdc8158b78dc465a5a67b6dde178a46987b244a72"}, {file = "charset_normalizer-3.4.3-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:cc9370a2da1ac13f0153780040f465839e6cccb4a1e44810124b4e22483c93fe"}, @@ -434,6 +508,7 @@ version = "2.1.3" description = "Python bindings for C-KZG-4844" optional = false python-versions = "*" +groups = ["main"] files = [ {file = "ckzg-2.1.3-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:90597d18e981dcaac1c5017ea843cc96a6b30fdbefd41e4c363e26df6cd3105f"}, {file = "ckzg-2.1.3-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:fe8673a1778102cbea878f4be1a59a3fb24d2a615bc8d00b171d2d3c0890f3ec"}, @@ -543,6 +618,7 @@ version = "0.19.0" description = "Build Nice User Interfaces In The Terminal" optional = false python-versions = "<4.0,>=3.9" +groups = ["dev"] files = [ {file = "cli_ui-0.19.0-py3-none-any.whl", hash = "sha256:1cf1b93328f7377730db29507e10bcb29ccc1427ceef45714b522d1f2055e7cd"}, {file = "cli_ui-0.19.0.tar.gz", hash = "sha256:59cdab0c6a2a6703c61b31cb75a1943076888907f015fffe15c5a8eb41a933aa"}, @@ -559,6 +635,7 @@ version = "8.2.1" description = "Composable command line interface toolkit" optional = false python-versions = ">=3.10" +groups = ["main", "dev"] files = [ {file = "click-8.2.1-py3-none-any.whl", hash = "sha256:61a3265b914e850b85317d0b3109c7f8cd35a670f963866005d6ef1d5175a12b"}, {file = "click-8.2.1.tar.gz", hash = "sha256:27c491cc05d968d271d5a1db13e3b5a184636d9d930f148c50b038f0d0646202"}, @@ -573,10 +650,12 @@ version = "0.4.6" description = "Cross-platform colored terminal text." optional = false python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" +groups = ["main", "dev"] files = [ {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, ] +markers = {main = "platform_system == \"Windows\""} [[package]] name = "cytoolz" @@ -584,6 +663,8 @@ version = "1.0.1" description = "Cython implementation of Toolz: High performance functional utilities" optional = false python-versions = ">=3.8" +groups = ["main"] +markers = "implementation_name == \"cpython\"" files = [ {file = "cytoolz-1.0.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:cec9af61f71fc3853eb5dca3d42eb07d1f48a4599fa502cbe92adde85f74b042"}, {file = "cytoolz-1.0.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:140bbd649dbda01e91add7642149a5987a7c3ccc251f2263de894b89f50b6608"}, @@ -693,12 +774,45 @@ toolz = ">=0.8.0" [package.extras] cython = ["cython"] +[[package]] +name = "datamodel-code-generator" +version = "0.34.0" +description = "Datamodel Code Generator" +optional = false +python-versions = ">=3.9" +groups = ["dev"] +files = [ + {file = "datamodel_code_generator-0.34.0-py3-none-any.whl", hash = "sha256:74d1aaf2ab27e21b6d6e28b5236f27271b8404b7fd0e856be95c2f7562d694ff"}, + {file = "datamodel_code_generator-0.34.0.tar.gz", hash = "sha256:4695bdd2c9e85049db4bdf5791f68647518d98fd589d30bd8525e941e628acf7"}, +] + +[package.dependencies] +argcomplete = ">=2.10.1,<4" +black = ">=19.10b0" +genson = ">=1.2.1,<2" +inflect = ">=4.1,<8" +isort = ">=4.3.21,<7" +jinja2 = ">=2.10.1,<4" +packaging = "*" +pydantic = ">=1.5" +pyyaml = ">=6.0.1" +tomli = {version = ">=2.2.1,<3", markers = "python_version <= \"3.11\""} + +[package.extras] +all = ["graphql-core (>=3.2.3)", "httpx (>=0.24.1)", "openapi-spec-validator (>=0.2.8,<0.7)", "prance (>=0.18.2)", "pysnooper (>=0.4.1,<2)", "ruff (>=0.9.10)"] +debug = ["pysnooper (>=0.4.1,<2)"] +graphql = ["graphql-core (>=3.2.3)"] +http = ["httpx (>=0.24.1)"] +ruff = ["ruff (>=0.9.10)"] +validation = ["openapi-spec-validator (>=0.2.8,<0.7)", "prance (>=0.18.2)"] + [[package]] name = "derive-action-signing" version = "0.0.13" description = "Python package to sign on-chain self-custodial requests for orders, transfers, deposits, withdrawals and RFQs." optional = false python-versions = "<4.0,>=3.9" +groups = ["main"] files = [ {file = "derive_action_signing-0.0.13-py3-none-any.whl", hash = "sha256:b5fb8ad9d4888a09441da9fc97d66fc0c909d1d1268c54a65c4e8bbd141d6598"}, {file = "derive_action_signing-0.0.13.tar.gz", hash = "sha256:753b3766e4c836d4cc4b36e076b14e4b9ebf28843a6192312459f718f0236d60"}, @@ -718,6 +832,7 @@ version = "0.6.2" description = "Pythonic argument parser, that will make you smile" optional = false python-versions = "*" +groups = ["dev"] files = [ {file = "docopt-0.6.2.tar.gz", hash = "sha256:49b3a825280bd66b3aa83585ef59c4a8c82f2c8a522dbe754a8bc8d08c85c491"}, ] @@ -728,6 +843,7 @@ version = "5.2.0" description = "eth_abi: Python utilities for working with Ethereum ABI definitions, especially encoding and decoding" optional = false python-versions = "<4,>=3.8" +groups = ["main"] files = [ {file = "eth_abi-5.2.0-py3-none-any.whl", hash = "sha256:17abe47560ad753f18054f5b3089fcb588f3e3a092136a416b6c1502cb7e8877"}, {file = "eth_abi-5.2.0.tar.gz", hash = "sha256:178703fa98c07d8eecd5ae569e7e8d159e493ebb6eeb534a8fe973fbc4e40ef0"}, @@ -750,6 +866,7 @@ version = "0.13.7" description = "eth-account: Sign Ethereum transactions and messages with local private keys" optional = false python-versions = "<4,>=3.8" +groups = ["main"] files = [ {file = "eth_account-0.13.7-py3-none-any.whl", hash = "sha256:39727de8c94d004ff61d10da7587509c04d2dc7eac71e04830135300bdfc6d24"}, {file = "eth_account-0.13.7.tar.gz", hash = "sha256:5853ecbcbb22e65411176f121f5f24b8afeeaf13492359d254b16d8b18c77a46"}, @@ -778,6 +895,7 @@ version = "0.7.1" description = "eth-hash: The Ethereum hashing function, keccak256, sometimes (erroneously) called sha3" optional = false python-versions = "<4,>=3.8" +groups = ["main"] files = [ {file = "eth_hash-0.7.1-py3-none-any.whl", hash = "sha256:0fb1add2adf99ef28883fd6228eb447ef519ea72933535ad1a0b28c6f65f868a"}, {file = "eth_hash-0.7.1.tar.gz", hash = "sha256:d2411a403a0b0a62e8247b4117932d900ffb4c8c64b15f92620547ca5ce46be5"}, @@ -790,7 +908,7 @@ pycryptodome = {version = ">=3.6.6,<4", optional = true, markers = "extra == \"p dev = ["build (>=0.9.0)", "bump_my_version (>=0.19.0)", "ipython", "mypy (==1.10.0)", "pre-commit (>=3.4.0)", "pytest (>=7.0.0)", "pytest-xdist (>=2.4.0)", "sphinx (>=6.0.0)", "sphinx-autobuild (>=2021.3.14)", "sphinx_rtd_theme (>=1.0.0)", "towncrier (>=24,<25)", "tox (>=4.0.0)", "twine", "wheel"] docs = ["sphinx (>=6.0.0)", "sphinx-autobuild (>=2021.3.14)", "sphinx_rtd_theme (>=1.0.0)", "towncrier (>=24,<25)"] pycryptodome = ["pycryptodome (>=3.6.6,<4)"] -pysha3 = ["pysha3 (>=1.0.0,<2.0.0)", "safe-pysha3 (>=1.0.0)"] +pysha3 = ["pysha3 (>=1.0.0,<2.0.0) ; python_version < \"3.9\"", "safe-pysha3 (>=1.0.0) ; python_version >= \"3.9\""] test = ["pytest (>=7.0.0)", "pytest-xdist (>=2.4.0)"] [[package]] @@ -799,6 +917,7 @@ version = "0.8.1" description = "eth-keyfile: A library for handling the encrypted keyfiles used to store ethereum private keys" optional = false python-versions = "<4,>=3.8" +groups = ["main"] files = [ {file = "eth_keyfile-0.8.1-py3-none-any.whl", hash = "sha256:65387378b82fe7e86d7cb9f8d98e6d639142661b2f6f490629da09fddbef6d64"}, {file = "eth_keyfile-0.8.1.tar.gz", hash = "sha256:9708bc31f386b52cca0969238ff35b1ac72bd7a7186f2a84b86110d3c973bec1"}, @@ -820,6 +939,7 @@ version = "0.7.0" description = "eth-keys: Common API for Ethereum key operations" optional = false python-versions = "<4,>=3.8" +groups = ["main"] files = [ {file = "eth_keys-0.7.0-py3-none-any.whl", hash = "sha256:b0cdda8ffe8e5ba69c7c5ca33f153828edcace844f67aabd4542d7de38b159cf"}, {file = "eth_keys-0.7.0.tar.gz", hash = "sha256:79d24fd876201df67741de3e3fefb3f4dbcbb6ace66e47e6fe662851a4547814"}, @@ -841,6 +961,7 @@ version = "2.2.0" description = "eth-rlp: RLP definitions for common Ethereum objects in Python" optional = false python-versions = "<4,>=3.8" +groups = ["main"] files = [ {file = "eth_rlp-2.2.0-py3-none-any.whl", hash = "sha256:5692d595a741fbaef1203db6a2fedffbd2506d31455a6ad378c8449ee5985c47"}, {file = "eth_rlp-2.2.0.tar.gz", hash = "sha256:5e4b2eb1b8213e303d6a232dfe35ab8c29e2d3051b86e8d359def80cd21db83d"}, @@ -863,6 +984,7 @@ version = "4.4.0" description = "eth-typing: Common type annotations for ethereum python packages" optional = false python-versions = "<4,>=3.8" +groups = ["main"] files = [ {file = "eth_typing-4.4.0-py3-none-any.whl", hash = "sha256:a5e30a6e69edda7b1d1e96e9d71bab48b9bb988a77909d8d1666242c5562f841"}, {file = "eth_typing-4.4.0.tar.gz", hash = "sha256:93848083ac6bb4c20cc209ea9153a08b0a528be23337c889f89e1e5ffbe9807d"}, @@ -882,6 +1004,7 @@ version = "4.1.1" description = "eth-utils: Common utility functions for python code that interacts with Ethereum" optional = false python-versions = "<4,>=3.8" +groups = ["main"] files = [ {file = "eth_utils-4.1.1-py3-none-any.whl", hash = "sha256:ccbbac68a6d65cb6e294c5bcb6c6a5cec79a241c56dc5d9c345ed788c30f8534"}, {file = "eth_utils-4.1.1.tar.gz", hash = "sha256:71c8d10dec7494aeed20fa7a4d52ec2ce4a2e52fdce80aab4f5c3c19f3648b25"}, @@ -904,6 +1027,8 @@ version = "1.3.0" description = "Backport of PEP 654 (exception groups)" optional = false python-versions = ">=3.7" +groups = ["dev"] +markers = "python_version < \"3.11\"" files = [ {file = "exceptiongroup-1.3.0-py3-none-any.whl", hash = "sha256:4d111e6e0c13d0644cad6ddaa7ed0261a0b36971f6d23e7ec9b4b9097da78a10"}, {file = "exceptiongroup-1.3.0.tar.gz", hash = "sha256:b241f5885f560bc56a59ee63ca4c6a8bfa46ae4ad651af316d4e81817bb9fd88"}, @@ -921,6 +1046,7 @@ version = "1.7.0" description = "A list-like structure which implements collections.abc.MutableSequence" optional = false python-versions = ">=3.9" +groups = ["main"] files = [ {file = "frozenlist-1.7.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:cc4df77d638aa2ed703b878dd093725b72a824c3c546c076e8fdf276f78ee84a"}, {file = "frozenlist-1.7.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:716a9973a2cc963160394f701964fe25012600f3d311f60c790400b00e568b61"}, @@ -1028,12 +1154,25 @@ files = [ {file = "frozenlist-1.7.0.tar.gz", hash = "sha256:2e310d81923c2437ea8670467121cc3e9b0f76d3043cc1d2331d56c7fb7a3a8f"}, ] +[[package]] +name = "genson" +version = "1.3.0" +description = "GenSON is a powerful, user-friendly JSON Schema generator." +optional = false +python-versions = "*" +groups = ["dev"] +files = [ + {file = "genson-1.3.0-py3-none-any.whl", hash = "sha256:468feccd00274cc7e4c09e84b08704270ba8d95232aa280f65b986139cec67f7"}, + {file = "genson-1.3.0.tar.gz", hash = "sha256:e02db9ac2e3fd29e65b5286f7135762e2cd8a986537c075b06fc5f1517308e37"}, +] + [[package]] name = "ghp-import" version = "2.1.0" description = "Copy your docs directly to the gh-pages branch." optional = false python-versions = "*" +groups = ["dev"] files = [ {file = "ghp-import-2.1.0.tar.gz", hash = "sha256:9c535c4c61193c2df8871222567d7fd7e5014d835f97dc7b7439069e2413d343"}, {file = "ghp_import-2.1.0-py3-none-any.whl", hash = "sha256:8337dd7b50877f163d4c0289bc1f1c7f127550241988d568c1db512c4324a619"}, @@ -1051,6 +1190,7 @@ version = "1.3.1" description = "hexbytes: Python `bytes` subclass that decodes hex, with a readable console output" optional = false python-versions = "<4,>=3.8" +groups = ["main"] files = [ {file = "hexbytes-1.3.1-py3-none-any.whl", hash = "sha256:da01ff24a1a9a2b1881c4b85f0e9f9b0f51b526b379ffa23832ae7899d29c2c7"}, {file = "hexbytes-1.3.1.tar.gz", hash = "sha256:a657eebebdfe27254336f98d8af6e2236f3f83aed164b87466b6cf6c5f5a4765"}, @@ -1067,6 +1207,7 @@ version = "3.10" description = "Internationalized Domain Names in Applications (IDNA)" optional = false python-versions = ">=3.6" +groups = ["main", "dev"] files = [ {file = "idna-3.10-py3-none-any.whl", hash = "sha256:946d195a0d259cbba61165e88e65941f16e9b36ea6ddb97f00452bae8b1287d3"}, {file = "idna-3.10.tar.gz", hash = "sha256:12f65c9b470abda6dc35cf8e63cc574b1c52b11df2c86030af0ac09b01b13ea9"}, @@ -1075,23 +1216,65 @@ files = [ [package.extras] all = ["flake8 (>=7.1.1)", "mypy (>=1.11.2)", "pytest (>=8.3.2)", "ruff (>=0.6.2)"] +[[package]] +name = "inflect" +version = "7.5.0" +description = "Correctly generate plurals, singular nouns, ordinals, indefinite articles" +optional = false +python-versions = ">=3.9" +groups = ["dev"] +files = [ + {file = "inflect-7.5.0-py3-none-any.whl", hash = "sha256:2aea70e5e70c35d8350b8097396ec155ffd68def678c7ff97f51aa69c1d92344"}, + {file = "inflect-7.5.0.tar.gz", hash = "sha256:faf19801c3742ed5a05a8ce388e0d8fe1a07f8d095c82201eb904f5d27ad571f"}, +] + +[package.dependencies] +more_itertools = ">=8.5.0" +typeguard = ">=4.0.1" + +[package.extras] +check = ["pytest-checkdocs (>=2.4)", "pytest-ruff (>=0.2.1) ; sys_platform != \"cygwin\""] +cover = ["pytest-cov"] +doc = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"] +enabler = ["pytest-enabler (>=2.2)"] +test = ["pygments", "pytest (>=6,!=8.1.*)"] +type = ["pytest-mypy"] + [[package]] name = "iniconfig" version = "2.1.0" description = "brain-dead simple config-ini parsing" optional = false python-versions = ">=3.8" +groups = ["dev"] files = [ {file = "iniconfig-2.1.0-py3-none-any.whl", hash = "sha256:9deba5723312380e77435581c6bf4935c94cbfab9b1ed33ef8d238ea168eb760"}, {file = "iniconfig-2.1.0.tar.gz", hash = "sha256:3abbd2e30b36733fee78f9c7f7308f2d0050e88f0087fd25c2645f63c773e1c7"}, ] +[[package]] +name = "isort" +version = "6.0.1" +description = "A Python utility / library to sort Python imports." +optional = false +python-versions = ">=3.9.0" +groups = ["dev"] +files = [ + {file = "isort-6.0.1-py3-none-any.whl", hash = "sha256:2dc5d7f65c9678d94c88dfc29161a320eec67328bc97aad576874cb4be1e9615"}, + {file = "isort-6.0.1.tar.gz", hash = "sha256:1cb5df28dfbc742e490c5e41bad6da41b805b0a8be7bc93cd0fb2a8a890ac450"}, +] + +[package.extras] +colors = ["colorama"] +plugins = ["setuptools"] + [[package]] name = "jinja2" version = "3.1.6" description = "A very fast and expressive template engine." optional = false python-versions = ">=3.7" +groups = ["dev"] files = [ {file = "jinja2-3.1.6-py3-none-any.whl", hash = "sha256:85ece4451f492d0c13c5dd7c13a64681a86afae63a5f347908daf103ce6d2f67"}, {file = "jinja2-3.1.6.tar.gz", hash = "sha256:0137fb05990d35f1275a587e9aee6d56da821fc83491a0fb838183be43f66d6d"}, @@ -1109,6 +1292,7 @@ version = "4.25.1" description = "An implementation of JSON Schema validation for Python" optional = false python-versions = ">=3.9" +groups = ["main"] files = [ {file = "jsonschema-4.25.1-py3-none-any.whl", hash = "sha256:3fba0169e345c7175110351d456342c364814cfcf3b964ba4587f22915230a63"}, {file = "jsonschema-4.25.1.tar.gz", hash = "sha256:e4a9655ce0da0c0b67a085847e00a3a51449e1157f4f75e9fb5aa545e122eb85"}, @@ -1130,6 +1314,7 @@ version = "2025.9.1" description = "The JSON Schema meta-schemas and vocabularies, exposed as a Registry" optional = false python-versions = ">=3.9" +groups = ["main"] files = [ {file = "jsonschema_specifications-2025.9.1-py3-none-any.whl", hash = "sha256:98802fee3a11ee76ecaca44429fda8a41bff98b00a0f2838151b113f210cc6fe"}, {file = "jsonschema_specifications-2025.9.1.tar.gz", hash = "sha256:b540987f239e745613c7a9176f3edb72b832a4ac465cf02712288397832b5e8d"}, @@ -1144,6 +1329,7 @@ version = "1.3.0" description = "An Dict like LRU container." optional = false python-versions = ">=3.8" +groups = ["main"] files = [ {file = "lru-dict-1.3.0.tar.gz", hash = "sha256:54fd1966d6bd1fcde781596cb86068214edeebff1db13a2cea11079e3fd07b6b"}, {file = "lru_dict-1.3.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:4073333894db9840f066226d50e6f914a2240711c87d60885d8c940b69a6673f"}, @@ -1237,6 +1423,7 @@ version = "3.9" description = "Python implementation of John Gruber's Markdown." optional = false python-versions = ">=3.9" +groups = ["dev"] files = [ {file = "markdown-3.9-py3-none-any.whl", hash = "sha256:9f4d91ed810864ea88a6f32c07ba8bee1346c0cc1f6b1f9f6c822f2a9667d280"}, {file = "markdown-3.9.tar.gz", hash = "sha256:d2900fe1782bd33bdbbd56859defef70c2e78fc46668f8eb9df3128138f2cb6a"}, @@ -1252,6 +1439,7 @@ version = "4.0.0" description = "Python port of markdown-it. Markdown parsing, done right!" optional = false python-versions = ">=3.10" +groups = ["main"] files = [ {file = "markdown_it_py-4.0.0-py3-none-any.whl", hash = "sha256:87327c59b172c5011896038353a81343b6754500a08cd7a4973bb48c6d578147"}, {file = "markdown_it_py-4.0.0.tar.gz", hash = "sha256:cb0a2b4aa34f932c007117b194e945bd74e0ec24133ceb5bac59009cda1cb9f3"}, @@ -1275,6 +1463,7 @@ version = "3.0.2" description = "Safely add untrusted strings to HTML/XML markup." optional = false python-versions = ">=3.9" +groups = ["dev"] files = [ {file = "MarkupSafe-3.0.2-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:7e94c425039cde14257288fd61dcfb01963e658efbc0ff54f5306b06054700f8"}, {file = "MarkupSafe-3.0.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:9e2d922824181480953426608b81967de705c3cef4d1af983af849d7bd619158"}, @@ -1345,6 +1534,7 @@ version = "0.1.2" description = "Markdown URL utilities" optional = false python-versions = ">=3.7" +groups = ["main"] files = [ {file = "mdurl-0.1.2-py3-none-any.whl", hash = "sha256:84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8"}, {file = "mdurl-0.1.2.tar.gz", hash = "sha256:bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba"}, @@ -1356,6 +1546,7 @@ version = "1.3.4" description = "A deep merge function for 🐍." optional = false python-versions = ">=3.6" +groups = ["dev"] files = [ {file = "mergedeep-1.3.4-py3-none-any.whl", hash = "sha256:70775750742b25c0d8f36c55aed03d24c3384d17c951b3175d898bd778ef0307"}, {file = "mergedeep-1.3.4.tar.gz", hash = "sha256:0096d52e9dad9939c3d975a774666af186eda617e6ca84df4c94dec30004f2a8"}, @@ -1367,6 +1558,7 @@ version = "1.6.1" description = "Project documentation with Markdown." optional = false python-versions = ">=3.8" +groups = ["dev"] files = [ {file = "mkdocs-1.6.1-py3-none-any.whl", hash = "sha256:db91759624d1647f3f34aa0c3f327dd2601beae39a366d6e064c03468d35c20e"}, {file = "mkdocs-1.6.1.tar.gz", hash = "sha256:7b432f01d928c084353ab39c57282f29f92136665bdd6abf7c1ec8d822ef86f2"}, @@ -1389,7 +1581,7 @@ watchdog = ">=2.0" [package.extras] i18n = ["babel (>=2.9.0)"] -min-versions = ["babel (==2.9.0)", "click (==7.0)", "colorama (==0.4)", "ghp-import (==1.0)", "importlib-metadata (==4.4)", "jinja2 (==2.11.1)", "markdown (==3.3.6)", "markupsafe (==2.0.1)", "mergedeep (==1.3.4)", "mkdocs-get-deps (==0.2.0)", "packaging (==20.5)", "pathspec (==0.11.1)", "pyyaml (==5.1)", "pyyaml-env-tag (==0.1)", "watchdog (==2.0)"] +min-versions = ["babel (==2.9.0)", "click (==7.0)", "colorama (==0.4) ; platform_system == \"Windows\"", "ghp-import (==1.0)", "importlib-metadata (==4.4) ; python_version < \"3.10\"", "jinja2 (==2.11.1)", "markdown (==3.3.6)", "markupsafe (==2.0.1)", "mergedeep (==1.3.4)", "mkdocs-get-deps (==0.2.0)", "packaging (==20.5)", "pathspec (==0.11.1)", "pyyaml (==5.1)", "pyyaml-env-tag (==0.1)", "watchdog (==2.0)"] [[package]] name = "mkdocs-autorefs" @@ -1397,6 +1589,7 @@ version = "0.4.1" description = "Automatically link across pages in MkDocs." optional = false python-versions = ">=3.7" +groups = ["dev"] files = [ {file = "mkdocs-autorefs-0.4.1.tar.gz", hash = "sha256:70748a7bd025f9ecd6d6feeba8ba63f8e891a1af55f48e366d6d6e78493aba84"}, {file = "mkdocs_autorefs-0.4.1-py3-none-any.whl", hash = "sha256:a2248a9501b29dc0cc8ba4c09f4f47ff121945f6ce33d760f145d6f89d313f5b"}, @@ -1412,6 +1605,7 @@ version = "0.2.0" description = "MkDocs extension that lists all dependencies according to a mkdocs.yml file" optional = false python-versions = ">=3.8" +groups = ["dev"] files = [ {file = "mkdocs_get_deps-0.2.0-py3-none-any.whl", hash = "sha256:2bf11d0b133e77a0dd036abeeb06dec8775e46efa526dc70667d8863eefc6134"}, {file = "mkdocs_get_deps-0.2.0.tar.gz", hash = "sha256:162b3d129c7fad9b19abfdcb9c1458a651628e4b1dea628ac68790fb3061c60c"}, @@ -1428,6 +1622,7 @@ version = "3.9.1" description = "Mkdocs Markdown includer plugin." optional = false python-versions = ">=3.6" +groups = ["dev"] files = [ {file = "mkdocs_include_markdown_plugin-3.9.1-py3-none-any.whl", hash = "sha256:f33687e29ac66d045ba181ea50f054646b0090b42b0a4318f08e7f1d1235e6f6"}, {file = "mkdocs_include_markdown_plugin-3.9.1.tar.gz", hash = "sha256:5e5698e78d7fea111be9873a456089daa333497988405acaac8eba2924a19152"}, @@ -1443,6 +1638,7 @@ version = "8.5.11" description = "Documentation that simply works" optional = false python-versions = ">=3.7" +groups = ["dev"] files = [ {file = "mkdocs_material-8.5.11-py3-none-any.whl", hash = "sha256:c907b4b052240a5778074a30a78f31a1f8ff82d7012356dc26898b97559f082e"}, {file = "mkdocs_material-8.5.11.tar.gz", hash = "sha256:b0ea0513fd8cab323e8a825d6692ea07fa83e917bb5db042e523afecc7064ab7"}, @@ -1463,17 +1659,31 @@ version = "1.3.1" description = "Extension pack for Python Markdown and MkDocs Material." optional = false python-versions = ">=3.8" +groups = ["dev"] files = [ {file = "mkdocs_material_extensions-1.3.1-py3-none-any.whl", hash = "sha256:adff8b62700b25cb77b53358dad940f3ef973dd6db797907c49e3c2ef3ab4e31"}, {file = "mkdocs_material_extensions-1.3.1.tar.gz", hash = "sha256:10c9511cea88f568257f960358a467d12b970e1f7b2c0e5fb2bb48cab1928443"}, ] +[[package]] +name = "more-itertools" +version = "10.8.0" +description = "More routines for operating on iterables, beyond itertools" +optional = false +python-versions = ">=3.9" +groups = ["dev"] +files = [ + {file = "more_itertools-10.8.0-py3-none-any.whl", hash = "sha256:52d4362373dcf7c52546bc4af9a86ee7c4579df9a8dc268be0a2f949d376cc9b"}, + {file = "more_itertools-10.8.0.tar.gz", hash = "sha256:f638ddf8a1a0d134181275fb5d58b086ead7c6a72429ad725c67503f13ba30bd"}, +] + [[package]] name = "multidict" version = "6.6.4" description = "multidict implementation" optional = false python-versions = ">=3.9" +groups = ["main"] files = [ {file = "multidict-6.6.4-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:b8aa6f0bd8125ddd04a6593437bad6a7e70f300ff4180a531654aa2ab3f6d58f"}, {file = "multidict-6.6.4-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:b9e5853bbd7264baca42ffc53391b490d65fe62849bf2c690fa3f6273dbcd0cb"}, @@ -1590,12 +1800,25 @@ files = [ [package.dependencies] typing-extensions = {version = ">=4.1.0", markers = "python_version < \"3.11\""} +[[package]] +name = "mypy-extensions" +version = "1.1.0" +description = "Type system extensions for programs checked with the mypy type checker." +optional = false +python-versions = ">=3.8" +groups = ["dev"] +files = [ + {file = "mypy_extensions-1.1.0-py3-none-any.whl", hash = "sha256:1be4cccdb0f2482337c4743e60421de3a356cd97508abadd57d47403e94f5505"}, + {file = "mypy_extensions-1.1.0.tar.gz", hash = "sha256:52e68efc3284861e772bbcd66823fde5ae21fd2fdb51c62a211403730b916558"}, +] + [[package]] name = "numpy" version = "1.26.4" description = "Fundamental package for array computing in Python" optional = false python-versions = ">=3.9" +groups = ["main", "dev"] files = [ {file = "numpy-1.26.4-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:9ff0f4f29c51e2803569d7a51c2304de5554655a60c5d776e35b4a41413830d0"}, {file = "numpy-1.26.4-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:2e4ee3380d6de9c9ec04745830fd9e2eccb3e6cf790d39d7b98ffd19b0dd754a"}, @@ -1641,6 +1864,7 @@ version = "25.0" description = "Core utilities for Python packages" optional = false python-versions = ">=3.8" +groups = ["dev"] files = [ {file = "packaging-25.0-py3-none-any.whl", hash = "sha256:29572ef2b1f17581046b3a2227d5c611fb25ec70ca1ba8554b24b0e69331a484"}, {file = "packaging-25.0.tar.gz", hash = "sha256:d443872c98d677bf60f6a1f2f8c1cb748e8fe762d2bf9d3148b5599295b0fc4f"}, @@ -1652,6 +1876,7 @@ version = "2.3.2" description = "Powerful data structures for data analysis, time series, and statistics" optional = false python-versions = ">=3.9" +groups = ["main"] files = [ {file = "pandas-2.3.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:52bc29a946304c360561974c6542d1dd628ddafa69134a7131fdfd6a5d7a1a35"}, {file = "pandas-2.3.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:220cc5c35ffaa764dd5bb17cf42df283b5cb7fdf49e10a7b053a06c9cb48ee2b"}, @@ -1738,6 +1963,7 @@ version = "0.10.0" description = "(Soon to be) the fastest pure-Python PEG parser I could muster" optional = false python-versions = "*" +groups = ["main"] files = [ {file = "parsimonious-0.10.0-py3-none-any.whl", hash = "sha256:982ab435fabe86519b57f6b35610aa4e4e977e9f02a14353edf4bbc75369fc0f"}, {file = "parsimonious-0.10.0.tar.gz", hash = "sha256:8281600da180ec8ae35427a4ab4f7b82bfec1e3d1e52f80cb60ea82b9512501c"}, @@ -1752,6 +1978,7 @@ version = "0.12.1" description = "Utility library for gitignore style pattern matching of file paths." optional = false python-versions = ">=3.8" +groups = ["dev"] files = [ {file = "pathspec-0.12.1-py3-none-any.whl", hash = "sha256:a0d503e138a4c123b27490a4f7beda6a01c6f288df0e4a8b79c7eb0dc7b4cc08"}, {file = "pathspec-0.12.1.tar.gz", hash = "sha256:a482d51503a1ab33b1c67a6c3813a26953dbdc71c31dacaef9a838c4e29f5712"}, @@ -1763,6 +1990,7 @@ version = "4.4.0" description = "A small Python package for determining appropriate platform-specific dirs, e.g. a `user data dir`." optional = false python-versions = ">=3.9" +groups = ["dev"] files = [ {file = "platformdirs-4.4.0-py3-none-any.whl", hash = "sha256:abd01743f24e5287cd7a5db3752faf1a2d65353f38ec26d98e25a6db65958c85"}, {file = "platformdirs-4.4.0.tar.gz", hash = "sha256:ca753cf4d81dc309bc67b0ea38fd15dc97bc30ce419a7f58d13eb3bf14c4febf"}, @@ -1779,6 +2007,7 @@ version = "1.6.0" description = "plugin and hook calling mechanisms for python" optional = false python-versions = ">=3.9" +groups = ["dev"] files = [ {file = "pluggy-1.6.0-py3-none-any.whl", hash = "sha256:e920276dd6813095e9377c0bc5566d94c932c33b27a3e3945d8389c374dd4746"}, {file = "pluggy-1.6.0.tar.gz", hash = "sha256:7dcc130b76258d33b90f61b658791dede3486c3e6bfb003ee5c9bfb396dd22f3"}, @@ -1794,6 +2023,7 @@ version = "0.3.2" description = "Accelerated property cache" optional = false python-versions = ">=3.9" +groups = ["main"] files = [ {file = "propcache-0.3.2-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:22d9962a358aedbb7a2e36187ff273adeaab9743373a272976d2e348d08c7770"}, {file = "propcache-0.3.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:0d0fda578d1dc3f77b6b5a5dce3b9ad69a8250a891760a548df850a5e8da87f3"}, @@ -1901,6 +2131,7 @@ version = "6.32.1" description = "" optional = false python-versions = ">=3.9" +groups = ["main"] files = [ {file = "protobuf-6.32.1-cp310-abi3-win32.whl", hash = "sha256:a8a32a84bc9f2aad712041b8b366190f71dde248926da517bde9e832e4412085"}, {file = "protobuf-6.32.1-cp310-abi3-win_amd64.whl", hash = "sha256:b00a7d8c25fa471f16bc8153d0e53d6c9e827f0953f3c09aaa4331c718cae5e1"}, @@ -1919,6 +2150,7 @@ version = "3.23.0" description = "Cryptographic library for Python" optional = false python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" +groups = ["main"] files = [ {file = "pycryptodome-3.23.0-cp27-cp27m-macosx_10_9_x86_64.whl", hash = "sha256:a176b79c49af27d7f6c12e4b178b0824626f40a7b9fed08f712291b6d54bf566"}, {file = "pycryptodome-3.23.0-cp27-cp27m-manylinux2010_i686.whl", hash = "sha256:573a0b3017e06f2cffd27d92ef22e46aa3be87a2d317a5abf7cc0e84e321bd75"}, @@ -1969,6 +2201,7 @@ version = "2.11.9" description = "Data validation using Python type hints" optional = false python-versions = ">=3.9" +groups = ["main", "dev"] files = [ {file = "pydantic-2.11.9-py3-none-any.whl", hash = "sha256:c42dd626f5cfc1c6950ce6205ea58c93efa406da65f479dcb4029d5934857da2"}, {file = "pydantic-2.11.9.tar.gz", hash = "sha256:6b8ffda597a14812a7975c90b82a8a2e777d9257aba3453f973acd3c032a18e2"}, @@ -1982,7 +2215,7 @@ typing-inspection = ">=0.4.0" [package.extras] email = ["email-validator (>=2.0.0)"] -timezone = ["tzdata"] +timezone = ["tzdata ; python_version >= \"3.9\" and platform_system == \"Windows\""] [[package]] name = "pydantic-core" @@ -1990,6 +2223,7 @@ version = "2.33.2" description = "Core functionality for Pydantic validation and serialization" optional = false python-versions = ">=3.9" +groups = ["main", "dev"] files = [ {file = "pydantic_core-2.33.2-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:2b3d326aaef0c0399d9afffeb6367d5e26ddc24d351dbc9c636840ac355dc5d8"}, {file = "pydantic_core-2.33.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:0e5b2671f05ba48b94cb90ce55d8bdcaaedb8ba00cc5359f6810fc918713983d"}, @@ -2101,6 +2335,7 @@ version = "2.19.2" description = "Pygments is a syntax highlighting package written in Python." optional = false python-versions = ">=3.8" +groups = ["main", "dev"] files = [ {file = "pygments-2.19.2-py3-none-any.whl", hash = "sha256:86540386c03d588bb81d44bc3928634ff26449851e99741617ecb9037ee5ec0b"}, {file = "pygments-2.19.2.tar.gz", hash = "sha256:636cb2477cec7f8952536970bc533bc43743542f70392ae026374600add5b887"}, @@ -2115,6 +2350,7 @@ version = "10.16.1" description = "Extension pack for Python Markdown." optional = false python-versions = ">=3.9" +groups = ["dev"] files = [ {file = "pymdown_extensions-10.16.1-py3-none-any.whl", hash = "sha256:d6ba157a6c03146a7fb122b2b9a121300056384eafeec9c9f9e584adfdb2a32d"}, {file = "pymdown_extensions-10.16.1.tar.gz", hash = "sha256:aace82bcccba3efc03e25d584e6a22d27a8e17caa3f4dd9f207e49b787aa9a91"}, @@ -2133,6 +2369,7 @@ version = "7.4.4" description = "pytest: simple powerful testing with Python" optional = false python-versions = ">=3.7" +groups = ["dev"] files = [ {file = "pytest-7.4.4-py3-none-any.whl", hash = "sha256:b090cdf5ed60bf4c45261be03239c2c1c22df034fbffe691abe93cd80cea01d8"}, {file = "pytest-7.4.4.tar.gz", hash = "sha256:2cf0005922c6ace4a3e2ec8b4080eb0d9753fdc93107415332f50ce9e7994280"}, @@ -2155,6 +2392,7 @@ version = "13.0" description = "pytest plugin to re-run tests to eliminate flaky failures" optional = false python-versions = ">=3.7" +groups = ["dev"] files = [ {file = "pytest-rerunfailures-13.0.tar.gz", hash = "sha256:e132dbe420bc476f544b96e7036edd0a69707574209b6677263c950d19b09199"}, {file = "pytest_rerunfailures-13.0-py3-none-any.whl", hash = "sha256:34919cb3fcb1f8e5d4b940aa75ccdea9661bade925091873b7c6fa5548333069"}, @@ -2170,6 +2408,7 @@ version = "2.9.0.post0" description = "Extensions to the standard Python datetime module" optional = false python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7" +groups = ["main", "dev"] files = [ {file = "python-dateutil-2.9.0.post0.tar.gz", hash = "sha256:37dd54208da7e1cd875388217d5e00ebd4179249f90fb72437e91a35459a0ad3"}, {file = "python_dateutil-2.9.0.post0-py2.py3-none-any.whl", hash = "sha256:a8b2bc7bffae282281c8140a97d3aa9c14da0b136dfe83f850eea9a5f7470427"}, @@ -2184,6 +2423,7 @@ version = "1.1.1" description = "Read key-value pairs from a .env file and set them as environment variables" optional = false python-versions = ">=3.9" +groups = ["main"] files = [ {file = "python_dotenv-1.1.1-py3-none-any.whl", hash = "sha256:31f23644fe2602f88ff55e1f5c79ba497e01224ee7737937930c448e4d0e24dc"}, {file = "python_dotenv-1.1.1.tar.gz", hash = "sha256:a8a6399716257f45be6a007360200409fce5cda2661e3dec71d23dc15f6189ab"}, @@ -2192,12 +2432,28 @@ files = [ [package.extras] cli = ["click (>=5.0)"] +[[package]] +name = "pytokens" +version = "0.1.10" +description = "A Fast, spec compliant Python 3.12+ tokenizer that runs on older Pythons." +optional = false +python-versions = ">=3.8" +groups = ["dev"] +files = [ + {file = "pytokens-0.1.10-py3-none-any.whl", hash = "sha256:db7b72284e480e69fb085d9f251f66b3d2df8b7166059261258ff35f50fb711b"}, + {file = "pytokens-0.1.10.tar.gz", hash = "sha256:c9a4bfa0be1d26aebce03e6884ba454e842f186a59ea43a6d3b25af58223c044"}, +] + +[package.extras] +dev = ["black", "build", "mypy", "pytest", "pytest-cov", "setuptools", "tox", "twine", "wheel"] + [[package]] name = "pytz" version = "2025.2" description = "World timezone definitions, modern and historical" optional = false python-versions = "*" +groups = ["main"] files = [ {file = "pytz-2025.2-py2.py3-none-any.whl", hash = "sha256:5ddf76296dd8c44c26eb8f4b6f35488f3ccbf6fbbd7adee0b7262d43f0ec2f00"}, {file = "pytz-2025.2.tar.gz", hash = "sha256:360b9e3dbb49a209c21ad61809c7fb453643e048b38924c765813546746e81c3"}, @@ -2209,6 +2465,7 @@ version = "16.0.0" description = "Unicode normalization forms (NFC, NFKC, NFD, NFKD). A library independent of the Python core Unicode database." optional = false python-versions = ">=3.6" +groups = ["main"] files = [ {file = "pyunormalize-16.0.0-py3-none-any.whl", hash = "sha256:c647d95e5d1e2ea9a2f448d1d95d8518348df24eab5c3fd32d2b5c3300a49152"}, {file = "pyunormalize-16.0.0.tar.gz", hash = "sha256:2e1dfbb4a118154ae26f70710426a52a364b926c9191f764601f5a8cb12761f7"}, @@ -2220,6 +2477,8 @@ version = "311" description = "Python for Window Extensions" optional = false python-versions = "*" +groups = ["main"] +markers = "platform_system == \"Windows\"" files = [ {file = "pywin32-311-cp310-cp310-win32.whl", hash = "sha256:d03ff496d2a0cd4a5893504789d4a15399133fe82517455e78bad62efbb7f0a3"}, {file = "pywin32-311-cp310-cp310-win_amd64.whl", hash = "sha256:797c2772017851984b97180b0bebe4b620bb86328e8a884bb626156295a63b3b"}, @@ -2249,6 +2508,7 @@ version = "6.0.2" description = "YAML parser and emitter for Python" optional = false python-versions = ">=3.8" +groups = ["dev"] files = [ {file = "PyYAML-6.0.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:0a9a2848a5b7feac301353437eb7d5957887edbf81d56e903999a75a3d743086"}, {file = "PyYAML-6.0.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:29717114e51c84ddfba879543fb232a6ed60086602313ca38cce623c1d62cfbf"}, @@ -2311,6 +2571,7 @@ version = "1.1" description = "A custom YAML tag for referencing environment variables in YAML files." optional = false python-versions = ">=3.9" +groups = ["dev"] files = [ {file = "pyyaml_env_tag-1.1-py3-none-any.whl", hash = "sha256:17109e1a528561e32f026364712fee1264bc2ea6715120891174ed1b980d2e04"}, {file = "pyyaml_env_tag-1.1.tar.gz", hash = "sha256:2eb38b75a2d21ee0475d6d97ec19c63287a7e140231e4214969d0eac923cd7ff"}, @@ -2325,6 +2586,7 @@ version = "0.36.2" description = "JSON Referencing + Python" optional = false python-versions = ">=3.9" +groups = ["main"] files = [ {file = "referencing-0.36.2-py3-none-any.whl", hash = "sha256:e8699adbbf8b5c7de96d8ffa0eb5c158b3beafce084968e2ea8bb08c6794dcd0"}, {file = "referencing-0.36.2.tar.gz", hash = "sha256:df2e89862cd09deabbdba16944cc3f10feb6b3e6f18e902f7cc25609a34775aa"}, @@ -2341,6 +2603,7 @@ version = "2025.9.1" description = "Alternative regular expression module, to replace re." optional = false python-versions = ">=3.9" +groups = ["main"] files = [ {file = "regex-2025.9.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:c5aa2a6a73bf218515484b36a0d20c6ad9dc63f6339ff6224147b0e2c095ee55"}, {file = "regex-2025.9.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:8c2ff5c01d5e47ad5fc9d31bcd61e78c2fa0068ed00cab86b7320214446da766"}, @@ -2437,6 +2700,7 @@ version = "2.32.5" description = "Python HTTP for Humans." optional = false python-versions = ">=3.9" +groups = ["main", "dev"] files = [ {file = "requests-2.32.5-py3-none-any.whl", hash = "sha256:2462f94637a34fd532264295e186976db0f5d453d1cdd31473c85a6a161affb6"}, {file = "requests-2.32.5.tar.gz", hash = "sha256:dbba0bac56e100853db0ea71b82b4dfd5fe2bf6d3754a8893c3af500cec7d7cf"}, @@ -2458,6 +2722,7 @@ version = "0.26.0" description = "Make your functions return something meaningful, typed, and safe!" optional = false python-versions = "<4.0,>=3.10" +groups = ["main"] files = [ {file = "returns-0.26.0-py3-none-any.whl", hash = "sha256:7cae94c730d6c56ffd9d0f583f7a2c0b32cfe17d141837150c8e6cff3eb30d71"}, {file = "returns-0.26.0.tar.gz", hash = "sha256:180320e0f6e9ea9845330ccfc020f542330f05b7250941d9b9b7c00203fcc3da"}, @@ -2476,6 +2741,7 @@ version = "14.1.0" description = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal" optional = false python-versions = ">=3.8.0" +groups = ["main"] files = [ {file = "rich-14.1.0-py3-none-any.whl", hash = "sha256:536f5f1785986d6dbdea3c75205c473f970777b4a0d6c6dd1b696aa05a3fa04f"}, {file = "rich-14.1.0.tar.gz", hash = "sha256:e497a48b844b0320d45007cdebfeaeed8db2a4f4bcf49f15e455cfc4af11eaa8"}, @@ -2494,6 +2760,7 @@ version = "1.9.0" description = "Format click help output nicely with rich" optional = false python-versions = ">=3.8" +groups = ["main"] files = [ {file = "rich_click-1.9.0-py3-none-any.whl", hash = "sha256:28e6eb34a99c8c45eb910259078bc54dd78cf6f18cc75cb77a50012a98458664"}, {file = "rich_click-1.9.0.tar.gz", hash = "sha256:212a19875b1e485803a5448130a9157b04c0d0befcc2bc29cb64d3577b93b005"}, @@ -2506,7 +2773,7 @@ typing-extensions = {version = ">=4", markers = "python_version < \"3.11\""} [package.extras] dev = ["inline-snapshot (>=0.24)", "jsonschema (>=4)", "mypy (>=1.14.1)", "nodeenv (>=1.9.1)", "packaging (>=25)", "pre-commit (>=3.5)", "pytest (>=8.3.5)", "pytest-cov (>=5)", "rich-codex (>=1.2.11)", "ruff (>=0.12.4)", "typer (>=0.15)", "types-setuptools (>=75.8.0.20250110)"] -docs = ["markdown-include (>=0.8.1)", "mike (>=2.1.3)", "mkdocs-github-admonitions-plugin (>=0.1.1)", "mkdocs-glightbox (>=0.4)", "mkdocs-include-markdown-plugin (>=7.1.7)", "mkdocs-material-extensions (>=1.3.1)", "mkdocs-material[imaging] (>=9.5.18,<9.6.0)", "mkdocs-redirects (>=1.2.2)", "mkdocs-rss-plugin (>=1.15)", "mkdocs[docs] (>=1.6.1)", "mkdocstrings[python] (>=0.26.1)", "rich-codex (>=1.2.11)", "typer (>=0.15)"] +docs = ["markdown-include (>=0.8.1)", "mike (>=2.1.3)", "mkdocs-github-admonitions-plugin (>=0.1.1)", "mkdocs-glightbox (>=0.4)", "mkdocs-include-markdown-plugin (>=7.1.7) ; python_version >= \"3.9\"", "mkdocs-material-extensions (>=1.3.1)", "mkdocs-material[imaging] (>=9.5.18,<9.6.0)", "mkdocs-redirects (>=1.2.2)", "mkdocs-rss-plugin (>=1.15)", "mkdocs[docs] (>=1.6.1)", "mkdocstrings[python] (>=0.26.1)", "rich-codex (>=1.2.11)", "typer (>=0.15)"] [[package]] name = "rlp" @@ -2514,6 +2781,7 @@ version = "4.1.0" description = "rlp: A package for Recursive Length Prefix encoding and decoding" optional = false python-versions = "<4,>=3.8" +groups = ["main"] files = [ {file = "rlp-4.1.0-py3-none-any.whl", hash = "sha256:8eca394c579bad34ee0b937aecb96a57052ff3716e19c7a578883e767bc5da6f"}, {file = "rlp-4.1.0.tar.gz", hash = "sha256:be07564270a96f3e225e2c107db263de96b5bc1f27722d2855bd3459a08e95a9"}, @@ -2534,6 +2802,7 @@ version = "0.27.1" description = "Python bindings to Rust's persistent data structures (rpds)" optional = false python-versions = ">=3.9" +groups = ["main"] files = [ {file = "rpds_py-0.27.1-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:68afeec26d42ab3b47e541b272166a0b4400313946871cba3ed3a4fc0cab1cef"}, {file = "rpds_py-0.27.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:74e5b2f7bb6fa38b1b10546d27acbacf2a022a8b5543efb06cfebc72a59c85be"}, @@ -2698,6 +2967,7 @@ version = "0.13.0" description = "An extremely fast Python linter and code formatter, written in Rust." optional = false python-versions = ">=3.7" +groups = ["dev"] files = [ {file = "ruff-0.13.0-py3-none-linux_armv6l.whl", hash = "sha256:137f3d65d58ee828ae136a12d1dc33d992773d8f7644bc6b82714570f31b2004"}, {file = "ruff-0.13.0-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:21ae48151b66e71fd111b7d79f9ad358814ed58c339631450c66a4be33cc28b9"}, @@ -2726,6 +2996,7 @@ version = "0.7.7" description = "Simple data validation library" optional = false python-versions = "*" +groups = ["dev"] files = [ {file = "schema-0.7.7-py2.py3-none-any.whl", hash = "sha256:5d976a5b50f36e74e2157b47097b60002bd4d42e65425fcc9c9befadb4255dde"}, {file = "schema-0.7.7.tar.gz", hash = "sha256:7da553abd2958a19dc2547c388cde53398b39196175a9be59ea1caf5ab0a1807"}, @@ -2737,6 +3008,7 @@ version = "2.13.0" description = "Python helper for Semantic Versioning (http://semver.org/)" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +groups = ["dev"] files = [ {file = "semver-2.13.0-py2.py3-none-any.whl", hash = "sha256:ced8b23dceb22134307c1b8abfa523da14198793d9787ac838e70e29e77458d4"}, {file = "semver-2.13.0.tar.gz", hash = "sha256:fa0fe2722ee1c3f57eac478820c3a5ae2f624af8264cbdf9000c980ff7f75e3f"}, @@ -2748,19 +3020,20 @@ version = "75.9.1" description = "Easily download, build, install, upgrade, and uninstall Python packages" optional = false python-versions = ">=3.9" +groups = ["main"] files = [ {file = "setuptools-75.9.1-py3-none-any.whl", hash = "sha256:0a6f876d62f4d978ca1a11ab4daf728d1357731f978543ff18ecdbf9fd071f73"}, {file = "setuptools-75.9.1.tar.gz", hash = "sha256:b6eca2c3070cdc82f71b4cb4bb2946bc0760a210d11362278cf1ff394e6ea32c"}, ] [package.extras] -check = ["pytest-checkdocs (>=2.4)", "pytest-ruff (>=0.2.1)", "ruff (>=0.8.0)"] -core = ["importlib_metadata (>=6)", "jaraco.collections", "jaraco.functools (>=4)", "jaraco.text (>=3.7)", "more_itertools", "more_itertools (>=8.8)", "packaging", "packaging (>=24.2)", "platformdirs (>=4.2.2)", "tomli (>=2.0.1)", "wheel (>=0.43.0)"] +check = ["pytest-checkdocs (>=2.4)", "pytest-ruff (>=0.2.1) ; sys_platform != \"cygwin\"", "ruff (>=0.8.0) ; sys_platform != \"cygwin\""] +core = ["importlib_metadata (>=6) ; python_version < \"3.10\"", "jaraco.collections", "jaraco.functools (>=4)", "jaraco.text (>=3.7)", "more_itertools", "more_itertools (>=8.8)", "packaging", "packaging (>=24.2)", "platformdirs (>=4.2.2)", "tomli (>=2.0.1) ; python_version < \"3.11\"", "wheel (>=0.43.0)"] cover = ["pytest-cov"] doc = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "pygments-github-lexers (==0.0.5)", "pyproject-hooks (!=1.1)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-favicon", "sphinx-inline-tabs", "sphinx-lint", "sphinx-notfound-page (>=1,<2)", "sphinx-reredirects", "sphinxcontrib-towncrier", "towncrier (<24.7)"] enabler = ["pytest-enabler (>=2.2)"] -test = ["build[virtualenv] (>=1.0.3)", "filelock (>=3.4.0)", "ini2toml[lite] (>=0.14)", "jaraco.develop (>=7.21)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.7.2)", "jaraco.test (>=5.5)", "packaging (>=24.2)", "pip (>=19.1)", "pyproject-hooks (!=1.1)", "pytest (>=6,!=8.1.*)", "pytest-home (>=0.5)", "pytest-perf", "pytest-subprocess", "pytest-timeout", "pytest-xdist (>=3)", "tomli-w (>=1.0.0)", "virtualenv (>=13.0.0)", "wheel (>=0.44.0)"] -type = ["importlib_metadata (>=7.0.2)", "jaraco.develop (>=7.21)", "mypy (==1.14.*)", "pytest-mypy"] +test = ["build[virtualenv] (>=1.0.3)", "filelock (>=3.4.0)", "ini2toml[lite] (>=0.14)", "jaraco.develop (>=7.21) ; python_version >= \"3.9\" and sys_platform != \"cygwin\"", "jaraco.envs (>=2.2)", "jaraco.path (>=3.7.2)", "jaraco.test (>=5.5)", "packaging (>=24.2)", "pip (>=19.1)", "pyproject-hooks (!=1.1)", "pytest (>=6,!=8.1.*)", "pytest-home (>=0.5)", "pytest-perf ; sys_platform != \"cygwin\"", "pytest-subprocess", "pytest-timeout", "pytest-xdist (>=3)", "tomli-w (>=1.0.0)", "virtualenv (>=13.0.0)", "wheel (>=0.44.0)"] +type = ["importlib_metadata (>=7.0.2) ; python_version < \"3.10\"", "jaraco.develop (>=7.21) ; sys_platform != \"cygwin\"", "mypy (==1.14.*)", "pytest-mypy"] [[package]] name = "six" @@ -2768,6 +3041,7 @@ version = "1.17.0" description = "Python 2 and 3 compatibility utilities" optional = false python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7" +groups = ["main", "dev"] files = [ {file = "six-1.17.0-py2.py3-none-any.whl", hash = "sha256:4721f391ed90541fddacab5acf947aa0d3dc7d27b2e1e8eda2be8970586c3274"}, {file = "six-1.17.0.tar.gz", hash = "sha256:ff70335d468e7eb6ec65b95b99d3a2836546063f63acc5171de367e834932a81"}, @@ -2779,6 +3053,7 @@ version = "0.9.0" description = "Pretty-print tabular data" optional = false python-versions = ">=3.7" +groups = ["dev"] files = [ {file = "tabulate-0.9.0-py3-none-any.whl", hash = "sha256:024ca478df22e9340661486f85298cff5f6dcdba14f3813e8830015b9ed1948f"}, {file = "tabulate-0.9.0.tar.gz", hash = "sha256:0095b12bf5966de529c0feb1fa08671671b3368eec77d7ef7ab114be2c068b3c"}, @@ -2793,6 +3068,7 @@ version = "6.11.0" description = "Bump software releases" optional = false python-versions = ">=3.7,<4.0" +groups = ["dev"] files = [ {file = "tbump-6.11.0-py3-none-any.whl", hash = "sha256:6b181fe6f3ae84ce0b9af8cc2009a8bca41ded34e73f623a7413b9684f1b4526"}, {file = "tbump-6.11.0.tar.gz", hash = "sha256:385e710eedf0a8a6ff959cf1e9f3cfd17c873617132fc0ec5f629af0c355c870"}, @@ -2810,6 +3086,8 @@ version = "2.2.1" description = "A lil' TOML parser" optional = false python-versions = ">=3.8" +groups = ["dev"] +markers = "python_version <= \"3.11\"" files = [ {file = "tomli-2.2.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:678e4fa69e4575eb77d103de3df8a895e1591b48e740211bd1067378c69e8249"}, {file = "tomli-2.2.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:023aa114dd824ade0100497eb2318602af309e5a55595f76b626d6d9f3b7b0a6"}, @@ -2851,6 +3129,7 @@ version = "0.11.8" description = "Style preserving TOML library" optional = false python-versions = ">=3.7" +groups = ["dev"] files = [ {file = "tomlkit-0.11.8-py3-none-any.whl", hash = "sha256:8c726c4c202bdb148667835f68d68780b9a003a9ec34167b6c673b38eff2a171"}, {file = "tomlkit-0.11.8.tar.gz", hash = "sha256:9330fc7faa1db67b541b28e62018c17d20be733177d290a13b24c62d1614e0c3"}, @@ -2862,17 +3141,35 @@ version = "1.0.0" description = "List processing tools and functional utilities" optional = false python-versions = ">=3.8" +groups = ["main"] +markers = "implementation_name == \"cpython\" or implementation_name == \"pypy\"" files = [ {file = "toolz-1.0.0-py3-none-any.whl", hash = "sha256:292c8f1c4e7516bf9086f8850935c799a874039c8bcf959d47b600e4c44a6236"}, {file = "toolz-1.0.0.tar.gz", hash = "sha256:2c86e3d9a04798ac556793bced838816296a2f085017664e4995cb40a1047a02"}, ] +[[package]] +name = "typeguard" +version = "4.4.4" +description = "Run-time type checker for Python" +optional = false +python-versions = ">=3.9" +groups = ["dev"] +files = [ + {file = "typeguard-4.4.4-py3-none-any.whl", hash = "sha256:b5f562281b6bfa1f5492470464730ef001646128b180769880468bd84b68b09e"}, + {file = "typeguard-4.4.4.tar.gz", hash = "sha256:3a7fd2dffb705d4d0efaed4306a704c89b9dee850b688f060a8b1615a79e5f74"}, +] + +[package.dependencies] +typing_extensions = ">=4.14.0" + [[package]] name = "typing-extensions" version = "4.15.0" description = "Backported and Experimental Type Hints for Python 3.9+" optional = false python-versions = ">=3.9" +groups = ["main", "dev"] files = [ {file = "typing_extensions-4.15.0-py3-none-any.whl", hash = "sha256:f0fa19c6845758ab08074a0cfa8b7aecb71c999ca73d62883bc25cc018c4e548"}, {file = "typing_extensions-4.15.0.tar.gz", hash = "sha256:0cea48d173cc12fa28ecabc3b837ea3cf6f38c6d1136f85cbaaf598984861466"}, @@ -2884,6 +3181,7 @@ version = "0.4.1" description = "Runtime typing introspection tools" optional = false python-versions = ">=3.9" +groups = ["main", "dev"] files = [ {file = "typing_inspection-0.4.1-py3-none-any.whl", hash = "sha256:389055682238f53b04f7badcb49b989835495a96700ced5dab2d8feae4b26f51"}, {file = "typing_inspection-0.4.1.tar.gz", hash = "sha256:6ae134cc0203c33377d43188d4064e9b357dba58cff3185f22924610e70a9d28"}, @@ -2898,6 +3196,7 @@ version = "2025.2" description = "Provider of IANA time zone data" optional = false python-versions = ">=2" +groups = ["main"] files = [ {file = "tzdata-2025.2-py2.py3-none-any.whl", hash = "sha256:1a403fada01ff9221ca8044d701868fa132215d84beb92242d9acd2147f667a8"}, {file = "tzdata-2025.2.tar.gz", hash = "sha256:b60a638fcc0daffadf82fe0f57e53d06bdec2f36c4df66280ae79bce6bd6f2b9"}, @@ -2909,6 +3208,7 @@ version = "1.4.0" description = "ASCII transliterations of Unicode text" optional = false python-versions = ">=3.7" +groups = ["dev"] files = [ {file = "Unidecode-1.4.0-py3-none-any.whl", hash = "sha256:c3c7606c27503ad8d501270406e345ddb480a7b5f38827eafe4fa82a137f0021"}, {file = "Unidecode-1.4.0.tar.gz", hash = "sha256:ce35985008338b676573023acc382d62c264f307c8f7963733405add37ea2b23"}, @@ -2920,13 +3220,14 @@ version = "2.5.0" description = "HTTP library with thread-safe connection pooling, file post, and more." optional = false python-versions = ">=3.9" +groups = ["main", "dev"] files = [ {file = "urllib3-2.5.0-py3-none-any.whl", hash = "sha256:e6b01673c0fa6a13e374b50871808eb3bf7046c4b125b216f6bf1cc604cff0dc"}, {file = "urllib3-2.5.0.tar.gz", hash = "sha256:3fc47733c7e419d4bc3f6b3dc2b4f890bb743906a30d56ba4a5bfa4bbff92760"}, ] [package.extras] -brotli = ["brotli (>=1.0.9)", "brotlicffi (>=0.8.0)"] +brotli = ["brotli (>=1.0.9) ; platform_python_implementation == \"CPython\"", "brotlicffi (>=0.8.0) ; platform_python_implementation != \"CPython\""] h2 = ["h2 (>=4,<5)"] socks = ["pysocks (>=1.5.6,!=1.5.7,<2.0)"] zstd = ["zstandard (>=0.18.0)"] @@ -2937,6 +3238,7 @@ version = "6.0.0" description = "Filesystem events monitoring" optional = false python-versions = ">=3.9" +groups = ["dev"] files = [ {file = "watchdog-6.0.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:d1cdb490583ebd691c012b3d6dae011000fe42edb7a82ece80965b42abd61f26"}, {file = "watchdog-6.0.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:bc64ab3bdb6a04d69d4023b29422170b74681784ffb9463ed4870cf2f3e66112"}, @@ -2979,6 +3281,7 @@ version = "6.11.0" description = "web3.py" optional = false python-versions = ">=3.7.2" +groups = ["main"] files = [ {file = "web3-6.11.0-py3-none-any.whl", hash = "sha256:44e79da6a4765eacf137f2f388e37aa0c1e24a93bdfb462cffe9441d1be3d509"}, {file = "web3-6.11.0.tar.gz", hash = "sha256:050dea52ae73d787272e7ecba7249f096595938c90cce1a384c20375c6b0f720"}, @@ -3002,7 +3305,7 @@ typing-extensions = ">=4.0.1" websockets = ">=10.0.0" [package.extras] -dev = ["black (>=22.1.0)", "build (>=0.9.0)", "bumpversion", "eth-tester[py-evm] (==v0.9.1-b.1)", "flake8 (==3.8.3)", "flaky (>=3.7.0)", "hypothesis (>=3.31.2)", "importlib-metadata (<5.0)", "ipfshttpclient (==0.8.0a2)", "isort (>=5.11.0)", "mypy (==1.4.1)", "py-geth (>=3.11.0)", "pytest (>=7.0.0)", "pytest-asyncio (>=0.18.1)", "pytest-mock (>=1.10)", "pytest-watch (>=4.2)", "pytest-xdist (>=1.29)", "setuptools (>=38.6.0)", "sphinx (>=5.3.0)", "sphinx-rtd-theme (>=1.0.0)", "towncrier (>=21,<22)", "tox (>=3.18.0)", "tqdm (>4.32)", "twine (>=1.13)", "types-protobuf (==3.19.13)", "types-requests (>=2.26.1)", "types-setuptools (>=57.4.4)", "when-changed (>=0.3.0)"] +dev = ["black (>=22.1.0)", "build (>=0.9.0)", "bumpversion", "eth-tester[py-evm] (==v0.9.1-b.1)", "flake8 (==3.8.3)", "flaky (>=3.7.0)", "hypothesis (>=3.31.2)", "importlib-metadata (<5.0) ; python_version < \"3.8\"", "ipfshttpclient (==0.8.0a2)", "isort (>=5.11.0)", "mypy (==1.4.1)", "py-geth (>=3.11.0)", "pytest (>=7.0.0)", "pytest-asyncio (>=0.18.1)", "pytest-mock (>=1.10)", "pytest-watch (>=4.2)", "pytest-xdist (>=1.29)", "setuptools (>=38.6.0)", "sphinx (>=5.3.0)", "sphinx-rtd-theme (>=1.0.0)", "towncrier (>=21,<22)", "tox (>=3.18.0)", "tqdm (>4.32)", "twine (>=1.13)", "types-protobuf (==3.19.13)", "types-requests (>=2.26.1)", "types-setuptools (>=57.4.4)", "when-changed (>=0.3.0)"] docs = ["sphinx (>=5.3.0)", "sphinx-rtd-theme (>=1.0.0)", "towncrier (>=21,<22)"] ipfs = ["ipfshttpclient (==0.8.0a2)"] linter = ["black (>=22.1.0)", "flake8 (==3.8.3)", "isort (>=5.11.0)", "mypy (==1.4.1)", "types-protobuf (==3.19.13)", "types-requests (>=2.26.1)", "types-setuptools (>=57.4.4)"] @@ -3014,6 +3317,7 @@ version = "0.59.0" description = "WebSocket client for Python with low level API options" optional = false python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +groups = ["main"] files = [ {file = "websocket-client-0.59.0.tar.gz", hash = "sha256:d376bd60eace9d437ab6d7ee16f4ab4e821c9dae591e1b783c58ebd8aaf80c5c"}, {file = "websocket_client-0.59.0-py2.py3-none-any.whl", hash = "sha256:2e50d26ca593f70aba7b13a489435ef88b8fc3b5c5643c1ce8808ff9b40f0b32"}, @@ -3028,6 +3332,7 @@ version = "15.0.1" description = "An implementation of the WebSocket Protocol (RFC 6455 & 7692)" optional = false python-versions = ">=3.9" +groups = ["main"] files = [ {file = "websockets-15.0.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:d63efaa0cd96cf0c5fe4d581521d9fa87744540d4bc999ae6e08595a1014b45b"}, {file = "websockets-15.0.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:ac60e3b188ec7574cb761b08d50fcedf9d77f1530352db4eef1707fe9dee7205"}, @@ -3106,6 +3411,7 @@ version = "1.20.1" description = "Yet another URL library" optional = false python-versions = ">=3.9" +groups = ["main"] files = [ {file = "yarl-1.20.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:6032e6da6abd41e4acda34d75a816012717000fa6839f37124a47fcefc49bec4"}, {file = "yarl-1.20.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:2c7b34d804b8cf9b214f05015c4fee2ebe7ed05cf581e7192c06555c71f4446a"}, @@ -3219,6 +3525,6 @@ multidict = ">=4.0" propcache = ">=0.2.1" [metadata] -lock-version = "2.0" +lock-version = "2.1" python-versions = ">=3.10,<=3.12" -content-hash = "c568f60f4b19074dc19a2d943b72fb392d633747f3daca2c0a7c1f6807406439" +content-hash = "a866f9946e573fcaf033f95da79733a58681ca67bdefd6223939b9770514e697" diff --git a/pyproject.toml b/pyproject.toml index ea3c25bc..3fe52c88 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,6 +39,7 @@ mkdocs-material = "^8.4.0" mkdocs-material-extensions = "^1.0.3" mkdocs-autorefs = "^0.4.1" ruff = "^0.13.0" +datamodel-code-generator = "^0.34.0" [build-system] requires = ["poetry-core"] From 100ddd345360ae6addfbc902c92f3d5fe7a15f9a Mon Sep 17 00:00:00 2001 From: 8ball030 <8baller@station.codes> Date: Wed, 1 Oct 2025 14:02:38 +0100 Subject: [PATCH 6/6] feat:ensure-types-pass-linters --- Makefile | 3 + .../{_clients => data/generated}/models.py | 3143 ++++++++--------- openapi-spec.json | 1 + scripts/generate-models.py | 18 +- 4 files changed, 1577 insertions(+), 1588 deletions(-) rename derive_client/{_clients => data/generated}/models.py (93%) create mode 100644 openapi-spec.json diff --git a/Makefile b/Makefile index 0f1f8fe2..ec11273a 100644 --- a/Makefile +++ b/Makefile @@ -39,6 +39,9 @@ clean-test: find . -name 'log.txt' -exec rm -fr {} + find . -name 'log.*.txt' -exec rm -fr {} + +codegen: + poetry run python scripts/generate-models.py + .PHONY: tests tests: poetry run pytest tests -vv --reruns 3 --reruns-delay 3 diff --git a/derive_client/_clients/models.py b/derive_client/data/generated/models.py similarity index 93% rename from derive_client/_clients/models.py rename to derive_client/data/generated/models.py index 26ddf95d..adbe5672 100644 --- a/derive_client/_clients/models.py +++ b/derive_client/data/generated/models.py @@ -1,6 +1,4 @@ -# generated by datamodel-codegen: -# filename: RESTAPI-v2_0-latest.json -# timestamp: 2025-10-01T12:11:13+00:00 +# ruff: noqa: E741 from __future__ import annotations @@ -10,122 +8,124 @@ from typing import Any, Dict, List, Optional, Union -class Status(str, Enum): - unseen = "unseen" - seen = "seen" - hidden = "hidden" - - -class TypeEnum(str, Enum): - deposit = "deposit" - withdraw = "withdraw" - transfer = "transfer" - trade = "trade" - settlement = "settlement" - liquidation = "liquidation" - custom = "custom" +@dataclass +class PublicGetVaultStatisticsParamsSchema: + pass @dataclass -class PrivateGetNotificationsParamsSchema: - page: Optional[int] = 1 - page_size: Optional[int] = 50 - status: Optional[Status] = None - subaccount_id: Optional[int] = None - type: Optional[List[TypeEnum]] = None - wallet: Optional[str] = None +class VaultStatisticsResponseSchema: + base_value: Decimal + block_number: int + block_timestamp: int + subaccount_value_at_last_trade: Optional[Decimal] + total_supply: Decimal + underlying_value: Optional[Decimal] + usd_tvl: Decimal + usd_value: Decimal + vault_name: str -@dataclass -class NotificationResponseSchema: - event: str - event_details: Dict[str, Any] - id: int - status: str - subaccount_id: int - timestamp: int - transaction_id: Optional[int] = None - tx_hash: Optional[str] = None +class Direction(str, Enum): + buy = "buy" + sell = "sell" @dataclass -class PaginationInfoSchema: - count: int - num_pages: int +class LegPricedSchema: + amount: Decimal + direction: Direction + instrument_name: str + price: Decimal -@dataclass -class PublicGetCurrencyParamsSchema: - currency: str +class CancelReason(str, Enum): + field_ = "" + user_request = "user_request" + insufficient_margin = "insufficient_margin" + signed_max_fee_too_low = "signed_max_fee_too_low" + mmp_trigger = "mmp_trigger" + cancel_on_disconnect = "cancel_on_disconnect" + session_key_deregistered = "session_key_deregistered" + subaccount_withdrawn = "subaccount_withdrawn" + rfq_no_longer_open = "rfq_no_longer_open" + compliance = "compliance" -class InstrumentType(str, Enum): - erc20 = "erc20" - option = "option" - perp = "perp" +class LiquidityRole(str, Enum): + maker = "maker" + taker = "taker" -class MarketType(str, Enum): - ALL = "ALL" - SRM_BASE_ONLY = "SRM_BASE_ONLY" - SRM_OPTION_ONLY = "SRM_OPTION_ONLY" - SRM_PERP_ONLY = "SRM_PERP_ONLY" - CASH = "CASH" +class Status(str, Enum): + open = "open" + filled = "filled" + cancelled = "cancelled" + expired = "expired" -@dataclass -class OpenInterestStatsSchema: - current_open_interest: Decimal - interest_cap: Decimal - manager_currency: Optional[str] = None +class TxStatus(str, Enum): + requested = "requested" + pending = "pending" + settled = "settled" + reverted = "reverted" + ignored = "ignored" + timed_out = "timed_out" -class MarginType(str, Enum): - PM = "PM" - SM = "SM" - PM2 = "PM2" +@dataclass +class QuoteResultSchema: + cancel_reason: CancelReason + creation_timestamp: int + direction: Direction + fee: Decimal + fill_pct: Decimal + is_transfer: bool + label: str + last_update_timestamp: int + legs: List[LegPricedSchema] + legs_hash: str + liquidity_role: LiquidityRole + max_fee: Decimal + mmp: bool + nonce: int + quote_id: str + rfq_id: str + signature: str + signature_expiry_sec: int + signer: str + status: Status + subaccount_id: int + tx_hash: Optional[str] + tx_status: Optional[TxStatus] @dataclass -class ManagerContractResponseSchema: - address: str - margin_type: MarginType +class PrivateResetMmpParamsSchema: + subaccount_id: int currency: Optional[str] = None -@dataclass -class PM2CollateralDiscountsSchema: - im_discount: Decimal - manager_currency: str - mm_discount: Decimal +class Result(str, Enum): + ok = "ok" @dataclass -class ProtocolAssetAddressesSchema: - option: Optional[str] = None - perp: Optional[str] = None - spot: Optional[str] = None - underlying_erc20: Optional[str] = None +class PrivateResetMmpResponseSchema: + id: Union[str, int] + result: Result @dataclass -class PrivateSetMmpConfigParamsSchema: +class PublicGetOptionSettlementPricesParamsSchema: currency: str - mmp_frozen_time: int - mmp_interval: int - subaccount_id: int - mmp_amount_limit: Decimal = "0" - mmp_delta_limit: Decimal = "0" @dataclass -class PrivateSetMmpConfigResultSchema(PrivateSetMmpConfigParamsSchema): - pass - - -class Direction(str, Enum): - buy = "buy" - sell = "sell" +class ExpiryResponseSchema: + expiry_date: str + price: Optional[Decimal] + utc_expiry_sec: int @dataclass @@ -142,7 +142,7 @@ class TradeModuleParamsSchema: subaccount_id: int -class CancelReason(str, Enum): +class CancelReason1(str, Enum): field_ = "" user_request = "user_request" mmp_trigger = "mmp_trigger" @@ -191,7 +191,7 @@ class TriggerType(str, Enum): class OrderResponseSchema: amount: Decimal average_price: Decimal - cancel_reason: CancelReason + cancel_reason: CancelReason1 creation_timestamp: int direction: Direction filled_amount: Decimal @@ -220,20 +220,6 @@ class OrderResponseSchema: trigger_type: Optional[TriggerType] = None -class LiquidityRole(str, Enum): - maker = "maker" - taker = "taker" - - -class TxStatus(str, Enum): - requested = "requested" - pending = "pending" - settled = "settled" - reverted = "reverted" - ignored = "ignored" - timed_out = "timed_out" - - @dataclass class TradeResponseSchema: direction: Direction @@ -260,272 +246,187 @@ class TradeResponseSchema: @dataclass -class PrivateCreateSubaccountParamsSchema: +class PublicDepositDebugParamsSchema: amount: Decimal asset_name: str - margin_type: MarginType nonce: int - signature: str signature_expiry_sec: int signer: str - wallet: str - currency: Optional[str] = None + subaccount_id: int + is_atomic_signing: bool = False @dataclass -class PrivateCreateSubaccountResultSchema: - status: str - transaction_id: str +class PublicDepositDebugResultSchema: + action_hash: str + encoded_data: str + encoded_data_hashed: str + typed_data_hash: str @dataclass -class LegUnpricedSchema: - amount: Decimal - direction: Direction - instrument_name: str - - -class CancelReason1(str, Enum): - field_ = "" - user_request = "user_request" - insufficient_margin = "insufficient_margin" - signed_max_fee_too_low = "signed_max_fee_too_low" - mmp_trigger = "mmp_trigger" - cancel_on_disconnect = "cancel_on_disconnect" - session_key_deregistered = "session_key_deregistered" - subaccount_withdrawn = "subaccount_withdrawn" - rfq_no_longer_open = "rfq_no_longer_open" - compliance = "compliance" - - -class Status1(str, Enum): - open = "open" - filled = "filled" - cancelled = "cancelled" - expired = "expired" +class PrivateGetOpenOrdersParamsSchema: + subaccount_id: int @dataclass -class PrivateSendRfqResultSchema: - ask_total_cost: Optional[Decimal] - bid_total_cost: Optional[Decimal] - cancel_reason: CancelReason1 - counterparties: Optional[List[str]] - creation_timestamp: int - filled_direction: Optional[Direction] - filled_pct: Decimal - label: str - last_update_timestamp: int - legs: List[LegUnpricedSchema] - mark_total_cost: Optional[Decimal] - max_total_cost: Optional[Decimal] - min_total_cost: Optional[Decimal] - partial_fill_step: Decimal - rfq_id: str - status: Status1 +class PrivateGetOpenOrdersResultSchema: + orders: List[OrderResponseSchema] subaccount_id: int - total_cost: Optional[Decimal] - valid_until: int @dataclass -class PublicMarginWatchParamsSchema: - subaccount_id: int - force_onchain: bool = False +class SignatureDetailsSchema: + nonce: int + signature: str + signature_expiry_sec: int + signer: str @dataclass -class CollateralPublicResponseSchema: +class TransferDetailsSchema: + address: str amount: Decimal - asset_name: str - asset_type: InstrumentType - initial_margin: Decimal - maintenance_margin: Decimal - mark_price: Decimal - mark_value: Decimal + sub_id: int @dataclass -class PositionPublicResponseSchema: - amount: Decimal - delta: Decimal - gamma: Decimal - index_price: Decimal - initial_margin: Decimal - instrument_name: str - instrument_type: InstrumentType - liquidation_price: Optional[Decimal] - maintenance_margin: Decimal - mark_price: Decimal - mark_value: Decimal - theta: Decimal - vega: Decimal +class PrivateTransferErc20ResultSchema: + status: str + transaction_id: str + + +class Scope(str, Enum): + admin = "admin" + account = "account" + read_only = "read_only" @dataclass -class PublicStatisticsParamsSchema: - instrument_name: str - currency: Optional[str] = None - end_time: Optional[int] = None +class PrivateRegisterScopedSessionKeyParamsSchema: + expiry_sec: int + public_session_key: str + wallet: str + ip_whitelist: Optional[List[str]] = None + label: Optional[str] = None + scope: Scope = Scope.read_only + signed_raw_tx: Optional[str] = None @dataclass -class PublicStatisticsResultSchema: - daily_fees: Decimal - daily_notional_volume: Decimal - daily_premium_volume: Decimal - daily_trades: int - open_interest: Decimal - total_fees: Decimal - total_notional_volume: Decimal - total_premium_volume: Decimal - total_trades: int +class PrivateRegisterScopedSessionKeyResultSchema: + expiry_sec: int + ip_whitelist: Optional[List[str]] + label: Optional[str] + public_session_key: str + scope: Scope + transaction_id: Optional[str] @dataclass -class PublicLoginParamsSchema: - signature: str - timestamp: str - wallet: str +class PublicGetCurrencyParamsSchema(PublicGetOptionSettlementPricesParamsSchema): + pass + + +class InstrumentType(str, Enum): + erc20 = "erc20" + option = "option" + perp = "perp" + + +class MarketType(str, Enum): + ALL = "ALL" + SRM_BASE_ONLY = "SRM_BASE_ONLY" + SRM_OPTION_ONLY = "SRM_OPTION_ONLY" + SRM_PERP_ONLY = "SRM_PERP_ONLY" + CASH = "CASH" @dataclass -class PublicLoginResponseSchema: - id: Union[str, int] - result: List[int] +class OpenInterestStatsSchema: + current_open_interest: Decimal + interest_cap: Decimal + manager_currency: Optional[str] = None + + +class MarginType(str, Enum): + PM = "PM" + SM = "SM" + PM2 = "PM2" @dataclass -class PrivateCancelParamsSchema: - instrument_name: str - order_id: str - subaccount_id: int +class ManagerContractResponseSchema: + address: str + margin_type: MarginType + currency: Optional[str] = None @dataclass -class PrivateCancelResultSchema(OrderResponseSchema): - pass +class PM2CollateralDiscountsSchema: + im_discount: Decimal + manager_currency: str + mm_discount: Decimal @dataclass -class LegPricedSchema: - amount: Decimal - direction: Direction - instrument_name: str - price: Decimal +class ProtocolAssetAddressesSchema: + option: Optional[str] = None + perp: Optional[str] = None + spot: Optional[str] = None + underlying_erc20: Optional[str] = None @dataclass -class PrivateExecuteQuoteResultSchema: - cancel_reason: CancelReason1 - creation_timestamp: int - direction: Direction - fee: Decimal - fill_pct: Decimal - is_transfer: bool - label: str - last_update_timestamp: int - legs: List[LegPricedSchema] - legs_hash: str - liquidity_role: LiquidityRole - max_fee: Decimal - mmp: bool +class PrivateLiquidateParamsSchema: + cash_transfer: Decimal + last_seen_trade_id: int + liquidated_subaccount_id: int nonce: int - quote_id: str - rfq_filled_pct: Decimal - rfq_id: str + percent_bid: Decimal + price_limit: Decimal signature: str signature_expiry_sec: int signer: str - status: Status1 subaccount_id: int - tx_hash: Optional[str] - tx_status: Optional[TxStatus] -class Period(str, Enum): - field_60 = 60 - field_300 = 300 - field_900 = 900 - field_1800 = 1800 - field_3600 = 3600 - field_14400 = 14400 - field_28800 = 28800 - field_86400 = 86400 - field_604800 = 604800 +@dataclass +class PrivateLiquidateResultSchema: + estimated_bid_price: Decimal + estimated_discount_pnl: Decimal + estimated_percent_bid: Decimal + transaction_id: str @dataclass -class PublicGetSpotFeedHistoryCandlesParamsSchema: - currency: str +class PrivateGetSubaccountValueHistoryParamsSchema: end_timestamp: int - period: Period + period: int start_timestamp: int - - -@dataclass -class SpotFeedHistoryCandlesResponseSchema: - close_price: Decimal - high_price: Decimal - low_price: Decimal - open_price: Decimal - price: Decimal - timestamp: int - timestamp_bucket: int - - -@dataclass -class PrivatePollRfqsParamsSchema: subaccount_id: int - from_timestamp: int = 0 - page: int = 1 - page_size: int = 100 - rfq_id: Optional[str] = None - rfq_subaccount_id: Optional[int] = None - status: Optional[Status1] = None - to_timestamp: int = 18446744073709552000 @dataclass -class RFQResultPublicSchema: - cancel_reason: CancelReason1 - creation_timestamp: int - filled_direction: Optional[Direction] - filled_pct: Decimal - last_update_timestamp: int - legs: List[LegUnpricedSchema] - partial_fill_step: Decimal - rfq_id: str - status: Status1 - subaccount_id: int - total_cost: Optional[Decimal] - valid_until: int +class SubAccountValueHistoryResponseSchema: + subaccount_value: Decimal + timestamp: int @dataclass -class PrivateGetLiquidationHistoryParamsSchema: - subaccount_id: int - end_timestamp: int = 9223372036854776000 - start_timestamp: int = 0 - - -class AuctionType(str, Enum): - solvent = "solvent" - insolvent = "insolvent" +class PublicGetMakerProgramsParamsSchema(PublicGetVaultStatisticsParamsSchema): + pass @dataclass -class AuctionBidEventSchema: - amounts_liquidated: Dict[str, Decimal] - cash_received: Decimal - discount_pnl: Decimal - percent_liquidated: Decimal - positions_realized_pnl: Dict[str, Decimal] - positions_realized_pnl_excl_fees: Dict[str, Decimal] - realized_pnl: Decimal - realized_pnl_excl_fees: Decimal - timestamp: int - tx_hash: str +class ProgramResponseSchema: + asset_types: List[str] + currencies: List[str] + end_timestamp: int + min_notional: Decimal + name: str + rewards: Dict[str, Decimal] + start_timestamp: int @dataclass @@ -566,100 +467,269 @@ class TradeModuleDataSchema: @dataclass -class PrivateDepositParamsSchema: - amount: Decimal - asset_name: str - nonce: int - signature: str - signature_expiry_sec: int - signer: str +class PrivateGetInterestHistoryParamsSchema: subaccount_id: int - is_atomic_signing: bool = False + end_timestamp: int = 9223372036854776000 + start_timestamp: int = 0 + + +@dataclass +class InterestPaymentSchema: + interest: Decimal + timestamp: int @dataclass -class PrivateDepositResultSchema(PrivateCreateSubaccountResultSchema): +class PrivateGetDepositHistoryParamsSchema(PrivateGetInterestHistoryParamsSchema): pass @dataclass -class PrivateUpdateNotificationsParamsSchema: - notification_ids: List[int] - subaccount_id: int - status: Status = Status.seen +class DepositSchema: + amount: Decimal + asset: str + error_log: Optional[Dict[str, Any]] + timestamp: int + transaction_id: str + tx_hash: str + tx_status: TxStatus @dataclass -class PrivateUpdateNotificationsResultSchema: - updated_count: int +class PrivateGetMmpConfigParamsSchema(PrivateResetMmpParamsSchema): + pass @dataclass -class PrivateChangeSubaccountLabelParamsSchema: - label: str +class MMPConfigResultSchema: + currency: str + is_frozen: bool + mmp_frozen_time: int + mmp_interval: int + mmp_unfreeze_time: int subaccount_id: int + mmp_amount_limit: Decimal = "0" + mmp_delta_limit: Decimal = "0" @dataclass -class PrivateChangeSubaccountLabelResultSchema( - PrivateChangeSubaccountLabelParamsSchema -): - pass +class PrivateSessionKeysParamsSchema: + wallet: str @dataclass -class SignedQuoteParamsSchema: +class SessionKeyResponseSchema: + expiry_sec: int + ip_whitelist: List[str] + label: str + public_session_key: str + scope: str + + +@dataclass +class PublicGetInstrumentsParamsSchema: + currency: str + expired: bool + instrument_type: InstrumentType + + +@dataclass +class ERC20PublicDetailsSchema: + decimals: int + borrow_index: Decimal = "1" + supply_index: Decimal = "1" + underlying_erc20_address: str = "" + + +class OptionType(str, Enum): + C = "C" + P = "P" + + +@dataclass +class OptionPublicDetailsSchema: + expiry: int + index: str + option_type: OptionType + strike: Decimal + settlement_price: Optional[Decimal] = None + + +@dataclass +class PerpPublicDetailsSchema: + aggregate_funding: Decimal + funding_rate: Decimal + index: str + max_rate_per_hour: Decimal + min_rate_per_hour: Decimal + static_interest_rate: Decimal + + +@dataclass +class PrivateGetAllPortfoliosParamsSchema(PrivateSessionKeysParamsSchema): + pass + + +@dataclass +class CollateralResponseSchema: + amount: Decimal + amount_step: Decimal + asset_name: str + asset_type: InstrumentType + average_price: Decimal + average_price_excl_fees: Decimal + creation_timestamp: int + cumulative_interest: Decimal + currency: str + delta: Decimal + delta_currency: str + initial_margin: Decimal + maintenance_margin: Decimal + mark_price: Decimal + mark_value: Decimal + open_orders_margin: Decimal + pending_interest: Decimal + realized_pnl: Decimal + realized_pnl_excl_fees: Decimal + total_fees: Decimal + unrealized_pnl: Decimal + unrealized_pnl_excl_fees: Decimal + + +@dataclass +class PositionResponseSchema: + amount: Decimal + amount_step: Decimal + average_price: Decimal + average_price_excl_fees: Decimal + creation_timestamp: int + cumulative_funding: Decimal + delta: Decimal + gamma: Decimal + index_price: Decimal + initial_margin: Decimal + instrument_name: str + instrument_type: InstrumentType + leverage: Optional[Decimal] + liquidation_price: Optional[Decimal] + maintenance_margin: Decimal + mark_price: Decimal + mark_value: Decimal + net_settlements: Decimal + open_orders_margin: Decimal + pending_funding: Decimal + realized_pnl: Decimal + realized_pnl_excl_fees: Decimal + theta: Decimal + total_fees: Decimal + unrealized_pnl: Decimal + unrealized_pnl_excl_fees: Decimal + vega: Decimal + + +@dataclass +class PublicGetInstrumentParamsSchema: + instrument_name: str + + +@dataclass +class PublicGetInstrumentResultSchema: + amount_step: Decimal + base_asset_address: str + base_asset_sub_id: str + base_currency: str + base_fee: Decimal + erc20_details: Optional[ERC20PublicDetailsSchema] + fifo_min_allocation: Decimal + instrument_name: str + instrument_type: InstrumentType + is_active: bool + maker_fee_rate: Decimal + maximum_amount: Decimal + minimum_amount: Decimal + option_details: Optional[OptionPublicDetailsSchema] + perp_details: Optional[PerpPublicDetailsSchema] + pro_rata_amount_step: Decimal + pro_rata_fraction: Decimal + quote_currency: str + scheduled_activation: int + scheduled_deactivation: int + taker_fee_rate: Decimal + tick_size: Decimal + mark_price_fee_rate_cap: Optional[Decimal] = None + + +@dataclass +class PublicExecuteQuoteDebugParamsSchema: direction: Direction legs: List[LegPricedSchema] max_fee: Decimal nonce: int + quote_id: str + rfq_id: str signature: str signature_expiry_sec: int signer: str subaccount_id: int + label: str = "" @dataclass -class QuoteResultSchema: - cancel_reason: CancelReason1 +class PublicExecuteQuoteDebugResultSchema: + action_hash: str + encoded_data: str + encoded_data_hashed: str + encoded_legs: str + legs_hash: str + typed_data_hash: str + + +@dataclass +class PrivateGetCollateralsParamsSchema(PrivateGetOpenOrdersParamsSchema): + pass + + +@dataclass +class PrivateGetCollateralsResultSchema: + collaterals: List[CollateralResponseSchema] + subaccount_id: int + + +@dataclass +class PrivatePollQuotesParamsSchema: + subaccount_id: int + from_timestamp: int = 0 + page: int = 1 + page_size: int = 100 + quote_id: Optional[str] = None + rfq_id: Optional[str] = None + status: Optional[Status] = None + to_timestamp: int = 18446744073709552000 + + +@dataclass +class PaginationInfoSchema: + count: int + num_pages: int + + +@dataclass +class QuoteResultPublicSchema: + cancel_reason: CancelReason creation_timestamp: int direction: Direction - fee: Decimal fill_pct: Decimal - is_transfer: bool - label: str last_update_timestamp: int legs: List[LegPricedSchema] legs_hash: str liquidity_role: LiquidityRole - max_fee: Decimal - mmp: bool - nonce: int quote_id: str rfq_id: str - signature: str - signature_expiry_sec: int - signer: str - status: Status1 + status: Status subaccount_id: int tx_hash: Optional[str] tx_status: Optional[TxStatus] - - -@dataclass -class PublicGetMakerProgramsParamsSchema: - pass - - -@dataclass -class ProgramResponseSchema: - asset_types: List[str] - currencies: List[str] - end_timestamp: int - min_notional: Decimal - name: str - rewards: Dict[str, Decimal] - start_timestamp: int + wallet: str @dataclass @@ -676,7 +746,7 @@ class SimulatedPositionSchema: @dataclass -class PublicGetMarginResultSchema: +class PrivateGetMarginResultSchema: is_valid_trade: bool post_initial_margin: Decimal post_maintenance_margin: Decimal @@ -686,545 +756,412 @@ class PublicGetMarginResultSchema: @dataclass -class PrivateCancelByNonceParamsSchema: - instrument_name: str - nonce: int - subaccount_id: int +class PublicBuildRegisterSessionKeyTxParamsSchema: + expiry_sec: int + gas: Optional[int] + nonce: Optional[int] + public_session_key: str wallet: str @dataclass -class PrivateCancelByNonceResultSchema: - cancelled_orders: int +class PublicBuildRegisterSessionKeyTxResultSchema: + tx_params: Dict[str, Any] @dataclass -class PublicGetSpotFeedHistoryParamsSchema: - currency: str - end_timestamp: int - period: int - start_timestamp: int +class PrivateCancelTriggerOrderParamsSchema: + order_id: str + subaccount_id: int @dataclass -class SpotFeedHistoryResponseSchema: - price: Decimal - timestamp: int - timestamp_bucket: int +class PrivateCancelTriggerOrderResultSchema(OrderResponseSchema): + pass @dataclass -class PrivateGetSubaccountsParamsSchema: - wallet: str +class PrivateGetOrderParamsSchema(PrivateCancelTriggerOrderParamsSchema): + pass @dataclass -class PrivateGetSubaccountsResultSchema: - subaccount_ids: List[int] - wallet: str +class PrivateGetOrderResultSchema(OrderResponseSchema): + pass @dataclass -class PrivateGetDepositHistoryParamsSchema(PrivateGetLiquidationHistoryParamsSchema): +class PrivateGetWithdrawalHistoryParamsSchema(PrivateGetInterestHistoryParamsSchema): pass @dataclass -class DepositSchema: +class WithdrawalSchema: amount: Decimal asset: str error_log: Optional[Dict[str, Any]] timestamp: int - transaction_id: str tx_hash: str tx_status: TxStatus @dataclass -class PrivateCancelByLabelParamsSchema: - label: str - subaccount_id: int - instrument_name: Optional[str] = None - - -@dataclass -class PrivateCancelByLabelResultSchema(PrivateCancelByNonceResultSchema): +class PublicGetLiveIncidentsParamsSchema(PublicGetVaultStatisticsParamsSchema): pass -@dataclass -class PrivateGetMarginParamsSchema: - subaccount_id: int - simulated_collateral_changes: Optional[List[SimulatedCollateralSchema]] = None - simulated_position_changes: Optional[List[SimulatedPositionSchema]] = None +class MonitorType(str, Enum): + manual = "manual" + auto = "auto" -@dataclass -class PrivateGetMarginResultSchema(PublicGetMarginResultSchema): - pass +class Severity(str, Enum): + low = "low" + medium = "medium" + high = "high" @dataclass -class PublicCreateSubaccountDebugParamsSchema: - amount: Decimal - asset_name: str - margin_type: MarginType - nonce: int - signature_expiry_sec: int - signer: str - wallet: str - currency: Optional[str] = None +class IncidentResponseSchema: + creation_timestamp_sec: int + label: str + message: str + monitor_type: MonitorType + severity: Severity @dataclass -class PublicCreateSubaccountDebugResultSchema: - action_hash: str - encoded_data: str - encoded_data_hashed: str - typed_data_hash: str +class PrivateGetQuotesParamsSchema(PrivatePollQuotesParamsSchema): + pass @dataclass -class PublicGetInstrumentParamsSchema: - instrument_name: str +class PrivateGetQuotesResultSchema: + pagination: PaginationInfoSchema + quotes: List[QuoteResultSchema] @dataclass -class ERC20PublicDetailsSchema: - decimals: int - borrow_index: Decimal = "1" - supply_index: Decimal = "1" - underlying_erc20_address: str = "" +class PrivateGetPositionsParamsSchema(PrivateGetOpenOrdersParamsSchema): + pass -class OptionType(str, Enum): - C = "C" - P = "P" +@dataclass +class PrivateGetPositionsResultSchema: + positions: List[PositionResponseSchema] + subaccount_id: int @dataclass -class OptionPublicDetailsSchema: - expiry: int - index: str - option_type: OptionType - strike: Decimal - settlement_price: Optional[Decimal] = None +class PrivateGetOptionSettlementHistoryParamsSchema(PrivateGetOpenOrdersParamsSchema): + pass @dataclass -class PerpPublicDetailsSchema: - aggregate_funding: Decimal - funding_rate: Decimal - index: str - max_rate_per_hour: Decimal - min_rate_per_hour: Decimal - static_interest_rate: Decimal +class OptionSettlementResponseSchema: + amount: Decimal + expiry: int + instrument_name: str + option_settlement_pnl: Decimal + option_settlement_pnl_excl_fees: Decimal + settlement_price: Decimal + subaccount_id: int @dataclass -class PrivateEditSessionKeyParamsSchema: +class PublicDeregisterSessionKeyParamsSchema: public_session_key: str + signed_raw_tx: str wallet: str - disable: bool = False - ip_whitelist: Optional[List[str]] = None - label: Optional[str] = None @dataclass -class PrivateEditSessionKeyResultSchema: - expiry_sec: int - ip_whitelist: List[str] - label: str +class PublicDeregisterSessionKeyResultSchema: public_session_key: str - scope: str + transaction_id: str @dataclass -class PrivateGetLiquidatorHistoryParamsSchema: - subaccount_id: int - end_timestamp: int = 9223372036854776000 +class PublicGetVaultShareParamsSchema: + from_timestamp_sec: int + to_timestamp_sec: int + vault_name: str page: int = 1 page_size: int = 100 - start_timestamp: int = 0 @dataclass -class PrivateGetLiquidatorHistoryResultSchema: - bids: List[AuctionBidEventSchema] - pagination: PaginationInfoSchema +class VaultShareResponseSchema: + base_value: Decimal + block_number: int + block_timestamp: int + underlying_value: Optional[Decimal] + usd_value: Decimal @dataclass -class PrivateGetPositionsParamsSchema: +class PrivateExpiredAndCancelledHistoryParamsSchema: + end_timestamp: int + expiry: int + start_timestamp: int subaccount_id: int + wallet: str @dataclass -class PositionResponseSchema: - amount: Decimal - amount_step: Decimal - average_price: Decimal - average_price_excl_fees: Decimal - creation_timestamp: int - cumulative_funding: Decimal - delta: Decimal - gamma: Decimal - index_price: Decimal - initial_margin: Decimal - instrument_name: str - instrument_type: InstrumentType - leverage: Optional[Decimal] - liquidation_price: Optional[Decimal] - maintenance_margin: Decimal - mark_price: Decimal - mark_value: Decimal - net_settlements: Decimal - open_orders_margin: Decimal - pending_funding: Decimal - realized_pnl: Decimal - realized_pnl_excl_fees: Decimal - theta: Decimal - total_fees: Decimal - unrealized_pnl: Decimal - unrealized_pnl_excl_fees: Decimal - vega: Decimal - - -class TxStatus4(str, Enum): - settled = "settled" - reverted = "reverted" - timed_out = "timed_out" - - -@dataclass -class PublicGetTradeHistoryParamsSchema: - currency: Optional[str] = None - from_timestamp: int = 0 - instrument_name: Optional[str] = None - instrument_type: Optional[InstrumentType] = None - page: int = 1 - page_size: int = 100 - subaccount_id: Optional[int] = None - to_timestamp: int = 18446744073709552000 - trade_id: Optional[str] = None - tx_hash: Optional[str] = None - tx_status: TxStatus4 = TxStatus4.settled +class PrivateExpiredAndCancelledHistoryResultSchema: + presigned_urls: List[str] @dataclass -class TradeSettledPublicResponseSchema: - direction: Direction - expected_rebate: Decimal - index_price: Decimal - instrument_name: str - liquidity_role: LiquidityRole - mark_price: Decimal - quote_id: Optional[str] - realized_pnl: Decimal - realized_pnl_excl_fees: Decimal - subaccount_id: int - timestamp: int - trade_amount: Decimal - trade_fee: Decimal - trade_id: str - trade_price: Decimal - tx_hash: str - tx_status: TxStatus4 +class PrivateEditSessionKeyParamsSchema: + public_session_key: str wallet: str + disable: bool = False + ip_whitelist: Optional[List[str]] = None + label: Optional[str] = None @dataclass -class PrivateGetRfqsParamsSchema: - subaccount_id: int - from_timestamp: int = 0 - page: int = 1 - page_size: int = 100 - rfq_id: Optional[str] = None - status: Optional[Status1] = None - to_timestamp: int = 18446744073709552000 +class PrivateEditSessionKeyResultSchema(SessionKeyResponseSchema): + pass @dataclass -class RFQResultSchema(PrivateSendRfqResultSchema): +class PublicGetAllCurrenciesParamsSchema(PublicGetVaultStatisticsParamsSchema): pass @dataclass -class SignatureDetailsSchema: - nonce: int - signature: str - signature_expiry_sec: int - signer: str +class CurrencyDetailedResponseSchema: + asset_cap_and_supply_per_manager: Dict[ + str, Dict[str, List[OpenInterestStatsSchema]] + ] + borrow_apy: Decimal + currency: str + instrument_types: List[InstrumentType] + managers: List[ManagerContractResponseSchema] + market_type: MarketType + pm2_collateral_discounts: List[PM2CollateralDiscountsSchema] + protocol_asset_addresses: ProtocolAssetAddressesSchema + spot_price: Decimal + srm_im_discount: Decimal + srm_mm_discount: Decimal + supply_apy: Decimal + total_borrow: Decimal + total_supply: Decimal + spot_price_24h: Optional[Decimal] = None @dataclass -class TransferDetailsSchema: - address: str - amount: Decimal - sub_id: int +class PrivateCancelByLabelParamsSchema: + label: str + subaccount_id: int + instrument_name: Optional[str] = None @dataclass -class PrivateTransferErc20ResultSchema(PrivateCreateSubaccountResultSchema): - pass +class PrivateCancelByLabelResultSchema: + cancelled_orders: int @dataclass -class PrivateSendQuoteParamsSchema: - direction: Direction - legs: List[LegPricedSchema] - max_fee: Decimal - nonce: int - rfq_id: str - signature: str - signature_expiry_sec: int - signer: str - subaccount_id: int - label: str = "" - mmp: bool = False +class PublicWithdrawDebugParamsSchema(PublicDepositDebugParamsSchema): + pass @dataclass -class PrivateSendQuoteResultSchema(QuoteResultSchema): +class PublicWithdrawDebugResultSchema(PublicDepositDebugResultSchema): pass @dataclass -class PrivateCancelTriggerOrderParamsSchema: - order_id: str - subaccount_id: int +class PublicGetMarginParamsSchema: + margin_type: MarginType + simulated_collaterals: List[SimulatedCollateralSchema] + simulated_positions: List[SimulatedPositionSchema] + market: Optional[str] = None + simulated_collateral_changes: Optional[List[SimulatedCollateralSchema]] = None + simulated_position_changes: Optional[List[SimulatedPositionSchema]] = None @dataclass -class PrivateCancelTriggerOrderResultSchema(OrderResponseSchema): +class PublicGetMarginResultSchema(PrivateGetMarginResultSchema): pass @dataclass -class PrivateGetWithdrawalHistoryParamsSchema(PrivateGetLiquidationHistoryParamsSchema): +class PrivateGetSubaccountsParamsSchema(PrivateSessionKeysParamsSchema): pass @dataclass -class WithdrawalSchema: - amount: Decimal - asset: str - error_log: Optional[Dict[str, Any]] - timestamp: int - tx_hash: str - tx_status: TxStatus +class PrivateGetSubaccountsResultSchema: + subaccount_ids: List[int] + wallet: str @dataclass -class PublicGetOptionSettlementPricesParamsSchema(PublicGetCurrencyParamsSchema): - pass - +class PrivatePollRfqsParamsSchema: + subaccount_id: int + from_timestamp: int = 0 + page: int = 1 + page_size: int = 100 + rfq_id: Optional[str] = None + rfq_subaccount_id: Optional[int] = None + status: Optional[Status] = None + to_timestamp: int = 18446744073709552000 + @dataclass -class ExpiryResponseSchema: - expiry_date: str - price: Optional[Decimal] - utc_expiry_sec: int +class LegUnpricedSchema: + amount: Decimal + direction: Direction + instrument_name: str @dataclass -class PublicGetMakerProgramScoresParamsSchema: - epoch_start_timestamp: int - program_name: str +class PrivateWithdrawParamsSchema: + amount: Decimal + asset_name: str + nonce: int + signature: str + signature_expiry_sec: int + signer: str + subaccount_id: int + is_atomic_signing: bool = False @dataclass -class ScoreBreakdownSchema: - coverage_score: Decimal - holder_boost: Decimal - quality_score: Decimal - total_score: Decimal - volume: Decimal - volume_multiplier: Decimal - wallet: str +class PrivateWithdrawResultSchema(PrivateTransferErc20ResultSchema): + pass + + +class Status6(str, Enum): + unseen = "unseen" + seen = "seen" + hidden = "hidden" @dataclass -class PublicBuildRegisterSessionKeyTxParamsSchema: - expiry_sec: int - gas: Optional[int] - nonce: Optional[int] - public_session_key: str - wallet: str +class PrivateUpdateNotificationsParamsSchema: + notification_ids: List[int] + subaccount_id: int + status: Status6 = Status6.seen @dataclass -class PublicBuildRegisterSessionKeyTxResultSchema: - tx_params: Dict[str, Any] +class PrivateUpdateNotificationsResultSchema: + updated_count: int @dataclass -class PublicRegisterSessionKeyParamsSchema: - expiry_sec: int - label: str - public_session_key: str - signed_raw_tx: str +class PrivateSetCancelOnDisconnectParamsSchema: + enabled: bool wallet: str @dataclass -class PublicRegisterSessionKeyResultSchema: - label: str - public_session_key: str - transaction_id: str +class PrivateSetCancelOnDisconnectResponseSchema(PrivateResetMmpResponseSchema): + pass @dataclass -class PrivateGetOrderHistoryParamsSchema: - subaccount_id: int +class PrivateGetTradeHistoryParamsSchema: + from_timestamp: int = 0 + instrument_name: Optional[str] = None + order_id: Optional[str] = None page: int = 1 page_size: int = 100 + quote_id: Optional[str] = None + subaccount_id: Optional[int] = None + to_timestamp: int = 18446744073709552000 + wallet: Optional[str] = None @dataclass -class PrivateGetOrderHistoryResultSchema: - orders: List[OrderResponseSchema] +class PrivateGetTradeHistoryResultSchema: pagination: PaginationInfoSchema subaccount_id: int + trades: List[TradeResponseSchema] @dataclass -class PrivateCancelRfqParamsSchema: - rfq_id: str - subaccount_id: int - - -class Result(str, Enum): - ok = "ok" +class PrivateOrderParamsSchema(PrivateOrderDebugParamsSchema): + pass @dataclass -class PrivateCancelRfqResponseSchema: - id: Union[str, int] - result: Result +class PrivateOrderResultSchema: + order: OrderResponseSchema + trades: List[TradeResponseSchema] @dataclass -class PrivateCancelBatchRfqsParamsSchema: - subaccount_id: int - label: Optional[str] = None - nonce: Optional[int] = None - rfq_id: Optional[str] = None +class PublicGetInterestRateHistoryParamsSchema: + from_timestamp_sec: int + to_timestamp_sec: int + page: int = 1 + page_size: int = 100 @dataclass -class PrivateCancelBatchRfqsResultSchema: - cancelled_ids: List[str] +class InterestRateHistoryResponseSchema: + block: int + borrow_apy: Decimal + supply_apy: Decimal + timestamp_sec: int + total_borrow: Decimal + total_supply: Decimal @dataclass -class PrivateCancelBatchQuotesParamsSchema: - subaccount_id: int - label: Optional[str] = None - nonce: Optional[int] = None - quote_id: Optional[str] = None - rfq_id: Optional[str] = None +class PublicGetOptionSettlementHistoryParamsSchema: + page: int = 1 + page_size: int = 100 + subaccount_id: Optional[int] = None @dataclass -class PrivateCancelBatchQuotesResultSchema(PrivateCancelBatchRfqsResultSchema): - pass +class PublicGetOptionSettlementHistoryResultSchema: + pagination: PaginationInfoSchema + settlements: List[OptionSettlementResponseSchema] @dataclass -class PublicGetTimeParamsSchema(PublicGetMakerProgramsParamsSchema): - pass +class PublicGetMakerProgramScoresParamsSchema: + epoch_start_timestamp: int + program_name: str @dataclass -class PublicGetTimeResponseSchema: - id: Union[str, int] - result: int +class ScoreBreakdownSchema: + coverage_score: Decimal + holder_boost: Decimal + quality_score: Decimal + total_score: Decimal + volume: Decimal + volume_multiplier: Decimal + wallet: str @dataclass -class PrivateGetFundingHistoryParamsSchema: +class PrivateGetOrdersParamsSchema: subaccount_id: int - end_timestamp: int = 9223372036854776000 instrument_name: Optional[str] = None + label: Optional[str] = None page: int = 1 page_size: int = 100 - start_timestamp: int = 0 - - -@dataclass -class FundingPaymentSchema: - funding: Decimal - instrument_name: str - pnl: Decimal - timestamp: int - - -@dataclass -class PrivateGetOpenOrdersParamsSchema(PrivateGetPositionsParamsSchema): - pass + status: Optional[OrderStatus] = None @dataclass -class PrivateGetOpenOrdersResultSchema: +class PrivateGetOrdersResultSchema: orders: List[OrderResponseSchema] + pagination: PaginationInfoSchema subaccount_id: int -@dataclass -class PrivateGetAccountParamsSchema(PrivateGetSubaccountsParamsSchema): - pass - - -@dataclass -class AccountFeeInfoSchema: - base_fee_discount: Decimal - option_maker_fee: Optional[Decimal] - option_taker_fee: Optional[Decimal] - perp_maker_fee: Optional[Decimal] - perp_taker_fee: Optional[Decimal] - rfq_maker_discount: Decimal - rfq_taker_discount: Decimal - spot_maker_fee: Optional[Decimal] - spot_taker_fee: Optional[Decimal] - - -@dataclass -class PublicGetAllInstrumentsParamsSchema: - expired: bool - instrument_type: InstrumentType - currency: Optional[str] = None - page: int = 1 - page_size: int = 100 - - -@dataclass -class InstrumentPublicResponseSchema: - amount_step: Decimal - base_asset_address: str - base_asset_sub_id: str - base_currency: str - base_fee: Decimal - erc20_details: Optional[ERC20PublicDetailsSchema] - fifo_min_allocation: Decimal - instrument_name: str - instrument_type: InstrumentType - is_active: bool - maker_fee_rate: Decimal - maximum_amount: Decimal - minimum_amount: Decimal - option_details: Optional[OptionPublicDetailsSchema] - perp_details: Optional[PerpPublicDetailsSchema] - pro_rata_amount_step: Decimal - pro_rata_fraction: Decimal - quote_currency: str - scheduled_activation: int - scheduled_deactivation: int - taker_fee_rate: Decimal - tick_size: Decimal - mark_price_fee_rate_cap: Optional[Decimal] = None - - @dataclass class PublicGetTickerParamsSchema(PublicGetInstrumentParamsSchema): pass @@ -1257,189 +1194,192 @@ class AggregateTradingStatsSchema: @dataclass -class PublicGetVaultShareParamsSchema: - from_timestamp_sec: int - to_timestamp_sec: int - vault_name: str +class PublicLoginParamsSchema: + signature: str + timestamp: str + wallet: str + + +@dataclass +class PublicLoginResponseSchema: + id: Union[str, int] + result: List[int] + + +@dataclass +class PrivateGetFundingHistoryParamsSchema: + subaccount_id: int + end_timestamp: int = 9223372036854776000 + instrument_name: Optional[str] = None page: int = 1 page_size: int = 100 + start_timestamp: int = 0 @dataclass -class VaultShareResponseSchema: - base_value: Decimal - block_number: int - block_timestamp: int - underlying_value: Optional[Decimal] - usd_value: Decimal +class FundingPaymentSchema: + funding: Decimal + instrument_name: str + pnl: Decimal + timestamp: int @dataclass -class PrivateGetCollateralsParamsSchema(PrivateGetPositionsParamsSchema): - pass +class PublicGetSpotFeedHistoryParamsSchema: + currency: str + end_timestamp: int + period: int + start_timestamp: int @dataclass -class CollateralResponseSchema: - amount: Decimal - amount_step: Decimal - asset_name: str - asset_type: InstrumentType - average_price: Decimal - average_price_excl_fees: Decimal - creation_timestamp: int - cumulative_interest: Decimal - currency: str - delta: Decimal - delta_currency: str - initial_margin: Decimal - maintenance_margin: Decimal - mark_price: Decimal - mark_value: Decimal - open_orders_margin: Decimal - pending_interest: Decimal - realized_pnl: Decimal - realized_pnl_excl_fees: Decimal - total_fees: Decimal - unrealized_pnl: Decimal - unrealized_pnl_excl_fees: Decimal - - -class Scope(str, Enum): - admin = "admin" - account = "account" - read_only = "read_only" +class SpotFeedHistoryResponseSchema: + price: Decimal + timestamp: int + timestamp_bucket: int @dataclass -class PrivateRegisterScopedSessionKeyParamsSchema: - expiry_sec: int - public_session_key: str - wallet: str - ip_whitelist: Optional[List[str]] = None - label: Optional[str] = None - scope: Scope = Scope.read_only - signed_raw_tx: Optional[str] = None +class PrivateSetMmpConfigParamsSchema: + currency: str + mmp_frozen_time: int + mmp_interval: int + subaccount_id: int + mmp_amount_limit: Decimal = "0" + mmp_delta_limit: Decimal = "0" @dataclass -class PrivateRegisterScopedSessionKeyResultSchema: - expiry_sec: int - ip_whitelist: Optional[List[str]] - label: Optional[str] - public_session_key: str - scope: Scope - transaction_id: Optional[str] +class PrivateSetMmpConfigResultSchema(PrivateSetMmpConfigParamsSchema): + pass -@dataclass -class PrivateExpiredAndCancelledHistoryParamsSchema: - end_timestamp: int - expiry: int - start_timestamp: int - subaccount_id: int - wallet: str +class Period(str, Enum): + field_900 = 900 + field_3600 = 3600 + field_14400 = 14400 + field_28800 = 28800 + field_86400 = 86400 @dataclass -class PrivateExpiredAndCancelledHistoryResultSchema: - presigned_urls: List[str] +class PublicGetFundingRateHistoryParamsSchema: + instrument_name: str + end_timestamp: int = 9223372036854776000 + period: Period = Period.field_3600 + start_timestamp: int = 0 @dataclass -class PrivateSessionKeysParamsSchema(PrivateGetSubaccountsParamsSchema): - pass +class FundingRateSchema: + funding_rate: Decimal + timestamp: int -@dataclass -class SessionKeyResponseSchema(PrivateEditSessionKeyResultSchema): - pass +class TypeEnum(str, Enum): + deposit = "deposit" + withdraw = "withdraw" + transfer = "transfer" + trade = "trade" + settlement = "settlement" + liquidation = "liquidation" + custom = "custom" @dataclass -class PrivateGetMmpConfigParamsSchema: - subaccount_id: int - currency: Optional[str] = None +class PrivateGetNotificationsParamsSchema: + page: Optional[int] = 1 + page_size: Optional[int] = 50 + status: Optional[Status6] = None + subaccount_id: Optional[int] = None + type: Optional[List[TypeEnum]] = None + wallet: Optional[str] = None @dataclass -class MMPConfigResultSchema: - currency: str - is_frozen: bool - mmp_frozen_time: int - mmp_interval: int - mmp_unfreeze_time: int +class NotificationResponseSchema: + event: str + event_details: Dict[str, Any] + id: int + status: str subaccount_id: int - mmp_amount_limit: Decimal = "0" - mmp_delta_limit: Decimal = "0" - - -@dataclass -class PrivateOrderParamsSchema(PrivateOrderDebugParamsSchema): - pass + timestamp: int + transaction_id: Optional[int] = None + tx_hash: Optional[str] = None @dataclass -class PrivateOrderResultSchema: - order: OrderResponseSchema - trades: List[TradeResponseSchema] +class PrivateCancelBatchQuotesParamsSchema: + subaccount_id: int + label: Optional[str] = None + nonce: Optional[int] = None + quote_id: Optional[str] = None + rfq_id: Optional[str] = None @dataclass -class PrivateGetSubaccountParamsSchema(PrivateGetPositionsParamsSchema): - pass +class PrivateCancelBatchQuotesResultSchema: + cancelled_ids: List[str] @dataclass -class PrivateGetSubaccountResultSchema: - collaterals: List[CollateralResponseSchema] - collaterals_initial_margin: Decimal - collaterals_maintenance_margin: Decimal - collaterals_value: Decimal - currency: str - initial_margin: Decimal - is_under_liquidation: bool - label: str - maintenance_margin: Decimal - margin_type: MarginType - open_orders: List[OrderResponseSchema] - open_orders_margin: Decimal - positions: List[PositionResponseSchema] - positions_initial_margin: Decimal - positions_maintenance_margin: Decimal - positions_value: Decimal - projected_margin_change: Decimal +class PrivateRfqGetBestQuoteParamsSchema: + legs: List[LegUnpricedSchema] subaccount_id: int - subaccount_value: Decimal + counterparties: Optional[List[str]] = None + direction: Direction = Direction.buy + label: str = "" + max_total_cost: Optional[Decimal] = None + min_total_cost: Optional[Decimal] = None + partial_fill_step: Decimal = "1" + rfq_id: Optional[str] = None -@dataclass -class PublicGetInterestRateHistoryParamsSchema: - from_timestamp_sec: int - to_timestamp_sec: int - page: int = 1 - page_size: int = 100 +class InvalidReason(str, Enum): + Account_is_currently_under_maintenance_margin_requirements__trading_is_frozen_ = ( + "Account is currently under maintenance margin requirements, trading is frozen." + ) + This_order_would_cause_account_to_fall_under_maintenance_margin_requirements_ = ( + "This order would cause account to fall under maintenance margin requirements." + ) + Insufficient_buying_power__only_a_single_risk_reducing_open_order_is_allowed_ = ( + "Insufficient buying power, only a single risk-reducing open order is allowed." + ) + Insufficient_buying_power__consider_reducing_order_size_ = ( + "Insufficient buying power, consider reducing order size." + ) + Insufficient_buying_power__consider_reducing_order_size_or_canceling_other_orders_ = "Insufficient buying power, consider reducing order size or canceling other orders." + Consider_canceling_other_limit_orders_or_using_IOC__FOK__or_market_orders__This_order_is_risk_reducing__but_if_filled_with_other_open_orders__buying_power_might_be_insufficient_ = "Consider canceling other limit orders or using IOC, FOK, or market orders. This order is risk-reducing, but if filled with other open orders, buying power might be insufficient." + Insufficient_buying_power_ = "Insufficient buying power." @dataclass -class InterestRateHistoryResponseSchema: - block: int - borrow_apy: Decimal - supply_apy: Decimal - timestamp_sec: int - total_borrow: Decimal - total_supply: Decimal +class PrivateRfqGetBestQuoteResultSchema: + best_quote: Optional[QuoteResultPublicSchema] + direction: Direction + down_liquidation_price: Optional[Decimal] + estimated_fee: Decimal + estimated_realized_pnl: Decimal + estimated_realized_pnl_excl_fees: Decimal + estimated_total_cost: Decimal + filled_pct: Decimal + invalid_reason: Optional[InvalidReason] + is_valid: bool + post_initial_margin: Decimal + post_liquidation_price: Optional[Decimal] + pre_initial_margin: Decimal + suggested_max_fee: Decimal + up_liquidation_price: Optional[Decimal] @dataclass -class PrivateGetAllPortfoliosParamsSchema(PrivateGetSubaccountsParamsSchema): +class PrivateDepositParamsSchema(PrivateWithdrawParamsSchema): pass @dataclass -class PrivateGetAllPortfoliosResponseSchema: - id: Union[str, int] - result: List[PrivateGetSubaccountResultSchema] +class PrivateDepositResultSchema(PrivateTransferErc20ResultSchema): + pass @dataclass @@ -1451,477 +1391,287 @@ class PublicGetLiquidationHistoryParamsSchema: subaccount_id: Optional[int] = None +class AuctionType(str, Enum): + solvent = "solvent" + insolvent = "insolvent" + + @dataclass -class PublicDepositDebugParamsSchema: - amount: Decimal - asset_name: str - nonce: int - signature_expiry_sec: int - signer: str +class AuctionBidEventSchema: + amounts_liquidated: Dict[str, Decimal] + cash_received: Decimal + discount_pnl: Decimal + percent_liquidated: Decimal + positions_realized_pnl: Dict[str, Decimal] + positions_realized_pnl_excl_fees: Dict[str, Decimal] + realized_pnl: Decimal + realized_pnl_excl_fees: Decimal + timestamp: int + tx_hash: str + + +@dataclass +class PrivateChangeSubaccountLabelParamsSchema: + label: str subaccount_id: int - is_atomic_signing: bool = False @dataclass -class PublicDepositDebugResultSchema(PublicCreateSubaccountDebugResultSchema): +class PrivateChangeSubaccountLabelResultSchema( + PrivateChangeSubaccountLabelParamsSchema +): pass @dataclass -class PublicGetVaultBalancesParamsSchema: - smart_contract_owner: Optional[str] = None - wallet: Optional[str] = None +class PublicMarginWatchParamsSchema: + subaccount_id: int + force_onchain: bool = False @dataclass -class VaultBalanceResponseSchema: - address: str +class CollateralPublicResponseSchema: amount: Decimal - chain_id: int - name: str - vault_asset_type: str + asset_name: str + asset_type: InstrumentType + initial_margin: Decimal + maintenance_margin: Decimal + mark_price: Decimal + mark_value: Decimal @dataclass -class PublicGetReferralPerformanceParamsSchema: - end_ms: int - start_ms: int - referral_code: Optional[str] = None - wallet: Optional[str] = None - - -@dataclass -class ReferralPerformanceByInstrumentTypeSchema: - fee_reward: Decimal - notional_volume: Decimal - referred_fee: Decimal - - -@dataclass -class PrivateSetCancelOnDisconnectParamsSchema: - enabled: bool - wallet: str +class PositionPublicResponseSchema: + amount: Decimal + delta: Decimal + gamma: Decimal + index_price: Decimal + initial_margin: Decimal + instrument_name: str + instrument_type: InstrumentType + liquidation_price: Optional[Decimal] + maintenance_margin: Decimal + mark_price: Decimal + mark_value: Decimal + theta: Decimal + vega: Decimal @dataclass -class PrivateSetCancelOnDisconnectResponseSchema(PrivateCancelRfqResponseSchema): - pass +class PublicGetTransactionParamsSchema: + transaction_id: str @dataclass -class PrivateCancelQuoteParamsSchema: - quote_id: str - subaccount_id: int +class PublicGetTransactionResultSchema: + data: str + error_log: Optional[str] + status: TxStatus + transaction_hash: Optional[str] @dataclass -class PrivateCancelQuoteResultSchema(QuoteResultSchema): +class PrivateGetErc20TransferHistoryParamsSchema(PrivateGetInterestHistoryParamsSchema): pass @dataclass -class PrivateGetQuotesParamsSchema: - subaccount_id: int - from_timestamp: int = 0 - page: int = 1 - page_size: int = 100 - quote_id: Optional[str] = None - rfq_id: Optional[str] = None - status: Optional[Status1] = None - to_timestamp: int = 18446744073709552000 - - -@dataclass -class PrivateGetQuotesResultSchema: - pagination: PaginationInfoSchema - quotes: List[QuoteResultSchema] +class ERC20TransferSchema: + amount: Decimal + asset: str + counterparty_subaccount_id: int + is_outgoing: bool + timestamp: int + tx_hash: str @dataclass -class PublicExecuteQuoteDebugParamsSchema: +class PrivateReplaceParamsSchema: + amount: Decimal direction: Direction - legs: List[LegPricedSchema] + instrument_name: str + limit_price: Decimal max_fee: Decimal nonce: int - quote_id: str - rfq_id: str signature: str signature_expiry_sec: int signer: str subaccount_id: int - enable_taker_protection: bool = False + expected_filled_amount: Optional[Decimal] = None + is_atomic_signing: Optional[bool] = False label: str = "" + mmp: bool = False + nonce_to_cancel: Optional[int] = None + order_id_to_cancel: Optional[str] = None + order_type: OrderType = OrderType.limit + reduce_only: bool = False + referral_code: str = "" + reject_timestamp: int = 9223372036854776000 + time_in_force: TimeInForce = TimeInForce.gtc + trigger_price: Optional[Decimal] = None + trigger_price_type: Optional[TriggerPriceType] = None + trigger_type: Optional[TriggerType] = None @dataclass -class PublicExecuteQuoteDebugResultSchema: - action_hash: str - encoded_data: str - encoded_data_hashed: str - encoded_legs: str - legs_hash: str - typed_data_hash: str - - -@dataclass -class PrivateGetOptionSettlementHistoryParamsSchema(PrivateGetPositionsParamsSchema): - pass - - -@dataclass -class OptionSettlementResponseSchema: - amount: Decimal - expiry: int - instrument_name: str - option_settlement_pnl: Decimal - option_settlement_pnl_excl_fees: Decimal - settlement_price: Decimal - subaccount_id: int - - -@dataclass -class PrivateResetMmpParamsSchema(PrivateGetMmpConfigParamsSchema): - pass +class RPCErrorFormatSchema: + code: int + message: str + data: Optional[str] = None -@dataclass -class PrivateResetMmpResponseSchema(PrivateCancelRfqResponseSchema): - pass +class TxStatus5(str, Enum): + settled = "settled" + reverted = "reverted" + timed_out = "timed_out" @dataclass -class PrivateGetErc20TransferHistoryParamsSchema( - PrivateGetLiquidationHistoryParamsSchema -): - pass +class PublicGetTradeHistoryParamsSchema: + currency: Optional[str] = None + from_timestamp: int = 0 + instrument_name: Optional[str] = None + instrument_type: Optional[InstrumentType] = None + page: int = 1 + page_size: int = 100 + subaccount_id: Optional[int] = None + to_timestamp: int = 18446744073709552000 + trade_id: Optional[str] = None + tx_hash: Optional[str] = None + tx_status: TxStatus5 = TxStatus5.settled @dataclass -class ERC20TransferSchema: - amount: Decimal - asset: str - counterparty_subaccount_id: int - is_outgoing: bool +class TradeSettledPublicResponseSchema: + direction: Direction + expected_rebate: Decimal + index_price: Decimal + instrument_name: str + liquidity_role: LiquidityRole + mark_price: Decimal + quote_id: Optional[str] + realized_pnl: Decimal + realized_pnl_excl_fees: Decimal + subaccount_id: int timestamp: int + trade_amount: Decimal + trade_fee: Decimal + trade_id: str + trade_price: Decimal tx_hash: str + tx_status: TxStatus5 + wallet: str @dataclass -class PublicGetAllCurrenciesParamsSchema(PublicGetMakerProgramsParamsSchema): - pass - - -@dataclass -class CurrencyDetailedResponseSchema: - asset_cap_and_supply_per_manager: Dict[ - str, Dict[str, List[OpenInterestStatsSchema]] - ] - borrow_apy: Decimal - currency: str - instrument_types: List[InstrumentType] - managers: List[ManagerContractResponseSchema] - market_type: MarketType - pm2_collateral_discounts: List[PM2CollateralDiscountsSchema] - protocol_asset_addresses: ProtocolAssetAddressesSchema - spot_price: Decimal - srm_im_discount: Decimal - srm_mm_discount: Decimal - supply_apy: Decimal - total_borrow: Decimal - total_supply: Decimal - erc20_details: Optional[Dict[str, Optional[str]]] = None - spot_price_24h: Optional[Decimal] = None - - -@dataclass -class PrivateGetSubaccountValueHistoryParamsSchema: - end_timestamp: int - period: int - start_timestamp: int +class PublicSendQuoteDebugParamsSchema: + direction: Direction + legs: List[LegPricedSchema] + max_fee: Decimal + nonce: int + rfq_id: str + signature: str + signature_expiry_sec: int + signer: str subaccount_id: int + label: str = "" + mmp: bool = False @dataclass -class SubAccountValueHistoryResponseSchema: - subaccount_value: Decimal - timestamp: int - - -@dataclass -class PublicSendQuoteDebugParamsSchema(PrivateSendQuoteParamsSchema): - pass - - -@dataclass -class PublicSendQuoteDebugResultSchema(PublicCreateSubaccountDebugResultSchema): +class PublicSendQuoteDebugResultSchema(PublicDepositDebugResultSchema): pass @dataclass -class PublicGetLiveIncidentsParamsSchema(PublicGetMakerProgramsParamsSchema): - pass - - -class MonitorType(str, Enum): - manual = "manual" - auto = "auto" - - -class Severity(str, Enum): - low = "low" - medium = "medium" - high = "high" - - -@dataclass -class IncidentResponseSchema: - creation_timestamp_sec: int - label: str - message: str - monitor_type: MonitorType - severity: Severity - - -@dataclass -class PublicGetTransactionParamsSchema: - transaction_id: str - - -@dataclass -class PublicGetTransactionResultSchema: - data: str - error_log: Optional[str] - status: TxStatus - transaction_hash: Optional[str] - - -@dataclass -class PrivateGetOrdersParamsSchema: +class PrivateGetOrderHistoryParamsSchema: subaccount_id: int - instrument_name: Optional[str] = None - label: Optional[str] = None page: int = 1 page_size: int = 100 - status: Optional[OrderStatus] = None @dataclass -class PrivateGetOrdersResultSchema(PrivateGetOrderHistoryResultSchema): +class PrivateGetOrderHistoryResultSchema(PrivateGetOrdersResultSchema): pass @dataclass -class PrivateGetInterestHistoryParamsSchema(PrivateGetLiquidationHistoryParamsSchema): - pass +class PrivateCancelBatchRfqsParamsSchema: + subaccount_id: int + label: Optional[str] = None + nonce: Optional[int] = None + rfq_id: Optional[str] = None @dataclass -class InterestPaymentSchema: - interest: Decimal - timestamp: int +class PrivateCancelBatchRfqsResultSchema(PrivateCancelBatchQuotesResultSchema): + pass @dataclass -class PrivatePollQuotesParamsSchema(PrivateGetQuotesParamsSchema): +class PrivateExecuteQuoteParamsSchema(PublicExecuteQuoteDebugParamsSchema): pass @dataclass -class QuoteResultPublicSchema: - cancel_reason: CancelReason1 +class PrivateExecuteQuoteResultSchema: + cancel_reason: CancelReason creation_timestamp: int direction: Direction + fee: Decimal fill_pct: Decimal + is_transfer: bool + label: str last_update_timestamp: int legs: List[LegPricedSchema] legs_hash: str liquidity_role: LiquidityRole + max_fee: Decimal + mmp: bool + nonce: int quote_id: str + rfq_filled_pct: Decimal rfq_id: str - status: Status1 + signature: str + signature_expiry_sec: int + signer: str + status: Status subaccount_id: int tx_hash: Optional[str] tx_status: Optional[TxStatus] - wallet: str - - -@dataclass -class PrivateGetOrderParamsSchema(PrivateCancelTriggerOrderParamsSchema): - pass - - -@dataclass -class PrivateGetOrderResultSchema(OrderResponseSchema): - pass @dataclass -class PublicGetVaultStatisticsParamsSchema(PublicGetMakerProgramsParamsSchema): - pass - - -@dataclass -class VaultStatisticsResponseSchema: - base_value: Decimal - block_number: int - block_timestamp: int - subaccount_value_at_last_trade: Optional[Decimal] - total_supply: Decimal - underlying_value: Optional[Decimal] - usd_tvl: Decimal - usd_value: Decimal - vault_name: str +class PublicCreateSubaccountDebugParamsSchema: + amount: Decimal + asset_name: str + margin_type: MarginType + nonce: int + signature_expiry_sec: int + signer: str + wallet: str + currency: Optional[str] = None @dataclass -class PublicWithdrawDebugParamsSchema(PublicDepositDebugParamsSchema): +class PublicCreateSubaccountDebugResultSchema(PublicDepositDebugResultSchema): pass @dataclass -class PublicWithdrawDebugResultSchema(PublicCreateSubaccountDebugResultSchema): +class PrivateGetLiquidationHistoryParamsSchema(PrivateGetInterestHistoryParamsSchema): pass -class Period1(str, Enum): - field_900 = 900 - field_3600 = 3600 - field_14400 = 14400 - field_28800 = 28800 - field_86400 = 86400 - - -@dataclass -class PublicGetFundingRateHistoryParamsSchema: - instrument_name: str - end_timestamp: int = 9223372036854776000 - period: Period1 = Period1.field_3600 - start_timestamp: int = 0 - - -@dataclass -class FundingRateSchema: - funding_rate: Decimal - timestamp: int - - -@dataclass -class PrivateRfqGetBestQuoteParamsSchema: - legs: List[LegUnpricedSchema] - subaccount_id: int - counterparties: Optional[List[str]] = None - direction: Direction = Direction.buy - label: str = "" - max_total_cost: Optional[Decimal] = None - min_total_cost: Optional[Decimal] = None - partial_fill_step: Decimal = "1" - rfq_id: Optional[str] = None - - -class InvalidReason(str, Enum): - Account_is_currently_under_maintenance_margin_requirements__trading_is_frozen_ = ( - "Account is currently under maintenance margin requirements, trading is frozen." - ) - This_order_would_cause_account_to_fall_under_maintenance_margin_requirements_ = ( - "This order would cause account to fall under maintenance margin requirements." - ) - Insufficient_buying_power__only_a_single_risk_reducing_open_order_is_allowed_ = ( - "Insufficient buying power, only a single risk-reducing open order is allowed." - ) - Insufficient_buying_power__consider_reducing_order_size_ = ( - "Insufficient buying power, consider reducing order size." - ) - Insufficient_buying_power__consider_reducing_order_size_or_canceling_other_orders_ = "Insufficient buying power, consider reducing order size or canceling other orders." - Consider_canceling_other_limit_orders_or_using_IOC__FOK__or_market_orders__This_order_is_risk_reducing__but_if_filled_with_other_open_orders__buying_power_might_be_insufficient_ = "Consider canceling other limit orders or using IOC, FOK, or market orders. This order is risk-reducing, but if filled with other open orders, buying power might be insufficient." - Insufficient_buying_power_ = "Insufficient buying power." - - -@dataclass -class PrivateRfqGetBestQuoteResultSchema: - best_quote: Optional[QuoteResultPublicSchema] - direction: Direction - down_liquidation_price: Optional[Decimal] - estimated_fee: Decimal - estimated_realized_pnl: Decimal - estimated_realized_pnl_excl_fees: Decimal - estimated_total_cost: Decimal - filled_pct: Decimal - invalid_reason: Optional[InvalidReason] - is_valid: bool - orderbook_total_cost: Optional[Decimal] - post_initial_margin: Decimal - post_liquidation_price: Optional[Decimal] - pre_initial_margin: Decimal - suggested_max_fee: Decimal - up_liquidation_price: Optional[Decimal] - - -@dataclass -class PublicGetInstrumentsParamsSchema: - currency: str - expired: bool - instrument_type: InstrumentType - - -@dataclass -class PublicGetInstrumentsResponseSchema: - id: Union[str, int] - result: List[InstrumentPublicResponseSchema] - - -@dataclass -class PublicGetOptionSettlementHistoryParamsSchema: - page: int = 1 - page_size: int = 100 - subaccount_id: Optional[int] = None - - -@dataclass -class PublicGetOptionSettlementHistoryResultSchema: - pagination: PaginationInfoSchema - settlements: List[OptionSettlementResponseSchema] - - -@dataclass -class PrivateLiquidateParamsSchema: - cash_transfer: Decimal - last_seen_trade_id: int - liquidated_subaccount_id: int - nonce: int - percent_bid: Decimal - price_limit: Decimal - signature: str - signature_expiry_sec: int - signer: str - subaccount_id: int - - @dataclass -class PrivateLiquidateResultSchema: - estimated_bid_price: Decimal - estimated_discount_pnl: Decimal - estimated_percent_bid: Decimal - transaction_id: str - - -@dataclass -class PrivateGetTradeHistoryParamsSchema: - from_timestamp: int = 0 - instrument_name: Optional[str] = None - order_id: Optional[str] = None - page: int = 1 - page_size: int = 100 - quote_id: Optional[str] = None - subaccount_id: Optional[int] = None - to_timestamp: int = 18446744073709552000 - wallet: Optional[str] = None +class PrivateCancelRfqParamsSchema: + rfq_id: str + subaccount_id: int @dataclass -class PrivateGetTradeHistoryResultSchema: - pagination: PaginationInfoSchema - subaccount_id: int - trades: List[TradeResponseSchema] +class PrivateCancelRfqResponseSchema(PrivateResetMmpResponseSchema): + pass @dataclass @@ -1992,38 +1742,262 @@ class VolSVIParamDataSchema: @dataclass -class PrivateReplaceParamsSchema: +class PublicGetReferralPerformanceParamsSchema: + end_ms: int + start_ms: int + referral_code: Optional[str] = None + wallet: Optional[str] = None + + +@dataclass +class ReferralPerformanceByInstrumentTypeSchema: + fee_reward: Decimal + notional_volume: Decimal + referred_fee: Decimal + + +@dataclass +class PrivateCreateSubaccountParamsSchema: amount: Decimal - direction: Direction - instrument_name: str - limit_price: Decimal - max_fee: Decimal + asset_name: str + margin_type: MarginType nonce: int signature: str signature_expiry_sec: int signer: str + wallet: str + currency: Optional[str] = None + + +@dataclass +class PrivateCreateSubaccountResultSchema(PrivateTransferErc20ResultSchema): + pass + + +@dataclass +class PrivateCancelParamsSchema: + instrument_name: str + order_id: str subaccount_id: int - expected_filled_amount: Optional[Decimal] = None - is_atomic_signing: Optional[bool] = False + + +@dataclass +class PrivateCancelResultSchema(OrderResponseSchema): + pass + + +class Period1(str, Enum): + field_60 = 60 + field_300 = 300 + field_900 = 900 + field_1800 = 1800 + field_3600 = 3600 + field_14400 = 14400 + field_28800 = 28800 + field_86400 = 86400 + field_604800 = 604800 + + +@dataclass +class PublicGetSpotFeedHistoryCandlesParamsSchema: + currency: str + end_timestamp: int + period: Period1 + start_timestamp: int + + +@dataclass +class SpotFeedHistoryCandlesResponseSchema: + close_price: Decimal + high_price: Decimal + low_price: Decimal + open_price: Decimal + price: Decimal + timestamp: int + timestamp_bucket: int + + +@dataclass +class PrivateGetRfqsParamsSchema: + subaccount_id: int + from_timestamp: int = 0 + page: int = 1 + page_size: int = 100 + rfq_id: Optional[str] = None + status: Optional[Status] = None + to_timestamp: int = 18446744073709552000 + + +@dataclass +class RFQResultSchema: + ask_total_cost: Optional[Decimal] + bid_total_cost: Optional[Decimal] + cancel_reason: CancelReason + counterparties: Optional[List[str]] + creation_timestamp: int + filled_direction: Optional[Direction] + filled_pct: Decimal + label: str + last_update_timestamp: int + legs: List[LegUnpricedSchema] + mark_total_cost: Optional[Decimal] + max_total_cost: Optional[Decimal] + min_total_cost: Optional[Decimal] + partial_fill_step: Decimal + rfq_id: str + status: Status + subaccount_id: int + total_cost: Optional[Decimal] + valid_until: int + + +@dataclass +class PrivateCancelByNonceParamsSchema: + instrument_name: str + nonce: int + subaccount_id: int + wallet: str + + +@dataclass +class PrivateCancelByNonceResultSchema(PrivateCancelByLabelResultSchema): + pass + + +@dataclass +class PrivateGetSubaccountParamsSchema(PrivateGetOpenOrdersParamsSchema): + pass + + +@dataclass +class PrivateSendRfqParamsSchema: + legs: List[LegUnpricedSchema] + subaccount_id: int + counterparties: Optional[List[str]] = None label: str = "" - mmp: bool = False - nonce_to_cancel: Optional[int] = None - order_id_to_cancel: Optional[str] = None - order_type: OrderType = OrderType.limit - reduce_only: bool = False - referral_code: str = "" - reject_timestamp: int = 9223372036854776000 - time_in_force: TimeInForce = TimeInForce.gtc - trigger_price: Optional[Decimal] = None - trigger_price_type: Optional[TriggerPriceType] = None - trigger_type: Optional[TriggerType] = None + max_total_cost: Optional[Decimal] = None + min_total_cost: Optional[Decimal] = None + partial_fill_step: Decimal = "1" + + +@dataclass +class PrivateSendRfqResultSchema(RFQResultSchema): + pass + + +@dataclass +class PublicGetTimeParamsSchema(PublicGetVaultStatisticsParamsSchema): + pass + + +@dataclass +class PublicGetTimeResponseSchema: + id: Union[str, int] + result: int + + +@dataclass +class PublicStatisticsParamsSchema: + instrument_name: str + currency: Optional[str] = None + end_time: Optional[int] = None + + +@dataclass +class PublicStatisticsResultSchema: + daily_fees: Decimal + daily_notional_volume: Decimal + daily_premium_volume: Decimal + daily_trades: int + open_interest: Decimal + total_fees: Decimal + total_notional_volume: Decimal + total_premium_volume: Decimal + total_trades: int + + +@dataclass +class PublicGetAllInstrumentsParamsSchema: + expired: bool + instrument_type: InstrumentType + currency: Optional[str] = None + page: int = 1 + page_size: int = 100 + + +@dataclass +class PrivateGetLiquidatorHistoryParamsSchema: + subaccount_id: int + end_timestamp: int = 9223372036854776000 + page: int = 1 + page_size: int = 100 + start_timestamp: int = 0 + + +@dataclass +class PrivateGetLiquidatorHistoryResultSchema: + bids: List[AuctionBidEventSchema] + pagination: PaginationInfoSchema + + +@dataclass +class PublicRegisterSessionKeyParamsSchema: + expiry_sec: int + label: str + public_session_key: str + signed_raw_tx: str + wallet: str + + +@dataclass +class PublicRegisterSessionKeyResultSchema: + label: str + public_session_key: str + transaction_id: str + + +@dataclass +class PublicGetVaultBalancesParamsSchema: + smart_contract_owner: Optional[str] = None + wallet: Optional[str] = None + + +@dataclass +class VaultBalanceResponseSchema: + address: str + amount: Decimal + chain_id: int + name: str + vault_asset_type: str + + +@dataclass +class PrivateGetAccountParamsSchema(PrivateSessionKeysParamsSchema): + pass + + +@dataclass +class AccountFeeInfoSchema: + base_fee_discount: Decimal + option_maker_fee: Optional[Decimal] + option_taker_fee: Optional[Decimal] + perp_maker_fee: Optional[Decimal] + perp_taker_fee: Optional[Decimal] + rfq_maker_discount: Decimal + rfq_taker_discount: Decimal + spot_maker_fee: Optional[Decimal] + spot_taker_fee: Optional[Decimal] + + +@dataclass +class PrivateCancelQuoteParamsSchema: + quote_id: str + subaccount_id: int @dataclass -class RPCErrorFormatSchema: - code: int - message: str - data: Optional[str] = None +class PrivateCancelQuoteResultSchema(QuoteResultSchema): + pass @dataclass @@ -2033,58 +2007,57 @@ class PrivateCancelByInstrumentParamsSchema: @dataclass -class PrivateCancelByInstrumentResultSchema(PrivateCancelByNonceResultSchema): +class PrivateCancelByInstrumentResultSchema(PrivateCancelByLabelResultSchema): pass @dataclass -class PrivateCancelAllParamsSchema(PrivateGetPositionsParamsSchema): +class PrivateSendQuoteParamsSchema(PublicSendQuoteDebugParamsSchema): pass @dataclass -class PrivateCancelAllResponseSchema(PrivateCancelRfqResponseSchema): +class PrivateSendQuoteResultSchema(QuoteResultSchema): pass @dataclass -class PublicDeregisterSessionKeyParamsSchema: - public_session_key: str - signed_raw_tx: str - wallet: str - - -@dataclass -class PublicDeregisterSessionKeyResultSchema: - public_session_key: str - transaction_id: str +class PrivateCancelAllParamsSchema(PrivateGetOpenOrdersParamsSchema): + pass @dataclass -class PrivateWithdrawParamsSchema(PrivateDepositParamsSchema): +class PrivateCancelAllResponseSchema(PrivateResetMmpResponseSchema): pass @dataclass -class PrivateWithdrawResultSchema(PrivateCreateSubaccountResultSchema): - pass +class PublicGetVaultStatisticsResponseSchema: + id: Union[str, int] + result: List[VaultStatisticsResponseSchema] @dataclass -class PrivateGetNotificationsResultSchema: - notifications: List[NotificationResponseSchema] - pagination: PaginationInfoSchema +class SignedQuoteParamsSchema: + direction: Direction + legs: List[LegPricedSchema] + max_fee: Decimal + nonce: int + signature: str + signature_expiry_sec: int + signer: str + subaccount_id: int @dataclass -class PublicGetCurrencyResultSchema(CurrencyDetailedResponseSchema): - pass +class PrivateTransferPositionsResultSchema: + maker_quote: QuoteResultSchema + taker_quote: QuoteResultSchema @dataclass -class PrivateSetMmpConfigResponseSchema: - id: Union[str, int] - result: PrivateSetMmpConfigResultSchema +class PublicGetOptionSettlementPricesResultSchema: + expiries: List[ExpiryResponseSchema] @dataclass @@ -2103,86 +2076,59 @@ class PrivateTransferPositionResultSchema: @dataclass -class PrivateCreateSubaccountResponseSchema: +class PublicDepositDebugResponseSchema: id: Union[str, int] - result: PrivateCreateSubaccountResultSchema - - -@dataclass -class PrivateSendRfqParamsSchema: - legs: List[LegUnpricedSchema] - subaccount_id: int - counterparties: Optional[List[str]] = None - label: str = "" - max_total_cost: Optional[Decimal] = None - min_total_cost: Optional[Decimal] = None - partial_fill_step: Decimal = "1" + result: PublicDepositDebugResultSchema @dataclass -class PrivateSendRfqResponseSchema: +class PrivateGetOpenOrdersResponseSchema: id: Union[str, int] - result: PrivateSendRfqResultSchema + result: PrivateGetOpenOrdersResultSchema @dataclass -class PublicMarginWatchResultSchema: - collaterals: List[CollateralPublicResponseSchema] - currency: str - initial_margin: Decimal - maintenance_margin: Decimal - margin_type: MarginType - positions: List[PositionPublicResponseSchema] +class PrivateTransferErc20ParamsSchema: + recipient_details: SignatureDetailsSchema + recipient_subaccount_id: int + sender_details: SignatureDetailsSchema subaccount_id: int - subaccount_value: Decimal - valuation_timestamp: int + transfer: TransferDetailsSchema @dataclass -class PublicStatisticsResponseSchema: +class PrivateTransferErc20ResponseSchema: id: Union[str, int] - result: PublicStatisticsResultSchema + result: PrivateTransferErc20ResultSchema @dataclass -class PrivateCancelResponseSchema: +class PrivateRegisterScopedSessionKeyResponseSchema: id: Union[str, int] - result: PrivateCancelResultSchema + result: PrivateRegisterScopedSessionKeyResultSchema @dataclass -class PrivateExecuteQuoteParamsSchema(PublicExecuteQuoteDebugParamsSchema): +class PublicGetCurrencyResultSchema(CurrencyDetailedResponseSchema): pass @dataclass -class PrivateExecuteQuoteResponseSchema: +class PrivateLiquidateResponseSchema: id: Union[str, int] - result: PrivateExecuteQuoteResultSchema - - -@dataclass -class PublicGetSpotFeedHistoryCandlesResultSchema: - currency: str - spot_feed_history: List[SpotFeedHistoryCandlesResponseSchema] + result: PrivateLiquidateResultSchema @dataclass -class PrivatePollRfqsResultSchema: - pagination: PaginationInfoSchema - rfqs: List[RFQResultPublicSchema] +class PrivateGetSubaccountValueHistoryResultSchema: + subaccount_id: int + subaccount_value_history: List[SubAccountValueHistoryResponseSchema] @dataclass -class AuctionResultSchema: - auction_id: str - auction_type: AuctionType - bids: List[AuctionBidEventSchema] - end_timestamp: Optional[int] - fee: Decimal - start_timestamp: int - subaccount_id: int - tx_hash: str +class PublicGetMakerProgramsResponseSchema: + id: Union[str, int] + result: List[ProgramResponseSchema] @dataclass @@ -2199,240 +2145,255 @@ class SignedTradeOrderSchema: @dataclass -class PrivateDepositResponseSchema: - id: Union[str, int] - result: PrivateDepositResultSchema +class PrivateGetInterestHistoryResultSchema: + events: List[InterestPaymentSchema] @dataclass -class PrivateUpdateNotificationsResponseSchema: - id: Union[str, int] - result: PrivateUpdateNotificationsResultSchema +class PrivateGetDepositHistoryResultSchema: + events: List[DepositSchema] @dataclass -class PrivateChangeSubaccountLabelResponseSchema: +class PrivateGetMmpConfigResponseSchema: id: Union[str, int] - result: PrivateChangeSubaccountLabelResultSchema + result: List[MMPConfigResultSchema] @dataclass -class PrivateTransferPositionsParamsSchema: - maker_params: SignedQuoteParamsSchema - taker_params: SignedQuoteParamsSchema - wallet: str +class PrivateSessionKeysResultSchema: + public_session_keys: List[SessionKeyResponseSchema] @dataclass -class PrivateTransferPositionsResultSchema: - maker_quote: QuoteResultSchema - taker_quote: QuoteResultSchema +class InstrumentPublicResponseSchema(PublicGetInstrumentResultSchema): + pass @dataclass -class PublicGetMakerProgramsResponseSchema: - id: Union[str, int] - result: List[ProgramResponseSchema] +class PrivateGetSubaccountResultSchema: + collaterals: List[CollateralResponseSchema] + collaterals_initial_margin: Decimal + collaterals_maintenance_margin: Decimal + collaterals_value: Decimal + currency: str + initial_margin: Decimal + is_under_liquidation: bool + label: str + maintenance_margin: Decimal + margin_type: MarginType + open_orders: List[OrderResponseSchema] + open_orders_margin: Decimal + positions: List[PositionResponseSchema] + positions_initial_margin: Decimal + positions_maintenance_margin: Decimal + positions_value: Decimal + projected_margin_change: Decimal + subaccount_id: int + subaccount_value: Decimal @dataclass -class PublicGetMarginParamsSchema: - margin_type: MarginType - simulated_collaterals: List[SimulatedCollateralSchema] - simulated_positions: List[SimulatedPositionSchema] - market: Optional[str] = None - simulated_collateral_changes: Optional[List[SimulatedCollateralSchema]] = None - simulated_position_changes: Optional[List[SimulatedPositionSchema]] = None +class PublicGetInstrumentResponseSchema: + id: Union[str, int] + result: PublicGetInstrumentResultSchema @dataclass -class PublicGetMarginResponseSchema: +class PublicExecuteQuoteDebugResponseSchema: id: Union[str, int] - result: PublicGetMarginResultSchema + result: PublicExecuteQuoteDebugResultSchema @dataclass -class PrivateCancelByNonceResponseSchema: +class PrivateGetCollateralsResponseSchema: id: Union[str, int] - result: PrivateCancelByNonceResultSchema + result: PrivateGetCollateralsResultSchema @dataclass -class PublicGetSpotFeedHistoryResultSchema: - currency: str - spot_feed_history: List[SpotFeedHistoryResponseSchema] +class PrivatePollQuotesResultSchema: + pagination: PaginationInfoSchema + quotes: List[QuoteResultPublicSchema] @dataclass -class PrivateGetSubaccountsResponseSchema: - id: Union[str, int] - result: PrivateGetSubaccountsResultSchema +class PrivateGetMarginParamsSchema: + subaccount_id: int + simulated_collateral_changes: Optional[List[SimulatedCollateralSchema]] = None + simulated_position_changes: Optional[List[SimulatedPositionSchema]] = None @dataclass -class PrivateGetDepositHistoryResultSchema: - events: List[DepositSchema] +class PrivateGetMarginResponseSchema: + id: Union[str, int] + result: PrivateGetMarginResultSchema @dataclass -class PrivateCancelByLabelResponseSchema: +class PublicBuildRegisterSessionKeyTxResponseSchema: id: Union[str, int] - result: PrivateCancelByLabelResultSchema + result: PublicBuildRegisterSessionKeyTxResultSchema @dataclass -class PrivateGetMarginResponseSchema: +class PrivateCancelTriggerOrderResponseSchema: id: Union[str, int] - result: PrivateGetMarginResultSchema + result: PrivateCancelTriggerOrderResultSchema @dataclass -class PublicCreateSubaccountDebugResponseSchema: +class PrivateGetOrderResponseSchema: id: Union[str, int] - result: PublicCreateSubaccountDebugResultSchema + result: PrivateGetOrderResultSchema @dataclass -class PublicGetInstrumentResultSchema(InstrumentPublicResponseSchema): - pass +class PrivateGetWithdrawalHistoryResultSchema: + events: List[WithdrawalSchema] @dataclass -class PrivateEditSessionKeyResponseSchema: +class PublicGetLiveIncidentsResultSchema: + incidents: List[IncidentResponseSchema] + + +@dataclass +class PrivateGetQuotesResponseSchema: id: Union[str, int] - result: PrivateEditSessionKeyResultSchema + result: PrivateGetQuotesResultSchema @dataclass -class PrivateGetLiquidatorHistoryResponseSchema: +class PrivateGetPositionsResponseSchema: id: Union[str, int] - result: PrivateGetLiquidatorHistoryResultSchema + result: PrivateGetPositionsResultSchema @dataclass -class PrivateGetPositionsResultSchema: - positions: List[PositionResponseSchema] +class PrivateGetOptionSettlementHistoryResultSchema: + settlements: List[OptionSettlementResponseSchema] subaccount_id: int @dataclass -class PublicGetTradeHistoryResultSchema: - pagination: PaginationInfoSchema - trades: List[TradeSettledPublicResponseSchema] +class PublicDeregisterSessionKeyResponseSchema: + id: Union[str, int] + result: PublicDeregisterSessionKeyResultSchema @dataclass -class PrivateGetRfqsResultSchema: +class PublicGetVaultShareResultSchema: pagination: PaginationInfoSchema - rfqs: List[RFQResultSchema] + vault_shares: List[VaultShareResponseSchema] @dataclass -class PrivateTransferErc20ParamsSchema: - recipient_details: SignatureDetailsSchema - recipient_subaccount_id: int - sender_details: SignatureDetailsSchema - subaccount_id: int - transfer: TransferDetailsSchema +class PrivateExpiredAndCancelledHistoryResponseSchema: + id: Union[str, int] + result: PrivateExpiredAndCancelledHistoryResultSchema @dataclass -class PrivateTransferErc20ResponseSchema: +class PrivateEditSessionKeyResponseSchema: id: Union[str, int] - result: PrivateTransferErc20ResultSchema + result: PrivateEditSessionKeyResultSchema @dataclass -class PrivateSendQuoteResponseSchema: +class PublicGetAllCurrenciesResponseSchema: id: Union[str, int] - result: PrivateSendQuoteResultSchema + result: List[CurrencyDetailedResponseSchema] @dataclass -class PrivateCancelTriggerOrderResponseSchema: +class PrivateCancelByLabelResponseSchema: id: Union[str, int] - result: PrivateCancelTriggerOrderResultSchema + result: PrivateCancelByLabelResultSchema @dataclass -class PrivateGetWithdrawalHistoryResultSchema: - events: List[WithdrawalSchema] +class PublicWithdrawDebugResponseSchema: + id: Union[str, int] + result: PublicWithdrawDebugResultSchema @dataclass -class PublicGetOptionSettlementPricesResultSchema: - expiries: List[ExpiryResponseSchema] +class PublicGetMarginResponseSchema: + id: Union[str, int] + result: PublicGetMarginResultSchema @dataclass -class PublicGetMakerProgramScoresResultSchema: - program: ProgramResponseSchema - scores: List[ScoreBreakdownSchema] - total_score: Decimal - total_volume: Decimal +class PrivateGetSubaccountsResponseSchema: + id: Union[str, int] + result: PrivateGetSubaccountsResultSchema @dataclass -class PublicBuildRegisterSessionKeyTxResponseSchema: - id: Union[str, int] - result: PublicBuildRegisterSessionKeyTxResultSchema +class RFQResultPublicSchema: + cancel_reason: CancelReason + creation_timestamp: int + filled_direction: Optional[Direction] + filled_pct: Decimal + last_update_timestamp: int + legs: List[LegUnpricedSchema] + partial_fill_step: Decimal + rfq_id: str + status: Status + subaccount_id: int + total_cost: Optional[Decimal] + valid_until: int @dataclass -class PublicRegisterSessionKeyResponseSchema: +class PrivateWithdrawResponseSchema: id: Union[str, int] - result: PublicRegisterSessionKeyResultSchema + result: PrivateWithdrawResultSchema @dataclass -class PrivateGetOrderHistoryResponseSchema: +class PrivateUpdateNotificationsResponseSchema: id: Union[str, int] - result: PrivateGetOrderHistoryResultSchema + result: PrivateUpdateNotificationsResultSchema @dataclass -class PrivateCancelBatchRfqsResponseSchema: +class PrivateGetTradeHistoryResponseSchema: id: Union[str, int] - result: PrivateCancelBatchRfqsResultSchema + result: PrivateGetTradeHistoryResultSchema @dataclass -class PrivateCancelBatchQuotesResponseSchema: +class PrivateOrderResponseSchema: id: Union[str, int] - result: PrivateCancelBatchQuotesResultSchema + result: PrivateOrderResultSchema @dataclass -class PrivateGetFundingHistoryResultSchema: - events: List[FundingPaymentSchema] +class PublicGetInterestRateHistoryResultSchema: + interest_rates: List[InterestRateHistoryResponseSchema] pagination: PaginationInfoSchema @dataclass -class PrivateGetOpenOrdersResponseSchema: +class PublicGetOptionSettlementHistoryResponseSchema: id: Union[str, int] - result: PrivateGetOpenOrdersResultSchema + result: PublicGetOptionSettlementHistoryResultSchema @dataclass -class PrivateGetAccountResultSchema: - cancel_on_disconnect: bool - fee_info: AccountFeeInfoSchema - is_rfq_maker: bool - per_endpoint_tps: Dict[str, Any] - subaccount_ids: List[int] - wallet: str - websocket_matching_tps: int - websocket_non_matching_tps: int - websocket_option_tps: int - websocket_perp_tps: int - referral_code: Optional[str] = None +class PublicGetMakerProgramScoresResultSchema: + program: ProgramResponseSchema + scores: List[ScoreBreakdownSchema] + total_score: Decimal + total_volume: Decimal @dataclass -class PublicGetAllInstrumentsResultSchema: - instruments: List[InstrumentPublicResponseSchema] - pagination: PaginationInfoSchema +class PrivateGetOrdersResponseSchema: + id: Union[str, int] + result: PrivateGetOrdersResultSchema @dataclass @@ -2477,239 +2438,270 @@ class PublicGetTickerResultSchema: @dataclass -class PublicGetVaultShareResultSchema: +class PrivateGetFundingHistoryResultSchema: + events: List[FundingPaymentSchema] pagination: PaginationInfoSchema - vault_shares: List[VaultShareResponseSchema] @dataclass -class PrivateGetCollateralsResultSchema: - collaterals: List[CollateralResponseSchema] - subaccount_id: int +class PublicGetSpotFeedHistoryResultSchema: + currency: str + spot_feed_history: List[SpotFeedHistoryResponseSchema] @dataclass -class PrivateRegisterScopedSessionKeyResponseSchema: +class PrivateSetMmpConfigResponseSchema: id: Union[str, int] - result: PrivateRegisterScopedSessionKeyResultSchema + result: PrivateSetMmpConfigResultSchema @dataclass -class PrivateExpiredAndCancelledHistoryResponseSchema: - id: Union[str, int] - result: PrivateExpiredAndCancelledHistoryResultSchema +class PublicGetFundingRateHistoryResultSchema: + funding_rate_history: List[FundingRateSchema] @dataclass -class PrivateSessionKeysResultSchema: - public_session_keys: List[SessionKeyResponseSchema] +class PrivateGetNotificationsResultSchema: + notifications: List[NotificationResponseSchema] + pagination: PaginationInfoSchema @dataclass -class PrivateGetMmpConfigResponseSchema: +class PrivateCancelBatchQuotesResponseSchema: id: Union[str, int] - result: List[MMPConfigResultSchema] + result: PrivateCancelBatchQuotesResultSchema @dataclass -class PrivateOrderResponseSchema: +class PrivateRfqGetBestQuoteResponseSchema: id: Union[str, int] - result: PrivateOrderResultSchema + result: PrivateRfqGetBestQuoteResultSchema @dataclass -class PrivateGetSubaccountResponseSchema: +class PrivateDepositResponseSchema: id: Union[str, int] - result: PrivateGetSubaccountResultSchema + result: PrivateDepositResultSchema @dataclass -class PublicGetInterestRateHistoryResultSchema: - interest_rates: List[InterestRateHistoryResponseSchema] - pagination: PaginationInfoSchema +class AuctionResultSchema: + auction_id: str + auction_type: AuctionType + bids: List[AuctionBidEventSchema] + end_timestamp: Optional[int] + fee: Decimal + start_timestamp: int + subaccount_id: int + tx_hash: str @dataclass -class PublicGetLiquidationHistoryResultSchema: - auctions: List[AuctionResultSchema] - pagination: PaginationInfoSchema +class PrivateChangeSubaccountLabelResponseSchema: + id: Union[str, int] + result: PrivateChangeSubaccountLabelResultSchema @dataclass -class PublicDepositDebugResponseSchema: - id: Union[str, int] - result: PublicDepositDebugResultSchema +class PublicMarginWatchResultSchema: + collaterals: List[CollateralPublicResponseSchema] + currency: str + initial_margin: Decimal + maintenance_margin: Decimal + margin_type: MarginType + positions: List[PositionPublicResponseSchema] + subaccount_id: int + subaccount_value: Decimal + valuation_timestamp: int @dataclass -class PublicGetVaultBalancesResponseSchema: +class PublicGetTransactionResponseSchema: id: Union[str, int] - result: List[VaultBalanceResponseSchema] + result: PublicGetTransactionResultSchema @dataclass -class PublicGetReferralPerformanceResultSchema: - fee_share_percentage: Decimal - referral_code: str - rewards: Dict[str, Dict[str, Dict[str, ReferralPerformanceByInstrumentTypeSchema]]] - stdrv_balance: Decimal - total_fee_rewards: Decimal - total_notional_volume: Decimal - total_referred_fees: Decimal +class PrivateGetErc20TransferHistoryResultSchema: + events: List[ERC20TransferSchema] @dataclass -class PrivateCancelQuoteResponseSchema: +class PrivateReplaceResultSchema: + cancelled_order: OrderResponseSchema + create_order_error: Optional[RPCErrorFormatSchema] = None + order: Optional[OrderResponseSchema] = None + trades: Optional[List[TradeResponseSchema]] = None + + +@dataclass +class PublicGetTradeHistoryResultSchema: + pagination: PaginationInfoSchema + trades: List[TradeSettledPublicResponseSchema] + + +@dataclass +class PublicSendQuoteDebugResponseSchema: id: Union[str, int] - result: PrivateCancelQuoteResultSchema + result: PublicSendQuoteDebugResultSchema @dataclass -class PrivateGetQuotesResponseSchema: +class PrivateGetOrderHistoryResponseSchema: id: Union[str, int] - result: PrivateGetQuotesResultSchema + result: PrivateGetOrderHistoryResultSchema @dataclass -class PublicExecuteQuoteDebugResponseSchema: +class PrivateCancelBatchRfqsResponseSchema: id: Union[str, int] - result: PublicExecuteQuoteDebugResultSchema + result: PrivateCancelBatchRfqsResultSchema @dataclass -class PrivateGetOptionSettlementHistoryResultSchema: - settlements: List[OptionSettlementResponseSchema] - subaccount_id: int +class PrivateExecuteQuoteResponseSchema: + id: Union[str, int] + result: PrivateExecuteQuoteResultSchema @dataclass -class PrivateGetErc20TransferHistoryResultSchema: - events: List[ERC20TransferSchema] +class PublicCreateSubaccountDebugResponseSchema: + id: Union[str, int] + result: PublicCreateSubaccountDebugResultSchema @dataclass -class PublicGetAllCurrenciesResponseSchema: +class PrivateGetLiquidationHistoryResponseSchema: id: Union[str, int] - result: List[CurrencyDetailedResponseSchema] + result: List[AuctionResultSchema] @dataclass -class PrivateGetSubaccountValueHistoryResultSchema: - subaccount_id: int - subaccount_value_history: List[SubAccountValueHistoryResponseSchema] +class ForwardFeedDataSchema: + confidence: Decimal + currency: str + deadline: int + expiry: int + fwd_diff: Decimal + signatures: OracleSignatureDataSchema + spot_aggregate_latest: Decimal + spot_aggregate_start: Decimal + timestamp: int @dataclass -class PublicSendQuoteDebugResponseSchema: - id: Union[str, int] - result: PublicSendQuoteDebugResultSchema +class VolFeedDataSchema: + confidence: Decimal + currency: str + deadline: int + expiry: int + signatures: OracleSignatureDataSchema + timestamp: int + vol_data: VolSVIParamDataSchema @dataclass -class PublicGetLiveIncidentsResultSchema: - incidents: List[IncidentResponseSchema] +class PublicGetReferralPerformanceResultSchema: + fee_share_percentage: Decimal + referral_code: str + rewards: Dict[str, Dict[str, Dict[str, ReferralPerformanceByInstrumentTypeSchema]]] + stdrv_balance: Decimal + total_fee_rewards: Decimal + total_notional_volume: Decimal + total_referred_fees: Decimal @dataclass -class PublicGetTransactionResponseSchema: +class PrivateCreateSubaccountResponseSchema: id: Union[str, int] - result: PublicGetTransactionResultSchema + result: PrivateCreateSubaccountResultSchema @dataclass -class PrivateGetOrdersResponseSchema: +class PrivateCancelResponseSchema: id: Union[str, int] - result: PrivateGetOrdersResultSchema + result: PrivateCancelResultSchema @dataclass -class PrivateGetInterestHistoryResultSchema: - events: List[InterestPaymentSchema] +class PublicGetSpotFeedHistoryCandlesResultSchema: + currency: str + spot_feed_history: List[SpotFeedHistoryCandlesResponseSchema] @dataclass -class PrivatePollQuotesResultSchema: +class PrivateGetRfqsResultSchema: pagination: PaginationInfoSchema - quotes: List[QuoteResultPublicSchema] + rfqs: List[RFQResultSchema] @dataclass -class PrivateGetOrderResponseSchema: +class PrivateCancelByNonceResponseSchema: id: Union[str, int] - result: PrivateGetOrderResultSchema + result: PrivateCancelByNonceResultSchema @dataclass -class PublicGetVaultStatisticsResponseSchema: +class PrivateGetSubaccountResponseSchema: id: Union[str, int] - result: List[VaultStatisticsResponseSchema] + result: PrivateGetSubaccountResultSchema @dataclass -class PublicWithdrawDebugResponseSchema: +class PrivateSendRfqResponseSchema: id: Union[str, int] - result: PublicWithdrawDebugResultSchema - - -@dataclass -class PublicGetFundingRateHistoryResultSchema: - funding_rate_history: List[FundingRateSchema] + result: PrivateSendRfqResultSchema @dataclass -class PrivateRfqGetBestQuoteResponseSchema: +class PublicStatisticsResponseSchema: id: Union[str, int] - result: PrivateRfqGetBestQuoteResultSchema + result: PublicStatisticsResultSchema @dataclass -class PublicGetOptionSettlementHistoryResponseSchema: - id: Union[str, int] - result: PublicGetOptionSettlementHistoryResultSchema +class PublicGetAllInstrumentsResultSchema: + instruments: List[InstrumentPublicResponseSchema] + pagination: PaginationInfoSchema @dataclass -class PrivateLiquidateResponseSchema: +class PrivateGetLiquidatorHistoryResponseSchema: id: Union[str, int] - result: PrivateLiquidateResultSchema + result: PrivateGetLiquidatorHistoryResultSchema @dataclass -class PrivateGetTradeHistoryResponseSchema: +class PublicRegisterSessionKeyResponseSchema: id: Union[str, int] - result: PrivateGetTradeHistoryResultSchema + result: PublicRegisterSessionKeyResultSchema @dataclass -class ForwardFeedDataSchema: - confidence: Decimal - currency: str - deadline: int - expiry: int - fwd_diff: Decimal - signatures: OracleSignatureDataSchema - spot_aggregate_latest: Decimal - spot_aggregate_start: Decimal - timestamp: int +class PublicGetVaultBalancesResponseSchema: + id: Union[str, int] + result: List[VaultBalanceResponseSchema] @dataclass -class VolFeedDataSchema: - confidence: Decimal - currency: str - deadline: int - expiry: int - signatures: OracleSignatureDataSchema - timestamp: int - vol_data: VolSVIParamDataSchema +class PrivateGetAccountResultSchema: + cancel_on_disconnect: bool + fee_info: AccountFeeInfoSchema + is_rfq_maker: bool + per_endpoint_tps: Dict[str, Any] + subaccount_ids: List[int] + wallet: str + websocket_matching_tps: int + websocket_non_matching_tps: int + websocket_option_tps: int + websocket_perp_tps: int + referral_code: Optional[str] = None @dataclass -class PrivateReplaceResultSchema: - cancelled_order: OrderResponseSchema - create_order_error: Optional[RPCErrorFormatSchema] = None - order: Optional[OrderResponseSchema] = None - trades: Optional[List[TradeResponseSchema]] = None +class PrivateCancelQuoteResponseSchema: + id: Union[str, int] + result: PrivateCancelQuoteResultSchema @dataclass @@ -2719,27 +2711,28 @@ class PrivateCancelByInstrumentResponseSchema: @dataclass -class PublicDeregisterSessionKeyResponseSchema: +class PrivateSendQuoteResponseSchema: id: Union[str, int] - result: PublicDeregisterSessionKeyResultSchema + result: PrivateSendQuoteResultSchema @dataclass -class PrivateWithdrawResponseSchema: - id: Union[str, int] - result: PrivateWithdrawResultSchema +class PrivateTransferPositionsParamsSchema: + maker_params: SignedQuoteParamsSchema + taker_params: SignedQuoteParamsSchema + wallet: str @dataclass -class PrivateGetNotificationsResponseSchema: +class PrivateTransferPositionsResponseSchema: id: Union[str, int] - result: PrivateGetNotificationsResultSchema + result: PrivateTransferPositionsResultSchema @dataclass -class PublicGetCurrencyResponseSchema: +class PublicGetOptionSettlementPricesResponseSchema: id: Union[str, int] - result: PublicGetCurrencyResultSchema + result: PublicGetOptionSettlementPricesResultSchema @dataclass @@ -2749,27 +2742,15 @@ class PrivateTransferPositionResponseSchema: @dataclass -class PublicMarginWatchResponseSchema: - id: Union[str, int] - result: PublicMarginWatchResultSchema - - -@dataclass -class PublicGetSpotFeedHistoryCandlesResponseSchema: - id: Union[str, int] - result: PublicGetSpotFeedHistoryCandlesResultSchema - - -@dataclass -class PrivatePollRfqsResponseSchema: +class PublicGetCurrencyResponseSchema: id: Union[str, int] - result: PrivatePollRfqsResultSchema + result: PublicGetCurrencyResultSchema @dataclass -class PrivateGetLiquidationHistoryResponseSchema: +class PrivateGetSubaccountValueHistoryResponseSchema: id: Union[str, int] - result: List[AuctionResultSchema] + result: PrivateGetSubaccountValueHistoryResultSchema @dataclass @@ -2782,15 +2763,9 @@ class PrivateOrderDebugResultSchema: @dataclass -class PrivateTransferPositionsResponseSchema: - id: Union[str, int] - result: PrivateTransferPositionsResultSchema - - -@dataclass -class PublicGetSpotFeedHistoryResponseSchema: +class PrivateGetInterestHistoryResponseSchema: id: Union[str, int] - result: PublicGetSpotFeedHistoryResultSchema + result: PrivateGetInterestHistoryResultSchema @dataclass @@ -2800,27 +2775,27 @@ class PrivateGetDepositHistoryResponseSchema: @dataclass -class PublicGetInstrumentResponseSchema: +class PrivateSessionKeysResponseSchema: id: Union[str, int] - result: PublicGetInstrumentResultSchema + result: PrivateSessionKeysResultSchema @dataclass -class PrivateGetPositionsResponseSchema: +class PublicGetInstrumentsResponseSchema: id: Union[str, int] - result: PrivateGetPositionsResultSchema + result: List[InstrumentPublicResponseSchema] @dataclass -class PublicGetTradeHistoryResponseSchema: +class PrivateGetAllPortfoliosResponseSchema: id: Union[str, int] - result: PublicGetTradeHistoryResultSchema + result: List[PrivateGetSubaccountResultSchema] @dataclass -class PrivateGetRfqsResponseSchema: +class PrivatePollQuotesResponseSchema: id: Union[str, int] - result: PrivateGetRfqsResultSchema + result: PrivatePollQuotesResultSchema @dataclass @@ -2830,81 +2805,81 @@ class PrivateGetWithdrawalHistoryResponseSchema: @dataclass -class PublicGetOptionSettlementPricesResponseSchema: +class PublicGetLiveIncidentsResponseSchema: id: Union[str, int] - result: PublicGetOptionSettlementPricesResultSchema + result: PublicGetLiveIncidentsResultSchema @dataclass -class PublicGetMakerProgramScoresResponseSchema: +class PrivateGetOptionSettlementHistoryResponseSchema: id: Union[str, int] - result: PublicGetMakerProgramScoresResultSchema + result: PrivateGetOptionSettlementHistoryResultSchema @dataclass -class PrivateGetFundingHistoryResponseSchema: +class PublicGetVaultShareResponseSchema: id: Union[str, int] - result: PrivateGetFundingHistoryResultSchema + result: PublicGetVaultShareResultSchema @dataclass -class PrivateGetAccountResponseSchema: - id: Union[str, int] - result: PrivateGetAccountResultSchema +class PrivatePollRfqsResultSchema: + pagination: PaginationInfoSchema + rfqs: List[RFQResultPublicSchema] @dataclass -class PublicGetAllInstrumentsResponseSchema: +class PublicGetInterestRateHistoryResponseSchema: id: Union[str, int] - result: PublicGetAllInstrumentsResultSchema + result: PublicGetInterestRateHistoryResultSchema @dataclass -class PublicGetTickerResponseSchema: +class PublicGetMakerProgramScoresResponseSchema: id: Union[str, int] - result: PublicGetTickerResultSchema + result: PublicGetMakerProgramScoresResultSchema @dataclass -class PublicGetVaultShareResponseSchema: +class PublicGetTickerResponseSchema: id: Union[str, int] - result: PublicGetVaultShareResultSchema + result: PublicGetTickerResultSchema @dataclass -class PrivateGetCollateralsResponseSchema: +class PrivateGetFundingHistoryResponseSchema: id: Union[str, int] - result: PrivateGetCollateralsResultSchema + result: PrivateGetFundingHistoryResultSchema @dataclass -class PrivateSessionKeysResponseSchema: +class PublicGetSpotFeedHistoryResponseSchema: id: Union[str, int] - result: PrivateSessionKeysResultSchema + result: PublicGetSpotFeedHistoryResultSchema @dataclass -class PublicGetInterestRateHistoryResponseSchema: +class PublicGetFundingRateHistoryResponseSchema: id: Union[str, int] - result: PublicGetInterestRateHistoryResultSchema + result: PublicGetFundingRateHistoryResultSchema @dataclass -class PublicGetLiquidationHistoryResponseSchema: +class PrivateGetNotificationsResponseSchema: id: Union[str, int] - result: PublicGetLiquidationHistoryResultSchema + result: PrivateGetNotificationsResultSchema @dataclass -class PublicGetReferralPerformanceResponseSchema: - id: Union[str, int] - result: PublicGetReferralPerformanceResultSchema +class PublicGetLiquidationHistoryResultSchema: + auctions: List[AuctionResultSchema] + pagination: PaginationInfoSchema @dataclass -class PrivateGetOptionSettlementHistoryResponseSchema: +class PublicMarginWatchResponseSchema: id: Union[str, int] - result: PrivateGetOptionSettlementHistoryResultSchema + result: PublicMarginWatchResultSchema @dataclass @@ -2914,48 +2889,54 @@ class PrivateGetErc20TransferHistoryResponseSchema: @dataclass -class PrivateGetSubaccountValueHistoryResponseSchema: +class PrivateReplaceResponseSchema: id: Union[str, int] - result: PrivateGetSubaccountValueHistoryResultSchema + result: PrivateReplaceResultSchema @dataclass -class PublicGetLiveIncidentsResponseSchema: +class PublicGetTradeHistoryResponseSchema: id: Union[str, int] - result: PublicGetLiveIncidentsResultSchema + result: PublicGetTradeHistoryResultSchema @dataclass -class PrivateGetInterestHistoryResponseSchema: +class PublicGetLatestSignedFeedsResultSchema: + fwd_data: Dict[str, Dict[str, ForwardFeedDataSchema]] + perp_data: Dict[str, Dict[str, PerpFeedDataSchema]] + rate_data: Dict[str, Dict[str, RateFeedDataSchema]] + spot_data: Dict[str, SpotFeedDataSchema] + vol_data: Dict[str, Dict[str, VolFeedDataSchema]] + + +@dataclass +class PublicGetReferralPerformanceResponseSchema: id: Union[str, int] - result: PrivateGetInterestHistoryResultSchema + result: PublicGetReferralPerformanceResultSchema @dataclass -class PrivatePollQuotesResponseSchema: +class PublicGetSpotFeedHistoryCandlesResponseSchema: id: Union[str, int] - result: PrivatePollQuotesResultSchema + result: PublicGetSpotFeedHistoryCandlesResultSchema @dataclass -class PublicGetFundingRateHistoryResponseSchema: +class PrivateGetRfqsResponseSchema: id: Union[str, int] - result: PublicGetFundingRateHistoryResultSchema + result: PrivateGetRfqsResultSchema @dataclass -class PublicGetLatestSignedFeedsResultSchema: - fwd_data: Dict[str, Dict[str, ForwardFeedDataSchema]] - perp_data: Dict[str, Dict[str, PerpFeedDataSchema]] - rate_data: Dict[str, Dict[str, RateFeedDataSchema]] - spot_data: Dict[str, SpotFeedDataSchema] - vol_data: Dict[str, Dict[str, VolFeedDataSchema]] +class PublicGetAllInstrumentsResponseSchema: + id: Union[str, int] + result: PublicGetAllInstrumentsResultSchema @dataclass -class PrivateReplaceResponseSchema: +class PrivateGetAccountResponseSchema: id: Union[str, int] - result: PrivateReplaceResultSchema + result: PrivateGetAccountResultSchema @dataclass @@ -2964,6 +2945,18 @@ class PrivateOrderDebugResponseSchema: result: PrivateOrderDebugResultSchema +@dataclass +class PrivatePollRfqsResponseSchema: + id: Union[str, int] + result: PrivatePollRfqsResultSchema + + +@dataclass +class PublicGetLiquidationHistoryResponseSchema: + id: Union[str, int] + result: PublicGetLiquidationHistoryResultSchema + + @dataclass class PublicGetLatestSignedFeedsResponseSchema: id: Union[str, int] diff --git a/openapi-spec.json b/openapi-spec.json new file mode 100644 index 00000000..abc3c02b --- /dev/null +++ b/openapi-spec.json @@ -0,0 +1 @@ +{"openapi":"3.0.0","info":{"version":"1.0.0","title":"REST API"},"servers":[{"url":"https://api.lyra.finance","description":"Prod"},{"url":"https://api-demo.lyra.finance","description":"Testnet"}],"paths":{"/public/build_register_session_key_tx":{"post":{"tags":["Public"],"summary":"Build Register Session Key Tx","description":"Build a signable transaction params dictionary.","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicBuildRegisterSessionKeyTxResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicBuildRegisterSessionKeyTxParamsSchema"}}}}}},"/public/register_session_key":{"post":{"tags":["Public"],"summary":"Register Session Key","description":"Register or update expiry of an existing session key.
Currently, this only supports creating admin level session keys.
Keys with fewer permissions are registered via `/register_scoped_session_key`

Expiries updated on admin session keys may not happen immediately due to waiting for the onchain transaction to settle.","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicRegisterSessionKeyResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicRegisterSessionKeyParamsSchema"}}}}}},"/public/deregister_session_key":{"post":{"tags":["Public"],"summary":"Deregister Session Key","description":"Used for de-registering admin scoped keys. For other scopes, use `/edit_session_key`.","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicDeregisterSessionKeyResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicDeregisterSessionKeyParamsSchema"}}}}}},"/public/login":{"post":{"tags":["Public"],"summary":"Login","description":"Authenticate a websocket connection. Unavailable via HTTP.","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicLoginResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicLoginParamsSchema"}}}}}},"/public/statistics":{"post":{"tags":["Public"],"summary":"Statistics","description":"Get statistics for a specific instrument or instrument type","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicStatisticsResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicStatisticsParamsSchema"}}}}}},"/public/get_all_currencies":{"post":{"tags":["Public"],"summary":"Get All Currencies","description":"Get all active currencies with their spot price, spot price 24hrs ago.

For real-time updates, recommend using channels -> ticker or orderbook.","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicGetAllCurrenciesResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicGetAllCurrenciesParamsSchema"}}}}}},"/public/get_currency":{"post":{"tags":["Public"],"summary":"Get Currency","description":"Get currency related risk params, spot price 24hrs ago and lending details for a specific currency.","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicGetCurrencyResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicGetCurrencyParamsSchema"}}}}}},"/public/get_instrument":{"post":{"tags":["Public"],"summary":"Get Instrument","description":"Get single instrument by asset name","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicGetInstrumentResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicGetInstrumentParamsSchema"}}}}}},"/public/get_all_instruments":{"post":{"tags":["Public"],"summary":"Get All Instruments","description":"Get a paginated history of all instruments","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicGetAllInstrumentsResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicGetAllInstrumentsParamsSchema"}}}}}},"/public/get_instruments":{"post":{"tags":["Public"],"summary":"Get Instruments","description":"Get all active instruments for a given `currency` and `type`.","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicGetInstrumentsResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicGetInstrumentsParamsSchema"}}}}}},"/public/get_ticker":{"post":{"tags":["Public"],"summary":"Get Ticker","description":"Get ticker information (best bid / ask, instrument contraints, fees info, etc.) for a single instrument","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicGetTickerResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicGetTickerParamsSchema"}}}}}},"/public/get_latest_signed_feeds":{"post":{"tags":["Public"],"summary":"Get Latest Signed Feeds","description":"Get latest signed data feeds","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicGetLatestSignedFeedsResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicGetLatestSignedFeedsParamsSchema"}}}}}},"/public/get_option_settlement_prices":{"post":{"tags":["Public"],"summary":"Get Option Settlement Prices","description":"Get settlement prices by expiry for each currency","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicGetOptionSettlementPricesResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicGetOptionSettlementPricesParamsSchema"}}}}}},"/public/get_spot_feed_history":{"post":{"tags":["Public"],"summary":"Get Spot Feed History","description":"Get spot feed history by currency

DB: read replica","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicGetSpotFeedHistoryResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicGetSpotFeedHistoryParamsSchema"}}}}}},"/public/get_spot_feed_history_candles":{"post":{"tags":["Public"],"summary":"Get Spot Feed History Candles","description":"Get spot feed history candles by currency

DB: read replica","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicGetSpotFeedHistoryCandlesResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicGetSpotFeedHistoryCandlesParamsSchema"}}}}}},"/public/get_funding_rate_history":{"post":{"tags":["Public"],"summary":"Get Funding Rate History","description":"Get funding rate history. Start timestamp is restricted to at most 30 days ago.
End timestamp greater than current time will be truncated to current time.
Zero start timestamp is allowed and will default to 30 days from the end timestamp.

DB: read replica","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicGetFundingRateHistoryResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicGetFundingRateHistoryParamsSchema"}}}}}},"/public/get_trade_history":{"post":{"tags":["Public"],"summary":"Get Trade History","description":"Get trade history for a subaccount, with filter parameters.","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicGetTradeHistoryResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicGetTradeHistoryParamsSchema"}}}}}},"/public/get_option_settlement_history":{"post":{"tags":["Public"],"summary":"Get Option Settlement History","description":"Get expired option settlement history for a subaccount","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicGetOptionSettlementHistoryResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicGetOptionSettlementHistoryParamsSchema"}}}}}},"/public/get_liquidation_history":{"post":{"tags":["Public"],"summary":"Get Liquidation History","description":"Returns a paginated liquidation history for all subaccounts. Note that the pagination is based on the number of
raw events that include bids, auction start, and auction end events. This means that the count returned in the
pagination info will be larger than the total number of auction events. This also means the number of returned
auctions per page will be smaller than the supplied `page_size`.","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicGetLiquidationHistoryResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicGetLiquidationHistoryParamsSchema"}}}}}},"/public/get_interest_rate_history":{"post":{"tags":["Public"],"summary":"Get Interest Rate History","description":"Get latest USDC interest rate history","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicGetInterestRateHistoryResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicGetInterestRateHistoryParamsSchema"}}}}}},"/public/get_transaction":{"post":{"tags":["Public"],"summary":"Get Transaction","description":"Used for getting a transaction by its transaction id","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicGetTransactionResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicGetTransactionParamsSchema"}}}}}},"/public/get_margin":{"post":{"tags":["Public"],"summary":"Get Margin","description":"Calculates margin for a given portfolio and (optionally) a simulated state change.
Does not take into account open orders margin requirements.public/withdraw_debug","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicGetMarginResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicGetMarginParamsSchema"}}}}}},"/public/margin_watch":{"post":{"tags":["Public"],"summary":"Margin Watch","description":"Calculates MtM and maintenance margin for a given subaccount.","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicMarginWatchResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicMarginWatchParamsSchema"}}}}}},"/public/get_vault_share":{"post":{"tags":["Public"],"summary":"Get Vault Share","description":"Gets the value of a vault's token against the base currency, underlying currency, and USD for a timestamp range.

The name of the vault from the Vault proxy contract is used to fetch the vault's value.","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicGetVaultShareResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicGetVaultShareParamsSchema"}}}}}},"/public/get_vault_statistics":{"post":{"tags":["Public"],"summary":"Get Vault Statistics","description":"Gets all the latest vault shareRate, totalSupply and TVL values for all vaults.

For data on shares across chains, use public/get_vault_assets.","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicGetVaultStatisticsResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicGetVaultStatisticsParamsSchema"}}}}}},"/public/get_vault_balances":{"post":{"tags":["Public"],"summary":"Get Vault Balances","description":"Get all vault assets held by user. Can query by smart contract address or smart contract owner.

Includes VaultERC20Pool balances","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicGetVaultBalancesResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicGetVaultBalancesParamsSchema"}}}}}},"/private/get_account":{"post":{"tags":["Private"],"summary":"Get Account","description":"Account details getter\nRequired minimum session key permission level is `read_only`","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateGetAccountResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateGetAccountParamsSchema"}}}}}},"/private/create_subaccount":{"post":{"tags":["Private"],"summary":"Create Subaccount","description":"Create a new subaccount under a given wallet, and deposit an asset into that subaccount.

See `public/create_subaccount_debug` for debugging invalid signature issues or go to guides in Documentation.\nRequired minimum session key permission level is `admin`","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateCreateSubaccountResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateCreateSubaccountParamsSchema"}}}}}},"/public/create_subaccount_debug":{"post":{"tags":["Public"],"summary":"Create Subaccount Debug","description":"Used for debugging only, do not use in production. Will return the incremental encoded and hashed data.

See guides in Documentation for more.","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicCreateSubaccountDebugResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicCreateSubaccountDebugParamsSchema"}}}}}},"/private/get_subaccount":{"post":{"tags":["Private"],"summary":"Get Subaccount","description":"Get open orders, active positions, and collaterals of a subaccount\nRequired minimum session key permission level is `read_only`","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateGetSubaccountResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateGetSubaccountParamsSchema"}}}}}},"/private/get_subaccounts":{"post":{"tags":["Private"],"summary":"Get Subaccounts","description":"Get all subaccounts of an account / wallet\nRequired minimum session key permission level is `read_only`","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateGetSubaccountsResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateGetSubaccountsParamsSchema"}}}}}},"/private/get_all_portfolios":{"post":{"tags":["Private"],"summary":"Get All Portfolios","description":"Get all portfolios of a wallet\nRequired minimum session key permission level is `read_only`","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateGetAllPortfoliosResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateGetAllPortfoliosParamsSchema"}}}}}},"/private/change_subaccount_label":{"post":{"tags":["Private"],"summary":"Change Subaccount Label","description":"Change a user defined label for given subaccount\nRequired minimum session key permission level is `account`","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateChangeSubaccountLabelResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateChangeSubaccountLabelParamsSchema"}}}}}},"/private/get_notifications":{"post":{"tags":["Private"],"summary":"Get Notifications","description":"Get the notifications related to a subaccount.\nRequired minimum session key permission level is `read_only`","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateGetNotificationsResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateGetNotificationsParamsSchema"}}}}}},"/private/update_notifications":{"post":{"tags":["Private"],"summary":"Update Notifications","description":"RPC to mark specified notifications as seen for a given subaccount.\nRequired minimum session key permission level is `account`","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateUpdateNotificationsResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateUpdateNotificationsParamsSchema"}}}}}},"/private/deposit":{"post":{"tags":["Private"],"summary":"Deposit","description":"Deposit an asset to a subaccount.

See `public/deposit_debug' for debugging invalid signature issues or go to guides in Documentation.\nRequired minimum session key permission level is `admin`","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateDepositResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateDepositParamsSchema"}}}}}},"/public/deposit_debug":{"post":{"tags":["Public"],"summary":"Deposit Debug","description":"Used for debugging only, do not use in production. Will return the incremental encoded and hashed data.

See guides in Documentation for more.","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicDepositDebugResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicDepositDebugParamsSchema"}}}}}},"/private/withdraw":{"post":{"tags":["Private"],"summary":"Withdraw","description":"Withdraw an asset to wallet.

See `public/withdraw_debug` for debugging invalid signature issues or go to guides in Documentation.\nRequired minimum session key permission level is `admin`","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateWithdrawResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateWithdrawParamsSchema"}}}}}},"/public/withdraw_debug":{"post":{"tags":["Public"],"summary":"Withdraw Debug","description":"Used for debugging only, do not use in production. Will return the incremental encoded and hashed data.

See guides in Documentation for more.","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicWithdrawDebugResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicWithdrawDebugParamsSchema"}}}}}},"/private/transfer_erc20":{"post":{"tags":["Private"],"summary":"Transfer Erc20","description":"Transfer ERC20 assets from one subaccount to another (e.g. USDC or ETH).

For transfering positions (e.g. options or perps), use `private/transfer_position` instead.\nRequired minimum session key permission level is `admin`","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateTransferErc20ResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateTransferErc20ParamsSchema"}}}}}},"/private/transfer_position":{"post":{"tags":["Private"],"summary":"Transfer Position","description":"Transfers a positions from one subaccount to another, owned by the same wallet.

The transfer is executed as a pair of orders crossing each other.
The maker order is created first, followed by a taker order crossing it.
The order amounts, limit prices and instrument name must be the same for both orders.
Fee is not charged and a zero `max_fee` must be signed.
The maker order is forcibly considered to be `reduce_only`, meaning it can only reduce the position size.

History: For position transfer history, use the `private/get_trade_history` RPC (not `private/get_erc20_transfer_history`).\nRequired minimum session key permission level is `admin`","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateTransferPositionResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateTransferPositionParamsSchema"}}}}}},"/private/transfer_positions":{"post":{"tags":["Private"],"summary":"Transfer Positions","description":"Transfers multiple positions from one subaccount to another, owned by the same wallet.

The transfer is executed as a an RFQ. A mock RFQ is first created from the taker parameters, followed by a maker quote and a taker execute.
The leg amounts, prices and instrument name must be the same in both param payloads.
Fee is not charged and a zero `max_fee` must be signed.
Every leg in the transfer must be a position reduction for either maker or taker (or both).

History: for position transfer history, use the `private/get_trade_history` RPC (not `private/get_erc20_transfer_history`).\nRequired minimum session key permission level is `admin`","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateTransferPositionsResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateTransferPositionsParamsSchema"}}}}}},"/private/order":{"post":{"tags":["Private"],"summary":"Order","description":"Create a new order.\nRequired minimum session key permission level is `admin`","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateOrderResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateOrderParamsSchema"}}}}}},"/private/replace":{"post":{"tags":["Private"],"summary":"Replace","description":"Cancel an existing order with nonce or order_id and create new order with different order_id in a single RPC call.

If the cancel fails, the new order will not be created.
If the cancel succeeds but the new order fails, the old order will still be cancelled.\nRequired minimum session key permission level is `admin`","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateReplaceResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateReplaceParamsSchema"}}}}}},"/private/order_debug":{"post":{"tags":["Private"],"summary":"Order Debug","description":"Debug a new order\nRequired minimum session key permission level is `read_only`","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateOrderDebugResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateOrderDebugParamsSchema"}}}}}},"/private/get_order":{"post":{"tags":["Private"],"summary":"Get Order","description":"Get state of an order by order id\nRequired minimum session key permission level is `read_only`","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateGetOrderResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateGetOrderParamsSchema"}}}}}},"/private/get_orders":{"post":{"tags":["Private"],"summary":"Get Orders","description":"Get orders for a subaccount, with optional filtering.\nRequired minimum session key permission level is `read_only`","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateGetOrdersResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateGetOrdersParamsSchema"}}}}}},"/private/get_open_orders":{"post":{"tags":["Private"],"summary":"Get Open Orders","description":"Get all open orders of a subacccount\nRequired minimum session key permission level is `read_only`","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateGetOpenOrdersResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateGetOpenOrdersParamsSchema"}}}}}},"/private/cancel":{"post":{"tags":["Private"],"summary":"Cancel","description":"Cancel a single order.

Other `private/cancel_*` routes are available through both REST and WebSocket.\nRequired minimum session key permission level is `admin`","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateCancelResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateCancelParamsSchema"}}}}}},"/private/cancel_by_label":{"post":{"tags":["Private"],"summary":"Cancel By Label","description":"Cancel all open orders for a given subaccount and a given label. If instrument_name is provided, only orders for that instrument will be cancelled.\nRequired minimum session key permission level is `admin`","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateCancelByLabelResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateCancelByLabelParamsSchema"}}}}}},"/private/cancel_by_nonce":{"post":{"tags":["Private"],"summary":"Cancel By Nonce","description":"Cancel a single order by nonce. Uses up that nonce if the order does not exist, so any future orders with that nonce will fail\nRequired minimum session key permission level is `admin`","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateCancelByNonceResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateCancelByNonceParamsSchema"}}}}}},"/private/cancel_by_instrument":{"post":{"tags":["Private"],"summary":"Cancel By Instrument","description":"Cancel all orders for this instrument.\nRequired minimum session key permission level is `admin`","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateCancelByInstrumentResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateCancelByInstrumentParamsSchema"}}}}}},"/private/cancel_all":{"post":{"tags":["Private"],"summary":"Cancel All","description":"Cancel all orders for this instrument.\nRequired minimum session key permission level is `admin`","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateCancelAllResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateCancelAllParamsSchema"}}}}}},"/private/cancel_trigger_order":{"post":{"tags":["Private"],"summary":"Cancel Trigger Order","description":"Cancels a trigger order.\nRequired minimum session key permission level is `admin`","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateCancelTriggerOrderResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateCancelTriggerOrderParamsSchema"}}}}}},"/private/get_order_history":{"post":{"tags":["Private"],"summary":"Get Order History","description":"Get order history for a subaccount\nRequired minimum session key permission level is `read_only`","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateGetOrderHistoryResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateGetOrderHistoryParamsSchema"}}}}}},"/private/get_trade_history":{"post":{"tags":["Private"],"summary":"Get Trade History","description":"Get trade history for a subaccount, with filter parameters.\nRequired minimum session key permission level is `read_only`","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateGetTradeHistoryResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateGetTradeHistoryParamsSchema"}}}}}},"/private/get_deposit_history":{"post":{"tags":["Private"],"summary":"Get Deposit History","description":"Get subaccount deposit history.\nRequired minimum session key permission level is `read_only`","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateGetDepositHistoryResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateGetDepositHistoryParamsSchema"}}}}}},"/private/get_withdrawal_history":{"post":{"tags":["Private"],"summary":"Get Withdrawal History","description":"Get subaccount withdrawal history.\nRequired minimum session key permission level is `read_only`","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateGetWithdrawalHistoryResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateGetWithdrawalHistoryParamsSchema"}}}}}},"/private/send_rfq":{"post":{"tags":["Private"],"summary":"Send Rfq","description":"Requests two-sided quotes from participating market makers.\nRequired minimum session key permission level is `account`","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateSendRfqResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateSendRfqParamsSchema"}}}}}},"/private/cancel_rfq":{"post":{"tags":["Private"],"summary":"Cancel Rfq","description":"Cancels a single RFQ by id.\nRequired minimum session key permission level is `account`","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateCancelRfqResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateCancelRfqParamsSchema"}}}}}},"/private/cancel_batch_rfqs":{"post":{"tags":["Private"],"summary":"Cancel Batch Rfqs","description":"Cancels RFQs given optional filters.
If no filters are provided, all RFQs for the subaccount are cancelled.
All filters are combined using `AND` logic, so mutually exclusive filters will result in no RFQs being cancelled.\nRequired minimum session key permission level is `account`","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateCancelBatchRfqsResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateCancelBatchRfqsParamsSchema"}}}}}},"/private/get_rfqs":{"post":{"tags":["Private"],"summary":"Get Rfqs","description":"Retrieves a list of RFQs matching filter criteria. Takers can use this to get their open RFQs, RFQ history, etc.\nRequired minimum session key permission level is `read_only`","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateGetRfqsResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateGetRfqsParamsSchema"}}}}}},"/private/poll_rfqs":{"post":{"tags":["Private"],"summary":"Poll Rfqs","description":"Retrieves a list of RFQs matching filter criteria. Market makers can use this to poll RFQs directed to them.\nRequired minimum session key permission level is `read_only`","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivatePollRfqsResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivatePollRfqsParamsSchema"}}}}}},"/private/send_quote":{"post":{"tags":["Private"],"summary":"Send Quote","description":"Sends a quote in response to an RFQ request.
The legs supplied in the parameters must exactly match those in the RFQ.\nRequired minimum session key permission level is `admin`","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateSendQuoteResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateSendQuoteParamsSchema"}}}}}},"/private/cancel_quote":{"post":{"tags":["Private"],"summary":"Cancel Quote","description":"Cancels an open quote.\nRequired minimum session key permission level is `admin`","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateCancelQuoteResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateCancelQuoteParamsSchema"}}}}}},"/private/cancel_batch_quotes":{"post":{"tags":["Private"],"summary":"Cancel Batch Quotes","description":"Cancels quotes given optional filters. If no filters are provided, all quotes by the subaccount are cancelled.
All filters are combined using `AND` logic, so mutually exclusive filters will result in no quotes being cancelled.\nRequired minimum session key permission level is `admin`","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateCancelBatchQuotesResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateCancelBatchQuotesParamsSchema"}}}}}},"/private/get_quotes":{"post":{"tags":["Private"],"summary":"Get Quotes","description":"Retrieves a list of quotes matching filter criteria.
Market makers can use this to get their open quotes, quote history, etc.\nRequired minimum session key permission level is `read_only`","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateGetQuotesResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateGetQuotesParamsSchema"}}}}}},"/private/poll_quotes":{"post":{"tags":["Private"],"summary":"Poll Quotes","description":"Retrieves a list of quotes matching filter criteria.
Takers can use this to poll open quotes that they can fill against their open RFQs.\nRequired minimum session key permission level is `read_only`","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivatePollQuotesResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivatePollQuotesParamsSchema"}}}}}},"/private/execute_quote":{"post":{"tags":["Private"],"summary":"Execute Quote","description":"Executes a quote.\nRequired minimum session key permission level is `admin`","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateExecuteQuoteResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateExecuteQuoteParamsSchema"}}}}}},"/private/rfq_get_best_quote":{"post":{"tags":["Private"],"summary":"Rfq Get Best Quote","description":"Performs a \"dry run\" on an RFQ, returning the estimated fee and whether the trade is expected to pass.

Should any exception be raised in the process of evaluating the trade, a standard RPC error will be returned
with the error details.\nRequired minimum session key permission level is `read_only`","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateRfqGetBestQuoteResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateRfqGetBestQuoteParamsSchema"}}}}}},"/public/send_quote_debug":{"post":{"tags":["Public"],"summary":"Send Quote Debug","description":"Sends a quote in response to an RFQ request.
The legs supplied in the parameters must exactly match those in the RFQ.","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicSendQuoteDebugResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicSendQuoteDebugParamsSchema"}}}}}},"/public/execute_quote_debug":{"post":{"tags":["Public"],"summary":"Execute Quote Debug","description":"Sends a quote in response to an RFQ request.
The legs supplied in the parameters must exactly match those in the RFQ.","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicExecuteQuoteDebugResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicExecuteQuoteDebugParamsSchema"}}}}}},"/private/get_margin":{"post":{"tags":["Private"],"summary":"Get Margin","description":"Calculates margin for a given subaccount and (optionally) a simulated state change. Does not take into account
open orders margin requirements.\nRequired minimum session key permission level is `read_only`","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateGetMarginResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateGetMarginParamsSchema"}}}}}},"/private/get_collaterals":{"post":{"tags":["Private"],"summary":"Get Collaterals","description":"Get collaterals of a subaccount\nRequired minimum session key permission level is `read_only`","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateGetCollateralsResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateGetCollateralsParamsSchema"}}}}}},"/private/get_positions":{"post":{"tags":["Private"],"summary":"Get Positions","description":"Get active positions of a subaccount\nRequired minimum session key permission level is `read_only`","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateGetPositionsResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateGetPositionsParamsSchema"}}}}}},"/private/get_option_settlement_history":{"post":{"tags":["Private"],"summary":"Get Option Settlement History","description":"Get expired option settlement history for a subaccount\nRequired minimum session key permission level is `read_only`","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateGetOptionSettlementHistoryResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateGetOptionSettlementHistoryParamsSchema"}}}}}},"/private/get_subaccount_value_history":{"post":{"tags":["Private"],"summary":"Get Subaccount Value History","description":"Get the value history of a subaccount\nRequired minimum session key permission level is `read_only`","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateGetSubaccountValueHistoryResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateGetSubaccountValueHistoryParamsSchema"}}}}}},"/private/expired_and_cancelled_history":{"post":{"tags":["Private"],"summary":"Expired And Cancelled History","description":"Generate a list of URLs to retrieve archived orders\nRequired minimum session key permission level is `read_only`","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateExpiredAndCancelledHistoryResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateExpiredAndCancelledHistoryParamsSchema"}}}}}},"/private/get_funding_history":{"post":{"tags":["Private"],"summary":"Get Funding History","description":"Get subaccount funding history.

DB: read replica\nRequired minimum session key permission level is `read_only`","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateGetFundingHistoryResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateGetFundingHistoryParamsSchema"}}}}}},"/private/get_interest_history":{"post":{"tags":["Private"],"summary":"Get Interest History","description":"Get subaccount interest payment history.\nRequired minimum session key permission level is `read_only`","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateGetInterestHistoryResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateGetInterestHistoryParamsSchema"}}}}}},"/private/get_erc20_transfer_history":{"post":{"tags":["Private"],"summary":"Get Erc20 Transfer History","description":"Get subaccount erc20 transfer history.

Position transfers (e.g. options or perps) are treated as trades. Use `private/get_trade_history` for position transfer history.\nRequired minimum session key permission level is `read_only`","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateGetErc20TransferHistoryResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateGetErc20TransferHistoryParamsSchema"}}}}}},"/private/get_liquidation_history":{"post":{"tags":["Private"],"summary":"Get Liquidation History","description":"\nRequired minimum session key permission level is `read_only`","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateGetLiquidationHistoryResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateGetLiquidationHistoryParamsSchema"}}}}}},"/private/liquidate":{"post":{"tags":["Private"],"summary":"Liquidate","description":"Liquidates a given subaccount using funds from another subaccount. This endpoint has a few limitations:
1. If succesful, the RPC will freeze the caller's subaccount until the bid is settled or is reverted on chain.
2. The caller's subaccount must not have any open orders.
3. The caller's subaccount must have enough withdrawable cash to cover the bid and the buffer margin requirements.\nRequired minimum session key permission level is `admin`","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateLiquidateResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateLiquidateParamsSchema"}}}}}},"/private/get_liquidator_history":{"post":{"tags":["Private"],"summary":"Get Liquidator History","description":"Returns a paginated history of auctions that the subaccount has participated in as a liquidator.\nRequired minimum session key permission level is `read_only`","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateGetLiquidatorHistoryResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateGetLiquidatorHistoryParamsSchema"}}}}}},"/private/session_keys":{"post":{"tags":["Private"],"summary":"Session Keys","description":"\nRequired minimum session key permission level is `read_only`","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateSessionKeysResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateSessionKeysParamsSchema"}}}}}},"/private/edit_session_key":{"post":{"tags":["Private"],"summary":"Edit Session Key","description":"Edits session key parameters such as label and IP whitelist.
For non-admin keys you can also toggle whether to disable a particular key.
Disabling non-admin keys must be done through /deregister_session_key\nRequired minimum session key permission level is `account`","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateEditSessionKeyResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateEditSessionKeyParamsSchema"}}}}}},"/private/register_scoped_session_key":{"post":{"tags":["Private"],"summary":"Register Scoped Session Key","description":"Registers a new session key bounded to a scope without a transaction attached.
If you want to register an admin key, you must provide a signed raw transaction.\nRequired minimum session key permission level is `account`","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateRegisterScopedSessionKeyResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateRegisterScopedSessionKeyParamsSchema"}}}}}},"/private/get_mmp_config":{"post":{"tags":["Private"],"summary":"Get Mmp Config","description":"Get the current mmp config for a subaccount (optionally filtered by currency)\nRequired minimum session key permission level is `read_only`","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateGetMmpConfigResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateGetMmpConfigParamsSchema"}}}}}},"/private/set_mmp_config":{"post":{"tags":["Private"],"summary":"Set Mmp Config","description":"Set the mmp config for the subaccount and currency\nRequired minimum session key permission level is `account`","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateSetMmpConfigResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateSetMmpConfigParamsSchema"}}}}}},"/private/reset_mmp":{"post":{"tags":["Private"],"summary":"Reset Mmp","description":"Resets (unfreezes) the mmp state for a subaccount (optionally filtered by currency)\nRequired minimum session key permission level is `account`","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateResetMmpResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateResetMmpParamsSchema"}}}}}},"/private/set_cancel_on_disconnect":{"post":{"tags":["Private"],"summary":"Set Cancel On Disconnect","description":"Enables cancel on disconnect for the account\nRequired minimum session key permission level is `account`","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateSetCancelOnDisconnectResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivateSetCancelOnDisconnectParamsSchema"}}}}}},"/public/get_time":{"post":{"tags":["Public"],"summary":"Get Time","description":"","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicGetTimeResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicGetTimeParamsSchema"}}}}}},"/public/get_live_incidents":{"post":{"tags":["Public"],"summary":"Get Live Incidents","description":"","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicGetLiveIncidentsResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicGetLiveIncidentsParamsSchema"}}}}}},"/public/get_maker_programs":{"post":{"tags":["Public"],"summary":"Get Maker Programs","description":"Get all maker programs, including past / historical ones.","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicGetMakerProgramsResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicGetMakerProgramsParamsSchema"}}}}}},"/public/get_maker_program_scores":{"post":{"tags":["Public"],"summary":"Get Maker Program Scores","description":"Get scores breakdown by maker program.","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicGetMakerProgramScoresResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicGetMakerProgramScoresParamsSchema"}}}}}},"/public/get_referral_performance":{"post":{"tags":["Public"],"summary":"Get Referral Performance","description":"Get the broker program referral performance. Epochs are 28 days long.","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicGetReferralPerformanceResponseSchema"}}}}},"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicGetReferralPerformanceParamsSchema"}}}}}}},"components":{"schemas":{"PublicGetVaultStatisticsParamsSchema":{"type":"object","properties":{},"additionalProperties":false},"PublicGetVaultStatisticsResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"title":"result","type":"array","description":"","items":{"$ref":"#/components/schemas/VaultStatisticsResponseSchema"}}},"additionalProperties":false},"VaultStatisticsResponseSchema":{"required":["base_value","block_number","block_timestamp","subaccount_value_at_last_trade","total_supply","underlying_value","usd_tvl","usd_value","vault_name"],"type":"object","properties":{"base_value":{"title":"base_value","type":"string","format":"decimal","description":"The value of the vault's token against the base currency. Ex: rswETHC vs rswETH"},"block_number":{"title":"block_number","type":"integer","description":"The Derive chain block number"},"block_timestamp":{"title":"block_timestamp","type":"integer","description":"Timestamp of the Derive chain block number"},"subaccount_value_at_last_trade":{"title":"subaccount_value_at_last_trade","type":"string","format":"decimal","default":null,"description":"Will return None before vault creates subaccount or if no trades found.","nullable":true},"total_supply":{"title":"total_supply","type":"string","format":"decimal","description":"Total supply of the vault's token on Derive chain"},"underlying_value":{"title":"underlying_value","type":"string","format":"decimal","default":null,"description":"The value of the vault's token against the underlying currency. Ex: rswETHC vs ETH","nullable":true},"usd_tvl":{"title":"usd_tvl","type":"string","format":"decimal","description":"Total USD TVL of the vault"},"usd_value":{"title":"usd_value","type":"string","format":"decimal","description":"The value of the vault's token against USD"},"vault_name":{"title":"vault_name","type":"string","description":"Name of the vault"}},"additionalProperties":false},"PrivateTransferPositionsParamsSchema":{"required":["maker_params","taker_params","wallet"],"type":"object","properties":{"maker_params":{"$ref":"#/components/schemas/SignedQuoteParamsSchema"},"taker_params":{"$ref":"#/components/schemas/SignedQuoteParamsSchema"},"wallet":{"title":"wallet","type":"string","description":"Public key (wallet) of the account"}},"additionalProperties":false},"SignedQuoteParamsSchema":{"required":["direction","legs","max_fee","nonce","signature","signature_expiry_sec","signer","subaccount_id"],"type":"object","properties":{"direction":{"title":"direction","type":"string","enum":["buy","sell"],"description":"Quote direction, `buy` means trading each leg at its direction, `sell` means trading each leg in the opposite direction."},"legs":{"title":"legs","type":"array","description":"Quote legs","items":{"$ref":"#/components/schemas/LegPricedSchema"}},"max_fee":{"title":"max_fee","type":"string","format":"decimal","description":"Max fee ($ for the full trade). Request will be rejected if the supplied max fee is below the estimated fee for this trade."},"nonce":{"title":"nonce","type":"integer","description":"Unique nonce defined as a concatenated `UTC timestamp in ms` and `random number up to 6 digits` (e.g. 1695836058725001, where 001 is the random number)"},"signature":{"title":"signature","type":"string","description":"Ethereum signature of the quote"},"signature_expiry_sec":{"title":"signature_expiry_sec","type":"integer","description":"Unix timestamp in seconds. Expiry MUST be at least 310 seconds from now. Once time till signature expiry reaches 300 seconds, the quote will be considered expired. This buffer is meant to ensure the trade can settle on chain in case of a blockchain congestion."},"signer":{"title":"signer","type":"string","description":"Owner wallet address or registered session key that signed the quote"},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount ID"}},"additionalProperties":false},"LegPricedSchema":{"required":["amount","direction","instrument_name","price"],"type":"object","properties":{"amount":{"title":"amount","type":"string","format":"decimal","description":"Amount in units of the base"},"direction":{"title":"direction","type":"string","enum":["buy","sell"],"description":"Leg direction"},"instrument_name":{"title":"instrument_name","type":"string","description":"Instrument name"},"price":{"title":"price","type":"string","format":"decimal","description":"Leg price"}},"additionalProperties":false},"PrivateTransferPositionsResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PrivateTransferPositionsResultSchema"}},"additionalProperties":false},"PrivateTransferPositionsResultSchema":{"required":["maker_quote","taker_quote"],"type":"object","properties":{"maker_quote":{"$ref":"#/components/schemas/QuoteResultSchema"},"taker_quote":{"$ref":"#/components/schemas/QuoteResultSchema"}},"additionalProperties":false},"QuoteResultSchema":{"required":["cancel_reason","creation_timestamp","direction","fee","fill_pct","is_transfer","label","last_update_timestamp","legs","legs_hash","liquidity_role","max_fee","mmp","nonce","quote_id","rfq_id","signature","signature_expiry_sec","signer","status","subaccount_id","tx_hash","tx_status"],"type":"object","properties":{"cancel_reason":{"title":"cancel_reason","type":"string","enum":["","user_request","insufficient_margin","signed_max_fee_too_low","mmp_trigger","cancel_on_disconnect","session_key_deregistered","subaccount_withdrawn","rfq_no_longer_open","compliance"],"description":"Cancel reason, if any"},"creation_timestamp":{"title":"creation_timestamp","type":"integer","description":"Creation timestamp in ms since Unix epoch"},"direction":{"title":"direction","type":"string","enum":["buy","sell"],"description":"Quote direction"},"fee":{"title":"fee","type":"string","format":"decimal","description":"Fee paid for this quote (if executed)"},"fill_pct":{"title":"fill_pct","type":"string","format":"decimal","description":"Percentage of the RFQ that this quote would fill, from 0 to 1."},"is_transfer":{"title":"is_transfer","type":"boolean","description":"Whether the order was generated through `private/transfer_position`"},"label":{"title":"label","type":"string","description":"User-defined label, if any"},"last_update_timestamp":{"title":"last_update_timestamp","type":"integer","description":"Last update timestamp in ms since Unix epoch"},"legs":{"title":"legs","type":"array","description":"Quote legs","items":{"$ref":"#/components/schemas/LegPricedSchema"}},"legs_hash":{"title":"legs_hash","type":"string","description":"Hash of the legs of the best quote to be signed by the taker."},"liquidity_role":{"title":"liquidity_role","type":"string","enum":["maker","taker"],"description":"Liquidity role"},"max_fee":{"title":"max_fee","type":"string","format":"decimal","description":"Signed max fee"},"mmp":{"title":"mmp","type":"boolean","description":"Whether the quote is tagged for market maker protections (default false)"},"nonce":{"title":"nonce","type":"integer","description":"Nonce"},"quote_id":{"title":"quote_id","type":"string","format":"uuid","description":"Quote ID"},"rfq_id":{"title":"rfq_id","type":"string","format":"uuid","description":"RFQ ID"},"signature":{"title":"signature","type":"string","description":"Ethereum signature of the quote"},"signature_expiry_sec":{"title":"signature_expiry_sec","type":"integer","description":"Unix timestamp in seconds"},"signer":{"title":"signer","type":"string","description":"Owner wallet address or registered session key that signed the quote"},"status":{"title":"status","type":"string","enum":["open","filled","cancelled","expired"],"description":"Status"},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount ID"},"tx_hash":{"title":"tx_hash","type":"string","default":null,"description":"Blockchain transaction hash (only for executed quotes)","nullable":true},"tx_status":{"title":"tx_status","type":"string","default":null,"enum":["requested","pending","settled","reverted","ignored","timed_out"],"description":"Blockchain transaction status (only for executed quotes)","nullable":true}},"additionalProperties":false},"PrivateResetMmpParamsSchema":{"required":["subaccount_id"],"type":"object","properties":{"currency":{"title":"currency","type":"string","default":null,"description":"Currency to reset the mmp for. If not provided, resets all configs for the subaccount","nullable":true},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount_id for which to reset the mmp state"}},"additionalProperties":false},"PrivateResetMmpResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"title":"result","type":"string","enum":["ok"],"description":"The result of this method call, `ok` if successful"}},"additionalProperties":false},"PublicGetOptionSettlementPricesParamsSchema":{"required":["currency"],"type":"object","properties":{"currency":{"title":"currency","type":"string","description":"Currency for which to show expiries"}},"additionalProperties":false},"PublicGetOptionSettlementPricesResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PublicGetOptionSettlementPricesResultSchema"}},"additionalProperties":false},"PublicGetOptionSettlementPricesResultSchema":{"required":["expiries"],"type":"object","properties":{"expiries":{"title":"expiries","type":"array","description":"List of expiry details","items":{"$ref":"#/components/schemas/ExpiryResponseSchema"}}},"additionalProperties":false},"ExpiryResponseSchema":{"required":["expiry_date","price","utc_expiry_sec"],"type":"object","properties":{"expiry_date":{"title":"expiry_date","type":"string","description":"Expiry date in `YYYYMMDD` format"},"price":{"title":"price","type":"string","format":"decimal","default":null,"description":"Settlement price will show None if not yet settled onchain","nullable":true},"utc_expiry_sec":{"title":"utc_expiry_sec","type":"integer","description":"UTC timestamp of expiry"}},"additionalProperties":false},"PrivateTransferPositionParamsSchema":{"required":["maker_params","taker_params","wallet"],"type":"object","properties":{"maker_params":{"$ref":"#/components/schemas/TradeModuleParamsSchema"},"taker_params":{"$ref":"#/components/schemas/TradeModuleParamsSchema"},"wallet":{"title":"wallet","type":"string","description":"Public key (wallet) of the account"}},"additionalProperties":false},"TradeModuleParamsSchema":{"required":["amount","direction","instrument_name","limit_price","max_fee","nonce","signature","signature_expiry_sec","signer","subaccount_id"],"type":"object","properties":{"amount":{"title":"amount","type":"string","format":"decimal","description":"Order amount in units of the base"},"direction":{"title":"direction","type":"string","enum":["buy","sell"],"description":"Order direction"},"instrument_name":{"title":"instrument_name","type":"string","description":"Instrument name"},"limit_price":{"title":"limit_price","type":"string","format":"decimal","description":"Limit price in quote currency.
This field is still required for market orders because it is a component of the signature. However, market orders will not leave a resting order in the book in case of a partial fill."},"max_fee":{"title":"max_fee","type":"string","format":"decimal","description":"Max fee per unit of volume, denominated in units of the quote currency (usually USDC).Order will be rejected if the supplied max fee is below the estimated fee for this order."},"nonce":{"title":"nonce","type":"integer","description":"Unique nonce defined as (e.g. 1695836058725001, where 001 is the random number).Note, using a random number beyond 3 digits will cause JSON serialization to fail."},"signature":{"title":"signature","type":"string","description":"Ethereum signature of the order"},"signature_expiry_sec":{"title":"signature_expiry_sec","type":"integer","description":"Unix timestamp in seconds. Order signature becomes invalid after this time, and the system will cancel the order.Expiry MUST be at least 5 min from now."},"signer":{"title":"signer","type":"string","description":"Owner wallet address or registered session key that signed order"},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount ID"}},"additionalProperties":false},"PrivateTransferPositionResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PrivateTransferPositionResultSchema"}},"additionalProperties":false},"PrivateTransferPositionResultSchema":{"required":["maker_order","maker_trade","taker_order","taker_trade"],"type":"object","properties":{"maker_order":{"$ref":"#/components/schemas/OrderResponseSchema"},"maker_trade":{"$ref":"#/components/schemas/TradeResponseSchema"},"taker_order":{"$ref":"#/components/schemas/OrderResponseSchema"},"taker_trade":{"$ref":"#/components/schemas/TradeResponseSchema"}},"additionalProperties":false},"OrderResponseSchema":{"required":["amount","average_price","cancel_reason","creation_timestamp","direction","filled_amount","instrument_name","is_transfer","label","last_update_timestamp","limit_price","max_fee","mmp","nonce","order_fee","order_id","order_status","order_type","quote_id","signature","signature_expiry_sec","signer","subaccount_id","time_in_force"],"type":"object","properties":{"amount":{"title":"amount","type":"string","format":"decimal","description":"Order amount in units of the base"},"average_price":{"title":"average_price","type":"string","format":"decimal","description":"Average fill price"},"cancel_reason":{"title":"cancel_reason","type":"string","enum":["","user_request","mmp_trigger","insufficient_margin","signed_max_fee_too_low","cancel_on_disconnect","ioc_or_market_partial_fill","session_key_deregistered","subaccount_withdrawn","compliance","trigger_failed","validation_failed"],"description":"If cancelled, reason behind order cancellation"},"creation_timestamp":{"title":"creation_timestamp","type":"integer","description":"Creation timestamp (in ms since Unix epoch)"},"direction":{"title":"direction","type":"string","enum":["buy","sell"],"description":"Order direction"},"filled_amount":{"title":"filled_amount","type":"string","format":"decimal","description":"Total filled amount for the order"},"instrument_name":{"title":"instrument_name","type":"string","description":"Instrument name"},"is_transfer":{"title":"is_transfer","type":"boolean","description":"Whether the order was generated through `private/transfer_position`"},"label":{"title":"label","type":"string","description":"Optional user-defined label for the order"},"last_update_timestamp":{"title":"last_update_timestamp","type":"integer","description":"Last update timestamp (in ms since Unix epoch)"},"limit_price":{"title":"limit_price","type":"string","format":"decimal","description":"Limit price in quote currency"},"max_fee":{"title":"max_fee","type":"string","format":"decimal","description":"Max fee in units of the quote currency"},"mmp":{"title":"mmp","type":"boolean","description":"Whether the order is tagged for market maker protections"},"nonce":{"title":"nonce","type":"integer","description":"Unique nonce defined as (e.g. 1695836058725001, where 001 is the random number)"},"order_fee":{"title":"order_fee","type":"string","format":"decimal","description":"Total order fee paid so far"},"order_id":{"title":"order_id","type":"string","description":"Order ID"},"order_status":{"title":"order_status","type":"string","enum":["open","filled","cancelled","expired","untriggered"],"description":"Order status"},"order_type":{"title":"order_type","type":"string","enum":["limit","market"],"description":"Order type"},"quote_id":{"title":"quote_id","type":"string","format":"uuid","default":null,"description":"Quote ID if the trade was executed via RFQ","nullable":true},"replaced_order_id":{"title":"replaced_order_id","type":"string","format":"uuid","default":null,"description":"If replaced, ID of the order that was replaced","nullable":true},"signature":{"title":"signature","type":"string","description":"Ethereum signature of the order"},"signature_expiry_sec":{"title":"signature_expiry_sec","type":"integer","description":"Signature expiry timestamp"},"signer":{"title":"signer","type":"string","description":"Owner wallet address or registered session key that signed order"},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount ID"},"time_in_force":{"title":"time_in_force","type":"string","enum":["gtc","post_only","fok","ioc"],"description":"Time in force"},"trigger_price":{"title":"trigger_price","type":"string","format":"decimal","default":null,"description":"(Required for trigger orders) Index or Market price to trigger order at","nullable":true},"trigger_price_type":{"title":"trigger_price_type","type":"string","default":null,"enum":["mark","index"],"description":"(Required for trigger orders) Trigger with Index or Mark Price","nullable":true},"trigger_reject_message":{"title":"trigger_reject_message","type":"string","default":null,"description":"(Required for trigger orders) Error message if error occured during trigger","nullable":true},"trigger_type":{"title":"trigger_type","type":"string","default":null,"enum":["stoploss","takeprofit"],"description":"(Required for trigger orders) Stop-loss or Take-profit.","nullable":true}},"additionalProperties":false},"TradeResponseSchema":{"required":["direction","expected_rebate","index_price","instrument_name","is_transfer","label","liquidity_role","mark_price","order_id","quote_id","realized_pnl","realized_pnl_excl_fees","subaccount_id","timestamp","trade_amount","trade_fee","trade_id","trade_price","transaction_id","tx_hash","tx_status"],"type":"object","properties":{"direction":{"title":"direction","type":"string","enum":["buy","sell"],"description":"Order direction"},"expected_rebate":{"title":"expected_rebate","type":"string","format":"decimal","description":"Expected rebate for this trade"},"index_price":{"title":"index_price","type":"string","format":"decimal","description":"Index price of the underlying at the time of the trade"},"instrument_name":{"title":"instrument_name","type":"string","description":"Instrument name"},"is_transfer":{"title":"is_transfer","type":"boolean","description":"Whether the trade was generated through `private/transfer_position`"},"label":{"title":"label","type":"string","description":"Optional user-defined label for the order"},"liquidity_role":{"title":"liquidity_role","type":"string","enum":["maker","taker"],"description":"Role of the user in the trade"},"mark_price":{"title":"mark_price","type":"string","format":"decimal","description":"Mark price of the instrument at the time of the trade"},"order_id":{"title":"order_id","type":"string","description":"Order ID"},"quote_id":{"title":"quote_id","type":"string","format":"uuid","default":null,"description":"Quote ID if the trade was executed via RFQ","nullable":true},"realized_pnl":{"title":"realized_pnl","type":"string","format":"decimal","description":"Realized PnL for this trade"},"realized_pnl_excl_fees":{"title":"realized_pnl_excl_fees","type":"string","format":"decimal","description":"Realized PnL for this trade using cost accounting that excludes fees"},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount ID"},"timestamp":{"title":"timestamp","type":"integer","description":"Trade timestamp (in ms since Unix epoch)"},"trade_amount":{"title":"trade_amount","type":"string","format":"decimal","description":"Amount filled in this trade"},"trade_fee":{"title":"trade_fee","type":"string","format":"decimal","description":"Fee for this trade"},"trade_id":{"title":"trade_id","type":"string","description":"Trade ID"},"trade_price":{"title":"trade_price","type":"string","format":"decimal","description":"Price at which the trade was filled"},"transaction_id":{"title":"transaction_id","type":"string","description":"The transaction id of the related settlement transaction"},"tx_hash":{"title":"tx_hash","type":"string","default":null,"description":"Blockchain transaction hash","nullable":true},"tx_status":{"title":"tx_status","type":"string","enum":["requested","pending","settled","reverted","ignored","timed_out"],"description":"Blockchain transaction status"}},"additionalProperties":false},"PublicDepositDebugParamsSchema":{"required":["amount","asset_name","nonce","signature_expiry_sec","signer","subaccount_id"],"type":"object","properties":{"amount":{"title":"amount","type":"string","format":"decimal","description":"Amount of the asset to deposit"},"asset_name":{"title":"asset_name","type":"string","description":"Name of asset to deposit"},"is_atomic_signing":{"title":"is_atomic_signing","type":"boolean","default":false,"description":"Used by vaults to determine whether the signature is an EIP-1271 signature"},"nonce":{"title":"nonce","type":"integer","description":"Unique nonce defined as (e.g. 1695836058725001, where 001 is the random number)"},"signature_expiry_sec":{"title":"signature_expiry_sec","type":"integer","description":"Unix timestamp in seconds. Expiry MUST be >5min from now"},"signer":{"title":"signer","type":"string","description":"Ethereum wallet address that is signing the deposit"},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount_id"}},"additionalProperties":false},"PublicDepositDebugResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PublicDepositDebugResultSchema"}},"additionalProperties":false},"PublicDepositDebugResultSchema":{"required":["action_hash","encoded_data","encoded_data_hashed","typed_data_hash"],"type":"object","properties":{"action_hash":{"title":"action_hash","type":"string","description":"Keccak hashed action data"},"encoded_data":{"title":"encoded_data","type":"string","description":"ABI encoded deposit data"},"encoded_data_hashed":{"title":"encoded_data_hashed","type":"string","description":"Keccak hashed encoded_data"},"typed_data_hash":{"title":"typed_data_hash","type":"string","description":"EIP 712 typed data hash"}},"additionalProperties":false},"PrivateGetOpenOrdersParamsSchema":{"required":["subaccount_id"],"type":"object","properties":{"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount_id for which to get open orders"}},"additionalProperties":false},"PrivateGetOpenOrdersResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PrivateGetOpenOrdersResultSchema"}},"additionalProperties":false},"PrivateGetOpenOrdersResultSchema":{"required":["orders","subaccount_id"],"type":"object","properties":{"orders":{"title":"orders","type":"array","description":"List of open orders","items":{"$ref":"#/components/schemas/OrderResponseSchema"}},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount_id for which to get open orders"}},"additionalProperties":false},"PrivateTransferErc20ParamsSchema":{"required":["recipient_details","recipient_subaccount_id","sender_details","subaccount_id","transfer"],"type":"object","properties":{"recipient_details":{"$ref":"#/components/schemas/SignatureDetailsSchema"},"recipient_subaccount_id":{"title":"recipient_subaccount_id","type":"integer","description":"Subaccount_id of the recipient"},"sender_details":{"$ref":"#/components/schemas/SignatureDetailsSchema"},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount_id"},"transfer":{"$ref":"#/components/schemas/TransferDetailsSchema"}},"additionalProperties":false},"SignatureDetailsSchema":{"required":["nonce","signature","signature_expiry_sec","signer"],"type":"object","properties":{"nonce":{"title":"nonce","type":"integer","description":"Unique nonce defined as (e.g. 1695836058725001, where 001 is the random number)"},"signature":{"title":"signature","type":"string","description":"Ethereum signature of the transfer"},"signature_expiry_sec":{"title":"signature_expiry_sec","type":"integer","description":"Unix timestamp in seconds. Expiry MUST be >5min from now"},"signer":{"title":"signer","type":"string","description":"Ethereum wallet address that is signing the transfer"}},"additionalProperties":false},"TransferDetailsSchema":{"required":["address","amount","sub_id"],"type":"object","properties":{"address":{"title":"address","type":"string","description":"Ethereum address of the asset being transferred"},"amount":{"title":"amount","type":"string","format":"decimal","description":"Amount to transfer"},"sub_id":{"title":"sub_id","type":"integer","description":"Sub ID of the asset being transferred"}},"additionalProperties":false},"PrivateTransferErc20ResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PrivateTransferErc20ResultSchema"}},"additionalProperties":false},"PrivateTransferErc20ResultSchema":{"required":["status","transaction_id"],"type":"object","properties":{"status":{"title":"status","type":"string","description":"`requested`"},"transaction_id":{"title":"transaction_id","type":"string","format":"uuid","description":"Transaction id of the transfer"}},"additionalProperties":false},"PrivateRegisterScopedSessionKeyParamsSchema":{"required":["expiry_sec","public_session_key","wallet"],"type":"object","properties":{"expiry_sec":{"title":"expiry_sec","type":"integer","description":"Expiry of the session key"},"ip_whitelist":{"title":"ip_whitelist","type":"array","default":null,"description":"List of whitelisted IPs, if empty then any IP is allowed.","items":{"title":"ip_whitelist","type":"string"},"nullable":true},"label":{"title":"label","type":"string","default":null,"description":"User-defined session key label","nullable":true},"public_session_key":{"title":"public_session_key","type":"string","description":"Session key in the form of an Ethereum EOA"},"scope":{"title":"scope","type":"string","default":"read_only","enum":["admin","account","read_only"],"description":"Scope of the session key. Defaults to READ_ONLY level permissions. "},"signed_raw_tx":{"title":"signed_raw_tx","type":"string","default":null,"description":"A signed RLP encoded ETH transaction in form of a hex string (same as `w3.eth.account.sign_transaction(unsigned_tx, private_key).rawTransaction.hex()`) Must be included if the scope is ADMIN.","nullable":true},"wallet":{"title":"wallet","type":"string","description":"Ethereum wallet address of account"}},"additionalProperties":false},"PrivateRegisterScopedSessionKeyResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PrivateRegisterScopedSessionKeyResultSchema"}},"additionalProperties":false},"PrivateRegisterScopedSessionKeyResultSchema":{"required":["expiry_sec","ip_whitelist","label","public_session_key","scope","transaction_id"],"type":"object","properties":{"expiry_sec":{"title":"expiry_sec","type":"integer","description":"Session key expiry timestamp in sec"},"ip_whitelist":{"title":"ip_whitelist","type":"array","default":null,"description":"List of whitelisted IPs, if empty then any IP is allowed.","items":{"title":"ip_whitelist","type":"string"},"nullable":true},"label":{"title":"label","type":"string","default":null,"description":"User-defined session key label","nullable":true},"public_session_key":{"title":"public_session_key","type":"string","description":"Session key in the form of an Ethereum EOA"},"scope":{"title":"scope","type":"string","enum":["admin","account","read_only"],"description":"Session key permission level scope"},"transaction_id":{"title":"transaction_id","type":"string","format":"uuid","default":null,"description":"ID to lookup status of transaction if signed_raw_tx is provided","nullable":true}},"additionalProperties":false},"PublicGetCurrencyParamsSchema":{"required":["currency"],"type":"object","properties":{"currency":{"title":"currency","type":"string","description":"Underlying currency of asset (`ETH`, `BTC`, etc)"}},"additionalProperties":false},"PublicGetCurrencyResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PublicGetCurrencyResultSchema"}},"additionalProperties":false},"PublicGetCurrencyResultSchema":{"required":["asset_cap_and_supply_per_manager","borrow_apy","currency","instrument_types","managers","market_type","pm2_collateral_discounts","protocol_asset_addresses","spot_price","srm_im_discount","srm_mm_discount","supply_apy","total_borrow","total_supply"],"type":"object","properties":{"asset_cap_and_supply_per_manager":{"title":"asset_cap_and_supply_per_manager","type":"object","description":"Current open interest and open interest cap by manager and asset type","additionalProperties":{"title":"asset_cap_and_supply_per_manager","type":"object","additionalProperties":{"title":"asset_cap_and_supply_per_manager","type":"array","items":{"$ref":"#/components/schemas/OpenInterestStatsSchema"}}}},"borrow_apy":{"title":"borrow_apy","type":"string","format":"decimal","description":"Borrow APY (only for USDC)"},"currency":{"title":"currency","type":"string","description":"Underlying currency of asset (`ETH`, `BTC`, etc)"},"instrument_types":{"title":"instrument_types","type":"array","description":"Instrument types supported for the currency","items":{"title":"instrument_types","type":"string","enum":["erc20","option","perp"]}},"managers":{"title":"managers","type":"array","description":"Managers supported for the currency","items":{"$ref":"#/components/schemas/ManagerContractResponseSchema"}},"market_type":{"title":"market_type","type":"string","enum":["ALL","SRM_BASE_ONLY","SRM_OPTION_ONLY","SRM_PERP_ONLY","CASH"],"description":"Market type of the currency"},"pm2_collateral_discounts":{"title":"pm2_collateral_discounts","type":"array","description":"Initial and Maintenance Margin discounts for given collateral in PM2","items":{"$ref":"#/components/schemas/PM2CollateralDiscountsSchema"}},"protocol_asset_addresses":{"$ref":"#/components/schemas/ProtocolAssetAddressesSchema"},"spot_price":{"title":"spot_price","type":"string","format":"decimal","description":"Spot price of the currency"},"spot_price_24h":{"title":"spot_price_24h","type":"string","format":"decimal","default":null,"description":"Spot price of the currency 24 hours ago","nullable":true},"srm_im_discount":{"title":"srm_im_discount","type":"string","format":"decimal","description":"Initial Margin discount for given collateral in Standard Manager (e.g. LTV). Only the Standard Manager supports non-USDC collateral"},"srm_mm_discount":{"title":"srm_mm_discount","type":"string","format":"decimal","description":"Maintenance Margin discount for given collateral in Standard Manager (e.g. liquidation threshold). Only the Standard Manager supports non-USDC collateral"},"supply_apy":{"title":"supply_apy","type":"string","format":"decimal","description":"Supply APY (only for USDC)"},"total_borrow":{"title":"total_borrow","type":"string","format":"decimal","description":"Total collateral borrowed in the protocol (only USDC is borrowable)"},"total_supply":{"title":"total_supply","type":"string","format":"decimal","description":"Total collateral supplied in the protocol"}},"additionalProperties":false},"OpenInterestStatsSchema":{"required":["current_open_interest","interest_cap"],"type":"object","properties":{"current_open_interest":{"title":"current_open_interest","type":"string","format":"decimal","description":"Current open interest for the margin type"},"interest_cap":{"title":"interest_cap","type":"string","format":"decimal","description":"Total open interest cap"},"manager_currency":{"title":"manager_currency","type":"string","default":null,"description":"Currency of the manager (only applies to Portfolio Margin)","nullable":true}},"additionalProperties":false},"ManagerContractResponseSchema":{"required":["address","margin_type"],"type":"object","properties":{"address":{"title":"address","type":"string","description":"Address of the manager"},"currency":{"title":"currency","type":"string","default":null,"description":"Currency of the manager (only applies to portfolio managers)","nullable":true},"margin_type":{"title":"margin_type","type":"string","enum":["PM","SM","PM2"],"description":"Margin type of the manager"}},"additionalProperties":false},"PM2CollateralDiscountsSchema":{"required":["im_discount","manager_currency","mm_discount"],"type":"object","properties":{"im_discount":{"title":"im_discount","type":"string","format":"decimal","description":"Initial Margin discount for given collateral in PM2"},"manager_currency":{"title":"manager_currency","type":"string","description":"Currency of the manager"},"mm_discount":{"title":"mm_discount","type":"string","format":"decimal","description":"Maintenance Margin discount for given collateral in PM2"}},"additionalProperties":false},"ProtocolAssetAddressesSchema":{"type":"object","properties":{"option":{"title":"option","type":"string","default":null,"description":"Address of the Derive protocol option contract (none if not supported)","nullable":true},"perp":{"title":"perp","type":"string","default":null,"description":"Address of the Derive protocol perp contract (none if not supported)","nullable":true},"spot":{"title":"spot","type":"string","default":null,"description":"Address of the Derive protocol spot contract (none if not supported)","nullable":true},"underlying_erc20":{"title":"underlying_erc20","type":"string","default":null,"description":"Address of the erc20 asset on Derive chain. This is the asset that is deposited into the spot asset","nullable":true}},"additionalProperties":false},"PrivateLiquidateParamsSchema":{"required":["cash_transfer","last_seen_trade_id","liquidated_subaccount_id","nonce","percent_bid","price_limit","signature","signature_expiry_sec","signer","subaccount_id"],"type":"object","properties":{"cash_transfer":{"title":"cash_transfer","type":"string","format":"decimal","description":"Amount of cash to transfer to a newly created subaccount for bidding. Must be non-negative."},"last_seen_trade_id":{"title":"last_seen_trade_id","type":"integer","description":"Last seen trade ID for account being liquidated. Not checked if set to 0."},"liquidated_subaccount_id":{"title":"liquidated_subaccount_id","type":"integer","description":"Subaccount ID of the account to be liquidated."},"nonce":{"title":"nonce","type":"integer","description":"Unique nonce defined as (e.g. 1695836058725001, where 001 is the random number)"},"percent_bid":{"title":"percent_bid","type":"string","format":"decimal","description":"Percent of the liquidated position to bid for. Will bid for the maximum possible percent of the position if set to 1"},"price_limit":{"title":"price_limit","type":"string","format":"decimal","description":"Maximum amount of cash to be paid from bidder to liquidated account (supports negative amounts for insolvent auctions). Not checked if set to 0."},"signature":{"title":"signature","type":"string","description":"Ethereum signature of the order"},"signature_expiry_sec":{"title":"signature_expiry_sec","type":"integer","description":"Unix timestamp in seconds. Order signature becomes invalid after this time, and the system will cancel the order.Expiry MUST be at least 5 min from now."},"signer":{"title":"signer","type":"string","description":"Owner wallet address or registered session key that signed order"},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount ID owned by wallet, that will be doing the bidding."}},"additionalProperties":false},"PrivateLiquidateResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PrivateLiquidateResultSchema"}},"additionalProperties":false},"PrivateLiquidateResultSchema":{"required":["estimated_bid_price","estimated_discount_pnl","estimated_percent_bid","transaction_id"],"type":"object","properties":{"estimated_bid_price":{"title":"estimated_bid_price","type":"string","format":"decimal","description":"Estimated bid price for this liquidation"},"estimated_discount_pnl":{"title":"estimated_discount_pnl","type":"string","format":"decimal","description":"Estimated profit (increase in the subaccount mark value) if the liquidation is successful."},"estimated_percent_bid":{"title":"estimated_percent_bid","type":"string","format":"decimal","description":"Estimated percent of account the bid will aquire"},"transaction_id":{"title":"transaction_id","type":"string","format":"uuid","description":"The transaction id of the related settlement transaction"}},"additionalProperties":false},"PrivateGetSubaccountValueHistoryParamsSchema":{"required":["end_timestamp","period","start_timestamp","subaccount_id"],"type":"object","properties":{"end_timestamp":{"title":"end_timestamp","type":"integer","description":"End timestamp"},"period":{"title":"period","type":"integer","description":"Period"},"start_timestamp":{"title":"start_timestamp","type":"integer","description":"Start timestamp"},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount_id"}},"additionalProperties":false},"PrivateGetSubaccountValueHistoryResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PrivateGetSubaccountValueHistoryResultSchema"}},"additionalProperties":false},"PrivateGetSubaccountValueHistoryResultSchema":{"required":["subaccount_id","subaccount_value_history"],"type":"object","properties":{"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount_id"},"subaccount_value_history":{"title":"subaccount_value_history","type":"array","description":"Subaccount value history","items":{"$ref":"#/components/schemas/SubAccountValueHistoryResponseSchema"}}},"additionalProperties":false},"SubAccountValueHistoryResponseSchema":{"required":["subaccount_value","timestamp"],"type":"object","properties":{"subaccount_value":{"title":"subaccount_value","type":"string","format":"decimal","description":"Total mark-to-market value of all positions and collaterals"},"timestamp":{"title":"timestamp","type":"integer","description":"Timestamp of when the subaccount value was recorded into the database"}},"additionalProperties":false},"PublicGetMakerProgramsParamsSchema":{"type":"object","properties":{},"additionalProperties":false},"PublicGetMakerProgramsResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"title":"result","type":"array","description":"","items":{"$ref":"#/components/schemas/ProgramResponseSchema"}}},"additionalProperties":false},"ProgramResponseSchema":{"required":["asset_types","currencies","end_timestamp","min_notional","name","rewards","start_timestamp"],"type":"object","properties":{"asset_types":{"title":"asset_types","type":"array","description":"List of asset types covered by the program","items":{"title":"asset_types","type":"string"}},"currencies":{"title":"currencies","type":"array","description":"List of currencies covered by the program","items":{"title":"currencies","type":"string"}},"end_timestamp":{"title":"end_timestamp","type":"integer","description":"End timestamp of the epoch"},"min_notional":{"title":"min_notional","type":"string","format":"decimal","description":"Minimum dollar notional to quote for eligibility"},"name":{"title":"name","type":"string","description":"Name of the program"},"rewards":{"title":"rewards","type":"object","description":"Rewards for the program as a token -> total reward amount mapping","additionalProperties":{"title":"rewards","type":"string","format":"decimal"}},"start_timestamp":{"title":"start_timestamp","type":"integer","description":"Start timestamp of the epoch"}},"additionalProperties":false},"PrivateOrderDebugParamsSchema":{"required":["amount","direction","instrument_name","limit_price","max_fee","nonce","signature","signature_expiry_sec","signer","subaccount_id"],"type":"object","properties":{"amount":{"title":"amount","type":"string","format":"decimal","description":"Order amount in units of the base"},"direction":{"title":"direction","type":"string","enum":["buy","sell"],"description":"Order direction"},"instrument_name":{"title":"instrument_name","type":"string","description":"Instrument name"},"is_atomic_signing":{"title":"is_atomic_signing","type":"boolean","default":false,"description":"Used by vaults to determine whether the signature is an EIP-1271 signature.","nullable":true},"label":{"title":"label","type":"string","default":"","description":"Optional user-defined label for the order"},"limit_price":{"title":"limit_price","type":"string","format":"decimal","description":"Limit price in quote currency.
This field is still required for market orders because it is a component of the signature. However, market orders will not leave a resting order in the book in case of a partial fill."},"max_fee":{"title":"max_fee","type":"string","format":"decimal","description":"Max fee per unit of volume, denominated in units of the quote currency (usually USDC).Order will be rejected if the supplied max fee is below the estimated fee for this order."},"mmp":{"title":"mmp","type":"boolean","default":false,"description":"Whether the order is tagged for market maker protections (default false)"},"nonce":{"title":"nonce","type":"integer","description":"Unique nonce defined as (e.g. 1695836058725001, where 001 is the random number).Note, using a random number beyond 3 digits will cause JSON serialization to fail."},"order_type":{"title":"order_type","type":"string","default":"limit","enum":["limit","market"],"description":"Order type:
- `limit`: limit order (default)
- `market`: market order, note that limit_price is still required for market orders, but unfilled order portion will be marked as cancelled"},"reduce_only":{"title":"reduce_only","type":"boolean","default":false,"description":"If true, the order will not be able to increase position's size (default false). If the order amount exceeds available position size, the order will be filled up to the position size and the remainder will be cancelled. This flag is only supported for market orders or non-resting limit orders (IOC or FOK)"},"referral_code":{"title":"referral_code","type":"string","default":"","description":"Optional referral code for the order"},"reject_timestamp":{"title":"reject_timestamp","type":"integer","default":9223372036854776000,"description":"UTC timestamp in ms, if provided the matching engine will reject the order with an error if `reject_timestamp` < `server_time`. Note that the timestamp must be consistent with the server time: use `public/get_time` method to obtain current server time."},"signature":{"title":"signature","type":"string","description":"Ethereum signature of the order"},"signature_expiry_sec":{"title":"signature_expiry_sec","type":"integer","description":"Unix timestamp in seconds. Order signature becomes invalid after this time, and the system will cancel the order.Expiry MUST be at least 5 min from now."},"signer":{"title":"signer","type":"string","description":"Owner wallet address or registered session key that signed order"},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount ID"},"time_in_force":{"title":"time_in_force","type":"string","default":"gtc","enum":["gtc","post_only","fok","ioc"],"description":"Time in force behaviour:
- `gtc`: good til cancelled (default)
- `post_only`: a limit order that will be rejected if it crosses any order in the book, i.e. acts as a taker order
- `fok`: fill or kill, will be rejected if it is not fully filled
- `ioc`: immediate or cancel, fill at best bid/ask (market) or at limit price (limit), the unfilled portion is cancelled
Note that the order will still expire on the `signature_expiry_sec` timestamp."},"trigger_price":{"title":"trigger_price","type":"string","format":"decimal","default":null,"description":"(Required for trigger orders) \"index\" or \"mark\" price to trigger order at","nullable":true},"trigger_price_type":{"title":"trigger_price_type","type":"string","default":null,"enum":["mark","index"],"description":"(Required for trigger orders) Trigger with \"mark\" price as \"index\" price type not supported yet.","nullable":true},"trigger_type":{"title":"trigger_type","type":"string","default":null,"enum":["stoploss","takeprofit"],"description":"(Required for trigger orders) \"stoploss\" or \"takeprofit\"","nullable":true}},"additionalProperties":false},"PrivateOrderDebugResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PrivateOrderDebugResultSchema"}},"additionalProperties":false},"PrivateOrderDebugResultSchema":{"required":["action_hash","encoded_data","encoded_data_hashed","raw_data","typed_data_hash"],"type":"object","properties":{"action_hash":{"title":"action_hash","type":"string","description":"Keccak hashed action data"},"encoded_data":{"title":"encoded_data","type":"string","description":"ABI encoded order data"},"encoded_data_hashed":{"title":"encoded_data_hashed","type":"string","description":"Keccak hashed encoded_data"},"raw_data":{"$ref":"#/components/schemas/SignedTradeOrderSchema"},"typed_data_hash":{"title":"typed_data_hash","type":"string","description":"EIP 712 typed data hash"}},"additionalProperties":false},"SignedTradeOrderSchema":{"required":["data","expiry","is_atomic_signing","module","nonce","owner","signature","signer","subaccount_id"],"type":"object","properties":{"data":{"$ref":"#/components/schemas/TradeModuleDataSchema"},"expiry":{"title":"expiry","type":"integer"},"is_atomic_signing":{"title":"is_atomic_signing","type":"boolean"},"module":{"title":"module","type":"string"},"nonce":{"title":"nonce","type":"integer"},"owner":{"title":"owner","type":"string"},"signature":{"title":"signature","type":"string"},"signer":{"title":"signer","type":"string"},"subaccount_id":{"title":"subaccount_id","type":"integer"}},"additionalProperties":false},"TradeModuleDataSchema":{"required":["asset","desired_amount","is_bid","limit_price","recipient_id","sub_id","trade_id","worst_fee"],"type":"object","properties":{"asset":{"title":"asset","type":"string"},"desired_amount":{"title":"desired_amount","type":"string","format":"decimal"},"is_bid":{"title":"is_bid","type":"boolean"},"limit_price":{"title":"limit_price","type":"string","format":"decimal"},"recipient_id":{"title":"recipient_id","type":"integer"},"sub_id":{"title":"sub_id","type":"integer"},"trade_id":{"title":"trade_id","type":"string"},"worst_fee":{"title":"worst_fee","type":"string","format":"decimal"}},"additionalProperties":false},"PrivateGetInterestHistoryParamsSchema":{"required":["subaccount_id"],"type":"object","properties":{"end_timestamp":{"title":"end_timestamp","type":"integer","default":9223372036854776000,"description":"End timestamp of the event history (default current time)"},"start_timestamp":{"title":"start_timestamp","type":"integer","default":0,"description":"Start timestamp of the event history (default 0)"},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount id"}},"additionalProperties":false},"PrivateGetInterestHistoryResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PrivateGetInterestHistoryResultSchema"}},"additionalProperties":false},"PrivateGetInterestHistoryResultSchema":{"required":["events"],"type":"object","properties":{"events":{"title":"events","type":"array","description":"List of interest payments","items":{"$ref":"#/components/schemas/InterestPaymentSchema"}}},"additionalProperties":false},"InterestPaymentSchema":{"required":["interest","timestamp"],"type":"object","properties":{"interest":{"title":"interest","type":"string","format":"decimal","description":"Dollar interest paid (if negative) or received (if positive) by the subaccount"},"timestamp":{"title":"timestamp","type":"integer","description":"Timestamp of the interest payment (in ms since UNIX epoch)"}},"additionalProperties":false},"PrivateGetDepositHistoryParamsSchema":{"required":["subaccount_id"],"type":"object","properties":{"end_timestamp":{"title":"end_timestamp","type":"integer","default":9223372036854776000,"description":"End timestamp of the event history (default current time)"},"start_timestamp":{"title":"start_timestamp","type":"integer","default":0,"description":"Start timestamp of the event history (default 0)"},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount id"}},"additionalProperties":false},"PrivateGetDepositHistoryResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PrivateGetDepositHistoryResultSchema"}},"additionalProperties":false},"PrivateGetDepositHistoryResultSchema":{"required":["events"],"type":"object","properties":{"events":{"title":"events","type":"array","description":"List of deposit payments","items":{"$ref":"#/components/schemas/DepositSchema"}}},"additionalProperties":false},"DepositSchema":{"required":["amount","asset","error_log","timestamp","transaction_id","tx_hash","tx_status"],"type":"object","properties":{"amount":{"title":"amount","type":"string","format":"decimal","description":"Amount deposited by the subaccount"},"asset":{"title":"asset","type":"string","description":"Asset deposited"},"error_log":{"title":"error_log","type":"object","default":null,"description":"If failed, error log for reason","additionalProperties":{},"nullable":true},"timestamp":{"title":"timestamp","type":"integer","description":"Timestamp of the deposit (in ms since UNIX epoch)"},"transaction_id":{"title":"transaction_id","type":"string","format":"uuid","description":"Transaction ID"},"tx_hash":{"title":"tx_hash","type":"string","description":"Hash of the transaction that deposited the funds"},"tx_status":{"title":"tx_status","type":"string","enum":["requested","pending","settled","reverted","ignored","timed_out"],"description":"Status of the transaction that deposited the funds"}},"additionalProperties":false},"PrivateGetMmpConfigParamsSchema":{"required":["subaccount_id"],"type":"object","properties":{"currency":{"title":"currency","type":"string","default":null,"description":"Currency to get the config for. If not provided, returns all configs for the subaccount","nullable":true},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount_id for which to get the config"}},"additionalProperties":false},"PrivateGetMmpConfigResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"title":"result","type":"array","description":"","items":{"$ref":"#/components/schemas/MMPConfigResultSchema"}}},"additionalProperties":false},"MMPConfigResultSchema":{"required":["currency","is_frozen","mmp_frozen_time","mmp_interval","mmp_unfreeze_time","subaccount_id"],"type":"object","properties":{"currency":{"title":"currency","type":"string","description":"Currency of this mmp config"},"is_frozen":{"title":"is_frozen","type":"boolean","description":"Whether the subaccount is currently frozen"},"mmp_amount_limit":{"title":"mmp_amount_limit","type":"string","format":"decimal","default":"0","description":"Maximum total order amount that can be traded within the mmp_interval across all instruments of the provided currency. The amounts are not netted, so a filled bid of 1 and a filled ask of 2 would count as 3.
Default: 0 (no limit)"},"mmp_delta_limit":{"title":"mmp_delta_limit","type":"string","format":"decimal","default":"0","description":"Maximum total delta that can be traded within the mmp_interval across all instruments of the provided currency. This quantity is netted, so a filled order with +1 delta and a filled order with -2 delta would count as -1
Default: 0 (no limit)"},"mmp_frozen_time":{"title":"mmp_frozen_time","type":"integer","description":"Time interval in ms setting how long the subaccount is frozen after an mmp trigger, if 0 then a manual reset would be required via private/reset_mmp"},"mmp_interval":{"title":"mmp_interval","type":"integer","description":"Time interval in ms over which the limits are monotored, if 0 then mmp is disabled"},"mmp_unfreeze_time":{"title":"mmp_unfreeze_time","type":"integer","description":"Timestamp in ms after which the subaccount will be unfrozen"},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount_id for which to set the config"}},"additionalProperties":false},"PrivateSessionKeysParamsSchema":{"required":["wallet"],"type":"object","properties":{"wallet":{"title":"wallet","type":"string","description":"Ethereum wallet address of account"}},"additionalProperties":false},"PrivateSessionKeysResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PrivateSessionKeysResultSchema"}},"additionalProperties":false},"PrivateSessionKeysResultSchema":{"required":["public_session_keys"],"type":"object","properties":{"public_session_keys":{"title":"public_session_keys","type":"array","description":"List of session keys (includes unactivated and expired keys)","items":{"$ref":"#/components/schemas/SessionKeyResponseSchema"}}},"additionalProperties":false},"SessionKeyResponseSchema":{"required":["expiry_sec","ip_whitelist","label","public_session_key","scope"],"type":"object","properties":{"expiry_sec":{"title":"expiry_sec","type":"integer","description":"Session key expiry timestamp in sec"},"ip_whitelist":{"title":"ip_whitelist","type":"array","description":"List of whitelisted IPs, if empty then any IP is allowed.","items":{"title":"ip_whitelist","type":"string"}},"label":{"title":"label","type":"string","description":"User-defined session key label"},"public_session_key":{"title":"public_session_key","type":"string","description":"Public session key address (Ethereum EOA)"},"scope":{"title":"scope","type":"string","description":"Session key permission level scope"}},"additionalProperties":false},"PublicGetInstrumentsParamsSchema":{"required":["currency","expired","instrument_type"],"type":"object","properties":{"currency":{"title":"currency","type":"string","description":"Underlying currency of asset (`ETH`, `BTC`, etc)"},"expired":{"title":"expired","type":"boolean","description":"If `True`: include expired assets. Note: will soon be capped up to only 1 week in the past."},"instrument_type":{"title":"instrument_type","type":"string","enum":["erc20","option","perp"],"description":"`erc20`, `option`, or `perp`"}},"additionalProperties":false},"PublicGetInstrumentsResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"title":"result","type":"array","description":"","items":{"$ref":"#/components/schemas/InstrumentPublicResponseSchema"}}},"additionalProperties":false},"InstrumentPublicResponseSchema":{"required":["amount_step","base_asset_address","base_asset_sub_id","base_currency","base_fee","erc20_details","fifo_min_allocation","instrument_name","instrument_type","is_active","maker_fee_rate","maximum_amount","minimum_amount","option_details","perp_details","pro_rata_amount_step","pro_rata_fraction","quote_currency","scheduled_activation","scheduled_deactivation","taker_fee_rate","tick_size"],"type":"object","properties":{"amount_step":{"title":"amount_step","type":"string","format":"decimal","description":"Minimum valid increment of order amount"},"base_asset_address":{"title":"base_asset_address","type":"string","description":"Blockchain address of the base asset"},"base_asset_sub_id":{"title":"base_asset_sub_id","type":"string","description":"Sub ID of the specific base asset as defined in Asset.sol"},"base_currency":{"title":"base_currency","type":"string","description":"Underlying currency of base asset (`ETH`, `BTC`, etc)"},"base_fee":{"title":"base_fee","type":"string","format":"decimal","description":"$ base fee added to every taker order"},"erc20_details":{"$ref":"#/components/schemas/ERC20PublicDetailsSchema","nullable":true},"fifo_min_allocation":{"title":"fifo_min_allocation","type":"string","format":"decimal","description":"Minimum number of contracts that get filled using FIFO. Actual number of contracts that gets filled by FIFO will be the max between this value and (1 - pro_rata_fraction) x order_amount, plus any size leftovers due to rounding."},"instrument_name":{"title":"instrument_name","type":"string","description":"Instrument name"},"instrument_type":{"title":"instrument_type","type":"string","enum":["erc20","option","perp"],"description":"`erc20`, `option`, or `perp`"},"is_active":{"title":"is_active","type":"boolean","description":"If `True`: instrument is tradeable within `activation` and `deactivation` timestamps"},"maker_fee_rate":{"title":"maker_fee_rate","type":"string","format":"decimal","description":"Percent of spot price fee rate for makers"},"mark_price_fee_rate_cap":{"title":"mark_price_fee_rate_cap","type":"string","format":"decimal","default":null,"description":"Percent of option price fee cap, e.g. 12.5%, null if not applicable","nullable":true},"maximum_amount":{"title":"maximum_amount","type":"string","format":"decimal","description":"Maximum valid amount of contracts / tokens per trade"},"minimum_amount":{"title":"minimum_amount","type":"string","format":"decimal","description":"Minimum valid amount of contracts / tokens per trade"},"option_details":{"$ref":"#/components/schemas/OptionPublicDetailsSchema","nullable":true},"perp_details":{"$ref":"#/components/schemas/PerpPublicDetailsSchema","nullable":true},"pro_rata_amount_step":{"title":"pro_rata_amount_step","type":"string","format":"decimal","description":"Pro-rata fill share of every order is rounded down to be a multiple of this number. Leftovers of the order due to rounding are filled FIFO."},"pro_rata_fraction":{"title":"pro_rata_fraction","type":"string","format":"decimal","description":"Fraction of order that gets filled using pro-rata matching. If zero, the matching is full FIFO."},"quote_currency":{"title":"quote_currency","type":"string","description":"Quote currency (`USD` for perps, `USDC` for options)"},"scheduled_activation":{"title":"scheduled_activation","type":"integer","description":"Timestamp at which became or will become active (if applicable)"},"scheduled_deactivation":{"title":"scheduled_deactivation","type":"integer","description":"Scheduled deactivation time for instrument (if applicable)"},"taker_fee_rate":{"title":"taker_fee_rate","type":"string","format":"decimal","description":"Percent of spot price fee rate for takers"},"tick_size":{"title":"tick_size","type":"string","format":"decimal","description":"Tick size of the instrument, i.e. minimum price increment"}},"additionalProperties":false},"ERC20PublicDetailsSchema":{"required":["decimals"],"type":"object","properties":{"borrow_index":{"title":"borrow_index","type":"string","format":"decimal","default":"1","description":"Latest borrow index as per `CashAsset.sol` implementation"},"decimals":{"title":"decimals","type":"integer","description":"Number of decimals of the underlying on-chain ERC20 token"},"supply_index":{"title":"supply_index","type":"string","format":"decimal","default":"1","description":"Latest supply index as per `CashAsset.sol` implementation"},"underlying_erc20_address":{"title":"underlying_erc20_address","type":"string","default":"","description":"Address of underlying on-chain ERC20 (not V2 asset)"}},"additionalProperties":false},"OptionPublicDetailsSchema":{"required":["expiry","index","option_type","strike"],"type":"object","properties":{"expiry":{"title":"expiry","type":"integer","description":"Unix timestamp of expiry date (in seconds)"},"index":{"title":"index","type":"string","description":"Underlying settlement price index"},"option_type":{"title":"option_type","type":"string","enum":["C","P"]},"settlement_price":{"title":"settlement_price","type":"string","format":"decimal","default":null,"description":"Settlement price of the option","nullable":true},"strike":{"title":"strike","type":"string","format":"decimal"}},"additionalProperties":false},"PerpPublicDetailsSchema":{"required":["aggregate_funding","funding_rate","index","max_rate_per_hour","min_rate_per_hour","static_interest_rate"],"type":"object","properties":{"aggregate_funding":{"title":"aggregate_funding","type":"string","format":"decimal","description":"Latest aggregated funding as per `PerpAsset.sol`"},"funding_rate":{"title":"funding_rate","type":"string","format":"decimal","description":"Current hourly funding rate as per `PerpAsset.sol`"},"index":{"title":"index","type":"string","description":"Underlying spot price index for funding rate"},"max_rate_per_hour":{"title":"max_rate_per_hour","type":"string","format":"decimal","description":"Max rate per hour as per `PerpAsset.sol`"},"min_rate_per_hour":{"title":"min_rate_per_hour","type":"string","format":"decimal","description":"Min rate per hour as per `PerpAsset.sol`"},"static_interest_rate":{"title":"static_interest_rate","type":"string","format":"decimal","description":"Static interest rate as per `PerpAsset.sol`"}},"additionalProperties":false},"PrivateGetAllPortfoliosParamsSchema":{"required":["wallet"],"type":"object","properties":{"wallet":{"title":"wallet","type":"string","description":"Wallet address"}},"additionalProperties":false},"PrivateGetAllPortfoliosResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"title":"result","type":"array","description":"","items":{"$ref":"#/components/schemas/PrivateGetSubaccountResultSchema"}}},"additionalProperties":false},"PrivateGetSubaccountResultSchema":{"required":["collaterals","collaterals_initial_margin","collaterals_maintenance_margin","collaterals_value","currency","initial_margin","is_under_liquidation","label","maintenance_margin","margin_type","open_orders","open_orders_margin","positions","positions_initial_margin","positions_maintenance_margin","positions_value","projected_margin_change","subaccount_id","subaccount_value"],"type":"object","properties":{"collaterals":{"title":"collaterals","type":"array","description":"All collaterals that count towards margin of subaccount","items":{"$ref":"#/components/schemas/CollateralResponseSchema"}},"collaterals_initial_margin":{"title":"collaterals_initial_margin","type":"string","format":"decimal","description":"Total initial margin credit contributed by collaterals"},"collaterals_maintenance_margin":{"title":"collaterals_maintenance_margin","type":"string","format":"decimal","description":"Total maintenance margin credit contributed by collaterals"},"collaterals_value":{"title":"collaterals_value","type":"string","format":"decimal","description":"Total mark-to-market value of all collaterals"},"currency":{"title":"currency","type":"string","description":"Currency of subaccount"},"initial_margin":{"title":"initial_margin","type":"string","format":"decimal","description":"Total initial margin requirement of all positions and collaterals.Trades will be rejected if this value falls below zero after the trade."},"is_under_liquidation":{"title":"is_under_liquidation","type":"boolean","description":"Whether the subaccount is undergoing a liquidation auction"},"label":{"title":"label","type":"string","description":"User defined label"},"maintenance_margin":{"title":"maintenance_margin","type":"string","format":"decimal","description":"Total maintenance margin requirement of all positions and collaterals.If this value falls below zero, the subaccount will be flagged for liquidation."},"margin_type":{"title":"margin_type","type":"string","enum":["PM","SM","PM2"],"description":"Margin type of subaccount (`PM` (Portfolio Margin), `PM2 (Portfolio Margin 2), or `SM` (Standard Margin))"},"open_orders":{"title":"open_orders","type":"array","description":"All open orders of subaccount","items":{"$ref":"#/components/schemas/OrderResponseSchema"}},"open_orders_margin":{"title":"open_orders_margin","type":"string","format":"decimal","description":"Total margin requirement of all open orders.Orders will be rejected if this value plus initial margin are below zero after the order."},"positions":{"title":"positions","type":"array","description":"All active positions of subaccount","items":{"$ref":"#/components/schemas/PositionResponseSchema"}},"positions_initial_margin":{"title":"positions_initial_margin","type":"string","format":"decimal","description":"Total initial margin requirement of all positions"},"positions_maintenance_margin":{"title":"positions_maintenance_margin","type":"string","format":"decimal","description":"Total maintenance margin requirement of all positions"},"positions_value":{"title":"positions_value","type":"string","format":"decimal","description":"Total mark-to-market value of all positions"},"projected_margin_change":{"title":"projected_margin_change","type":"string","format":"decimal","description":"Projected change in maintenance margin requirement between now and projected margin at 8:01 UTC. If this value plus current maintenance margin ise below zero, the account is at risk of being flagged for liquidation right after the upcoming expiry."},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount_id"},"subaccount_value":{"title":"subaccount_value","type":"string","format":"decimal","description":"Total mark-to-market value of all positions and collaterals"}},"additionalProperties":false},"CollateralResponseSchema":{"required":["amount","amount_step","asset_name","asset_type","average_price","average_price_excl_fees","creation_timestamp","cumulative_interest","currency","delta","delta_currency","initial_margin","maintenance_margin","mark_price","mark_value","open_orders_margin","pending_interest","realized_pnl","realized_pnl_excl_fees","total_fees","unrealized_pnl","unrealized_pnl_excl_fees"],"type":"object","properties":{"amount":{"title":"amount","type":"string","format":"decimal","description":"Asset amount of given collateral"},"amount_step":{"title":"amount_step","type":"string","format":"decimal","description":"Minimum amount step for the collateral"},"asset_name":{"title":"asset_name","type":"string","description":"Asset name"},"asset_type":{"title":"asset_type","type":"string","enum":["erc20","option","perp"],"description":"Type of asset collateral (currently always `erc20`)"},"average_price":{"title":"average_price","type":"string","format":"decimal","description":"Average price of the collateral, 0 for USDC."},"average_price_excl_fees":{"title":"average_price_excl_fees","type":"string","format":"decimal","description":"Average price of whole position excluding fees"},"creation_timestamp":{"title":"creation_timestamp","type":"integer","description":"Timestamp of when the position was opened (in ms since Unix epoch)"},"cumulative_interest":{"title":"cumulative_interest","type":"string","format":"decimal","description":"Cumulative interest earned on supplying collateral or paid for borrowing"},"currency":{"title":"currency","type":"string","description":"Underlying currency of asset (`ETH`, `BTC`, etc)"},"delta":{"title":"delta","type":"string","format":"decimal","description":"Asset delta w.r.t. the delta currency"},"delta_currency":{"title":"delta_currency","type":"string","description":"Currency with respect to which delta is reported.For example, LRTs like WEETH have their delta reported in ETH"},"initial_margin":{"title":"initial_margin","type":"string","format":"decimal","description":"USD value of collateral that contributes to initial margin"},"maintenance_margin":{"title":"maintenance_margin","type":"string","format":"decimal","description":"USD value of collateral that contributes to maintenance margin"},"mark_price":{"title":"mark_price","type":"string","format":"decimal","description":"Current mark price of the asset"},"mark_value":{"title":"mark_value","type":"string","format":"decimal","description":"USD value of the collateral (amount * mark price)"},"open_orders_margin":{"title":"open_orders_margin","type":"string","format":"decimal","description":"USD margin requirement for all open orders for this asset / instrument"},"pending_interest":{"title":"pending_interest","type":"string","format":"decimal","description":"Portion of interest that has not yet been settled on-chain. This number is added to the portfolio value for margin calculations purposes."},"realized_pnl":{"title":"realized_pnl","type":"string","format":"decimal","description":"Realized trading profit or loss of the collateral, 0 for USDC."},"realized_pnl_excl_fees":{"title":"realized_pnl_excl_fees","type":"string","format":"decimal","description":"Realized trading profit or loss of the position excluding fees"},"total_fees":{"title":"total_fees","type":"string","format":"decimal","description":"Total fees paid for opening and changing the position"},"unrealized_pnl":{"title":"unrealized_pnl","type":"string","format":"decimal","description":"Unrealized trading profit or loss of the collateral, 0 for USDC."},"unrealized_pnl_excl_fees":{"title":"unrealized_pnl_excl_fees","type":"string","format":"decimal","description":"Unrealized trading profit or loss of the position excluding fees"}},"additionalProperties":false},"PositionResponseSchema":{"required":["amount","amount_step","average_price","average_price_excl_fees","creation_timestamp","cumulative_funding","delta","gamma","index_price","initial_margin","instrument_name","instrument_type","leverage","liquidation_price","maintenance_margin","mark_price","mark_value","net_settlements","open_orders_margin","pending_funding","realized_pnl","realized_pnl_excl_fees","theta","total_fees","unrealized_pnl","unrealized_pnl_excl_fees","vega"],"type":"object","properties":{"amount":{"title":"amount","type":"string","format":"decimal","description":"Position amount held by subaccount"},"amount_step":{"title":"amount_step","type":"string","format":"decimal","description":"Minimum amount step for the position"},"average_price":{"title":"average_price","type":"string","format":"decimal","description":"Average price of whole position"},"average_price_excl_fees":{"title":"average_price_excl_fees","type":"string","format":"decimal","description":"Average price of whole position excluding fees"},"creation_timestamp":{"title":"creation_timestamp","type":"integer","description":"Timestamp of when the position was opened (in ms since Unix epoch)"},"cumulative_funding":{"title":"cumulative_funding","type":"string","format":"decimal","description":"Cumulative funding for the position (only for perpetuals)."},"delta":{"title":"delta","type":"string","format":"decimal","description":"Asset delta (w.r.t. forward price for options, `1.0` for perps)"},"gamma":{"title":"gamma","type":"string","format":"decimal","description":"Asset gamma (zero for non-options)"},"index_price":{"title":"index_price","type":"string","format":"decimal","description":"Current index (oracle) price for position's currency"},"initial_margin":{"title":"initial_margin","type":"string","format":"decimal","description":"USD initial margin requirement for this position"},"instrument_name":{"title":"instrument_name","type":"string","description":"Instrument name (same as the base Asset name)"},"instrument_type":{"title":"instrument_type","type":"string","enum":["erc20","option","perp"],"description":"`erc20`, `option`, or `perp`"},"leverage":{"title":"leverage","type":"string","format":"decimal","default":null,"description":"Only for perps. Leverage of the position, defined as `abs(notional) / collateral net of options margin`","nullable":true},"liquidation_price":{"title":"liquidation_price","type":"string","format":"decimal","default":null,"description":"Index price at which position will be liquidated","nullable":true},"maintenance_margin":{"title":"maintenance_margin","type":"string","format":"decimal","description":"USD maintenance margin requirement for this position"},"mark_price":{"title":"mark_price","type":"string","format":"decimal","description":"Current mark price for position's instrument"},"mark_value":{"title":"mark_value","type":"string","format":"decimal","description":"USD value of the position; this represents how much USD can be recieved by fully closing the position at the current oracle price"},"net_settlements":{"title":"net_settlements","type":"string","format":"decimal","description":"Net amount of USD from position settlements that has been paid to the user's subaccount. This number is subtracted from the portfolio value for margin calculations purposes.
Positive values mean the user has recieved USD from settlements, or is awaiting settlement of USD losses. Negative values mean the user has paid USD for settlements, or is awaiting settlement of USD gains."},"open_orders_margin":{"title":"open_orders_margin","type":"string","format":"decimal","description":"USD margin requirement for all open orders for this asset / instrument"},"pending_funding":{"title":"pending_funding","type":"string","format":"decimal","description":"A portion of funding payments that has not yet been settled into cash balance (only for perpetuals). This number is added to the portfolio value for margin calculations purposes."},"realized_pnl":{"title":"realized_pnl","type":"string","format":"decimal","description":"Realized trading profit or loss of the position."},"realized_pnl_excl_fees":{"title":"realized_pnl_excl_fees","type":"string","format":"decimal","description":"Realized trading profit or loss of the position excluding fees"},"theta":{"title":"theta","type":"string","format":"decimal","description":"Asset theta (zero for non-options)"},"total_fees":{"title":"total_fees","type":"string","format":"decimal","description":"Total fees paid for opening and changing the position"},"unrealized_pnl":{"title":"unrealized_pnl","type":"string","format":"decimal","description":"Unrealized trading profit or loss of the position."},"unrealized_pnl_excl_fees":{"title":"unrealized_pnl_excl_fees","type":"string","format":"decimal","description":"Unrealized trading profit or loss of the position excluding fees"},"vega":{"title":"vega","type":"string","format":"decimal","description":"Asset vega (zero for non-options)"}},"additionalProperties":false},"PublicGetInstrumentParamsSchema":{"required":["instrument_name"],"type":"object","properties":{"instrument_name":{"title":"instrument_name","type":"string","description":"Instrument name"}},"additionalProperties":false},"PublicGetInstrumentResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PublicGetInstrumentResultSchema"}},"additionalProperties":false},"PublicGetInstrumentResultSchema":{"required":["amount_step","base_asset_address","base_asset_sub_id","base_currency","base_fee","erc20_details","fifo_min_allocation","instrument_name","instrument_type","is_active","maker_fee_rate","maximum_amount","minimum_amount","option_details","perp_details","pro_rata_amount_step","pro_rata_fraction","quote_currency","scheduled_activation","scheduled_deactivation","taker_fee_rate","tick_size"],"type":"object","properties":{"amount_step":{"title":"amount_step","type":"string","format":"decimal","description":"Minimum valid increment of order amount"},"base_asset_address":{"title":"base_asset_address","type":"string","description":"Blockchain address of the base asset"},"base_asset_sub_id":{"title":"base_asset_sub_id","type":"string","description":"Sub ID of the specific base asset as defined in Asset.sol"},"base_currency":{"title":"base_currency","type":"string","description":"Underlying currency of base asset (`ETH`, `BTC`, etc)"},"base_fee":{"title":"base_fee","type":"string","format":"decimal","description":"$ base fee added to every taker order"},"erc20_details":{"$ref":"#/components/schemas/ERC20PublicDetailsSchema","nullable":true},"fifo_min_allocation":{"title":"fifo_min_allocation","type":"string","format":"decimal","description":"Minimum number of contracts that get filled using FIFO. Actual number of contracts that gets filled by FIFO will be the max between this value and (1 - pro_rata_fraction) x order_amount, plus any size leftovers due to rounding."},"instrument_name":{"title":"instrument_name","type":"string","description":"Instrument name"},"instrument_type":{"title":"instrument_type","type":"string","enum":["erc20","option","perp"],"description":"`erc20`, `option`, or `perp`"},"is_active":{"title":"is_active","type":"boolean","description":"If `True`: instrument is tradeable within `activation` and `deactivation` timestamps"},"maker_fee_rate":{"title":"maker_fee_rate","type":"string","format":"decimal","description":"Percent of spot price fee rate for makers"},"mark_price_fee_rate_cap":{"title":"mark_price_fee_rate_cap","type":"string","format":"decimal","default":null,"description":"Percent of option price fee cap, e.g. 12.5%, null if not applicable","nullable":true},"maximum_amount":{"title":"maximum_amount","type":"string","format":"decimal","description":"Maximum valid amount of contracts / tokens per trade"},"minimum_amount":{"title":"minimum_amount","type":"string","format":"decimal","description":"Minimum valid amount of contracts / tokens per trade"},"option_details":{"$ref":"#/components/schemas/OptionPublicDetailsSchema","nullable":true},"perp_details":{"$ref":"#/components/schemas/PerpPublicDetailsSchema","nullable":true},"pro_rata_amount_step":{"title":"pro_rata_amount_step","type":"string","format":"decimal","description":"Pro-rata fill share of every order is rounded down to be a multiple of this number. Leftovers of the order due to rounding are filled FIFO."},"pro_rata_fraction":{"title":"pro_rata_fraction","type":"string","format":"decimal","description":"Fraction of order that gets filled using pro-rata matching. If zero, the matching is full FIFO."},"quote_currency":{"title":"quote_currency","type":"string","description":"Quote currency (`USD` for perps, `USDC` for options)"},"scheduled_activation":{"title":"scheduled_activation","type":"integer","description":"Timestamp at which became or will become active (if applicable)"},"scheduled_deactivation":{"title":"scheduled_deactivation","type":"integer","description":"Scheduled deactivation time for instrument (if applicable)"},"taker_fee_rate":{"title":"taker_fee_rate","type":"string","format":"decimal","description":"Percent of spot price fee rate for takers"},"tick_size":{"title":"tick_size","type":"string","format":"decimal","description":"Tick size of the instrument, i.e. minimum price increment"}},"additionalProperties":false},"PublicExecuteQuoteDebugParamsSchema":{"required":["direction","legs","max_fee","nonce","quote_id","rfq_id","signature","signature_expiry_sec","signer","subaccount_id"],"type":"object","properties":{"direction":{"title":"direction","type":"string","enum":["buy","sell"],"description":"Quote direction, `buy` means trading each leg at its direction, `sell` means trading each leg in the opposite direction."},"label":{"title":"label","type":"string","default":"","description":"Optional user-defined label for the quote"},"legs":{"title":"legs","type":"array","description":"Quote legs","items":{"$ref":"#/components/schemas/LegPricedSchema"}},"max_fee":{"title":"max_fee","type":"string","format":"decimal","description":"Max fee ($ for the full trade). Request will be rejected if the supplied max fee is below the estimated fee for this trade."},"nonce":{"title":"nonce","type":"integer","description":"Unique nonce defined as a concatenated `UTC timestamp in ms` and `random number up to 6 digits` (e.g. 1695836058725001, where 001 is the random number)"},"quote_id":{"title":"quote_id","type":"string","format":"uuid","description":"Quote ID to execute against"},"rfq_id":{"title":"rfq_id","type":"string","format":"uuid","description":"RFQ ID to execute (must be sent by `subaccount_id`)"},"signature":{"title":"signature","type":"string","description":"Ethereum signature of the quote"},"signature_expiry_sec":{"title":"signature_expiry_sec","type":"integer","description":"Unix timestamp in seconds. Expiry MUST be at least 310 seconds from now. Once time till signature expiry reaches 300 seconds, the quote will be considered expired. This buffer is meant to ensure the trade can settle on chain in case of a blockchain congestion."},"signer":{"title":"signer","type":"string","description":"Owner wallet address or registered session key that signed the quote"},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount ID"}},"additionalProperties":false},"PublicExecuteQuoteDebugResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PublicExecuteQuoteDebugResultSchema"}},"additionalProperties":false},"PublicExecuteQuoteDebugResultSchema":{"required":["action_hash","encoded_data","encoded_data_hashed","encoded_legs","legs_hash","typed_data_hash"],"type":"object","properties":{"action_hash":{"title":"action_hash","type":"string","description":"Keccak hashed action data"},"encoded_data":{"title":"encoded_data","type":"string","description":"ABI encoded deposit data"},"encoded_data_hashed":{"title":"encoded_data_hashed","type":"string","description":"Keccak hashed encoded_data"},"encoded_legs":{"title":"encoded_legs","type":"string","description":"ABI encoded legs data"},"legs_hash":{"title":"legs_hash","type":"string","description":"Keccak hashed legs data"},"typed_data_hash":{"title":"typed_data_hash","type":"string","description":"EIP 712 typed data hash"}},"additionalProperties":false},"PrivateGetCollateralsParamsSchema":{"required":["subaccount_id"],"type":"object","properties":{"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount_id"}},"additionalProperties":false},"PrivateGetCollateralsResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PrivateGetCollateralsResultSchema"}},"additionalProperties":false},"PrivateGetCollateralsResultSchema":{"required":["collaterals","subaccount_id"],"type":"object","properties":{"collaterals":{"title":"collaterals","type":"array","description":"All collaterals that count towards margin of subaccount","items":{"$ref":"#/components/schemas/CollateralResponseSchema"}},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount_id"}},"additionalProperties":false},"PrivatePollQuotesParamsSchema":{"required":["subaccount_id"],"type":"object","properties":{"from_timestamp":{"title":"from_timestamp","type":"integer","default":0,"description":"Earliest timestamp to filter by (in ms since Unix epoch). If not provied, defaults to 0."},"page":{"title":"page","type":"integer","default":1,"description":"Page number of results to return (default 1, returns last if above `num_pages`)"},"page_size":{"title":"page_size","type":"integer","default":100,"description":"Number of results per page (default 100, max 1000)"},"quote_id":{"title":"quote_id","type":"string","format":"uuid","default":null,"description":"Quote ID filter, if applicable","nullable":true},"rfq_id":{"title":"rfq_id","type":"string","format":"uuid","default":null,"description":"RFQ ID filter, if applicable","nullable":true},"status":{"title":"status","type":"string","default":null,"enum":["open","filled","cancelled","expired"],"description":"Quote status filter, if applicable","nullable":true},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount ID for auth purposes, returned data will be scoped to this subaccount."},"to_timestamp":{"title":"to_timestamp","type":"integer","default":18446744073709552000,"description":"Latest timestamp to filter by (in ms since Unix epoch). If not provied, defaults to returning all data up to current time."}},"additionalProperties":false},"PrivatePollQuotesResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PrivatePollQuotesResultSchema"}},"additionalProperties":false},"PrivatePollQuotesResultSchema":{"required":["pagination","quotes"],"type":"object","properties":{"pagination":{"$ref":"#/components/schemas/PaginationInfoSchema"},"quotes":{"title":"quotes","type":"array","description":"Quotes matching filter criteria","items":{"$ref":"#/components/schemas/QuoteResultPublicSchema"}}},"additionalProperties":false},"PaginationInfoSchema":{"required":["count","num_pages"],"type":"object","properties":{"count":{"title":"count","type":"integer","description":"Total number of items, across all pages"},"num_pages":{"title":"num_pages","type":"integer","description":"Number of pages"}},"additionalProperties":false},"QuoteResultPublicSchema":{"required":["cancel_reason","creation_timestamp","direction","fill_pct","last_update_timestamp","legs","legs_hash","liquidity_role","quote_id","rfq_id","status","subaccount_id","tx_hash","tx_status","wallet"],"type":"object","properties":{"cancel_reason":{"title":"cancel_reason","type":"string","enum":["","user_request","insufficient_margin","signed_max_fee_too_low","mmp_trigger","cancel_on_disconnect","session_key_deregistered","subaccount_withdrawn","rfq_no_longer_open","compliance"],"description":"Cancel reason, if any"},"creation_timestamp":{"title":"creation_timestamp","type":"integer","description":"Creation timestamp in ms since Unix epoch"},"direction":{"title":"direction","type":"string","enum":["buy","sell"],"description":"Quote direction"},"fill_pct":{"title":"fill_pct","type":"string","format":"decimal","description":"Percentage of the RFQ that this quote would fill, from 0 to 1."},"last_update_timestamp":{"title":"last_update_timestamp","type":"integer","description":"Last update timestamp in ms since Unix epoch"},"legs":{"title":"legs","type":"array","description":"Quote legs","items":{"$ref":"#/components/schemas/LegPricedSchema"}},"legs_hash":{"title":"legs_hash","type":"string","description":"Hash of the legs of the best quote to be signed by the taker."},"liquidity_role":{"title":"liquidity_role","type":"string","enum":["maker","taker"],"description":"Liquidity role"},"quote_id":{"title":"quote_id","type":"string","format":"uuid","description":"Quote ID"},"rfq_id":{"title":"rfq_id","type":"string","format":"uuid","description":"RFQ ID"},"status":{"title":"status","type":"string","enum":["open","filled","cancelled","expired"],"description":"Status"},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount ID"},"tx_hash":{"title":"tx_hash","type":"string","default":null,"description":"Blockchain transaction hash (only for executed quotes)","nullable":true},"tx_status":{"title":"tx_status","type":"string","default":null,"enum":["requested","pending","settled","reverted","ignored","timed_out"],"description":"Blockchain transaction status (only for executed quotes)","nullable":true},"wallet":{"title":"wallet","type":"string","description":"Wallet address of the quote sender"}},"additionalProperties":false},"PrivateGetMarginParamsSchema":{"required":["subaccount_id"],"type":"object","properties":{"simulated_collateral_changes":{"title":"simulated_collateral_changes","type":"array","default":null,"description":"Optional, add collaterals to simulate deposits / withdrawals / spot trades","items":{"$ref":"#/components/schemas/SimulatedCollateralSchema"},"nullable":true},"simulated_position_changes":{"title":"simulated_position_changes","type":"array","default":null,"description":"Optional, add positions to simulate perp / option trades","items":{"$ref":"#/components/schemas/SimulatedPositionSchema"},"nullable":true},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount_id"}},"additionalProperties":false},"SimulatedCollateralSchema":{"required":["amount","asset_name"],"type":"object","properties":{"amount":{"title":"amount","type":"string","format":"decimal","description":"Collateral amount to simulate"},"asset_name":{"title":"asset_name","type":"string","description":"Collateral ERC20 asset name (e.g. ETH, USDC, WSTETH)"}},"additionalProperties":false},"SimulatedPositionSchema":{"required":["amount","instrument_name"],"type":"object","properties":{"amount":{"title":"amount","type":"string","format":"decimal","description":"Position amount to simulate"},"entry_price":{"title":"entry_price","type":"string","format":"decimal","default":null,"description":"Only for perps. Entry price to use in the simulation. Mark price is used if not provided.","nullable":true},"instrument_name":{"title":"instrument_name","type":"string","description":"Instrument name"}},"additionalProperties":false},"PrivateGetMarginResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PrivateGetMarginResultSchema"}},"additionalProperties":false},"PrivateGetMarginResultSchema":{"required":["is_valid_trade","post_initial_margin","post_maintenance_margin","pre_initial_margin","pre_maintenance_margin","subaccount_id"],"type":"object","properties":{"is_valid_trade":{"title":"is_valid_trade","type":"boolean","description":"True if trade passes margin requirement"},"post_initial_margin":{"title":"post_initial_margin","type":"string","format":"decimal","description":"Initial margin requirement post trade"},"post_maintenance_margin":{"title":"post_maintenance_margin","type":"string","format":"decimal","description":"Maintenance margin requirement post trade"},"pre_initial_margin":{"title":"pre_initial_margin","type":"string","format":"decimal","description":"Initial margin requirement before trade"},"pre_maintenance_margin":{"title":"pre_maintenance_margin","type":"string","format":"decimal","description":"Maintenance margin requirement before trade"},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount_id"}},"additionalProperties":false},"PublicBuildRegisterSessionKeyTxParamsSchema":{"required":["expiry_sec","gas","nonce","public_session_key","wallet"],"type":"object","properties":{"expiry_sec":{"title":"expiry_sec","type":"integer","description":"Expiry of the session key"},"gas":{"title":"gas","type":"integer","default":null,"description":"Gas allowance for transaction. If none, will use estimateGas * 150%","nullable":true},"nonce":{"title":"nonce","type":"integer","default":null,"description":"Wallet's transaction count, If none, will use eth.getTransactionCount()","nullable":true},"public_session_key":{"title":"public_session_key","type":"string","description":"Session key in the form of an Ethereum EOA"},"wallet":{"title":"wallet","type":"string","description":"Ethereum wallet address of account"}},"additionalProperties":false},"PublicBuildRegisterSessionKeyTxResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PublicBuildRegisterSessionKeyTxResultSchema"}},"additionalProperties":false},"PublicBuildRegisterSessionKeyTxResultSchema":{"required":["tx_params"],"type":"object","properties":{"tx_params":{"title":"tx_params","type":"object","description":"Transaction params in dictionary form, same as `TxParams` in `web3.py`","additionalProperties":{}}},"additionalProperties":false},"PrivateCancelTriggerOrderParamsSchema":{"required":["order_id","subaccount_id"],"type":"object","properties":{"order_id":{"title":"order_id","type":"string","format":"uuid"},"subaccount_id":{"title":"subaccount_id","type":"integer"}},"additionalProperties":false},"PrivateCancelTriggerOrderResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PrivateCancelTriggerOrderResultSchema"}},"additionalProperties":false},"PrivateCancelTriggerOrderResultSchema":{"required":["amount","average_price","cancel_reason","creation_timestamp","direction","filled_amount","instrument_name","is_transfer","label","last_update_timestamp","limit_price","max_fee","mmp","nonce","order_fee","order_id","order_status","order_type","quote_id","signature","signature_expiry_sec","signer","subaccount_id","time_in_force"],"type":"object","properties":{"amount":{"title":"amount","type":"string","format":"decimal","description":"Order amount in units of the base"},"average_price":{"title":"average_price","type":"string","format":"decimal","description":"Average fill price"},"cancel_reason":{"title":"cancel_reason","type":"string","enum":["","user_request","mmp_trigger","insufficient_margin","signed_max_fee_too_low","cancel_on_disconnect","ioc_or_market_partial_fill","session_key_deregistered","subaccount_withdrawn","compliance","trigger_failed","validation_failed"],"description":"If cancelled, reason behind order cancellation"},"creation_timestamp":{"title":"creation_timestamp","type":"integer","description":"Creation timestamp (in ms since Unix epoch)"},"direction":{"title":"direction","type":"string","enum":["buy","sell"],"description":"Order direction"},"filled_amount":{"title":"filled_amount","type":"string","format":"decimal","description":"Total filled amount for the order"},"instrument_name":{"title":"instrument_name","type":"string","description":"Instrument name"},"is_transfer":{"title":"is_transfer","type":"boolean","description":"Whether the order was generated through `private/transfer_position`"},"label":{"title":"label","type":"string","description":"Optional user-defined label for the order"},"last_update_timestamp":{"title":"last_update_timestamp","type":"integer","description":"Last update timestamp (in ms since Unix epoch)"},"limit_price":{"title":"limit_price","type":"string","format":"decimal","description":"Limit price in quote currency"},"max_fee":{"title":"max_fee","type":"string","format":"decimal","description":"Max fee in units of the quote currency"},"mmp":{"title":"mmp","type":"boolean","description":"Whether the order is tagged for market maker protections"},"nonce":{"title":"nonce","type":"integer","description":"Unique nonce defined as (e.g. 1695836058725001, where 001 is the random number)"},"order_fee":{"title":"order_fee","type":"string","format":"decimal","description":"Total order fee paid so far"},"order_id":{"title":"order_id","type":"string","description":"Order ID"},"order_status":{"title":"order_status","type":"string","enum":["open","filled","cancelled","expired","untriggered"],"description":"Order status"},"order_type":{"title":"order_type","type":"string","enum":["limit","market"],"description":"Order type"},"quote_id":{"title":"quote_id","type":"string","format":"uuid","default":null,"description":"Quote ID if the trade was executed via RFQ","nullable":true},"replaced_order_id":{"title":"replaced_order_id","type":"string","format":"uuid","default":null,"description":"If replaced, ID of the order that was replaced","nullable":true},"signature":{"title":"signature","type":"string","description":"Ethereum signature of the order"},"signature_expiry_sec":{"title":"signature_expiry_sec","type":"integer","description":"Signature expiry timestamp"},"signer":{"title":"signer","type":"string","description":"Owner wallet address or registered session key that signed order"},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount ID"},"time_in_force":{"title":"time_in_force","type":"string","enum":["gtc","post_only","fok","ioc"],"description":"Time in force"},"trigger_price":{"title":"trigger_price","type":"string","format":"decimal","default":null,"description":"(Required for trigger orders) Index or Market price to trigger order at","nullable":true},"trigger_price_type":{"title":"trigger_price_type","type":"string","default":null,"enum":["mark","index"],"description":"(Required for trigger orders) Trigger with Index or Mark Price","nullable":true},"trigger_reject_message":{"title":"trigger_reject_message","type":"string","default":null,"description":"(Required for trigger orders) Error message if error occured during trigger","nullable":true},"trigger_type":{"title":"trigger_type","type":"string","default":null,"enum":["stoploss","takeprofit"],"description":"(Required for trigger orders) Stop-loss or Take-profit.","nullable":true}},"additionalProperties":false},"PrivateGetOrderParamsSchema":{"required":["order_id","subaccount_id"],"type":"object","properties":{"order_id":{"title":"order_id","type":"string","description":"Order ID"},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount ID"}},"additionalProperties":false},"PrivateGetOrderResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PrivateGetOrderResultSchema"}},"additionalProperties":false},"PrivateGetOrderResultSchema":{"required":["amount","average_price","cancel_reason","creation_timestamp","direction","filled_amount","instrument_name","is_transfer","label","last_update_timestamp","limit_price","max_fee","mmp","nonce","order_fee","order_id","order_status","order_type","quote_id","signature","signature_expiry_sec","signer","subaccount_id","time_in_force"],"type":"object","properties":{"amount":{"title":"amount","type":"string","format":"decimal","description":"Order amount in units of the base"},"average_price":{"title":"average_price","type":"string","format":"decimal","description":"Average fill price"},"cancel_reason":{"title":"cancel_reason","type":"string","enum":["","user_request","mmp_trigger","insufficient_margin","signed_max_fee_too_low","cancel_on_disconnect","ioc_or_market_partial_fill","session_key_deregistered","subaccount_withdrawn","compliance","trigger_failed","validation_failed"],"description":"If cancelled, reason behind order cancellation"},"creation_timestamp":{"title":"creation_timestamp","type":"integer","description":"Creation timestamp (in ms since Unix epoch)"},"direction":{"title":"direction","type":"string","enum":["buy","sell"],"description":"Order direction"},"filled_amount":{"title":"filled_amount","type":"string","format":"decimal","description":"Total filled amount for the order"},"instrument_name":{"title":"instrument_name","type":"string","description":"Instrument name"},"is_transfer":{"title":"is_transfer","type":"boolean","description":"Whether the order was generated through `private/transfer_position`"},"label":{"title":"label","type":"string","description":"Optional user-defined label for the order"},"last_update_timestamp":{"title":"last_update_timestamp","type":"integer","description":"Last update timestamp (in ms since Unix epoch)"},"limit_price":{"title":"limit_price","type":"string","format":"decimal","description":"Limit price in quote currency"},"max_fee":{"title":"max_fee","type":"string","format":"decimal","description":"Max fee in units of the quote currency"},"mmp":{"title":"mmp","type":"boolean","description":"Whether the order is tagged for market maker protections"},"nonce":{"title":"nonce","type":"integer","description":"Unique nonce defined as (e.g. 1695836058725001, where 001 is the random number)"},"order_fee":{"title":"order_fee","type":"string","format":"decimal","description":"Total order fee paid so far"},"order_id":{"title":"order_id","type":"string","description":"Order ID"},"order_status":{"title":"order_status","type":"string","enum":["open","filled","cancelled","expired","untriggered"],"description":"Order status"},"order_type":{"title":"order_type","type":"string","enum":["limit","market"],"description":"Order type"},"quote_id":{"title":"quote_id","type":"string","format":"uuid","default":null,"description":"Quote ID if the trade was executed via RFQ","nullable":true},"replaced_order_id":{"title":"replaced_order_id","type":"string","format":"uuid","default":null,"description":"If replaced, ID of the order that was replaced","nullable":true},"signature":{"title":"signature","type":"string","description":"Ethereum signature of the order"},"signature_expiry_sec":{"title":"signature_expiry_sec","type":"integer","description":"Signature expiry timestamp"},"signer":{"title":"signer","type":"string","description":"Owner wallet address or registered session key that signed order"},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount ID"},"time_in_force":{"title":"time_in_force","type":"string","enum":["gtc","post_only","fok","ioc"],"description":"Time in force"},"trigger_price":{"title":"trigger_price","type":"string","format":"decimal","default":null,"description":"(Required for trigger orders) Index or Market price to trigger order at","nullable":true},"trigger_price_type":{"title":"trigger_price_type","type":"string","default":null,"enum":["mark","index"],"description":"(Required for trigger orders) Trigger with Index or Mark Price","nullable":true},"trigger_reject_message":{"title":"trigger_reject_message","type":"string","default":null,"description":"(Required for trigger orders) Error message if error occured during trigger","nullable":true},"trigger_type":{"title":"trigger_type","type":"string","default":null,"enum":["stoploss","takeprofit"],"description":"(Required for trigger orders) Stop-loss or Take-profit.","nullable":true}},"additionalProperties":false},"PrivateGetWithdrawalHistoryParamsSchema":{"required":["subaccount_id"],"type":"object","properties":{"end_timestamp":{"title":"end_timestamp","type":"integer","default":9223372036854776000,"description":"End timestamp of the event history (default current time)"},"start_timestamp":{"title":"start_timestamp","type":"integer","default":0,"description":"Start timestamp of the event history (default 0)"},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount id"}},"additionalProperties":false},"PrivateGetWithdrawalHistoryResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PrivateGetWithdrawalHistoryResultSchema"}},"additionalProperties":false},"PrivateGetWithdrawalHistoryResultSchema":{"required":["events"],"type":"object","properties":{"events":{"title":"events","type":"array","description":"List of withdrawals","items":{"$ref":"#/components/schemas/WithdrawalSchema"}}},"additionalProperties":false},"WithdrawalSchema":{"required":["amount","asset","error_log","timestamp","tx_hash","tx_status"],"type":"object","properties":{"amount":{"title":"amount","type":"string","format":"decimal","description":"Amount withdrawn by the subaccount"},"asset":{"title":"asset","type":"string","description":"Asset withdrawn"},"error_log":{"title":"error_log","type":"object","default":null,"description":"If failed, error log for reason","additionalProperties":{},"nullable":true},"timestamp":{"title":"timestamp","type":"integer","description":"Timestamp of the withdrawal (in ms since UNIX epoch)"},"tx_hash":{"title":"tx_hash","type":"string","description":"Hash of the transaction that withdrew the funds"},"tx_status":{"title":"tx_status","type":"string","enum":["requested","pending","settled","reverted","ignored","timed_out"],"description":"Status of the transaction that deposited the funds"}},"additionalProperties":false},"PublicGetLiveIncidentsParamsSchema":{"type":"object","properties":{},"additionalProperties":false},"PublicGetLiveIncidentsResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PublicGetLiveIncidentsResultSchema"}},"additionalProperties":false},"PublicGetLiveIncidentsResultSchema":{"required":["incidents"],"type":"object","properties":{"incidents":{"title":"incidents","type":"array","description":"List of ongoing incidents","items":{"$ref":"#/components/schemas/IncidentResponseSchema"}}},"additionalProperties":false},"IncidentResponseSchema":{"required":["creation_timestamp_sec","label","message","monitor_type","severity"],"type":"object","properties":{"creation_timestamp_sec":{"title":"creation_timestamp_sec","type":"integer","description":"Timestamp of incident in UTC sec"},"label":{"title":"label","type":"string","description":"Incident label"},"message":{"title":"message","type":"string","description":"Incident message"},"monitor_type":{"title":"monitor_type","type":"string","enum":["manual","auto"],"description":"Incident trigger type"},"severity":{"title":"severity","type":"string","enum":["low","medium","high"],"description":"Incident severity"}},"additionalProperties":false},"PrivateGetQuotesParamsSchema":{"required":["subaccount_id"],"type":"object","properties":{"from_timestamp":{"title":"from_timestamp","type":"integer","default":0,"description":"Earliest timestamp to filter by (in ms since Unix epoch). If not provied, defaults to 0."},"page":{"title":"page","type":"integer","default":1,"description":"Page number of results to return (default 1, returns last if above `num_pages`)"},"page_size":{"title":"page_size","type":"integer","default":100,"description":"Number of results per page (default 100, max 1000)"},"quote_id":{"title":"quote_id","type":"string","format":"uuid","default":null,"description":"Quote ID filter, if applicable","nullable":true},"rfq_id":{"title":"rfq_id","type":"string","format":"uuid","default":null,"description":"RFQ ID filter, if applicable","nullable":true},"status":{"title":"status","type":"string","default":null,"enum":["open","filled","cancelled","expired"],"description":"Quote status filter, if applicable","nullable":true},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount ID for auth purposes, returned data will be scoped to this subaccount."},"to_timestamp":{"title":"to_timestamp","type":"integer","default":18446744073709552000,"description":"Latest timestamp to filter by (in ms since Unix epoch). If not provied, defaults to returning all data up to current time."}},"additionalProperties":false},"PrivateGetQuotesResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PrivateGetQuotesResultSchema"}},"additionalProperties":false},"PrivateGetQuotesResultSchema":{"required":["pagination","quotes"],"type":"object","properties":{"pagination":{"$ref":"#/components/schemas/PaginationInfoSchema"},"quotes":{"title":"quotes","type":"array","description":"Quotes matching filter criteria","items":{"$ref":"#/components/schemas/QuoteResultSchema"}}},"additionalProperties":false},"PrivateGetPositionsParamsSchema":{"required":["subaccount_id"],"type":"object","properties":{"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount_id"}},"additionalProperties":false},"PrivateGetPositionsResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PrivateGetPositionsResultSchema"}},"additionalProperties":false},"PrivateGetPositionsResultSchema":{"required":["positions","subaccount_id"],"type":"object","properties":{"positions":{"title":"positions","type":"array","description":"All active positions of subaccount","items":{"$ref":"#/components/schemas/PositionResponseSchema"}},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount_id"}},"additionalProperties":false},"PrivateGetOptionSettlementHistoryParamsSchema":{"required":["subaccount_id"],"type":"object","properties":{"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount ID for which to get expired option settlement history"}},"additionalProperties":false},"PrivateGetOptionSettlementHistoryResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PrivateGetOptionSettlementHistoryResultSchema"}},"additionalProperties":false},"PrivateGetOptionSettlementHistoryResultSchema":{"required":["settlements","subaccount_id"],"type":"object","properties":{"settlements":{"title":"settlements","type":"array","description":"List of expired option settlements","items":{"$ref":"#/components/schemas/OptionSettlementResponseSchema"}},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount_id for which to get expired option settlement history"}},"additionalProperties":false},"OptionSettlementResponseSchema":{"required":["amount","expiry","instrument_name","option_settlement_pnl","option_settlement_pnl_excl_fees","settlement_price","subaccount_id"],"type":"object","properties":{"amount":{"title":"amount","type":"string","format":"decimal","description":"Amount that was settled"},"expiry":{"title":"expiry","type":"integer","description":"Expiry timestamp of the option"},"instrument_name":{"title":"instrument_name","type":"string","description":"Instrument name"},"option_settlement_pnl":{"title":"option_settlement_pnl","type":"string","format":"decimal","description":"USD profit or loss from option settlements calculated as: settlement value - (average cost including fees x amount)"},"option_settlement_pnl_excl_fees":{"title":"option_settlement_pnl_excl_fees","type":"string","format":"decimal","description":"USD profit or loss from option settlements calculated as: settlement value - (average price excluding fees x amount)"},"settlement_price":{"title":"settlement_price","type":"string","format":"decimal","description":"Price of option settlement"},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount ID of the settlement event"}},"additionalProperties":false},"PublicDeregisterSessionKeyParamsSchema":{"required":["public_session_key","signed_raw_tx","wallet"],"type":"object","properties":{"public_session_key":{"title":"public_session_key","type":"string","description":"Session key in the form of an Ethereum EOA"},"signed_raw_tx":{"title":"signed_raw_tx","type":"string","description":"A signed RLP encoded ETH transaction in form of a hex string (same as `w3.eth.account.sign_transaction(unsigned_tx, private_key).rawTransaction.hex()`)"},"wallet":{"title":"wallet","type":"string","description":"Ethereum wallet address of account"}},"additionalProperties":false},"PublicDeregisterSessionKeyResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PublicDeregisterSessionKeyResultSchema"}},"additionalProperties":false},"PublicDeregisterSessionKeyResultSchema":{"required":["public_session_key","transaction_id"],"type":"object","properties":{"public_session_key":{"title":"public_session_key","type":"string","description":"Session key in the form of an Ethereum EOA"},"transaction_id":{"title":"transaction_id","type":"string","format":"uuid","description":"ID to lookup status of transaction"}},"additionalProperties":false},"PublicGetVaultShareParamsSchema":{"required":["from_timestamp_sec","to_timestamp_sec","vault_name"],"type":"object","properties":{"from_timestamp_sec":{"title":"from_timestamp_sec","type":"integer","description":"From timestamp in seconds"},"page":{"title":"page","type":"integer","default":1,"description":"Page number of results to return (default 1, returns last if above `num_pages`)"},"page_size":{"title":"page_size","type":"integer","default":100,"description":"Number of results per page (default 100, max 1000)"},"to_timestamp_sec":{"title":"to_timestamp_sec","type":"integer","description":"To timestamp in seconds"},"vault_name":{"title":"vault_name","type":"string","description":"Name of the vault"}},"additionalProperties":false},"PublicGetVaultShareResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PublicGetVaultShareResultSchema"}},"additionalProperties":false},"PublicGetVaultShareResultSchema":{"required":["pagination","vault_shares"],"type":"object","properties":{"pagination":{"$ref":"#/components/schemas/PaginationInfoSchema"},"vault_shares":{"title":"vault_shares","type":"array","description":"List of vault history shares, recent first","items":{"$ref":"#/components/schemas/VaultShareResponseSchema"}}},"additionalProperties":false},"VaultShareResponseSchema":{"required":["base_value","block_number","block_timestamp","underlying_value","usd_value"],"type":"object","properties":{"base_value":{"title":"base_value","type":"string","format":"decimal","description":"The value of the vault's token against the base currency. Ex: rswETHC vs rswETH"},"block_number":{"title":"block_number","type":"integer","description":"The Derive chain block number"},"block_timestamp":{"title":"block_timestamp","type":"integer","description":"Timestamp of the Derive chain block number"},"underlying_value":{"title":"underlying_value","type":"string","format":"decimal","default":null,"description":"The value of the vault's token against the underlying currency. Ex: rswETHC vs ETH","nullable":true},"usd_value":{"title":"usd_value","type":"string","format":"decimal","description":"The value of the vault's token against USD"}},"additionalProperties":false},"PrivateExpiredAndCancelledHistoryParamsSchema":{"required":["end_timestamp","expiry","start_timestamp","subaccount_id","wallet"],"type":"object","properties":{"end_timestamp":{"title":"end_timestamp","type":"integer","description":"End Unix timestamp"},"expiry":{"title":"expiry","type":"integer","description":"Expiry of download link in seconds. Maximum of 604800."},"start_timestamp":{"title":"start_timestamp","type":"integer","description":"Start Unix timestamp"},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount to download data for"},"wallet":{"title":"wallet","type":"string","description":"Wallet to download data for"}},"additionalProperties":false},"PrivateExpiredAndCancelledHistoryResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PrivateExpiredAndCancelledHistoryResultSchema"}},"additionalProperties":false},"PrivateExpiredAndCancelledHistoryResultSchema":{"required":["presigned_urls"],"type":"object","properties":{"presigned_urls":{"title":"presigned_urls","type":"array","description":"List of presigned URLs to the snapshots","items":{"title":"presigned_urls","type":"string"}}},"additionalProperties":false},"PrivateEditSessionKeyParamsSchema":{"required":["public_session_key","wallet"],"type":"object","properties":{"disable":{"title":"disable","type":"boolean","default":false,"description":"Flag whether or not to disable to session key. Defaulted to false. Only allowed for non-admin keys. Admin keys must go through `/deregister_session_key` for now."},"ip_whitelist":{"title":"ip_whitelist","type":"array","default":null,"description":"Optional list of whitelisted IPs, an empty list can be supplied to whitelist all IPs","items":{"title":"ip_whitelist","type":"string"},"nullable":true},"label":{"title":"label","type":"string","default":null,"description":"Optional new label for the session key","nullable":true},"public_session_key":{"title":"public_session_key","type":"string","description":"Session key in the form of an Ethereum EOA"},"wallet":{"title":"wallet","type":"string","description":"Ethereum wallet address of account"}},"additionalProperties":false},"PrivateEditSessionKeyResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PrivateEditSessionKeyResultSchema"}},"additionalProperties":false},"PrivateEditSessionKeyResultSchema":{"required":["expiry_sec","ip_whitelist","label","public_session_key","scope"],"type":"object","properties":{"expiry_sec":{"title":"expiry_sec","type":"integer","description":"Session key expiry timestamp in sec"},"ip_whitelist":{"title":"ip_whitelist","type":"array","description":"List of whitelisted IPs, if empty then any IP is allowed.","items":{"title":"ip_whitelist","type":"string"}},"label":{"title":"label","type":"string","description":"User-defined session key label"},"public_session_key":{"title":"public_session_key","type":"string","description":"Public session key address (Ethereum EOA)"},"scope":{"title":"scope","type":"string","description":"Session key permission level scope"}},"additionalProperties":false},"PublicGetAllCurrenciesParamsSchema":{"type":"object","properties":{},"additionalProperties":false},"PublicGetAllCurrenciesResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"title":"result","type":"array","description":"","items":{"$ref":"#/components/schemas/CurrencyDetailedResponseSchema"}}},"additionalProperties":false},"CurrencyDetailedResponseSchema":{"required":["asset_cap_and_supply_per_manager","borrow_apy","currency","instrument_types","managers","market_type","pm2_collateral_discounts","protocol_asset_addresses","spot_price","srm_im_discount","srm_mm_discount","supply_apy","total_borrow","total_supply"],"type":"object","properties":{"asset_cap_and_supply_per_manager":{"title":"asset_cap_and_supply_per_manager","type":"object","description":"Current open interest and open interest cap by manager and asset type","additionalProperties":{"title":"asset_cap_and_supply_per_manager","type":"object","additionalProperties":{"title":"asset_cap_and_supply_per_manager","type":"array","items":{"$ref":"#/components/schemas/OpenInterestStatsSchema"}}}},"borrow_apy":{"title":"borrow_apy","type":"string","format":"decimal","description":"Borrow APY (only for USDC)"},"currency":{"title":"currency","type":"string","description":"Underlying currency of asset (`ETH`, `BTC`, etc)"},"instrument_types":{"title":"instrument_types","type":"array","description":"Instrument types supported for the currency","items":{"title":"instrument_types","type":"string","enum":["erc20","option","perp"]}},"managers":{"title":"managers","type":"array","description":"Managers supported for the currency","items":{"$ref":"#/components/schemas/ManagerContractResponseSchema"}},"market_type":{"title":"market_type","type":"string","enum":["ALL","SRM_BASE_ONLY","SRM_OPTION_ONLY","SRM_PERP_ONLY","CASH"],"description":"Market type of the currency"},"pm2_collateral_discounts":{"title":"pm2_collateral_discounts","type":"array","description":"Initial and Maintenance Margin discounts for given collateral in PM2","items":{"$ref":"#/components/schemas/PM2CollateralDiscountsSchema"}},"protocol_asset_addresses":{"$ref":"#/components/schemas/ProtocolAssetAddressesSchema"},"spot_price":{"title":"spot_price","type":"string","format":"decimal","description":"Spot price of the currency"},"spot_price_24h":{"title":"spot_price_24h","type":"string","format":"decimal","default":null,"description":"Spot price of the currency 24 hours ago","nullable":true},"srm_im_discount":{"title":"srm_im_discount","type":"string","format":"decimal","description":"Initial Margin discount for given collateral in Standard Manager (e.g. LTV). Only the Standard Manager supports non-USDC collateral"},"srm_mm_discount":{"title":"srm_mm_discount","type":"string","format":"decimal","description":"Maintenance Margin discount for given collateral in Standard Manager (e.g. liquidation threshold). Only the Standard Manager supports non-USDC collateral"},"supply_apy":{"title":"supply_apy","type":"string","format":"decimal","description":"Supply APY (only for USDC)"},"total_borrow":{"title":"total_borrow","type":"string","format":"decimal","description":"Total collateral borrowed in the protocol (only USDC is borrowable)"},"total_supply":{"title":"total_supply","type":"string","format":"decimal","description":"Total collateral supplied in the protocol"}},"additionalProperties":false},"PrivateCancelByLabelParamsSchema":{"required":["label","subaccount_id"],"type":"object","properties":{"instrument_name":{"title":"instrument_name","type":"string","default":null,"description":"Instrument name. If not provided, all orders for all instruments with the label will be cancelled. If provided, request counts as a regular matching request for ratelimit purposes.","nullable":true},"label":{"title":"label","type":"string","description":"Cancel all orders for this label"},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount ID"}},"additionalProperties":false},"PrivateCancelByLabelResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PrivateCancelByLabelResultSchema"}},"additionalProperties":false},"PrivateCancelByLabelResultSchema":{"required":["cancelled_orders"],"type":"object","properties":{"cancelled_orders":{"title":"cancelled_orders","type":"integer","description":"Number of cancelled orders"}},"additionalProperties":false},"PublicWithdrawDebugParamsSchema":{"required":["amount","asset_name","nonce","signature_expiry_sec","signer","subaccount_id"],"type":"object","properties":{"amount":{"title":"amount","type":"string","format":"decimal","description":"Amount of the asset to withdraw"},"asset_name":{"title":"asset_name","type":"string","description":"Name of asset to withdraw"},"is_atomic_signing":{"title":"is_atomic_signing","type":"boolean","default":false,"description":"Used by vaults to determine whether the signature is an EIP-1271 signature"},"nonce":{"title":"nonce","type":"integer","description":"Unique nonce defined as (e.g. 1695836058725001, where 001 is the random number)"},"signature_expiry_sec":{"title":"signature_expiry_sec","type":"integer","description":"Unix timestamp in seconds. Expiry MUST be >5min from now"},"signer":{"title":"signer","type":"string","description":"Ethereum wallet address that is signing the withdraw"},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount_id"}},"additionalProperties":false},"PublicWithdrawDebugResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PublicWithdrawDebugResultSchema"}},"additionalProperties":false},"PublicWithdrawDebugResultSchema":{"required":["action_hash","encoded_data","encoded_data_hashed","typed_data_hash"],"type":"object","properties":{"action_hash":{"title":"action_hash","type":"string","description":"Keccak hashed action data"},"encoded_data":{"title":"encoded_data","type":"string","description":"ABI encoded deposit data"},"encoded_data_hashed":{"title":"encoded_data_hashed","type":"string","description":"Keccak hashed encoded_data"},"typed_data_hash":{"title":"typed_data_hash","type":"string","description":"EIP 712 typed data hash"}},"additionalProperties":false},"PublicGetMarginParamsSchema":{"required":["margin_type","simulated_collaterals","simulated_positions"],"type":"object","properties":{"margin_type":{"title":"margin_type","type":"string","enum":["PM","SM","PM2"],"description":"`PM` (Portfolio Margin), `PM2 (Portfolio Margin 2), or `SM` (Standard Margin))"},"market":{"title":"market","type":"string","default":null,"description":"Must be defined for Portfolio Margin","nullable":true},"simulated_collateral_changes":{"title":"simulated_collateral_changes","type":"array","default":null,"description":"Optional, add collaterals to simulate deposits / withdrawals / spot trades","items":{"$ref":"#/components/schemas/SimulatedCollateralSchema"},"nullable":true},"simulated_collaterals":{"title":"simulated_collaterals","type":"array","description":"List of collaterals in a simulated portfolio","items":{"$ref":"#/components/schemas/SimulatedCollateralSchema"}},"simulated_position_changes":{"title":"simulated_position_changes","type":"array","default":null,"description":"Optional, add positions to simulate perp / option trades","items":{"$ref":"#/components/schemas/SimulatedPositionSchema"},"nullable":true},"simulated_positions":{"title":"simulated_positions","type":"array","description":"List of positions in a simulated portfolio","items":{"$ref":"#/components/schemas/SimulatedPositionSchema"}}},"additionalProperties":false},"PublicGetMarginResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PublicGetMarginResultSchema"}},"additionalProperties":false},"PublicGetMarginResultSchema":{"required":["is_valid_trade","post_initial_margin","post_maintenance_margin","pre_initial_margin","pre_maintenance_margin","subaccount_id"],"type":"object","properties":{"is_valid_trade":{"title":"is_valid_trade","type":"boolean","description":"True if trade passes margin requirement"},"post_initial_margin":{"title":"post_initial_margin","type":"string","format":"decimal","description":"Initial margin requirement post trade"},"post_maintenance_margin":{"title":"post_maintenance_margin","type":"string","format":"decimal","description":"Maintenance margin requirement post trade"},"pre_initial_margin":{"title":"pre_initial_margin","type":"string","format":"decimal","description":"Initial margin requirement before trade"},"pre_maintenance_margin":{"title":"pre_maintenance_margin","type":"string","format":"decimal","description":"Maintenance margin requirement before trade"},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount_id"}},"additionalProperties":false},"PrivateGetSubaccountsParamsSchema":{"required":["wallet"],"type":"object","properties":{"wallet":{"title":"wallet","type":"string","description":"Ethereum wallet address of account"}},"additionalProperties":false},"PrivateGetSubaccountsResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PrivateGetSubaccountsResultSchema"}},"additionalProperties":false},"PrivateGetSubaccountsResultSchema":{"required":["subaccount_ids","wallet"],"type":"object","properties":{"subaccount_ids":{"title":"subaccount_ids","type":"array","description":"List of subaccount_ids owned by the wallet in `SubAccounts.sol`","items":{"title":"subaccount_ids","type":"integer"}},"wallet":{"title":"wallet","type":"string","description":"Ethereum wallet address"}},"additionalProperties":false},"PrivatePollRfqsParamsSchema":{"required":["subaccount_id"],"type":"object","properties":{"from_timestamp":{"title":"from_timestamp","type":"integer","default":0,"description":"Earliest `last_update_timestamp` to filter by (in ms since Unix epoch). If not provied, defaults to 0."},"page":{"title":"page","type":"integer","default":1,"description":"Page number of results to return (default 1, returns last if above `num_pages`)"},"page_size":{"title":"page_size","type":"integer","default":100,"description":"Number of results per page (default 100, max 1000)"},"rfq_id":{"title":"rfq_id","type":"string","format":"uuid","default":null,"description":"RFQ ID filter, if applicable","nullable":true},"rfq_subaccount_id":{"title":"rfq_subaccount_id","type":"integer","default":null,"description":"Filter returned RFQs by rfq requestor subaccount","nullable":true},"status":{"title":"status","type":"string","default":null,"enum":["open","filled","cancelled","expired"],"description":"RFQ status filter, if applicable","nullable":true},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount ID for auth purposes, returned data will be scoped to this subaccount."},"to_timestamp":{"title":"to_timestamp","type":"integer","default":18446744073709552000,"description":"Latest `last_update_timestamp` to filter by (in ms since Unix epoch). If not provied, defaults to returning all data up to current time."}},"additionalProperties":false},"PrivatePollRfqsResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PrivatePollRfqsResultSchema"}},"additionalProperties":false},"PrivatePollRfqsResultSchema":{"required":["pagination","rfqs"],"type":"object","properties":{"pagination":{"$ref":"#/components/schemas/PaginationInfoSchema"},"rfqs":{"title":"rfqs","type":"array","description":"RFQs matching filter criteria","items":{"$ref":"#/components/schemas/RFQResultPublicSchema"}}},"additionalProperties":false},"RFQResultPublicSchema":{"required":["cancel_reason","creation_timestamp","filled_direction","filled_pct","last_update_timestamp","legs","partial_fill_step","rfq_id","status","subaccount_id","total_cost","valid_until"],"type":"object","properties":{"cancel_reason":{"title":"cancel_reason","type":"string","enum":["","user_request","insufficient_margin","signed_max_fee_too_low","mmp_trigger","cancel_on_disconnect","session_key_deregistered","subaccount_withdrawn","rfq_no_longer_open","compliance"],"description":"Cancel reason, if any"},"creation_timestamp":{"title":"creation_timestamp","type":"integer","description":"Creation timestamp in ms since Unix epoch"},"filled_direction":{"title":"filled_direction","type":"string","default":null,"enum":["buy","sell"],"description":"Direction at which the RFQ was filled (only if filled)","nullable":true},"filled_pct":{"title":"filled_pct","type":"string","format":"decimal","description":"Percentage of the RFQ that has been filled, from 0 to 1."},"last_update_timestamp":{"title":"last_update_timestamp","type":"integer","description":"Last update timestamp in ms since Unix epoch"},"legs":{"title":"legs","type":"array","description":"RFQ legs","items":{"$ref":"#/components/schemas/LegUnpricedSchema"}},"partial_fill_step":{"title":"partial_fill_step","type":"string","format":"decimal","description":"Step size for partial fills (default: 1)"},"rfq_id":{"title":"rfq_id","type":"string","format":"uuid","description":"RFQ ID"},"status":{"title":"status","type":"string","enum":["open","filled","cancelled","expired"],"description":"Status"},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount ID"},"total_cost":{"title":"total_cost","type":"string","format":"decimal","default":null,"description":"Total cost for the RFQ (only if filled)","nullable":true},"valid_until":{"title":"valid_until","type":"integer","description":"RFQ expiry timestamp in ms since Unix epoch"}},"additionalProperties":false},"LegUnpricedSchema":{"required":["amount","direction","instrument_name"],"type":"object","properties":{"amount":{"title":"amount","type":"string","format":"decimal","description":"Amount in units of the base"},"direction":{"title":"direction","type":"string","enum":["buy","sell"],"description":"Leg direction"},"instrument_name":{"title":"instrument_name","type":"string","description":"Instrument name"}},"additionalProperties":false},"PrivateWithdrawParamsSchema":{"required":["amount","asset_name","nonce","signature","signature_expiry_sec","signer","subaccount_id"],"type":"object","properties":{"amount":{"title":"amount","type":"string","format":"decimal","description":"Amount of the asset to withdraw"},"asset_name":{"title":"asset_name","type":"string","description":"Name of asset to withdraw"},"is_atomic_signing":{"title":"is_atomic_signing","type":"boolean","default":false,"description":"Used by vaults to determine whether the signature is an EIP-1271 signature"},"nonce":{"title":"nonce","type":"integer","description":"Unique nonce defined as (e.g. 1695836058725001, where 001 is the random number)"},"signature":{"title":"signature","type":"string","description":"Ethereum signature of the withdraw"},"signature_expiry_sec":{"title":"signature_expiry_sec","type":"integer","description":"Unix timestamp in seconds. Expiry MUST be >5min from now"},"signer":{"title":"signer","type":"string","description":"Ethereum wallet address that is signing the withdraw"},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount_id"}},"additionalProperties":false},"PrivateWithdrawResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PrivateWithdrawResultSchema"}},"additionalProperties":false},"PrivateWithdrawResultSchema":{"required":["status","transaction_id"],"type":"object","properties":{"status":{"title":"status","type":"string","description":"`requested`"},"transaction_id":{"title":"transaction_id","type":"string","format":"uuid","description":"Transaction id of the withdrawal"}},"additionalProperties":false},"PrivateUpdateNotificationsParamsSchema":{"required":["notification_ids","subaccount_id"],"type":"object","properties":{"notification_ids":{"title":"notification_ids","type":"array","description":"List of notification IDs to be marked as seen","items":{"title":"notification_ids","type":"integer"}},"status":{"title":"status","type":"string","default":"seen","enum":["unseen","seen","hidden"],"description":"Status of the notification"},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount_id"}},"additionalProperties":false},"PrivateUpdateNotificationsResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PrivateUpdateNotificationsResultSchema"}},"additionalProperties":false},"PrivateUpdateNotificationsResultSchema":{"required":["updated_count"],"type":"object","properties":{"updated_count":{"title":"updated_count","type":"integer","description":"Number of notifications marked as seen"}},"additionalProperties":false},"PrivateSetCancelOnDisconnectParamsSchema":{"required":["enabled","wallet"],"type":"object","properties":{"enabled":{"title":"enabled","type":"boolean","description":"Whether to enable or disable cancel on disconnect"},"wallet":{"title":"wallet","type":"string","description":"Public key (wallet) of the account"}},"additionalProperties":false},"PrivateSetCancelOnDisconnectResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"title":"result","type":"string","enum":["ok"],"description":""}},"additionalProperties":false},"PrivateGetTradeHistoryParamsSchema":{"type":"object","properties":{"from_timestamp":{"title":"from_timestamp","type":"integer","default":0,"description":"Earliest timestamp to filter by (in ms since Unix epoch). If not provied, defaults to 0."},"instrument_name":{"title":"instrument_name","type":"string","default":null,"description":"Instrument name to filter by","nullable":true},"order_id":{"title":"order_id","type":"string","default":null,"description":"Order id to filter by","nullable":true},"page":{"title":"page","type":"integer","default":1,"description":"Page number of results to return (default 1, returns last if above `num_pages`)"},"page_size":{"title":"page_size","type":"integer","default":100,"description":"Number of results per page (default 100, max 1000)"},"quote_id":{"title":"quote_id","type":"string","default":null,"description":"If supplied, quote id to filter by. Supports either a concrete UUID, or `is_quote` and `is_not_quote` enum","nullable":true},"subaccount_id":{"title":"subaccount_id","type":"integer","default":null,"description":"Subaccount_id (must be set if wallet is blank)","nullable":true},"to_timestamp":{"title":"to_timestamp","type":"integer","default":18446744073709552000,"description":"Latest timestamp to filter by (in ms since Unix epoch). If not provied, defaults to returning all data up to current time."},"wallet":{"title":"wallet","type":"string","default":null,"description":"Wallet address (if set, subaccount_id ignored)","nullable":true}},"additionalProperties":false},"PrivateGetTradeHistoryResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PrivateGetTradeHistoryResultSchema"}},"additionalProperties":false},"PrivateGetTradeHistoryResultSchema":{"required":["pagination","subaccount_id","trades"],"type":"object","properties":{"pagination":{"$ref":"#/components/schemas/PaginationInfoSchema"},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount ID requested, or 0 if not provided"},"trades":{"title":"trades","type":"array","description":"List of trades","items":{"$ref":"#/components/schemas/TradeResponseSchema"}}},"additionalProperties":false},"PrivateOrderParamsSchema":{"required":["amount","direction","instrument_name","limit_price","max_fee","nonce","signature","signature_expiry_sec","signer","subaccount_id"],"type":"object","properties":{"amount":{"title":"amount","type":"string","format":"decimal","description":"Order amount in units of the base"},"direction":{"title":"direction","type":"string","enum":["buy","sell"],"description":"Order direction"},"instrument_name":{"title":"instrument_name","type":"string","description":"Instrument name"},"is_atomic_signing":{"title":"is_atomic_signing","type":"boolean","default":false,"description":"Used by vaults to determine whether the signature is an EIP-1271 signature.","nullable":true},"label":{"title":"label","type":"string","default":"","description":"Optional user-defined label for the order"},"limit_price":{"title":"limit_price","type":"string","format":"decimal","description":"Limit price in quote currency.
This field is still required for market orders because it is a component of the signature. However, market orders will not leave a resting order in the book in case of a partial fill."},"max_fee":{"title":"max_fee","type":"string","format":"decimal","description":"Max fee per unit of volume, denominated in units of the quote currency (usually USDC).Order will be rejected if the supplied max fee is below the estimated fee for this order."},"mmp":{"title":"mmp","type":"boolean","default":false,"description":"Whether the order is tagged for market maker protections (default false)"},"nonce":{"title":"nonce","type":"integer","description":"Unique nonce defined as (e.g. 1695836058725001, where 001 is the random number).Note, using a random number beyond 3 digits will cause JSON serialization to fail."},"order_type":{"title":"order_type","type":"string","default":"limit","enum":["limit","market"],"description":"Order type:
- `limit`: limit order (default)
- `market`: market order, note that limit_price is still required for market orders, but unfilled order portion will be marked as cancelled"},"reduce_only":{"title":"reduce_only","type":"boolean","default":false,"description":"If true, the order will not be able to increase position's size (default false). If the order amount exceeds available position size, the order will be filled up to the position size and the remainder will be cancelled. This flag is only supported for market orders or non-resting limit orders (IOC or FOK)"},"referral_code":{"title":"referral_code","type":"string","default":"","description":"Optional referral code for the order"},"reject_timestamp":{"title":"reject_timestamp","type":"integer","default":9223372036854776000,"description":"UTC timestamp in ms, if provided the matching engine will reject the order with an error if `reject_timestamp` < `server_time`. Note that the timestamp must be consistent with the server time: use `public/get_time` method to obtain current server time."},"signature":{"title":"signature","type":"string","description":"Ethereum signature of the order"},"signature_expiry_sec":{"title":"signature_expiry_sec","type":"integer","description":"Unix timestamp in seconds. Order signature becomes invalid after this time, and the system will cancel the order.Expiry MUST be at least 5 min from now."},"signer":{"title":"signer","type":"string","description":"Owner wallet address or registered session key that signed order"},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount ID"},"time_in_force":{"title":"time_in_force","type":"string","default":"gtc","enum":["gtc","post_only","fok","ioc"],"description":"Time in force behaviour:
- `gtc`: good til cancelled (default)
- `post_only`: a limit order that will be rejected if it crosses any order in the book, i.e. acts as a taker order
- `fok`: fill or kill, will be rejected if it is not fully filled
- `ioc`: immediate or cancel, fill at best bid/ask (market) or at limit price (limit), the unfilled portion is cancelled
Note that the order will still expire on the `signature_expiry_sec` timestamp."},"trigger_price":{"title":"trigger_price","type":"string","format":"decimal","default":null,"description":"(Required for trigger orders) \"index\" or \"mark\" price to trigger order at","nullable":true},"trigger_price_type":{"title":"trigger_price_type","type":"string","default":null,"enum":["mark","index"],"description":"(Required for trigger orders) Trigger with \"mark\" price as \"index\" price type not supported yet.","nullable":true},"trigger_type":{"title":"trigger_type","type":"string","default":null,"enum":["stoploss","takeprofit"],"description":"(Required for trigger orders) \"stoploss\" or \"takeprofit\"","nullable":true}},"additionalProperties":false},"PrivateOrderResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PrivateOrderResultSchema"}},"additionalProperties":false},"PrivateOrderResultSchema":{"required":["order","trades"],"type":"object","properties":{"order":{"$ref":"#/components/schemas/OrderResponseSchema"},"trades":{"title":"trades","type":"array","items":{"$ref":"#/components/schemas/TradeResponseSchema"}}},"additionalProperties":false},"PublicGetInterestRateHistoryParamsSchema":{"required":["from_timestamp_sec","to_timestamp_sec"],"type":"object","properties":{"from_timestamp_sec":{"title":"from_timestamp_sec","type":"integer","description":"From timestamp in seconds"},"page":{"title":"page","type":"integer","default":1,"description":"Page number of results to return (default 1, returns last if above `num_pages`)"},"page_size":{"title":"page_size","type":"integer","default":100,"description":"Number of results per page (default 100, max 1000)"},"to_timestamp_sec":{"title":"to_timestamp_sec","type":"integer","description":"To timestamp in seconds"}},"additionalProperties":false},"PublicGetInterestRateHistoryResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PublicGetInterestRateHistoryResultSchema"}},"additionalProperties":false},"PublicGetInterestRateHistoryResultSchema":{"required":["interest_rates","pagination"],"type":"object","properties":{"interest_rates":{"title":"interest_rates","type":"array","description":"List of interest rates, recent first","items":{"$ref":"#/components/schemas/InterestRateHistoryResponseSchema"}},"pagination":{"$ref":"#/components/schemas/PaginationInfoSchema"}},"additionalProperties":false},"InterestRateHistoryResponseSchema":{"required":["block","borrow_apy","supply_apy","timestamp_sec","total_borrow","total_supply"],"type":"object","properties":{"block":{"title":"block","type":"integer","description":"Derive Chain block number"},"borrow_apy":{"title":"borrow_apy","type":"string","format":"decimal","description":"Borrow APY"},"supply_apy":{"title":"supply_apy","type":"string","format":"decimal","description":"Supply APY"},"timestamp_sec":{"title":"timestamp_sec","type":"integer","description":"Timestamp in seconds"},"total_borrow":{"title":"total_borrow","type":"string","format":"decimal","description":"Total USDC borrowed"},"total_supply":{"title":"total_supply","type":"string","format":"decimal","description":"Total USDC supplied"}},"additionalProperties":false},"PublicGetOptionSettlementHistoryParamsSchema":{"type":"object","properties":{"page":{"title":"page","type":"integer","default":1,"description":"Page number of results to return (default 1, returns last if above `num_pages`)"},"page_size":{"title":"page_size","type":"integer","default":100,"description":"Number of results per page (default 100, max 1000)"},"subaccount_id":{"title":"subaccount_id","type":"integer","default":null,"description":"Subaccount ID filter (defaults to all if not provided)","nullable":true}},"additionalProperties":false},"PublicGetOptionSettlementHistoryResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PublicGetOptionSettlementHistoryResultSchema"}},"additionalProperties":false},"PublicGetOptionSettlementHistoryResultSchema":{"required":["pagination","settlements"],"type":"object","properties":{"pagination":{"$ref":"#/components/schemas/PaginationInfoSchema"},"settlements":{"title":"settlements","type":"array","description":"List of expired option settlements","items":{"$ref":"#/components/schemas/OptionSettlementResponseSchema"}}},"additionalProperties":false},"PublicGetMakerProgramScoresParamsSchema":{"required":["epoch_start_timestamp","program_name"],"type":"object","properties":{"epoch_start_timestamp":{"title":"epoch_start_timestamp","type":"integer","description":"Start timestamp of the program epoch"},"program_name":{"title":"program_name","type":"string","description":"Program name"}},"additionalProperties":false},"PublicGetMakerProgramScoresResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PublicGetMakerProgramScoresResultSchema"}},"additionalProperties":false},"PublicGetMakerProgramScoresResultSchema":{"required":["program","scores","total_score","total_volume"],"type":"object","properties":{"program":{"$ref":"#/components/schemas/ProgramResponseSchema"},"scores":{"title":"scores","type":"array","description":"Scores breakdown of the program by market maker","items":{"$ref":"#/components/schemas/ScoreBreakdownSchema"}},"total_score":{"title":"total_score","type":"string","format":"decimal","description":"Total score across all market makers for the epoch"},"total_volume":{"title":"total_volume","type":"string","format":"decimal","description":"Total volume across all market makers for the epoch"}},"additionalProperties":false},"ScoreBreakdownSchema":{"required":["coverage_score","holder_boost","quality_score","total_score","volume","volume_multiplier","wallet"],"type":"object","properties":{"coverage_score":{"title":"coverage_score","type":"string","format":"decimal","description":"Coverag component of the score of the account for this program"},"holder_boost":{"title":"holder_boost","type":"string","format":"decimal","description":"A custom account multiplier for the score due to holding tokens"},"quality_score":{"title":"quality_score","type":"string","format":"decimal","description":"Quality component of the score of the account for this program"},"total_score":{"title":"total_score","type":"string","format":"decimal","description":"Total score of the account for this program"},"volume":{"title":"volume","type":"string","format":"decimal","description":"Volume traded by the account for this epoch"},"volume_multiplier":{"title":"volume_multiplier","type":"string","format":"decimal","description":"Multiplier for the volume traded by the account"},"wallet":{"title":"wallet","type":"string","description":"Wallet address of the account"}},"additionalProperties":false},"PrivateGetOrdersParamsSchema":{"required":["subaccount_id"],"type":"object","properties":{"instrument_name":{"title":"instrument_name","type":"string","default":null,"description":"Filter by instrument name","nullable":true},"label":{"title":"label","type":"string","default":null,"description":"Filter by label","nullable":true},"page":{"title":"page","type":"integer","default":1,"description":"Page number of results to return (default 1, returns last if above `num_pages`)"},"page_size":{"title":"page_size","type":"integer","default":100,"description":"Number of results per page (default 100, max 1000)"},"status":{"title":"status","type":"string","default":null,"enum":["open","filled","cancelled","expired","untriggered"],"description":"Filter by order status","nullable":true},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount_id for which to get open orders"}},"additionalProperties":false},"PrivateGetOrdersResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PrivateGetOrdersResultSchema"}},"additionalProperties":false},"PrivateGetOrdersResultSchema":{"required":["orders","pagination","subaccount_id"],"type":"object","properties":{"orders":{"title":"orders","type":"array","description":"List of open orders","items":{"$ref":"#/components/schemas/OrderResponseSchema"}},"pagination":{"$ref":"#/components/schemas/PaginationInfoSchema"},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount_id for which to get open orders"}},"additionalProperties":false},"PublicGetTickerParamsSchema":{"required":["instrument_name"],"type":"object","properties":{"instrument_name":{"title":"instrument_name","type":"string","description":"Instrument name"}},"additionalProperties":false},"PublicGetTickerResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PublicGetTickerResultSchema"}},"additionalProperties":false},"PublicGetTickerResultSchema":{"required":["amount_step","base_asset_address","base_asset_sub_id","base_currency","base_fee","best_ask_amount","best_ask_price","best_bid_amount","best_bid_price","erc20_details","fifo_min_allocation","five_percent_ask_depth","five_percent_bid_depth","index_price","instrument_name","instrument_type","is_active","maker_fee_rate","mark_price","max_price","maximum_amount","min_price","minimum_amount","open_interest","option_details","option_pricing","perp_details","pro_rata_amount_step","pro_rata_fraction","quote_currency","scheduled_activation","scheduled_deactivation","stats","taker_fee_rate","tick_size","timestamp"],"type":"object","properties":{"amount_step":{"title":"amount_step","type":"string","format":"decimal","description":"Minimum valid increment of order amount"},"base_asset_address":{"title":"base_asset_address","type":"string","description":"Blockchain address of the base asset"},"base_asset_sub_id":{"title":"base_asset_sub_id","type":"string","description":"Sub ID of the specific base asset as defined in Asset.sol"},"base_currency":{"title":"base_currency","type":"string","description":"Underlying currency of base asset (`ETH`, `BTC`, etc)"},"base_fee":{"title":"base_fee","type":"string","format":"decimal","description":"$ base fee added to every taker order"},"best_ask_amount":{"title":"best_ask_amount","type":"string","format":"decimal","description":"Amount of contracts / tokens available at best ask price"},"best_ask_price":{"title":"best_ask_price","type":"string","format":"decimal","description":"Best ask price"},"best_bid_amount":{"title":"best_bid_amount","type":"string","format":"decimal","description":"Amount of contracts / tokens available at best bid price"},"best_bid_price":{"title":"best_bid_price","type":"string","format":"decimal","description":"Best bid price"},"erc20_details":{"$ref":"#/components/schemas/ERC20PublicDetailsSchema","nullable":true},"fifo_min_allocation":{"title":"fifo_min_allocation","type":"string","format":"decimal","description":"Minimum number of contracts that get filled using FIFO. Actual number of contracts that gets filled by FIFO will be the max between this value and (1 - pro_rata_fraction) x order_amount, plus any size leftovers due to rounding."},"five_percent_ask_depth":{"title":"five_percent_ask_depth","type":"string","format":"decimal","description":"Total amount of contracts / tokens available at 5 percent above best ask price"},"five_percent_bid_depth":{"title":"five_percent_bid_depth","type":"string","format":"decimal","description":"Total amount of contracts / tokens available at 5 percent below best bid price"},"index_price":{"title":"index_price","type":"string","format":"decimal","description":"Index price"},"instrument_name":{"title":"instrument_name","type":"string","description":"Instrument name"},"instrument_type":{"title":"instrument_type","type":"string","enum":["erc20","option","perp"],"description":"`erc20`, `option`, or `perp`"},"is_active":{"title":"is_active","type":"boolean","description":"If `True`: instrument is tradeable within `activation` and `deactivation` timestamps"},"maker_fee_rate":{"title":"maker_fee_rate","type":"string","format":"decimal","description":"Percent of spot price fee rate for makers"},"mark_price":{"title":"mark_price","type":"string","format":"decimal","description":"Mark price"},"mark_price_fee_rate_cap":{"title":"mark_price_fee_rate_cap","type":"string","format":"decimal","default":null,"description":"Percent of option price fee cap, e.g. 12.5%, null if not applicable","nullable":true},"max_price":{"title":"max_price","type":"string","format":"decimal","description":"Maximum price at which an agressive buyer can be matched. Any portion of a market order that would execute above this price will be cancelled. A limit buy order with limit price above this value is treated as post only (i.e. it will be rejected if it would cross any existing resting order)."},"maximum_amount":{"title":"maximum_amount","type":"string","format":"decimal","description":"Maximum valid amount of contracts / tokens per trade"},"min_price":{"title":"min_price","type":"string","format":"decimal","description":"Minimum price at which an agressive seller can be matched. Any portion of a market order that would execute below this price will be cancelled. A limit sell order with limit price below this value is treated as post only (i.e. it will be rejected if it would cross any existing resting order)."},"minimum_amount":{"title":"minimum_amount","type":"string","format":"decimal","description":"Minimum valid amount of contracts / tokens per trade"},"open_interest":{"title":"open_interest","type":"object","description":"Margin type of subaccount (`PM` (Portfolio Margin), `PM2 (Portfolio Margin 2), or `SM` (Standard Margin)) -> (current open interest, open interest cap, manager currency)","additionalProperties":{"title":"open_interest","type":"array","items":{"$ref":"#/components/schemas/OpenInterestStatsSchema"}}},"option_details":{"$ref":"#/components/schemas/OptionPublicDetailsSchema","nullable":true},"option_pricing":{"$ref":"#/components/schemas/OptionPricingSchema","nullable":true},"perp_details":{"$ref":"#/components/schemas/PerpPublicDetailsSchema","nullable":true},"pro_rata_amount_step":{"title":"pro_rata_amount_step","type":"string","format":"decimal","description":"Pro-rata fill share of every order is rounded down to be a multiple of this number. Leftovers of the order due to rounding are filled FIFO."},"pro_rata_fraction":{"title":"pro_rata_fraction","type":"string","format":"decimal","description":"Fraction of order that gets filled using pro-rata matching. If zero, the matching is full FIFO."},"quote_currency":{"title":"quote_currency","type":"string","description":"Quote currency (`USD` for perps, `USDC` for options)"},"scheduled_activation":{"title":"scheduled_activation","type":"integer","description":"Timestamp at which became or will become active (if applicable)"},"scheduled_deactivation":{"title":"scheduled_deactivation","type":"integer","description":"Scheduled deactivation time for instrument (if applicable)"},"stats":{"$ref":"#/components/schemas/AggregateTradingStatsSchema"},"taker_fee_rate":{"title":"taker_fee_rate","type":"string","format":"decimal","description":"Percent of spot price fee rate for takers"},"tick_size":{"title":"tick_size","type":"string","format":"decimal","description":"Tick size of the instrument, i.e. minimum price increment"},"timestamp":{"title":"timestamp","type":"integer","description":"Timestamp of the ticker feed snapshot"}},"additionalProperties":false},"OptionPricingSchema":{"required":["ask_iv","bid_iv","delta","discount_factor","forward_price","gamma","iv","mark_price","rho","theta","vega"],"type":"object","properties":{"ask_iv":{"title":"ask_iv","type":"string","format":"decimal","description":"Implied volatility of the current best ask"},"bid_iv":{"title":"bid_iv","type":"string","format":"decimal","description":"Implied volatility of the current best bid"},"delta":{"title":"delta","type":"string","format":"decimal","description":"Delta of the option"},"discount_factor":{"title":"discount_factor","type":"string","format":"decimal","description":"Discount factor used to calculate option premium"},"forward_price":{"title":"forward_price","type":"string","format":"decimal","description":"Forward price used to calculate option premium"},"gamma":{"title":"gamma","type":"string","format":"decimal","description":"Gamma of the option"},"iv":{"title":"iv","type":"string","format":"decimal","description":"Implied volatility of the option"},"mark_price":{"title":"mark_price","type":"string","format":"decimal","description":"Mark price of the option"},"rho":{"title":"rho","type":"string","format":"decimal","description":"Rho of the option"},"theta":{"title":"theta","type":"string","format":"decimal","description":"Theta of the option"},"vega":{"title":"vega","type":"string","format":"decimal","description":"Vega of the option"}},"additionalProperties":false},"AggregateTradingStatsSchema":{"required":["contract_volume","high","low","num_trades","open_interest","percent_change","usd_change"],"type":"object","properties":{"contract_volume":{"title":"contract_volume","type":"string","format":"decimal","description":"Number of contracts traded during last 24 hours"},"high":{"title":"high","type":"string","format":"decimal","description":"Highest trade price during last 24h"},"low":{"title":"low","type":"string","format":"decimal","description":"Lowest trade price during last 24h"},"num_trades":{"title":"num_trades","type":"string","format":"decimal","description":"Number of trades during last 24h "},"open_interest":{"title":"open_interest","type":"string","format":"decimal","description":"Current total open interest"},"percent_change":{"title":"percent_change","type":"string","format":"decimal","description":"24-hour price change expressed as a percentage. Options: percent change in vol; Perps: percent change in mark price"},"usd_change":{"title":"usd_change","type":"string","format":"decimal","description":"24-hour price change in USD."}},"additionalProperties":false},"PublicLoginParamsSchema":{"required":["signature","timestamp","wallet"],"type":"object","properties":{"signature":{"title":"signature","type":"string","description":"Signature of the timestamp, signed with the wallet's private key or a session key"},"timestamp":{"title":"timestamp","type":"string","description":"Message that was signed, in the form of a timestamp in ms since Unix epoch"},"wallet":{"title":"wallet","type":"string","description":"Public key (wallet) of the account"}},"additionalProperties":false},"PublicLoginResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"title":"result","type":"array","description":"List of subaccount IDs that have been authenticated","items":{"title":"result","type":"integer"}}},"additionalProperties":false},"PrivateGetFundingHistoryParamsSchema":{"required":["subaccount_id"],"type":"object","properties":{"end_timestamp":{"title":"end_timestamp","type":"integer","default":9223372036854776000,"description":"End timestamp of the event history (default current time)"},"instrument_name":{"title":"instrument_name","type":"string","default":null,"description":"Instrument name (returns history for all perpetuals if not provided)","nullable":true},"page":{"title":"page","type":"integer","default":1,"description":"Page number of results to return (default 1, returns last if above `num_pages`)"},"page_size":{"title":"page_size","type":"integer","default":100,"description":"Number of results per page (default 100, max 1000)"},"start_timestamp":{"title":"start_timestamp","type":"integer","default":0,"description":"Start timestamp of the event history (default 0)"},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount id"}},"additionalProperties":false},"PrivateGetFundingHistoryResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PrivateGetFundingHistoryResultSchema"}},"additionalProperties":false},"PrivateGetFundingHistoryResultSchema":{"required":["events","pagination"],"type":"object","properties":{"events":{"title":"events","type":"array","description":"List of funding payments","items":{"$ref":"#/components/schemas/FundingPaymentSchema"}},"pagination":{"$ref":"#/components/schemas/PaginationInfoSchema"}},"additionalProperties":false},"FundingPaymentSchema":{"required":["funding","instrument_name","pnl","timestamp"],"type":"object","properties":{"funding":{"title":"funding","type":"string","format":"decimal","description":"Dollar funding paid (if negative) or received (if positive) by the subaccount"},"instrument_name":{"title":"instrument_name","type":"string","description":"Instrument name"},"pnl":{"title":"pnl","type":"string","format":"decimal","description":"Cashflow from the perp PnL settlement"},"timestamp":{"title":"timestamp","type":"integer","description":"Timestamp of the funding payment (in ms since UNIX epoch)"}},"additionalProperties":false},"PublicGetSpotFeedHistoryParamsSchema":{"required":["currency","end_timestamp","period","start_timestamp"],"type":"object","properties":{"currency":{"title":"currency","type":"string","description":"Currency"},"end_timestamp":{"title":"end_timestamp","type":"integer","description":"End timestamp"},"period":{"title":"period","type":"integer","description":"Period"},"start_timestamp":{"title":"start_timestamp","type":"integer","description":"Start timestamp"}},"additionalProperties":false},"PublicGetSpotFeedHistoryResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PublicGetSpotFeedHistoryResultSchema"}},"additionalProperties":false},"PublicGetSpotFeedHistoryResultSchema":{"required":["currency","spot_feed_history"],"type":"object","properties":{"currency":{"title":"currency","type":"string","description":"Currency"},"spot_feed_history":{"title":"spot_feed_history","type":"array","description":"Spot feed history","items":{"$ref":"#/components/schemas/SpotFeedHistoryResponseSchema"}}},"additionalProperties":false},"SpotFeedHistoryResponseSchema":{"required":["price","timestamp","timestamp_bucket"],"type":"object","properties":{"price":{"title":"price","type":"string","format":"decimal","description":"Spot price"},"timestamp":{"title":"timestamp","type":"integer","description":"Timestamp of when the spot price was recored into the database"},"timestamp_bucket":{"title":"timestamp_bucket","type":"integer","description":"Timestamp bucket; this value is regularly spaced out with `period` seconds between data points, missing values are forward-filled from earlier data where possible, if no earlier data is available, values are back-filled from the first observed data point"}},"additionalProperties":false},"PrivateSetMmpConfigParamsSchema":{"required":["currency","mmp_frozen_time","mmp_interval","subaccount_id"],"type":"object","properties":{"currency":{"title":"currency","type":"string","description":"Currency of this mmp config"},"mmp_amount_limit":{"title":"mmp_amount_limit","type":"string","format":"decimal","default":"0","description":"Maximum total order amount that can be traded within the mmp_interval across all instruments of the provided currency. The amounts are not netted, so a filled bid of 1 and a filled ask of 2 would count as 3.
Default: 0 (no limit)"},"mmp_delta_limit":{"title":"mmp_delta_limit","type":"string","format":"decimal","default":"0","description":"Maximum total delta that can be traded within the mmp_interval across all instruments of the provided currency. This quantity is netted, so a filled order with +1 delta and a filled order with -2 delta would count as -1
Default: 0 (no limit)"},"mmp_frozen_time":{"title":"mmp_frozen_time","type":"integer","description":"Time interval in ms setting how long the subaccount is frozen after an mmp trigger, if 0 then a manual reset would be required via private/reset_mmp"},"mmp_interval":{"title":"mmp_interval","type":"integer","description":"Time interval in ms over which the limits are monotored, if 0 then mmp is disabled"},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount_id for which to set the config"}},"additionalProperties":false},"PrivateSetMmpConfigResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PrivateSetMmpConfigResultSchema"}},"additionalProperties":false},"PrivateSetMmpConfigResultSchema":{"required":["currency","mmp_frozen_time","mmp_interval","subaccount_id"],"type":"object","properties":{"currency":{"title":"currency","type":"string","description":"Currency of this mmp config"},"mmp_amount_limit":{"title":"mmp_amount_limit","type":"string","format":"decimal","default":"0","description":"Maximum total order amount that can be traded within the mmp_interval across all instruments of the provided currency. The amounts are not netted, so a filled bid of 1 and a filled ask of 2 would count as 3.
Default: 0 (no limit)"},"mmp_delta_limit":{"title":"mmp_delta_limit","type":"string","format":"decimal","default":"0","description":"Maximum total delta that can be traded within the mmp_interval across all instruments of the provided currency. This quantity is netted, so a filled order with +1 delta and a filled order with -2 delta would count as -1
Default: 0 (no limit)"},"mmp_frozen_time":{"title":"mmp_frozen_time","type":"integer","description":"Time interval in ms setting how long the subaccount is frozen after an mmp trigger, if 0 then a manual reset would be required via private/reset_mmp"},"mmp_interval":{"title":"mmp_interval","type":"integer","description":"Time interval in ms over which the limits are monotored, if 0 then mmp is disabled"},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount_id for which to set the config"}},"additionalProperties":false},"PublicGetFundingRateHistoryParamsSchema":{"required":["instrument_name"],"type":"object","properties":{"end_timestamp":{"title":"end_timestamp","type":"integer","default":9223372036854776000,"description":"End timestamp of the event history (default current time)"},"instrument_name":{"title":"instrument_name","type":"string","description":"Instrument name to return funding history for"},"period":{"title":"period","type":"string","default":3600,"enum":[900,3600,14400,28800,86400],"description":"Period of the funding rate"},"start_timestamp":{"title":"start_timestamp","type":"integer","default":0,"description":"Start timestamp of the event history (default 0)"}},"additionalProperties":false},"PublicGetFundingRateHistoryResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PublicGetFundingRateHistoryResultSchema"}},"additionalProperties":false},"PublicGetFundingRateHistoryResultSchema":{"required":["funding_rate_history"],"type":"object","properties":{"funding_rate_history":{"title":"funding_rate_history","type":"array","description":"List of funding rates","items":{"$ref":"#/components/schemas/FundingRateSchema"}}},"additionalProperties":false},"FundingRateSchema":{"required":["funding_rate","timestamp"],"type":"object","properties":{"funding_rate":{"title":"funding_rate","type":"string","format":"decimal","description":"Hourly funding rate value at the event time"},"timestamp":{"title":"timestamp","type":"integer","description":"Timestamp of the funding rate update (in ms since UNIX epoch)"}},"additionalProperties":false},"PrivateGetNotificationsParamsSchema":{"type":"object","properties":{"page":{"title":"page","type":"integer","default":1,"description":"Page number of results to return","nullable":true},"page_size":{"title":"page_size","type":"integer","default":50,"description":"Number of results per page (must be between 0-50)","nullable":true},"status":{"title":"status","type":"string","default":null,"enum":["unseen","seen","hidden"],"description":"Status of the notification","nullable":true},"subaccount_id":{"title":"subaccount_id","type":"integer","default":null,"description":"Subaccount_id (must be set if wallet param is not set)","nullable":true},"type":{"title":"type","type":"array","default":null,"description":"List of notification types to filter by","items":{"title":"type","type":"string","enum":["deposit","withdraw","transfer","trade","settlement","liquidation","custom"]},"nullable":true},"wallet":{"title":"wallet","type":"string","default":null,"description":"Wallet address (if set, subaccount_id ignored)","nullable":true}},"additionalProperties":false},"PrivateGetNotificationsResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PrivateGetNotificationsResultSchema"}},"additionalProperties":false},"PrivateGetNotificationsResultSchema":{"required":["notifications","pagination"],"type":"object","properties":{"notifications":{"title":"notifications","type":"array","description":"Notification response","items":{"$ref":"#/components/schemas/NotificationResponseSchema"}},"pagination":{"$ref":"#/components/schemas/PaginationInfoSchema"}},"additionalProperties":false},"NotificationResponseSchema":{"required":["event","event_details","id","status","subaccount_id","timestamp"],"type":"object","properties":{"event":{"title":"event","type":"string","description":"The specific event leading to the notification."},"event_details":{"title":"event_details","type":"object","description":"A JSON-structured dictionary containing detailed data or context about the event.","additionalProperties":{}},"id":{"title":"id","type":"integer","description":"The unique identifier for the notification."},"status":{"title":"status","type":"string","description":"The status of the notification, indicating if it has been read, pending, or processed."},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"The subaccount_id associated with the notification."},"timestamp":{"title":"timestamp","type":"integer","description":"The timestamp indicating when the notification was created or triggered."},"transaction_id":{"title":"transaction_id","type":"integer","default":null,"description":"The transaction id associated with the notification.","nullable":true},"tx_hash":{"title":"tx_hash","type":"string","default":null,"description":"The transaction hash associated with the notification.","nullable":true}},"additionalProperties":false},"PrivateCancelBatchQuotesParamsSchema":{"required":["subaccount_id"],"type":"object","properties":{"label":{"title":"label","type":"string","default":null,"description":"Cancel quotes with this label","nullable":true},"nonce":{"title":"nonce","type":"integer","default":null,"description":"Cancel quote with this nonce","nullable":true},"quote_id":{"title":"quote_id","type":"string","format":"uuid","default":null,"description":"Quote ID to cancel","nullable":true},"rfq_id":{"title":"rfq_id","type":"string","format":"uuid","default":null,"description":"Cancel quotes for this RFQ ID","nullable":true},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount ID"}},"additionalProperties":false},"PrivateCancelBatchQuotesResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PrivateCancelBatchQuotesResultSchema"}},"additionalProperties":false},"PrivateCancelBatchQuotesResultSchema":{"required":["cancelled_ids"],"type":"object","properties":{"cancelled_ids":{"title":"cancelled_ids","type":"array","description":"Quote IDs of the cancelled quotes","items":{"title":"cancelled_ids","type":"string","format":"uuid"}}},"additionalProperties":false},"PrivateRfqGetBestQuoteParamsSchema":{"required":["legs","subaccount_id"],"type":"object","properties":{"counterparties":{"title":"counterparties","type":"array","default":null,"description":"Optional list of market maker account addresses to request quotes from. If not supplied, all market makers who are approved as RFQ makers will be notified.","items":{"title":"counterparties","type":"string"},"nullable":true},"direction":{"title":"direction","type":"string","default":"buy","enum":["buy","sell"],"description":"Planned execution direction (default `buy`)"},"label":{"title":"label","type":"string","default":"","description":"Optional user-defined label for the RFQ"},"legs":{"title":"legs","type":"array","description":"RFQ legs","items":{"$ref":"#/components/schemas/LegUnpricedSchema"}},"max_total_cost":{"title":"max_total_cost","type":"string","format":"decimal","default":null,"description":"An optional max total cost for the RFQ. Only used when the RFQ sender executes as buyer. Polling endpoints and channels will ignore quotes where the total cost across all legs is above this value. Positive values mean the RFQ sender expects to pay $, negative mean the RFQ sender expects to receive $.This field is not disclosed to the market makers.","nullable":true},"min_total_cost":{"title":"min_total_cost","type":"string","format":"decimal","default":null,"description":"An optional min total cost for the RFQ. Only used when the RFQ sender executes as seller. Polling endpoints and channels will ignore quotes where the total cost across all legs is below this value. Positive values mean the RFQ sender expects to receive $, negative mean the RFQ sender expects to pay $.This field is not disclosed to the market makers.","nullable":true},"partial_fill_step":{"title":"partial_fill_step","type":"string","format":"decimal","default":"1","description":"Optional step size for partial fills. If not supplied, the RFQ will not support partial fills."},"rfq_id":{"title":"rfq_id","type":"string","format":"uuid","default":null,"description":"RFQ ID to get best quote for. If not provided, will return estimates based on mark prices","nullable":true},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount ID"}},"additionalProperties":false},"PrivateRfqGetBestQuoteResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PrivateRfqGetBestQuoteResultSchema"}},"additionalProperties":false},"PrivateRfqGetBestQuoteResultSchema":{"required":["best_quote","direction","down_liquidation_price","estimated_fee","estimated_realized_pnl","estimated_realized_pnl_excl_fees","estimated_total_cost","filled_pct","invalid_reason","is_valid","post_initial_margin","post_liquidation_price","pre_initial_margin","suggested_max_fee","up_liquidation_price"],"type":"object","properties":{"best_quote":{"$ref":"#/components/schemas/QuoteResultPublicSchema","nullable":true},"direction":{"title":"direction","type":"string","enum":["buy","sell"],"description":"RFQ direction."},"down_liquidation_price":{"title":"down_liquidation_price","type":"string","format":"decimal","default":null,"description":"Liquidation price if the trade were to be filled and the market moves down.","nullable":true},"estimated_fee":{"title":"estimated_fee","type":"string","format":"decimal","description":"An estimate for how much the user will pay in fees ($ for the whole trade)."},"estimated_realized_pnl":{"title":"estimated_realized_pnl","type":"string","format":"decimal","description":"An estimate for the realized PnL of the trade."},"estimated_realized_pnl_excl_fees":{"title":"estimated_realized_pnl_excl_fees","type":"string","format":"decimal","description":"An estimate for the realized PnL of the trade. with cost basis calculated without considering fees."},"estimated_total_cost":{"title":"estimated_total_cost","type":"string","format":"decimal","description":"An estimate for the total $ cost of the trade."},"filled_pct":{"title":"filled_pct","type":"string","format":"decimal","description":"Percentage of the RFQ that has already been filled, from 0 to 1."},"invalid_reason":{"title":"invalid_reason","type":"string","default":null,"enum":["Account is currently under maintenance margin requirements, trading is frozen.","This order would cause account to fall under maintenance margin requirements.","Insufficient buying power, only a single risk-reducing open order is allowed.","Insufficient buying power, consider reducing order size.","Insufficient buying power, consider reducing order size or canceling other orders.","Consider canceling other limit orders or using IOC, FOK, or market orders. This order is risk-reducing, but if filled with other open orders, buying power might be insufficient.","Insufficient buying power."],"description":"Reason for the RFQ being invalid, if any.","nullable":true},"is_valid":{"title":"is_valid","type":"boolean","description":"`True` if RFQ is expected to pass margin requirements."},"post_initial_margin":{"title":"post_initial_margin","type":"string","format":"decimal","description":"User's hypothetical margin balance if the trade were to get executed."},"post_liquidation_price":{"title":"post_liquidation_price","type":"string","format":"decimal","default":null,"description":"Liquidation price if the trade were to be filled. If both upside and downside liquidation prices exist, returns the closest one to the current index price.","nullable":true},"pre_initial_margin":{"title":"pre_initial_margin","type":"string","format":"decimal","description":"User's initial margin balance before the trade."},"suggested_max_fee":{"title":"suggested_max_fee","type":"string","format":"decimal","description":"Recommended value for `max_fee` of the trade."},"up_liquidation_price":{"title":"up_liquidation_price","type":"string","format":"decimal","default":null,"description":"Liquidation price if the trade were to be filled and the market moves up.","nullable":true}},"additionalProperties":false},"PrivateDepositParamsSchema":{"required":["amount","asset_name","nonce","signature","signature_expiry_sec","signer","subaccount_id"],"type":"object","properties":{"amount":{"title":"amount","type":"string","format":"decimal","description":"Amount of the asset to deposit"},"asset_name":{"title":"asset_name","type":"string","description":"Name of asset to deposit"},"is_atomic_signing":{"title":"is_atomic_signing","type":"boolean","default":false,"description":"Used by vaults to determine whether the signature is an EIP-1271 signature"},"nonce":{"title":"nonce","type":"integer","description":"Unique nonce defined as (e.g. 1695836058725001, where 001 is the random number)"},"signature":{"title":"signature","type":"string","description":"Ethereum signature of the deposit"},"signature_expiry_sec":{"title":"signature_expiry_sec","type":"integer","description":"Unix timestamp in seconds. Expiry MUST be >5min from now"},"signer":{"title":"signer","type":"string","description":"Ethereum wallet address that is signing the deposit"},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount_id"}},"additionalProperties":false},"PrivateDepositResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PrivateDepositResultSchema"}},"additionalProperties":false},"PrivateDepositResultSchema":{"required":["status","transaction_id"],"type":"object","properties":{"status":{"title":"status","type":"string","description":"`requested`"},"transaction_id":{"title":"transaction_id","type":"string","format":"uuid","description":"Transaction id of the deposit"}},"additionalProperties":false},"PublicGetLiquidationHistoryParamsSchema":{"type":"object","properties":{"end_timestamp":{"title":"end_timestamp","type":"integer","default":9223372036854776000,"description":"End timestamp of the event history (default current time)"},"page":{"title":"page","type":"integer","default":1,"description":"Page number of results to return (default 1, returns last if above `num_pages`)"},"page_size":{"title":"page_size","type":"integer","default":100,"description":"Number of results per page (default 100, max 1000)"},"start_timestamp":{"title":"start_timestamp","type":"integer","default":0,"description":"Start timestamp of the event history (default 0)"},"subaccount_id":{"title":"subaccount_id","type":"integer","default":null,"description":"(Optional) Subaccount ID","nullable":true}},"additionalProperties":false},"PublicGetLiquidationHistoryResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PublicGetLiquidationHistoryResultSchema"}},"additionalProperties":false},"PublicGetLiquidationHistoryResultSchema":{"required":["auctions","pagination"],"type":"object","properties":{"auctions":{"title":"auctions","type":"array","description":"List of auction results","items":{"$ref":"#/components/schemas/AuctionResultSchema"}},"pagination":{"$ref":"#/components/schemas/PaginationInfoSchema"}},"additionalProperties":false},"AuctionResultSchema":{"required":["auction_id","auction_type","bids","end_timestamp","fee","start_timestamp","subaccount_id","tx_hash"],"type":"object","properties":{"auction_id":{"title":"auction_id","type":"string","description":"Unique ID of the auction"},"auction_type":{"title":"auction_type","type":"string","enum":["solvent","insolvent"],"description":"Type of auction"},"bids":{"title":"bids","type":"array","description":"List of auction bid events","items":{"$ref":"#/components/schemas/AuctionBidEventSchema"}},"end_timestamp":{"title":"end_timestamp","type":"integer","default":null,"description":"Timestamp of the auction end (in ms since UNIX epoch), or `null` if not ended","nullable":true},"fee":{"title":"fee","type":"string","format":"decimal","description":"Fee paid by the subaccount"},"start_timestamp":{"title":"start_timestamp","type":"integer","description":"Timestamp of the auction start (in ms since UNIX epoch)"},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Liquidated subaccount ID"},"tx_hash":{"title":"tx_hash","type":"string","description":"Hash of the transaction that started the auction"}},"additionalProperties":false},"AuctionBidEventSchema":{"required":["amounts_liquidated","cash_received","discount_pnl","percent_liquidated","positions_realized_pnl","positions_realized_pnl_excl_fees","realized_pnl","realized_pnl_excl_fees","timestamp","tx_hash"],"type":"object","properties":{"amounts_liquidated":{"title":"amounts_liquidated","type":"object","description":"Amounts of each asset that were closed","additionalProperties":{"title":"amounts_liquidated","type":"string","format":"decimal"}},"cash_received":{"title":"cash_received","type":"string","format":"decimal","description":"Cash received by the subaccount for the liquidation. For the liquidated accounts this is the amount the liquidator paid to buy out the percentage of the portfolio. For the liquidator account, this is the amount they received from the security module (if positive) or the amount they paid for the bid (if negative)"},"discount_pnl":{"title":"discount_pnl","type":"string","format":"decimal","description":"Realized PnL due to liquidating or being liquidated at a discount to mark portfolio value"},"percent_liquidated":{"title":"percent_liquidated","type":"string","format":"decimal","description":"Percent of the subaccount that was liquidated"},"positions_realized_pnl":{"title":"positions_realized_pnl","type":"object","description":"Realized PnL of each position that was closed","additionalProperties":{"title":"positions_realized_pnl","type":"string","format":"decimal"}},"positions_realized_pnl_excl_fees":{"title":"positions_realized_pnl_excl_fees","type":"object","description":"Realized PnL of each position that was closed, excluding fees from total cost basis","additionalProperties":{"title":"positions_realized_pnl_excl_fees","type":"string","format":"decimal"}},"realized_pnl":{"title":"realized_pnl","type":"string","format":"decimal","description":"Realized PnL of the auction bid, assuming positions are closed at mark price at the time of the liquidation"},"realized_pnl_excl_fees":{"title":"realized_pnl_excl_fees","type":"string","format":"decimal","description":"Realized PnL of the auction bid, excluding fees from total cost basis, assuming positions are closed at mark price at the time of the liquidation"},"timestamp":{"title":"timestamp","type":"integer","description":"Timestamp of the bid (in ms since UNIX epoch)"},"tx_hash":{"title":"tx_hash","type":"string","description":"Hash of the bid transaction"}},"additionalProperties":false},"PrivateChangeSubaccountLabelParamsSchema":{"required":["label","subaccount_id"],"type":"object","properties":{"label":{"title":"label","type":"string","description":"User defined label"},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount_id"}},"additionalProperties":false},"PrivateChangeSubaccountLabelResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PrivateChangeSubaccountLabelResultSchema"}},"additionalProperties":false},"PrivateChangeSubaccountLabelResultSchema":{"required":["label","subaccount_id"],"type":"object","properties":{"label":{"title":"label","type":"string","description":"User defined label"},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount_id"}},"additionalProperties":false},"PublicMarginWatchParamsSchema":{"required":["subaccount_id"],"type":"object","properties":{"force_onchain":{"title":"force_onchain","type":"boolean","default":false,"description":"Force the fetching of on-chain balances, default False."},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount ID to get margin for."}},"additionalProperties":false},"PublicMarginWatchResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PublicMarginWatchResultSchema"}},"additionalProperties":false},"PublicMarginWatchResultSchema":{"required":["collaterals","currency","initial_margin","maintenance_margin","margin_type","positions","subaccount_id","subaccount_value","valuation_timestamp"],"type":"object","properties":{"collaterals":{"title":"collaterals","type":"array","description":"All collaterals that count towards margin of subaccount","items":{"$ref":"#/components/schemas/CollateralPublicResponseSchema"}},"currency":{"title":"currency","type":"string","description":"Currency of subaccount"},"initial_margin":{"title":"initial_margin","type":"string","format":"decimal","description":"Total initial margin requirement of all positions and collaterals."},"maintenance_margin":{"title":"maintenance_margin","type":"string","format":"decimal","description":"Total maintenance margin requirement of all positions and collaterals.If this value falls below zero, the subaccount will be flagged for liquidation."},"margin_type":{"title":"margin_type","type":"string","enum":["PM","SM","PM2"],"description":"Margin type of subaccount (`PM` (Portfolio Margin), `PM2 (Portfolio Margin 2), or `SM` (Standard Margin))"},"positions":{"title":"positions","type":"array","description":"All active positions of subaccount","items":{"$ref":"#/components/schemas/PositionPublicResponseSchema"}},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount_id"},"subaccount_value":{"title":"subaccount_value","type":"string","format":"decimal","description":"Total mark-to-market value of all positions and collaterals"},"valuation_timestamp":{"title":"valuation_timestamp","type":"integer","description":"Timestamp (in seconds since epoch) of when margin and MtM were computed."}},"additionalProperties":false},"CollateralPublicResponseSchema":{"required":["amount","asset_name","asset_type","initial_margin","maintenance_margin","mark_price","mark_value"],"type":"object","properties":{"amount":{"title":"amount","type":"string","format":"decimal","description":"Asset amount of given collateral"},"asset_name":{"title":"asset_name","type":"string","description":"Asset name"},"asset_type":{"title":"asset_type","type":"string","enum":["erc20","option","perp"],"description":"Type of asset collateral (currently always `erc20`)"},"initial_margin":{"title":"initial_margin","type":"string","format":"decimal","description":"USD value of collateral that contributes to initial margin"},"maintenance_margin":{"title":"maintenance_margin","type":"string","format":"decimal","description":"USD value of collateral that contributes to maintenance margin"},"mark_price":{"title":"mark_price","type":"string","format":"decimal","description":"Current mark price of the asset"},"mark_value":{"title":"mark_value","type":"string","format":"decimal","description":"USD value of the collateral (amount * mark price)"}},"additionalProperties":false},"PositionPublicResponseSchema":{"required":["amount","delta","gamma","index_price","initial_margin","instrument_name","instrument_type","liquidation_price","maintenance_margin","mark_price","mark_value","theta","vega"],"type":"object","properties":{"amount":{"title":"amount","type":"string","format":"decimal","description":"Position amount held by subaccount"},"delta":{"title":"delta","type":"string","format":"decimal","description":"Asset delta (w.r.t. forward price for options, `1.0` for perps)"},"gamma":{"title":"gamma","type":"string","format":"decimal","description":"Asset gamma (zero for non-options)"},"index_price":{"title":"index_price","type":"string","format":"decimal","description":"Current index (oracle) price for position's currency"},"initial_margin":{"title":"initial_margin","type":"string","format":"decimal","description":"USD initial margin requirement for this position"},"instrument_name":{"title":"instrument_name","type":"string","description":"Instrument name (same as the base Asset name)"},"instrument_type":{"title":"instrument_type","type":"string","enum":["erc20","option","perp"],"description":"`erc20`, `option`, or `perp`"},"liquidation_price":{"title":"liquidation_price","type":"string","format":"decimal","default":null,"description":"Index price at which position will be liquidated","nullable":true},"maintenance_margin":{"title":"maintenance_margin","type":"string","format":"decimal","description":"USD maintenance margin requirement for this position"},"mark_price":{"title":"mark_price","type":"string","format":"decimal","description":"Current mark price for position's instrument"},"mark_value":{"title":"mark_value","type":"string","format":"decimal","description":"USD value of the position; this represents how much USD can be recieved by fully closing the position at the current oracle price"},"theta":{"title":"theta","type":"string","format":"decimal","description":"Asset theta (zero for non-options)"},"vega":{"title":"vega","type":"string","format":"decimal","description":"Asset vega (zero for non-options)"}},"additionalProperties":false},"PublicGetTransactionParamsSchema":{"required":["transaction_id"],"type":"object","properties":{"transaction_id":{"title":"transaction_id","type":"string","format":"uuid","description":"transaction_id of the transaction to get"}},"additionalProperties":false},"PublicGetTransactionResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PublicGetTransactionResultSchema"}},"additionalProperties":false},"PublicGetTransactionResultSchema":{"required":["data","error_log","status","transaction_hash"],"type":"object","properties":{"data":{"title":"data","type":"string","description":"Data used to create transaction"},"error_log":{"title":"error_log","type":"string","default":null,"description":"Error log if failed tx","nullable":true},"status":{"title":"status","type":"string","enum":["requested","pending","settled","reverted","ignored","timed_out"],"description":"Status of the transaction"},"transaction_hash":{"title":"transaction_hash","type":"string","default":null,"description":"Transaction hash of a pending tx","nullable":true}},"additionalProperties":false},"PrivateGetErc20TransferHistoryParamsSchema":{"required":["subaccount_id"],"type":"object","properties":{"end_timestamp":{"title":"end_timestamp","type":"integer","default":9223372036854776000,"description":"End timestamp of the event history (default current time)"},"start_timestamp":{"title":"start_timestamp","type":"integer","default":0,"description":"Start timestamp of the event history (default 0)"},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount id"}},"additionalProperties":false},"PrivateGetErc20TransferHistoryResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PrivateGetErc20TransferHistoryResultSchema"}},"additionalProperties":false},"PrivateGetErc20TransferHistoryResultSchema":{"required":["events"],"type":"object","properties":{"events":{"title":"events","type":"array","description":"List of erc20 transfers","items":{"$ref":"#/components/schemas/ERC20TransferSchema"}}},"additionalProperties":false},"ERC20TransferSchema":{"required":["amount","asset","counterparty_subaccount_id","is_outgoing","timestamp","tx_hash"],"type":"object","properties":{"amount":{"title":"amount","type":"string","format":"decimal","description":"Amount withdrawn by the subaccount"},"asset":{"title":"asset","type":"string","description":"Asset withdrawn"},"counterparty_subaccount_id":{"title":"counterparty_subaccount_id","type":"integer","description":"Recipient or sender subaccount_id of transfer"},"is_outgoing":{"title":"is_outgoing","type":"boolean","description":"True if the transfer was initiated by the subaccount, False otherwise"},"timestamp":{"title":"timestamp","type":"integer","description":"Timestamp of the transfer (in ms since UNIX epoch)"},"tx_hash":{"title":"tx_hash","type":"string","description":"Hash of the transaction that withdrew the funds"}},"additionalProperties":false},"PrivateReplaceParamsSchema":{"required":["amount","direction","instrument_name","limit_price","max_fee","nonce","signature","signature_expiry_sec","signer","subaccount_id"],"type":"object","properties":{"amount":{"title":"amount","type":"string","format":"decimal","description":"Order amount in units of the base"},"direction":{"title":"direction","type":"string","enum":["buy","sell"],"description":"Order direction"},"expected_filled_amount":{"title":"expected_filled_amount","type":"string","format":"decimal","default":null,"description":"Optional check to only create new order if old order filled_amount is equal to this value.","nullable":true},"instrument_name":{"title":"instrument_name","type":"string","description":"Instrument name"},"is_atomic_signing":{"title":"is_atomic_signing","type":"boolean","default":false,"description":"Used by vaults to determine whether the signature is an EIP-1271 signature.","nullable":true},"label":{"title":"label","type":"string","default":"","description":"Optional user-defined label for the order"},"limit_price":{"title":"limit_price","type":"string","format":"decimal","description":"Limit price in quote currency.
This field is still required for market orders because it is a component of the signature. However, market orders will not leave a resting order in the book in case of a partial fill."},"max_fee":{"title":"max_fee","type":"string","format":"decimal","description":"Max fee per unit of volume, denominated in units of the quote currency (usually USDC).Order will be rejected if the supplied max fee is below the estimated fee for this order."},"mmp":{"title":"mmp","type":"boolean","default":false,"description":"Whether the order is tagged for market maker protections (default false)"},"nonce":{"title":"nonce","type":"integer","description":"Unique nonce defined as (e.g. 1695836058725001, where 001 is the random number).Note, using a random number beyond 3 digits will cause JSON serialization to fail."},"nonce_to_cancel":{"title":"nonce_to_cancel","type":"integer","default":null,"description":"Cancel order by nonce (choose either order_id or nonce).","nullable":true},"order_id_to_cancel":{"title":"order_id_to_cancel","type":"string","format":"uuid","default":null,"description":"Cancel order by order_id (choose either order_id or nonce).","nullable":true},"order_type":{"title":"order_type","type":"string","default":"limit","enum":["limit","market"],"description":"Order type:
- `limit`: limit order (default)
- `market`: market order, note that limit_price is still required for market orders, but unfilled order portion will be marked as cancelled"},"reduce_only":{"title":"reduce_only","type":"boolean","default":false,"description":"If true, the order will not be able to increase position's size (default false). If the order amount exceeds available position size, the order will be filled up to the position size and the remainder will be cancelled. This flag is only supported for market orders or non-resting limit orders (IOC or FOK)"},"referral_code":{"title":"referral_code","type":"string","default":"","description":"Optional referral code for the order"},"reject_timestamp":{"title":"reject_timestamp","type":"integer","default":9223372036854776000,"description":"UTC timestamp in ms, if provided the matching engine will reject the order with an error if `reject_timestamp` < `server_time`. Note that the timestamp must be consistent with the server time: use `public/get_time` method to obtain current server time."},"signature":{"title":"signature","type":"string","description":"Ethereum signature of the order"},"signature_expiry_sec":{"title":"signature_expiry_sec","type":"integer","description":"Unix timestamp in seconds. Order signature becomes invalid after this time, and the system will cancel the order.Expiry MUST be at least 5 min from now."},"signer":{"title":"signer","type":"string","description":"Owner wallet address or registered session key that signed order"},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount ID"},"time_in_force":{"title":"time_in_force","type":"string","default":"gtc","enum":["gtc","post_only","fok","ioc"],"description":"Time in force behaviour:
- `gtc`: good til cancelled (default)
- `post_only`: a limit order that will be rejected if it crosses any order in the book, i.e. acts as a taker order
- `fok`: fill or kill, will be rejected if it is not fully filled
- `ioc`: immediate or cancel, fill at best bid/ask (market) or at limit price (limit), the unfilled portion is cancelled
Note that the order will still expire on the `signature_expiry_sec` timestamp."},"trigger_price":{"title":"trigger_price","type":"string","format":"decimal","default":null,"description":"(Required for trigger orders) \"index\" or \"mark\" price to trigger order at","nullable":true},"trigger_price_type":{"title":"trigger_price_type","type":"string","default":null,"enum":["mark","index"],"description":"(Required for trigger orders) Trigger with \"mark\" price as \"index\" price type not supported yet.","nullable":true},"trigger_type":{"title":"trigger_type","type":"string","default":null,"enum":["stoploss","takeprofit"],"description":"(Required for trigger orders) \"stoploss\" or \"takeprofit\"","nullable":true}},"additionalProperties":false},"PrivateReplaceResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PrivateReplaceResultSchema"}},"additionalProperties":false},"PrivateReplaceResultSchema":{"required":["cancelled_order"],"type":"object","properties":{"cancelled_order":{"$ref":"#/components/schemas/OrderResponseSchema"},"create_order_error":{"$ref":"#/components/schemas/RPCErrorFormatSchema","nullable":true},"order":{"$ref":"#/components/schemas/OrderResponseSchema","nullable":true},"trades":{"title":"trades","type":"array","default":null,"description":"List of trades executed by the created order","items":{"$ref":"#/components/schemas/TradeResponseSchema"},"nullable":true}},"additionalProperties":false},"RPCErrorFormatSchema":{"required":["code","message"],"type":"object","properties":{"code":{"title":"code","type":"integer"},"data":{"title":"data","type":"string","default":null,"nullable":true},"message":{"title":"message","type":"string"}},"additionalProperties":false},"PublicGetTradeHistoryParamsSchema":{"type":"object","properties":{"currency":{"title":"currency","type":"string","default":null,"description":"Currency to filter by (defaults to all)","nullable":true},"from_timestamp":{"title":"from_timestamp","type":"integer","default":0,"description":"Earliest timestamp to filter by (in ms since Unix epoch). If not provied, defaults to 0."},"instrument_name":{"title":"instrument_name","type":"string","default":null,"description":"Instrument name to filter by (defaults to all)","nullable":true},"instrument_type":{"title":"instrument_type","type":"string","default":null,"enum":["erc20","option","perp"],"description":"Instrument type to filter by (defaults to all)","nullable":true},"page":{"title":"page","type":"integer","default":1,"description":"Page number of results to return (default 1, returns last if above `num_pages`)"},"page_size":{"title":"page_size","type":"integer","default":100,"description":"Number of results per page (default 100, max 1000)"},"subaccount_id":{"title":"subaccount_id","type":"integer","default":null,"description":"Subaccount ID to filter by","nullable":true},"to_timestamp":{"title":"to_timestamp","type":"integer","default":18446744073709552000,"description":"Latest timestamp to filter by (in ms since Unix epoch). If not provied, defaults to returning all data up to current time."},"trade_id":{"title":"trade_id","type":"string","format":"uuid","default":null,"description":"Trade ID to filter by. If set, all other filters are ignored","nullable":true},"tx_hash":{"title":"tx_hash","type":"string","default":null,"description":"On-chain tx hash to filter by. If set, all other filters are ignored","nullable":true},"tx_status":{"title":"tx_status","type":"string","default":"settled","enum":["settled","reverted","timed_out"],"description":"Transaction status to filter by (default `settled`)."}},"additionalProperties":false},"PublicGetTradeHistoryResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PublicGetTradeHistoryResultSchema"}},"additionalProperties":false},"PublicGetTradeHistoryResultSchema":{"required":["pagination","trades"],"type":"object","properties":{"pagination":{"$ref":"#/components/schemas/PaginationInfoSchema"},"trades":{"title":"trades","type":"array","description":"List of trades","items":{"$ref":"#/components/schemas/TradeSettledPublicResponseSchema"}}},"additionalProperties":false},"TradeSettledPublicResponseSchema":{"required":["direction","expected_rebate","index_price","instrument_name","liquidity_role","mark_price","quote_id","realized_pnl","realized_pnl_excl_fees","subaccount_id","timestamp","trade_amount","trade_fee","trade_id","trade_price","tx_hash","tx_status","wallet"],"type":"object","properties":{"direction":{"title":"direction","type":"string","enum":["buy","sell"],"description":"Order direction"},"expected_rebate":{"title":"expected_rebate","type":"string","format":"decimal","description":"Expected rebate for this trade"},"index_price":{"title":"index_price","type":"string","format":"decimal","description":"Index price of the underlying at the time of the trade"},"instrument_name":{"title":"instrument_name","type":"string","description":"Instrument name"},"liquidity_role":{"title":"liquidity_role","type":"string","enum":["maker","taker"],"description":"Role of the user in the trade"},"mark_price":{"title":"mark_price","type":"string","format":"decimal","description":"Mark price of the instrument at the time of the trade"},"quote_id":{"title":"quote_id","type":"string","format":"uuid","default":null,"description":"Quote ID if the trade was executed via RFQ","nullable":true},"realized_pnl":{"title":"realized_pnl","type":"string","format":"decimal","description":"Realized PnL for this trade"},"realized_pnl_excl_fees":{"title":"realized_pnl_excl_fees","type":"string","format":"decimal","description":"Realized PnL for this trade using cost accounting that excludes fees"},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount ID"},"timestamp":{"title":"timestamp","type":"integer","description":"Trade timestamp (in ms since Unix epoch)"},"trade_amount":{"title":"trade_amount","type":"string","format":"decimal","description":"Amount filled in this trade"},"trade_fee":{"title":"trade_fee","type":"string","format":"decimal","description":"Fee for this trade"},"trade_id":{"title":"trade_id","type":"string","description":"Trade ID"},"trade_price":{"title":"trade_price","type":"string","format":"decimal","description":"Price at which the trade was filled"},"tx_hash":{"title":"tx_hash","type":"string","description":"Blockchain transaction hash"},"tx_status":{"title":"tx_status","type":"string","enum":["settled","reverted","timed_out"],"description":"Blockchain transaction status"},"wallet":{"title":"wallet","type":"string","description":"Wallet address (owner) of the subaccount"}},"additionalProperties":false},"PublicSendQuoteDebugParamsSchema":{"required":["direction","legs","max_fee","nonce","rfq_id","signature","signature_expiry_sec","signer","subaccount_id"],"type":"object","properties":{"direction":{"title":"direction","type":"string","enum":["buy","sell"],"description":"Quote direction, `buy` means trading each leg at its direction, `sell` means trading each leg in the opposite direction."},"label":{"title":"label","type":"string","default":"","description":"Optional user-defined label for the quote"},"legs":{"title":"legs","type":"array","description":"Quote legs","items":{"$ref":"#/components/schemas/LegPricedSchema"}},"max_fee":{"title":"max_fee","type":"string","format":"decimal","description":"Max fee ($ for the full trade). Request will be rejected if the supplied max fee is below the estimated fee for this trade."},"mmp":{"title":"mmp","type":"boolean","default":false,"description":"Whether the quote is tagged for market maker protections (default false)"},"nonce":{"title":"nonce","type":"integer","description":"Unique nonce defined as a concatenated `UTC timestamp in ms` and `random number up to 6 digits` (e.g. 1695836058725001, where 001 is the random number)"},"rfq_id":{"title":"rfq_id","type":"string","format":"uuid","description":"RFQ ID the quote is for"},"signature":{"title":"signature","type":"string","description":"Ethereum signature of the quote"},"signature_expiry_sec":{"title":"signature_expiry_sec","type":"integer","description":"Unix timestamp in seconds. Expiry MUST be at least 310 seconds from now. Once time till signature expiry reaches 300 seconds, the quote will be considered expired. This buffer is meant to ensure the trade can settle on chain in case of a blockchain congestion."},"signer":{"title":"signer","type":"string","description":"Owner wallet address or registered session key that signed the quote"},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount ID"}},"additionalProperties":false},"PublicSendQuoteDebugResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PublicSendQuoteDebugResultSchema"}},"additionalProperties":false},"PublicSendQuoteDebugResultSchema":{"required":["action_hash","encoded_data","encoded_data_hashed","typed_data_hash"],"type":"object","properties":{"action_hash":{"title":"action_hash","type":"string","description":"Keccak hashed action data"},"encoded_data":{"title":"encoded_data","type":"string","description":"ABI encoded deposit data"},"encoded_data_hashed":{"title":"encoded_data_hashed","type":"string","description":"Keccak hashed encoded_data"},"typed_data_hash":{"title":"typed_data_hash","type":"string","description":"EIP 712 typed data hash"}},"additionalProperties":false},"PrivateGetOrderHistoryParamsSchema":{"required":["subaccount_id"],"type":"object","properties":{"page":{"title":"page","type":"integer","default":1,"description":"Page number of results to return (default 1, returns last if above `num_pages`)"},"page_size":{"title":"page_size","type":"integer","default":100,"description":"Number of results per page (default 100, max 1000)"},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount_id for which to get order history"}},"additionalProperties":false},"PrivateGetOrderHistoryResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PrivateGetOrderHistoryResultSchema"}},"additionalProperties":false},"PrivateGetOrderHistoryResultSchema":{"required":["orders","pagination","subaccount_id"],"type":"object","properties":{"orders":{"title":"orders","type":"array","description":"List of open orders","items":{"$ref":"#/components/schemas/OrderResponseSchema"}},"pagination":{"$ref":"#/components/schemas/PaginationInfoSchema"},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount_id for which to get open orders"}},"additionalProperties":false},"PrivateCancelBatchRfqsParamsSchema":{"required":["subaccount_id"],"type":"object","properties":{"label":{"title":"label","type":"string","default":null,"description":"Cancel RFQs with this label","nullable":true},"nonce":{"title":"nonce","type":"integer","default":null,"description":"Cancel RFQ with this nonce","nullable":true},"rfq_id":{"title":"rfq_id","type":"string","format":"uuid","default":null,"description":"RFQ ID to cancel","nullable":true},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount ID"}},"additionalProperties":false},"PrivateCancelBatchRfqsResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PrivateCancelBatchRfqsResultSchema"}},"additionalProperties":false},"PrivateCancelBatchRfqsResultSchema":{"required":["cancelled_ids"],"type":"object","properties":{"cancelled_ids":{"title":"cancelled_ids","type":"array","description":"RFQ IDs of the cancelled RFQs","items":{"title":"cancelled_ids","type":"string","format":"uuid"}}},"additionalProperties":false},"PrivateExecuteQuoteParamsSchema":{"required":["direction","legs","max_fee","nonce","quote_id","rfq_id","signature","signature_expiry_sec","signer","subaccount_id"],"type":"object","properties":{"direction":{"title":"direction","type":"string","enum":["buy","sell"],"description":"Quote direction, `buy` means trading each leg at its direction, `sell` means trading each leg in the opposite direction."},"label":{"title":"label","type":"string","default":"","description":"Optional user-defined label for the quote"},"legs":{"title":"legs","type":"array","description":"Quote legs","items":{"$ref":"#/components/schemas/LegPricedSchema"}},"max_fee":{"title":"max_fee","type":"string","format":"decimal","description":"Max fee ($ for the full trade). Request will be rejected if the supplied max fee is below the estimated fee for this trade."},"nonce":{"title":"nonce","type":"integer","description":"Unique nonce defined as a concatenated `UTC timestamp in ms` and `random number up to 6 digits` (e.g. 1695836058725001, where 001 is the random number)"},"quote_id":{"title":"quote_id","type":"string","format":"uuid","description":"Quote ID to execute against"},"rfq_id":{"title":"rfq_id","type":"string","format":"uuid","description":"RFQ ID to execute (must be sent by `subaccount_id`)"},"signature":{"title":"signature","type":"string","description":"Ethereum signature of the quote"},"signature_expiry_sec":{"title":"signature_expiry_sec","type":"integer","description":"Unix timestamp in seconds. Expiry MUST be at least 310 seconds from now. Once time till signature expiry reaches 300 seconds, the quote will be considered expired. This buffer is meant to ensure the trade can settle on chain in case of a blockchain congestion."},"signer":{"title":"signer","type":"string","description":"Owner wallet address or registered session key that signed the quote"},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount ID"}},"additionalProperties":false},"PrivateExecuteQuoteResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PrivateExecuteQuoteResultSchema"}},"additionalProperties":false},"PrivateExecuteQuoteResultSchema":{"required":["cancel_reason","creation_timestamp","direction","fee","fill_pct","is_transfer","label","last_update_timestamp","legs","legs_hash","liquidity_role","max_fee","mmp","nonce","quote_id","rfq_filled_pct","rfq_id","signature","signature_expiry_sec","signer","status","subaccount_id","tx_hash","tx_status"],"type":"object","properties":{"cancel_reason":{"title":"cancel_reason","type":"string","enum":["","user_request","insufficient_margin","signed_max_fee_too_low","mmp_trigger","cancel_on_disconnect","session_key_deregistered","subaccount_withdrawn","rfq_no_longer_open","compliance"],"description":"Cancel reason, if any"},"creation_timestamp":{"title":"creation_timestamp","type":"integer","description":"Creation timestamp in ms since Unix epoch"},"direction":{"title":"direction","type":"string","enum":["buy","sell"],"description":"Quote direction"},"fee":{"title":"fee","type":"string","format":"decimal","description":"Fee paid for this quote (if executed)"},"fill_pct":{"title":"fill_pct","type":"string","format":"decimal","description":"Percentage of the RFQ that this quote would fill, from 0 to 1."},"is_transfer":{"title":"is_transfer","type":"boolean","description":"Whether the order was generated through `private/transfer_position`"},"label":{"title":"label","type":"string","description":"User-defined label, if any"},"last_update_timestamp":{"title":"last_update_timestamp","type":"integer","description":"Last update timestamp in ms since Unix epoch"},"legs":{"title":"legs","type":"array","description":"Quote legs","items":{"$ref":"#/components/schemas/LegPricedSchema"}},"legs_hash":{"title":"legs_hash","type":"string","description":"Hash of the legs of the best quote to be signed by the taker."},"liquidity_role":{"title":"liquidity_role","type":"string","enum":["maker","taker"],"description":"Liquidity role"},"max_fee":{"title":"max_fee","type":"string","format":"decimal","description":"Signed max fee"},"mmp":{"title":"mmp","type":"boolean","description":"Whether the quote is tagged for market maker protections (default false)"},"nonce":{"title":"nonce","type":"integer","description":"Nonce"},"quote_id":{"title":"quote_id","type":"string","format":"uuid","description":"Quote ID"},"rfq_filled_pct":{"title":"rfq_filled_pct","type":"string","format":"decimal","description":"Total percentage of the RFQ that has already been filled after this execution, from 0 to 1."},"rfq_id":{"title":"rfq_id","type":"string","format":"uuid","description":"RFQ ID"},"signature":{"title":"signature","type":"string","description":"Ethereum signature of the quote"},"signature_expiry_sec":{"title":"signature_expiry_sec","type":"integer","description":"Unix timestamp in seconds"},"signer":{"title":"signer","type":"string","description":"Owner wallet address or registered session key that signed the quote"},"status":{"title":"status","type":"string","enum":["open","filled","cancelled","expired"],"description":"Status"},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount ID"},"tx_hash":{"title":"tx_hash","type":"string","default":null,"description":"Blockchain transaction hash (only for executed quotes)","nullable":true},"tx_status":{"title":"tx_status","type":"string","default":null,"enum":["requested","pending","settled","reverted","ignored","timed_out"],"description":"Blockchain transaction status (only for executed quotes)","nullable":true}},"additionalProperties":false},"PublicCreateSubaccountDebugParamsSchema":{"required":["amount","asset_name","margin_type","nonce","signature_expiry_sec","signer","wallet"],"type":"object","properties":{"amount":{"title":"amount","type":"string","format":"decimal","description":"Amount of the asset to deposit"},"asset_name":{"title":"asset_name","type":"string","description":"Name of asset to deposit"},"currency":{"title":"currency","type":"string","default":null,"description":"Base currency of the subaccount (only for `PM`)","nullable":true},"margin_type":{"title":"margin_type","type":"string","enum":["PM","SM","PM2"],"description":"`PM` (Portfolio Margin), `PM2 (Portfolio Margin 2), or `SM` (Standard Margin))"},"nonce":{"title":"nonce","type":"integer","description":"Unique nonce defined as (e.g. 1695836058725001, where 001 is the random number)"},"signature_expiry_sec":{"title":"signature_expiry_sec","type":"integer","description":"Unix timestamp in seconds. Expiry MUST be >5min from now"},"signer":{"title":"signer","type":"string","description":"Ethereum wallet address that is signing the deposit"},"wallet":{"title":"wallet","type":"string","description":"Ethereum wallet address"}},"additionalProperties":false},"PublicCreateSubaccountDebugResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PublicCreateSubaccountDebugResultSchema"}},"additionalProperties":false},"PublicCreateSubaccountDebugResultSchema":{"required":["action_hash","encoded_data","encoded_data_hashed","typed_data_hash"],"type":"object","properties":{"action_hash":{"title":"action_hash","type":"string","description":"Keccak hashed action data"},"encoded_data":{"title":"encoded_data","type":"string","description":"ABI encoded deposit data"},"encoded_data_hashed":{"title":"encoded_data_hashed","type":"string","description":"Keccak hashed encoded_data"},"typed_data_hash":{"title":"typed_data_hash","type":"string","description":"EIP 712 typed data hash"}},"additionalProperties":false},"PrivateGetLiquidationHistoryParamsSchema":{"required":["subaccount_id"],"type":"object","properties":{"end_timestamp":{"title":"end_timestamp","type":"integer","default":9223372036854776000,"description":"End timestamp of the event history (default current time)"},"start_timestamp":{"title":"start_timestamp","type":"integer","default":0,"description":"Start timestamp of the event history (default 0)"},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount id"}},"additionalProperties":false},"PrivateGetLiquidationHistoryResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"title":"result","type":"array","description":"","items":{"$ref":"#/components/schemas/AuctionResultSchema"}}},"additionalProperties":false},"PrivateCancelRfqParamsSchema":{"required":["rfq_id","subaccount_id"],"type":"object","properties":{"rfq_id":{"title":"rfq_id","type":"string","format":"uuid","description":"RFQ ID to cancel"},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount ID"}},"additionalProperties":false},"PrivateCancelRfqResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"title":"result","type":"string","enum":["ok"],"description":"The result of this method call, `ok` if successful"}},"additionalProperties":false},"PublicGetLatestSignedFeedsParamsSchema":{"type":"object","properties":{"currency":{"title":"currency","type":"string","default":null,"description":"Currency filter, (defaults to all currencies)","nullable":true},"expiry":{"title":"expiry","type":"integer","default":null,"description":"Expiry filter for options and forward data (defaults to all expiries). Use `0` to get data only for spot and perpetuals","nullable":true}},"additionalProperties":false},"PublicGetLatestSignedFeedsResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PublicGetLatestSignedFeedsResultSchema"}},"additionalProperties":false},"PublicGetLatestSignedFeedsResultSchema":{"required":["fwd_data","perp_data","rate_data","spot_data","vol_data"],"type":"object","properties":{"fwd_data":{"title":"fwd_data","type":"object","description":"currency -> expiry -> latest forward feed data","additionalProperties":{"title":"fwd_data","type":"object","additionalProperties":{"$ref":"#/components/schemas/ForwardFeedDataSchema"}}},"perp_data":{"title":"perp_data","type":"object","description":"currency -> feed type -> latest perp feed data","additionalProperties":{"title":"perp_data","type":"object","additionalProperties":{"$ref":"#/components/schemas/PerpFeedDataSchema"}}},"rate_data":{"title":"rate_data","type":"object","description":"currency -> expiry -> latest rate feed data","additionalProperties":{"title":"rate_data","type":"object","additionalProperties":{"$ref":"#/components/schemas/RateFeedDataSchema"}}},"spot_data":{"title":"spot_data","type":"object","description":"currency -> latest spot feed data","additionalProperties":{"$ref":"#/components/schemas/SpotFeedDataSchema"}},"vol_data":{"title":"vol_data","type":"object","description":"currency -> expiry -> latest vol feed data","additionalProperties":{"title":"vol_data","type":"object","additionalProperties":{"$ref":"#/components/schemas/VolFeedDataSchema"}}}},"additionalProperties":false},"ForwardFeedDataSchema":{"required":["confidence","currency","deadline","expiry","fwd_diff","signatures","spot_aggregate_latest","spot_aggregate_start","timestamp"],"type":"object","properties":{"confidence":{"title":"confidence","type":"string","format":"decimal","description":"The confidence score of the price"},"currency":{"title":"currency","type":"string","description":"The currency for which the spot feed represents"},"deadline":{"title":"deadline","type":"integer","description":"The latest time the data can be submitted on chain"},"expiry":{"title":"expiry","type":"integer","description":"The expiry for the forward feed"},"fwd_diff":{"title":"fwd_diff","type":"string","format":"decimal","description":"difference of forward price from current spot price"},"signatures":{"$ref":"#/components/schemas/OracleSignatureDataSchema"},"spot_aggregate_latest":{"title":"spot_aggregate_latest","type":"string","format":"decimal","description":"expiry -> spot * time value at the latest timestamp"},"spot_aggregate_start":{"title":"spot_aggregate_start","type":"string","format":"decimal","description":"spot * time value at the start of the settlement period"},"timestamp":{"title":"timestamp","type":"integer","description":"The timestamp for which the data was created"}},"additionalProperties":false},"OracleSignatureDataSchema":{"type":"object","properties":{"signatures":{"title":"signatures","type":"array","description":"The signatures of the given signers","items":{"title":"signatures","type":"string"}},"signers":{"title":"signers","type":"array","description":"The signers who verify the data integrity","items":{"title":"signers","type":"string"}}},"additionalProperties":false},"PerpFeedDataSchema":{"required":["confidence","currency","deadline","signatures","spot_diff_value","timestamp","type"],"type":"object","properties":{"confidence":{"title":"confidence","type":"string","format":"decimal","description":"The confidence score of the price"},"currency":{"title":"currency","type":"string","description":"The currency for which the spot feed represents"},"deadline":{"title":"deadline","type":"integer","description":"The latest time the data can be submitted on chain"},"signatures":{"$ref":"#/components/schemas/OracleSignatureDataSchema"},"spot_diff_value":{"title":"spot_diff_value","type":"string","format":"decimal","description":"The difference between the spot price and the perp price"},"timestamp":{"title":"timestamp","type":"integer","description":"The timestamp for which the data was created"},"type":{"title":"type","type":"string","enum":["P","A","B"],"description":"The type of perp feed; mid price, ask impact or bid impact"}},"additionalProperties":false},"RateFeedDataSchema":{"required":["confidence","currency","deadline","expiry","rate","signatures","timestamp"],"type":"object","properties":{"confidence":{"title":"confidence","type":"string","format":"decimal","description":"The confidence score of the rate"},"currency":{"title":"currency","type":"string","description":"The currency for which the spot feed represents"},"deadline":{"title":"deadline","type":"integer","description":"The latest time the data can be submitted on chain"},"expiry":{"title":"expiry","type":"integer","description":"The expiry for the rate feed"},"rate":{"title":"rate","type":"string","format":"decimal","description":"The implied rate for the currency/expiry"},"signatures":{"$ref":"#/components/schemas/OracleSignatureDataSchema"},"timestamp":{"title":"timestamp","type":"integer","description":"The timestamp for which the data was created"}},"additionalProperties":false},"SpotFeedDataSchema":{"required":["confidence","currency","deadline","price","signatures","timestamp"],"type":"object","properties":{"confidence":{"title":"confidence","type":"string","format":"decimal","description":"The confidence score of the price"},"currency":{"title":"currency","type":"string","description":"The currency for which the spot feed represents"},"deadline":{"title":"deadline","type":"integer","description":"The latest time the data can be submitted on chain"},"feed_source_type":{"title":"feed_source_type","type":"string","default":"S","enum":["S","O"],"description":"The source of the feed"},"price":{"title":"price","type":"string","format":"decimal","description":"The price of the currency in USD"},"signatures":{"$ref":"#/components/schemas/OracleSignatureDataSchema"},"timestamp":{"title":"timestamp","type":"integer","description":"The timestamp for which the data was created"}},"additionalProperties":false},"VolFeedDataSchema":{"required":["confidence","currency","deadline","expiry","signatures","timestamp","vol_data"],"type":"object","properties":{"confidence":{"title":"confidence","type":"string","format":"decimal","description":"The confidence score of the price"},"currency":{"title":"currency","type":"string","description":"The currency for which the spot feed represents"},"deadline":{"title":"deadline","type":"integer","description":"The latest time the data can be submitted on chain"},"expiry":{"title":"expiry","type":"integer","description":"The expiry for the options for the vol feed"},"signatures":{"$ref":"#/components/schemas/OracleSignatureDataSchema"},"timestamp":{"title":"timestamp","type":"integer","description":"The timestamp for which the data was created"},"vol_data":{"$ref":"#/components/schemas/VolSVIParamDataSchema"}},"additionalProperties":false},"VolSVIParamDataSchema":{"required":["SVI_a","SVI_b","SVI_fwd","SVI_m","SVI_refTau","SVI_rho","SVI_sigma"],"type":"object","properties":{"SVI_a":{"title":"SVI_a","type":"string","format":"decimal"},"SVI_b":{"title":"SVI_b","type":"string","format":"decimal"},"SVI_fwd":{"title":"SVI_fwd","type":"string","format":"decimal"},"SVI_m":{"title":"SVI_m","type":"string","format":"decimal"},"SVI_refTau":{"title":"SVI_refTau","type":"string","format":"decimal"},"SVI_rho":{"title":"SVI_rho","type":"string","format":"decimal"},"SVI_sigma":{"title":"SVI_sigma","type":"string","format":"decimal"}},"additionalProperties":false},"PublicGetReferralPerformanceParamsSchema":{"required":["end_ms","start_ms"],"type":"object","properties":{"end_ms":{"title":"end_ms","type":"integer","description":"End timestamp in UTC milliseconds"},"referral_code":{"title":"referral_code","type":"string","default":null,"description":"(Optional) referral code","nullable":true},"start_ms":{"title":"start_ms","type":"integer","description":"Start timestamp in UTC milliseconds"},"wallet":{"title":"wallet","type":"string","default":null,"description":"(Optional) wallet of the referrer","nullable":true}},"additionalProperties":false},"PublicGetReferralPerformanceResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PublicGetReferralPerformanceResultSchema"}},"additionalProperties":false},"PublicGetReferralPerformanceResultSchema":{"required":["fee_share_percentage","referral_code","rewards","stdrv_balance","total_fee_rewards","total_notional_volume","total_referred_fees"],"type":"object","properties":{"fee_share_percentage":{"title":"fee_share_percentage","type":"string","format":"decimal","description":"Fee share percentage rewarded to referrer"},"referral_code":{"title":"referral_code","type":"string","description":"Referral code used to get performance"},"rewards":{"title":"rewards","type":"object","description":"Performance by liquidity role / currency / instrument type","additionalProperties":{"title":"rewards","type":"object","additionalProperties":{"title":"rewards","type":"object","additionalProperties":{"$ref":"#/components/schemas/ReferralPerformanceByInstrumentTypeSchema"}}}},"stdrv_balance":{"title":"stdrv_balance","type":"string","format":"decimal","description":"Staked DRV held used to determine fee share percentage"},"total_fee_rewards":{"title":"total_fee_rewards","type":"string","format":"decimal","description":"Total fee rewards to referrers"},"total_notional_volume":{"title":"total_notional_volume","type":"string","format":"decimal","description":"Total referred notional volume"},"total_referred_fees":{"title":"total_referred_fees","type":"string","format":"decimal","description":"Total fees paid by referred traders (double counts if both taker and maker of a trade with rebated fees)"}},"additionalProperties":false},"ReferralPerformanceByInstrumentTypeSchema":{"required":["fee_reward","notional_volume","referred_fee"],"type":"object","properties":{"fee_reward":{"title":"fee_reward","type":"string","format":"decimal","description":"Fee reward to referrer"},"notional_volume":{"title":"notional_volume","type":"string","format":"decimal","description":"Notional volume"},"referred_fee":{"title":"referred_fee","type":"string","format":"decimal","description":"Fees paid by referred trader"}},"additionalProperties":false},"PrivateCreateSubaccountParamsSchema":{"required":["amount","asset_name","margin_type","nonce","signature","signature_expiry_sec","signer","wallet"],"type":"object","properties":{"amount":{"title":"amount","type":"string","format":"decimal","description":"Amount of the asset to deposit"},"asset_name":{"title":"asset_name","type":"string","description":"Name of asset to deposit"},"currency":{"title":"currency","type":"string","default":null,"description":"Base currency of the subaccount (only for `PM`)","nullable":true},"margin_type":{"title":"margin_type","type":"string","enum":["PM","SM","PM2"],"description":"`PM` (Portfolio Margin), `PM2 (Portfolio Margin 2), or `SM` (Standard Margin))"},"nonce":{"title":"nonce","type":"integer","description":"Unique nonce defined as (e.g. 1695836058725001, where 001 is the random number)"},"signature":{"title":"signature","type":"string","description":"Ethereum signature of the deposit"},"signature_expiry_sec":{"title":"signature_expiry_sec","type":"integer","description":"Unix timestamp in seconds. Expiry MUST be >5min from now"},"signer":{"title":"signer","type":"string","description":"Ethereum wallet address that is signing the deposit"},"wallet":{"title":"wallet","type":"string","description":"Ethereum wallet address"}},"additionalProperties":false},"PrivateCreateSubaccountResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PrivateCreateSubaccountResultSchema"}},"additionalProperties":false},"PrivateCreateSubaccountResultSchema":{"required":["status","transaction_id"],"type":"object","properties":{"status":{"title":"status","type":"string","description":"`requested`"},"transaction_id":{"title":"transaction_id","type":"string","format":"uuid","description":"Transaction id of the request"}},"additionalProperties":false},"PrivateCancelParamsSchema":{"required":["instrument_name","order_id","subaccount_id"],"type":"object","properties":{"instrument_name":{"title":"instrument_name","type":"string"},"order_id":{"title":"order_id","type":"string","format":"uuid"},"subaccount_id":{"title":"subaccount_id","type":"integer"}},"additionalProperties":false},"PrivateCancelResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PrivateCancelResultSchema"}},"additionalProperties":false},"PrivateCancelResultSchema":{"required":["amount","average_price","cancel_reason","creation_timestamp","direction","filled_amount","instrument_name","is_transfer","label","last_update_timestamp","limit_price","max_fee","mmp","nonce","order_fee","order_id","order_status","order_type","quote_id","signature","signature_expiry_sec","signer","subaccount_id","time_in_force"],"type":"object","properties":{"amount":{"title":"amount","type":"string","format":"decimal","description":"Order amount in units of the base"},"average_price":{"title":"average_price","type":"string","format":"decimal","description":"Average fill price"},"cancel_reason":{"title":"cancel_reason","type":"string","enum":["","user_request","mmp_trigger","insufficient_margin","signed_max_fee_too_low","cancel_on_disconnect","ioc_or_market_partial_fill","session_key_deregistered","subaccount_withdrawn","compliance","trigger_failed","validation_failed"],"description":"If cancelled, reason behind order cancellation"},"creation_timestamp":{"title":"creation_timestamp","type":"integer","description":"Creation timestamp (in ms since Unix epoch)"},"direction":{"title":"direction","type":"string","enum":["buy","sell"],"description":"Order direction"},"filled_amount":{"title":"filled_amount","type":"string","format":"decimal","description":"Total filled amount for the order"},"instrument_name":{"title":"instrument_name","type":"string","description":"Instrument name"},"is_transfer":{"title":"is_transfer","type":"boolean","description":"Whether the order was generated through `private/transfer_position`"},"label":{"title":"label","type":"string","description":"Optional user-defined label for the order"},"last_update_timestamp":{"title":"last_update_timestamp","type":"integer","description":"Last update timestamp (in ms since Unix epoch)"},"limit_price":{"title":"limit_price","type":"string","format":"decimal","description":"Limit price in quote currency"},"max_fee":{"title":"max_fee","type":"string","format":"decimal","description":"Max fee in units of the quote currency"},"mmp":{"title":"mmp","type":"boolean","description":"Whether the order is tagged for market maker protections"},"nonce":{"title":"nonce","type":"integer","description":"Unique nonce defined as (e.g. 1695836058725001, where 001 is the random number)"},"order_fee":{"title":"order_fee","type":"string","format":"decimal","description":"Total order fee paid so far"},"order_id":{"title":"order_id","type":"string","description":"Order ID"},"order_status":{"title":"order_status","type":"string","enum":["open","filled","cancelled","expired","untriggered"],"description":"Order status"},"order_type":{"title":"order_type","type":"string","enum":["limit","market"],"description":"Order type"},"quote_id":{"title":"quote_id","type":"string","format":"uuid","default":null,"description":"Quote ID if the trade was executed via RFQ","nullable":true},"replaced_order_id":{"title":"replaced_order_id","type":"string","format":"uuid","default":null,"description":"If replaced, ID of the order that was replaced","nullable":true},"signature":{"title":"signature","type":"string","description":"Ethereum signature of the order"},"signature_expiry_sec":{"title":"signature_expiry_sec","type":"integer","description":"Signature expiry timestamp"},"signer":{"title":"signer","type":"string","description":"Owner wallet address or registered session key that signed order"},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount ID"},"time_in_force":{"title":"time_in_force","type":"string","enum":["gtc","post_only","fok","ioc"],"description":"Time in force"},"trigger_price":{"title":"trigger_price","type":"string","format":"decimal","default":null,"description":"(Required for trigger orders) Index or Market price to trigger order at","nullable":true},"trigger_price_type":{"title":"trigger_price_type","type":"string","default":null,"enum":["mark","index"],"description":"(Required for trigger orders) Trigger with Index or Mark Price","nullable":true},"trigger_reject_message":{"title":"trigger_reject_message","type":"string","default":null,"description":"(Required for trigger orders) Error message if error occured during trigger","nullable":true},"trigger_type":{"title":"trigger_type","type":"string","default":null,"enum":["stoploss","takeprofit"],"description":"(Required for trigger orders) Stop-loss or Take-profit.","nullable":true}},"additionalProperties":false},"PublicGetSpotFeedHistoryCandlesParamsSchema":{"required":["currency","end_timestamp","period","start_timestamp"],"type":"object","properties":{"currency":{"title":"currency","type":"string","description":"Currency"},"end_timestamp":{"title":"end_timestamp","type":"integer","description":"End timestamp"},"period":{"title":"period","type":"string","enum":[60,300,900,1800,3600,14400,28800,86400,604800],"description":"Period"},"start_timestamp":{"title":"start_timestamp","type":"integer","description":"Start timestamp"}},"additionalProperties":false},"PublicGetSpotFeedHistoryCandlesResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PublicGetSpotFeedHistoryCandlesResultSchema"}},"additionalProperties":false},"PublicGetSpotFeedHistoryCandlesResultSchema":{"required":["currency","spot_feed_history"],"type":"object","properties":{"currency":{"title":"currency","type":"string","description":"Currency"},"spot_feed_history":{"title":"spot_feed_history","type":"array","description":"Spot feed history candles","items":{"$ref":"#/components/schemas/SpotFeedHistoryCandlesResponseSchema"}}},"additionalProperties":false},"SpotFeedHistoryCandlesResponseSchema":{"required":["close_price","high_price","low_price","open_price","price","timestamp","timestamp_bucket"],"type":"object","properties":{"close_price":{"title":"close_price","type":"string","format":"decimal","description":"Close price"},"high_price":{"title":"high_price","type":"string","format":"decimal","description":"High price"},"low_price":{"title":"low_price","type":"string","format":"decimal","description":"Low price"},"open_price":{"title":"open_price","type":"string","format":"decimal","description":"Open price"},"price":{"title":"price","type":"string","format":"decimal","description":"Spot price"},"timestamp":{"title":"timestamp","type":"integer","description":"Timestamp of when the spot price was recored into the database"},"timestamp_bucket":{"title":"timestamp_bucket","type":"integer","description":"Timestamp bucket; this value is regularly spaced out with `period` seconds between data points, missing values are forward-filled from earlier data where possible, if no earlier data is available, values are back-filled from the first observed data point"}},"additionalProperties":false},"PrivateGetRfqsParamsSchema":{"required":["subaccount_id"],"type":"object","properties":{"from_timestamp":{"title":"from_timestamp","type":"integer","default":0,"description":"Earliest `last_update_timestamp` to filter by (in ms since Unix epoch). If not provied, defaults to 0."},"page":{"title":"page","type":"integer","default":1,"description":"Page number of results to return (default 1, returns last if above `num_pages`)"},"page_size":{"title":"page_size","type":"integer","default":100,"description":"Number of results per page (default 100, max 1000)"},"rfq_id":{"title":"rfq_id","type":"string","format":"uuid","default":null,"description":"RFQ ID filter, if applicable","nullable":true},"status":{"title":"status","type":"string","default":null,"enum":["open","filled","cancelled","expired"],"description":"RFQ status filter, if applicable","nullable":true},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount ID for auth purposes, returned data will be scoped to this subaccount."},"to_timestamp":{"title":"to_timestamp","type":"integer","default":18446744073709552000,"description":"Latest `last_update_timestamp` to filter by (in ms since Unix epoch). If not provied, defaults to returning all data up to current time."}},"additionalProperties":false},"PrivateGetRfqsResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PrivateGetRfqsResultSchema"}},"additionalProperties":false},"PrivateGetRfqsResultSchema":{"required":["pagination","rfqs"],"type":"object","properties":{"pagination":{"$ref":"#/components/schemas/PaginationInfoSchema"},"rfqs":{"title":"rfqs","type":"array","description":"RFQs matching filter criteria","items":{"$ref":"#/components/schemas/RFQResultSchema"}}},"additionalProperties":false},"RFQResultSchema":{"required":["ask_total_cost","bid_total_cost","cancel_reason","counterparties","creation_timestamp","filled_direction","filled_pct","label","last_update_timestamp","legs","mark_total_cost","max_total_cost","min_total_cost","partial_fill_step","rfq_id","status","subaccount_id","total_cost","valid_until"],"type":"object","properties":{"ask_total_cost":{"title":"ask_total_cost","type":"string","format":"decimal","default":null,"description":"Ask total cost for the RFQ implied from orderbook (as `sell`)","nullable":true},"bid_total_cost":{"title":"bid_total_cost","type":"string","format":"decimal","default":null,"description":"Bid total cost for the RFQ implied from orderbook (as `buy`)","nullable":true},"cancel_reason":{"title":"cancel_reason","type":"string","enum":["","user_request","insufficient_margin","signed_max_fee_too_low","mmp_trigger","cancel_on_disconnect","session_key_deregistered","subaccount_withdrawn","rfq_no_longer_open","compliance"],"description":"Cancel reason, if any"},"counterparties":{"title":"counterparties","type":"array","default":null,"description":"List of requested counterparties, if applicable","items":{"title":"counterparties","type":"string"},"nullable":true},"creation_timestamp":{"title":"creation_timestamp","type":"integer","description":"Creation timestamp in ms since Unix epoch"},"filled_direction":{"title":"filled_direction","type":"string","default":null,"enum":["buy","sell"],"description":"Direction at which the RFQ was filled (only if filled)","nullable":true},"filled_pct":{"title":"filled_pct","type":"string","format":"decimal","description":"Percentage of the RFQ that has been filled, from 0 to 1."},"label":{"title":"label","type":"string","description":"User-defined label, if any"},"last_update_timestamp":{"title":"last_update_timestamp","type":"integer","description":"Last update timestamp in ms since Unix epoch"},"legs":{"title":"legs","type":"array","description":"RFQ legs","items":{"$ref":"#/components/schemas/LegUnpricedSchema"}},"mark_total_cost":{"title":"mark_total_cost","type":"string","format":"decimal","default":null,"description":"Mark total cost for the RFQ (assuming `buy` direction)","nullable":true},"max_total_cost":{"title":"max_total_cost","type":"string","format":"decimal","default":null,"description":"Max total cost for the RFQ","nullable":true},"min_total_cost":{"title":"min_total_cost","type":"string","format":"decimal","default":null,"description":"Min total cost for the RFQ","nullable":true},"partial_fill_step":{"title":"partial_fill_step","type":"string","format":"decimal","description":"Step size for partial fills (default: 1)"},"rfq_id":{"title":"rfq_id","type":"string","format":"uuid","description":"RFQ ID"},"status":{"title":"status","type":"string","enum":["open","filled","cancelled","expired"],"description":"Status"},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount ID"},"total_cost":{"title":"total_cost","type":"string","format":"decimal","default":null,"description":"Total cost for the RFQ (only if filled)","nullable":true},"valid_until":{"title":"valid_until","type":"integer","description":"RFQ expiry timestamp in ms since Unix epoch"}},"additionalProperties":false},"PrivateCancelByNonceParamsSchema":{"required":["instrument_name","nonce","subaccount_id","wallet"],"type":"object","properties":{"instrument_name":{"title":"instrument_name","type":"string","description":"Instrument name"},"nonce":{"title":"nonce","type":"integer","description":"Cancel an order with this nonce"},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount ID"},"wallet":{"title":"wallet","type":"string","description":"Wallet address"}},"additionalProperties":false},"PrivateCancelByNonceResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PrivateCancelByNonceResultSchema"}},"additionalProperties":false},"PrivateCancelByNonceResultSchema":{"required":["cancelled_orders"],"type":"object","properties":{"cancelled_orders":{"title":"cancelled_orders","type":"integer","description":"Number of cancelled orders"}},"additionalProperties":false},"PrivateGetSubaccountParamsSchema":{"required":["subaccount_id"],"type":"object","properties":{"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount_id"}},"additionalProperties":false},"PrivateGetSubaccountResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PrivateGetSubaccountResultSchema"}},"additionalProperties":false},"PrivateSendRfqParamsSchema":{"required":["legs","subaccount_id"],"type":"object","properties":{"counterparties":{"title":"counterparties","type":"array","default":null,"description":"Optional list of market maker account addresses to request quotes from. If not supplied, all market makers who are approved as RFQ makers will be notified.","items":{"title":"counterparties","type":"string"},"nullable":true},"label":{"title":"label","type":"string","default":"","description":"Optional user-defined label for the RFQ"},"legs":{"title":"legs","type":"array","description":"RFQ legs","items":{"$ref":"#/components/schemas/LegUnpricedSchema"}},"max_total_cost":{"title":"max_total_cost","type":"string","format":"decimal","default":null,"description":"An optional max total cost for the RFQ. Only used when the RFQ sender executes as buyer. Polling endpoints and channels will ignore quotes where the total cost across all legs is above this value. Positive values mean the RFQ sender expects to pay $, negative mean the RFQ sender expects to receive $.This field is not disclosed to the market makers.","nullable":true},"min_total_cost":{"title":"min_total_cost","type":"string","format":"decimal","default":null,"description":"An optional min total cost for the RFQ. Only used when the RFQ sender executes as seller. Polling endpoints and channels will ignore quotes where the total cost across all legs is below this value. Positive values mean the RFQ sender expects to receive $, negative mean the RFQ sender expects to pay $.This field is not disclosed to the market makers.","nullable":true},"partial_fill_step":{"title":"partial_fill_step","type":"string","format":"decimal","default":"1","description":"Optional step size for partial fills. If not supplied, the RFQ will not support partial fills."},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount ID"}},"additionalProperties":false},"PrivateSendRfqResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PrivateSendRfqResultSchema"}},"additionalProperties":false},"PrivateSendRfqResultSchema":{"required":["ask_total_cost","bid_total_cost","cancel_reason","counterparties","creation_timestamp","filled_direction","filled_pct","label","last_update_timestamp","legs","mark_total_cost","max_total_cost","min_total_cost","partial_fill_step","rfq_id","status","subaccount_id","total_cost","valid_until"],"type":"object","properties":{"ask_total_cost":{"title":"ask_total_cost","type":"string","format":"decimal","default":null,"description":"Ask total cost for the RFQ implied from orderbook (as `sell`)","nullable":true},"bid_total_cost":{"title":"bid_total_cost","type":"string","format":"decimal","default":null,"description":"Bid total cost for the RFQ implied from orderbook (as `buy`)","nullable":true},"cancel_reason":{"title":"cancel_reason","type":"string","enum":["","user_request","insufficient_margin","signed_max_fee_too_low","mmp_trigger","cancel_on_disconnect","session_key_deregistered","subaccount_withdrawn","rfq_no_longer_open","compliance"],"description":"Cancel reason, if any"},"counterparties":{"title":"counterparties","type":"array","default":null,"description":"List of requested counterparties, if applicable","items":{"title":"counterparties","type":"string"},"nullable":true},"creation_timestamp":{"title":"creation_timestamp","type":"integer","description":"Creation timestamp in ms since Unix epoch"},"filled_direction":{"title":"filled_direction","type":"string","default":null,"enum":["buy","sell"],"description":"Direction at which the RFQ was filled (only if filled)","nullable":true},"filled_pct":{"title":"filled_pct","type":"string","format":"decimal","description":"Percentage of the RFQ that has been filled, from 0 to 1."},"label":{"title":"label","type":"string","description":"User-defined label, if any"},"last_update_timestamp":{"title":"last_update_timestamp","type":"integer","description":"Last update timestamp in ms since Unix epoch"},"legs":{"title":"legs","type":"array","description":"RFQ legs","items":{"$ref":"#/components/schemas/LegUnpricedSchema"}},"mark_total_cost":{"title":"mark_total_cost","type":"string","format":"decimal","default":null,"description":"Mark total cost for the RFQ (assuming `buy` direction)","nullable":true},"max_total_cost":{"title":"max_total_cost","type":"string","format":"decimal","default":null,"description":"Max total cost for the RFQ","nullable":true},"min_total_cost":{"title":"min_total_cost","type":"string","format":"decimal","default":null,"description":"Min total cost for the RFQ","nullable":true},"partial_fill_step":{"title":"partial_fill_step","type":"string","format":"decimal","description":"Step size for partial fills (default: 1)"},"rfq_id":{"title":"rfq_id","type":"string","format":"uuid","description":"RFQ ID"},"status":{"title":"status","type":"string","enum":["open","filled","cancelled","expired"],"description":"Status"},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount ID"},"total_cost":{"title":"total_cost","type":"string","format":"decimal","default":null,"description":"Total cost for the RFQ (only if filled)","nullable":true},"valid_until":{"title":"valid_until","type":"integer","description":"RFQ expiry timestamp in ms since Unix epoch"}},"additionalProperties":false},"PublicGetTimeParamsSchema":{"type":"object","properties":{},"additionalProperties":false},"PublicGetTimeResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"title":"result","type":"integer","description":"Current time in milliseconds since UNIX epoch"}},"additionalProperties":false},"PublicStatisticsParamsSchema":{"required":["instrument_name"],"type":"object","properties":{"currency":{"title":"currency","type":"string","default":null,"description":"Currency for stats","nullable":true},"end_time":{"title":"end_time","type":"integer","default":null,"description":"End time for statistics in ms","nullable":true},"instrument_name":{"title":"instrument_name","type":"string","description":"Instrument name or 'ALL', 'OPTION', 'PERP', 'SPOT'"}},"additionalProperties":false},"PublicStatisticsResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PublicStatisticsResultSchema"}},"additionalProperties":false},"PublicStatisticsResultSchema":{"required":["daily_fees","daily_notional_volume","daily_premium_volume","daily_trades","open_interest","total_fees","total_notional_volume","total_premium_volume","total_trades"],"type":"object","properties":{"daily_fees":{"title":"daily_fees","type":"string","format":"decimal","description":"24h Fees"},"daily_notional_volume":{"title":"daily_notional_volume","type":"string","format":"decimal","description":"24h Notional volume"},"daily_premium_volume":{"title":"daily_premium_volume","type":"string","format":"decimal","description":"24h Premium volume"},"daily_trades":{"title":"daily_trades","type":"integer","description":"24h Trades"},"open_interest":{"title":"open_interest","type":"string","format":"decimal","description":"Open interest"},"total_fees":{"title":"total_fees","type":"string","format":"decimal","description":"Total fees"},"total_notional_volume":{"title":"total_notional_volume","type":"string","format":"decimal","description":"Total notional volume"},"total_premium_volume":{"title":"total_premium_volume","type":"string","format":"decimal","description":"Total premium volume"},"total_trades":{"title":"total_trades","type":"integer","description":"Total trades"}},"additionalProperties":false},"PublicGetAllInstrumentsParamsSchema":{"required":["expired","instrument_type"],"type":"object","properties":{"currency":{"title":"currency","type":"string","default":null,"description":"Underlying currency of asset (`ETH`, `BTC`, etc)","nullable":true},"expired":{"title":"expired","type":"boolean","description":"If `True`: include expired instruments."},"instrument_type":{"title":"instrument_type","type":"string","enum":["erc20","option","perp"],"description":"`erc20`, `option`, or `perp`"},"page":{"title":"page","type":"integer","default":1,"description":"Page number of results to return (default 1, returns last if above `num_pages`)"},"page_size":{"title":"page_size","type":"integer","default":100,"description":"Number of results per page (default 100, max 1000)"}},"additionalProperties":false},"PublicGetAllInstrumentsResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PublicGetAllInstrumentsResultSchema"}},"additionalProperties":false},"PublicGetAllInstrumentsResultSchema":{"required":["instruments","pagination"],"type":"object","properties":{"instruments":{"title":"instruments","type":"array","description":"List of instruments","items":{"$ref":"#/components/schemas/InstrumentPublicResponseSchema"}},"pagination":{"$ref":"#/components/schemas/PaginationInfoSchema"}},"additionalProperties":false},"PrivateGetLiquidatorHistoryParamsSchema":{"required":["subaccount_id"],"type":"object","properties":{"end_timestamp":{"title":"end_timestamp","type":"integer","default":9223372036854776000,"description":"End timestamp of the event history (default current time)"},"page":{"title":"page","type":"integer","default":1,"description":"Page number of results to return (default 1, returns last if above `num_pages`)"},"page_size":{"title":"page_size","type":"integer","default":100,"description":"Number of results per page (default 100, max 1000)"},"start_timestamp":{"title":"start_timestamp","type":"integer","default":0,"description":"Start timestamp of the event history (default 0)"},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount ID"}},"additionalProperties":false},"PrivateGetLiquidatorHistoryResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PrivateGetLiquidatorHistoryResultSchema"}},"additionalProperties":false},"PrivateGetLiquidatorHistoryResultSchema":{"required":["bids","pagination"],"type":"object","properties":{"bids":{"title":"bids","type":"array","description":"List of auction bid events","items":{"$ref":"#/components/schemas/AuctionBidEventSchema"}},"pagination":{"$ref":"#/components/schemas/PaginationInfoSchema"}},"additionalProperties":false},"PublicRegisterSessionKeyParamsSchema":{"required":["expiry_sec","label","public_session_key","signed_raw_tx","wallet"],"type":"object","properties":{"expiry_sec":{"title":"expiry_sec","type":"integer","description":"Expiry of the session key"},"label":{"title":"label","type":"string","description":"Ethereum wallet address"},"public_session_key":{"title":"public_session_key","type":"string","description":"Session key in the form of an Ethereum EOA"},"signed_raw_tx":{"title":"signed_raw_tx","type":"string","description":"A signed RLP encoded ETH transaction in form of a hex string (same as `w3.eth.account.sign_transaction(unsigned_tx, private_key).rawTransaction.hex()`)"},"wallet":{"title":"wallet","type":"string","description":"Ethereum wallet address of account"}},"additionalProperties":false},"PublicRegisterSessionKeyResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PublicRegisterSessionKeyResultSchema"}},"additionalProperties":false},"PublicRegisterSessionKeyResultSchema":{"required":["label","public_session_key","transaction_id"],"type":"object","properties":{"label":{"title":"label","type":"string","description":"User-defined session key label"},"public_session_key":{"title":"public_session_key","type":"string","description":"Session key in the form of an Ethereum EOA"},"transaction_id":{"title":"transaction_id","type":"string","format":"uuid","description":"ID to lookup status of transaction"}},"additionalProperties":false},"PublicGetVaultBalancesParamsSchema":{"type":"object","properties":{"smart_contract_owner":{"title":"smart_contract_owner","type":"string","default":null,"description":"If wallet not provided, can query balances by EOA that owns smart contract wallet","nullable":true},"wallet":{"title":"wallet","type":"string","default":null,"description":"Ethereum wallet address of smart contract","nullable":true}},"additionalProperties":false},"PublicGetVaultBalancesResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"title":"result","type":"array","description":"","items":{"$ref":"#/components/schemas/VaultBalanceResponseSchema"}}},"additionalProperties":false},"VaultBalanceResponseSchema":{"required":["address","amount","chain_id","name","vault_asset_type"],"type":"object","properties":{"address":{"title":"address","type":"string"},"amount":{"title":"amount","type":"string","format":"decimal"},"chain_id":{"title":"chain_id","type":"integer"},"name":{"title":"name","type":"string"},"vault_asset_type":{"title":"vault_asset_type","type":"string"}},"additionalProperties":false},"PrivateGetAccountParamsSchema":{"required":["wallet"],"type":"object","properties":{"wallet":{"title":"wallet","type":"string","description":"Ethereum wallet address of account"}},"additionalProperties":false},"PrivateGetAccountResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PrivateGetAccountResultSchema"}},"additionalProperties":false},"PrivateGetAccountResultSchema":{"required":["cancel_on_disconnect","fee_info","is_rfq_maker","per_endpoint_tps","subaccount_ids","wallet","websocket_matching_tps","websocket_non_matching_tps","websocket_option_tps","websocket_perp_tps"],"type":"object","properties":{"cancel_on_disconnect":{"title":"cancel_on_disconnect","type":"boolean","description":"Whether cancel on disconnect is enabled for the account"},"fee_info":{"$ref":"#/components/schemas/AccountFeeInfoSchema"},"is_rfq_maker":{"title":"is_rfq_maker","type":"boolean","description":"Whether account allowed to market make RFQs"},"per_endpoint_tps":{"title":"per_endpoint_tps","type":"object","description":"If a particular endpoint has a different max TPS, it will be specified here","additionalProperties":{}},"referral_code":{"title":"referral_code","type":"string","default":null,"description":"Referral code for the account (must register with broker program first)","nullable":true},"subaccount_ids":{"title":"subaccount_ids","type":"array","description":"List of subaccount_ids owned by the wallet in `SubAccounts.sol`","items":{"title":"subaccount_ids","type":"integer"}},"wallet":{"title":"wallet","type":"string","description":"Ethereum wallet address"},"websocket_matching_tps":{"title":"websocket_matching_tps","type":"integer","description":"Max transactions per second for matching requests over websocket (see `Rate Limiting` in docs)"},"websocket_non_matching_tps":{"title":"websocket_non_matching_tps","type":"integer","description":"Max transactions per second for non-matching requests over websocket (see `Rate Limiting` in docs)"},"websocket_option_tps":{"title":"websocket_option_tps","type":"integer","description":"Max transactions per second for EACH option instrument over websocket (see `Rate Limiting` in docs)"},"websocket_perp_tps":{"title":"websocket_perp_tps","type":"integer","description":"Max transactions per second for EACH perp instrument over websocket (see `Rate Limiting` in docs)"}},"additionalProperties":false},"AccountFeeInfoSchema":{"required":["base_fee_discount","option_maker_fee","option_taker_fee","perp_maker_fee","perp_taker_fee","rfq_maker_discount","rfq_taker_discount","spot_maker_fee","spot_taker_fee"],"type":"object","properties":{"base_fee_discount":{"title":"base_fee_discount","type":"string","format":"decimal","description":"Base fee discount"},"option_maker_fee":{"title":"option_maker_fee","type":"string","format":"decimal","default":null,"description":"Option maker fee - uses default instrument fee rate if None","nullable":true},"option_taker_fee":{"title":"option_taker_fee","type":"string","format":"decimal","default":null,"description":"Option taker fee - uses default instrument fee rate if None","nullable":true},"perp_maker_fee":{"title":"perp_maker_fee","type":"string","format":"decimal","default":null,"description":"Perp maker fee - uses default instrument fee rate if None","nullable":true},"perp_taker_fee":{"title":"perp_taker_fee","type":"string","format":"decimal","default":null,"description":"Perp taker fee - uses default instrument fee rate if None","nullable":true},"rfq_maker_discount":{"title":"rfq_maker_discount","type":"string","format":"decimal","description":"RFQ maker fee discount"},"rfq_taker_discount":{"title":"rfq_taker_discount","type":"string","format":"decimal","description":"RFQ taker fee discount"},"spot_maker_fee":{"title":"spot_maker_fee","type":"string","format":"decimal","default":null,"description":"Spot maker fee - uses default instrument fee rate if None","nullable":true},"spot_taker_fee":{"title":"spot_taker_fee","type":"string","format":"decimal","default":null,"description":"Spot taker fee - uses default instrument fee rate if None","nullable":true}},"additionalProperties":false},"PrivateCancelQuoteParamsSchema":{"required":["quote_id","subaccount_id"],"type":"object","properties":{"quote_id":{"title":"quote_id","type":"string","format":"uuid","description":"Quote ID to cancel"},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount ID"}},"additionalProperties":false},"PrivateCancelQuoteResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PrivateCancelQuoteResultSchema"}},"additionalProperties":false},"PrivateCancelQuoteResultSchema":{"required":["cancel_reason","creation_timestamp","direction","fee","fill_pct","is_transfer","label","last_update_timestamp","legs","legs_hash","liquidity_role","max_fee","mmp","nonce","quote_id","rfq_id","signature","signature_expiry_sec","signer","status","subaccount_id","tx_hash","tx_status"],"type":"object","properties":{"cancel_reason":{"title":"cancel_reason","type":"string","enum":["","user_request","insufficient_margin","signed_max_fee_too_low","mmp_trigger","cancel_on_disconnect","session_key_deregistered","subaccount_withdrawn","rfq_no_longer_open","compliance"],"description":"Cancel reason, if any"},"creation_timestamp":{"title":"creation_timestamp","type":"integer","description":"Creation timestamp in ms since Unix epoch"},"direction":{"title":"direction","type":"string","enum":["buy","sell"],"description":"Quote direction"},"fee":{"title":"fee","type":"string","format":"decimal","description":"Fee paid for this quote (if executed)"},"fill_pct":{"title":"fill_pct","type":"string","format":"decimal","description":"Percentage of the RFQ that this quote would fill, from 0 to 1."},"is_transfer":{"title":"is_transfer","type":"boolean","description":"Whether the order was generated through `private/transfer_position`"},"label":{"title":"label","type":"string","description":"User-defined label, if any"},"last_update_timestamp":{"title":"last_update_timestamp","type":"integer","description":"Last update timestamp in ms since Unix epoch"},"legs":{"title":"legs","type":"array","description":"Quote legs","items":{"$ref":"#/components/schemas/LegPricedSchema"}},"legs_hash":{"title":"legs_hash","type":"string","description":"Hash of the legs of the best quote to be signed by the taker."},"liquidity_role":{"title":"liquidity_role","type":"string","enum":["maker","taker"],"description":"Liquidity role"},"max_fee":{"title":"max_fee","type":"string","format":"decimal","description":"Signed max fee"},"mmp":{"title":"mmp","type":"boolean","description":"Whether the quote is tagged for market maker protections (default false)"},"nonce":{"title":"nonce","type":"integer","description":"Nonce"},"quote_id":{"title":"quote_id","type":"string","format":"uuid","description":"Quote ID"},"rfq_id":{"title":"rfq_id","type":"string","format":"uuid","description":"RFQ ID"},"signature":{"title":"signature","type":"string","description":"Ethereum signature of the quote"},"signature_expiry_sec":{"title":"signature_expiry_sec","type":"integer","description":"Unix timestamp in seconds"},"signer":{"title":"signer","type":"string","description":"Owner wallet address or registered session key that signed the quote"},"status":{"title":"status","type":"string","enum":["open","filled","cancelled","expired"],"description":"Status"},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount ID"},"tx_hash":{"title":"tx_hash","type":"string","default":null,"description":"Blockchain transaction hash (only for executed quotes)","nullable":true},"tx_status":{"title":"tx_status","type":"string","default":null,"enum":["requested","pending","settled","reverted","ignored","timed_out"],"description":"Blockchain transaction status (only for executed quotes)","nullable":true}},"additionalProperties":false},"PrivateCancelByInstrumentParamsSchema":{"required":["instrument_name","subaccount_id"],"type":"object","properties":{"instrument_name":{"title":"instrument_name","type":"string","description":"Cancel all orders for this instrument"},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount ID"}},"additionalProperties":false},"PrivateCancelByInstrumentResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PrivateCancelByInstrumentResultSchema"}},"additionalProperties":false},"PrivateCancelByInstrumentResultSchema":{"required":["cancelled_orders"],"type":"object","properties":{"cancelled_orders":{"title":"cancelled_orders","type":"integer","description":"Number of cancelled orders"}},"additionalProperties":false},"PrivateSendQuoteParamsSchema":{"required":["direction","legs","max_fee","nonce","rfq_id","signature","signature_expiry_sec","signer","subaccount_id"],"type":"object","properties":{"direction":{"title":"direction","type":"string","enum":["buy","sell"],"description":"Quote direction, `buy` means trading each leg at its direction, `sell` means trading each leg in the opposite direction."},"label":{"title":"label","type":"string","default":"","description":"Optional user-defined label for the quote"},"legs":{"title":"legs","type":"array","description":"Quote legs","items":{"$ref":"#/components/schemas/LegPricedSchema"}},"max_fee":{"title":"max_fee","type":"string","format":"decimal","description":"Max fee ($ for the full trade). Request will be rejected if the supplied max fee is below the estimated fee for this trade."},"mmp":{"title":"mmp","type":"boolean","default":false,"description":"Whether the quote is tagged for market maker protections (default false)"},"nonce":{"title":"nonce","type":"integer","description":"Unique nonce defined as a concatenated `UTC timestamp in ms` and `random number up to 6 digits` (e.g. 1695836058725001, where 001 is the random number)"},"rfq_id":{"title":"rfq_id","type":"string","format":"uuid","description":"RFQ ID the quote is for"},"signature":{"title":"signature","type":"string","description":"Ethereum signature of the quote"},"signature_expiry_sec":{"title":"signature_expiry_sec","type":"integer","description":"Unix timestamp in seconds. Expiry MUST be at least 310 seconds from now. Once time till signature expiry reaches 300 seconds, the quote will be considered expired. This buffer is meant to ensure the trade can settle on chain in case of a blockchain congestion."},"signer":{"title":"signer","type":"string","description":"Owner wallet address or registered session key that signed the quote"},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount ID"}},"additionalProperties":false},"PrivateSendQuoteResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"$ref":"#/components/schemas/PrivateSendQuoteResultSchema"}},"additionalProperties":false},"PrivateSendQuoteResultSchema":{"required":["cancel_reason","creation_timestamp","direction","fee","fill_pct","is_transfer","label","last_update_timestamp","legs","legs_hash","liquidity_role","max_fee","mmp","nonce","quote_id","rfq_id","signature","signature_expiry_sec","signer","status","subaccount_id","tx_hash","tx_status"],"type":"object","properties":{"cancel_reason":{"title":"cancel_reason","type":"string","enum":["","user_request","insufficient_margin","signed_max_fee_too_low","mmp_trigger","cancel_on_disconnect","session_key_deregistered","subaccount_withdrawn","rfq_no_longer_open","compliance"],"description":"Cancel reason, if any"},"creation_timestamp":{"title":"creation_timestamp","type":"integer","description":"Creation timestamp in ms since Unix epoch"},"direction":{"title":"direction","type":"string","enum":["buy","sell"],"description":"Quote direction"},"fee":{"title":"fee","type":"string","format":"decimal","description":"Fee paid for this quote (if executed)"},"fill_pct":{"title":"fill_pct","type":"string","format":"decimal","description":"Percentage of the RFQ that this quote would fill, from 0 to 1."},"is_transfer":{"title":"is_transfer","type":"boolean","description":"Whether the order was generated through `private/transfer_position`"},"label":{"title":"label","type":"string","description":"User-defined label, if any"},"last_update_timestamp":{"title":"last_update_timestamp","type":"integer","description":"Last update timestamp in ms since Unix epoch"},"legs":{"title":"legs","type":"array","description":"Quote legs","items":{"$ref":"#/components/schemas/LegPricedSchema"}},"legs_hash":{"title":"legs_hash","type":"string","description":"Hash of the legs of the best quote to be signed by the taker."},"liquidity_role":{"title":"liquidity_role","type":"string","enum":["maker","taker"],"description":"Liquidity role"},"max_fee":{"title":"max_fee","type":"string","format":"decimal","description":"Signed max fee"},"mmp":{"title":"mmp","type":"boolean","description":"Whether the quote is tagged for market maker protections (default false)"},"nonce":{"title":"nonce","type":"integer","description":"Nonce"},"quote_id":{"title":"quote_id","type":"string","format":"uuid","description":"Quote ID"},"rfq_id":{"title":"rfq_id","type":"string","format":"uuid","description":"RFQ ID"},"signature":{"title":"signature","type":"string","description":"Ethereum signature of the quote"},"signature_expiry_sec":{"title":"signature_expiry_sec","type":"integer","description":"Unix timestamp in seconds"},"signer":{"title":"signer","type":"string","description":"Owner wallet address or registered session key that signed the quote"},"status":{"title":"status","type":"string","enum":["open","filled","cancelled","expired"],"description":"Status"},"subaccount_id":{"title":"subaccount_id","type":"integer","description":"Subaccount ID"},"tx_hash":{"title":"tx_hash","type":"string","default":null,"description":"Blockchain transaction hash (only for executed quotes)","nullable":true},"tx_status":{"title":"tx_status","type":"string","default":null,"enum":["requested","pending","settled","reverted","ignored","timed_out"],"description":"Blockchain transaction status (only for executed quotes)","nullable":true}},"additionalProperties":false},"PrivateCancelAllParamsSchema":{"required":["subaccount_id"],"type":"object","properties":{"subaccount_id":{"title":"subaccount_id","type":"integer"}},"additionalProperties":false},"PrivateCancelAllResponseSchema":{"required":["id","result"],"type":"object","properties":{"id":{"oneOf":[{"title":"","type":"string"},{"title":"","type":"integer"}]},"result":{"title":"result","type":"string","enum":["ok"],"description":""}},"additionalProperties":false}}},"x-readme":{"explorer-enabled":true,"proxy-enabled":true}} \ No newline at end of file diff --git a/scripts/generate-models.py b/scripts/generate-models.py index 6a72ef30..7e54e2d7 100644 --- a/scripts/generate-models.py +++ b/scripts/generate-models.py @@ -68,12 +68,14 @@ def generate_models(input_path: Path, output_path: Path): input_file_type=InputFileType.OpenAPI, output=output_path, output_model_type=DataModelType.DataclassesDataclass, - target_python_version=PythonVersion.PY_310, + target_python_version=PythonVersion.PY_311, reuse_model=True, use_subclass_enum=True, strict_nullable=True, use_double_quotes=True, field_constraints=True, + disable_timestamp=True, + custom_file_header="# ruff: noqa: E741" ) print(f"Models generated at: {output_path}") @@ -81,16 +83,6 @@ def generate_models(input_path: Path, output_path: Path): if __name__ == "__main__": base_url = "https://docs.derive.xyz" repo_root = Path(__file__).parent.parent - - openapi_specs_path = repo_root / "derive_client" / "data" / "openapi" - openapi_specs_path.mkdir(exist_ok=True) - - files = download_openapi_specs(base_url=base_url, dest_dir=openapi_specs_path) - - input_path = next((p for p in files if "latest" in p.stem.lower()), None) - if input_path is None: - available = ", ".join(p.name for p in files) - raise RuntimeError(f"No 'latest' spec found among downloaded files: {available}") - - output_path = repo_root / "derive_client" / "_clients" / "models.py" + input_path = Path("openapi-spec.json") + output_path = repo_root / "derive_client" / "data" / "generated" / "models.py" generate_models(input_path=input_path, output_path=output_path)