From 6731b41e63f20b49c2e7fbcb653afd1d66bc2c7b Mon Sep 17 00:00:00 2001
From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com>
Date: Thu, 8 Oct 2026 05:26:01 +0000
Subject: [PATCH 1/2] [fern-generated] Update SDK
Generated by Fern
CLI Version: unknown
Generators:
- fernapi/fern-python-sdk: 5.28.0
---
.fern/metadata.json | 2 +-
reference.md | 134 +-----
src/whop_sdk/__init__.py | 69 +--
src/whop_sdk/errors/__init__.py | 3 -
src/whop_sdk/errors/gone_error.py | 11 -
src/whop_sdk/trades/__init__.py | 9 +-
src/whop_sdk/trades/client.py | 244 ++++-------
src/whop_sdk/trades/raw_client.py | 408 ++++++------------
src/whop_sdk/trades/types/__init__.py | 9 +-
.../types/create_trades_request_type.py | 5 +
.../list_trades_request_operation_type.py | 7 -
.../types/list_trades_request_status.py | 2 +-
.../trades/types/list_trades_request_type.py | 5 +
src/whop_sdk/types/__init__.py | 57 +--
src/whop_sdk/types/trade.py | 67 ++-
.../types/trade_cancellation_result.py | 33 --
.../types/trade_cancellation_result_status.py | 5 -
src/whop_sdk/types/trade_failure_code.py | 16 +-
src/whop_sdk/types/trade_funds_location.py | 5 +
src/whop_sdk/types/trade_hyperliquid.py | 22 -
src/whop_sdk/types/trade_instrument_type.py | 5 -
src/whop_sdk/types/trade_leverage.py | 33 --
.../types/trade_leverage_margin_mode.py | 5 -
src/whop_sdk/types/trade_operation_type.py | 5 -
src/whop_sdk/types/trade_order_result.py | 86 ----
.../types/trade_order_result_object.py | 5 -
.../types/trade_order_result_order_type.py | 5 -
src/whop_sdk/types/trade_order_result_side.py | 5 -
.../types/trade_order_result_status.py | 5 -
src/whop_sdk/types/trade_requested_order.py | 60 ---
.../types/trade_requested_order_order_type.py | 5 -
.../types/trade_requested_order_side.py | 5 -
src/whop_sdk/types/trade_status.py | 4 +-
src/whop_sdk/types/trade_status_detail.py | 7 +
.../{trade_provider.py => trade_type.py} | 2 +-
35 files changed, 361 insertions(+), 989 deletions(-)
delete mode 100644 src/whop_sdk/errors/gone_error.py
create mode 100644 src/whop_sdk/trades/types/create_trades_request_type.py
delete mode 100644 src/whop_sdk/trades/types/list_trades_request_operation_type.py
create mode 100644 src/whop_sdk/trades/types/list_trades_request_type.py
delete mode 100644 src/whop_sdk/types/trade_cancellation_result.py
delete mode 100644 src/whop_sdk/types/trade_cancellation_result_status.py
create mode 100644 src/whop_sdk/types/trade_funds_location.py
delete mode 100644 src/whop_sdk/types/trade_hyperliquid.py
delete mode 100644 src/whop_sdk/types/trade_instrument_type.py
delete mode 100644 src/whop_sdk/types/trade_leverage.py
delete mode 100644 src/whop_sdk/types/trade_leverage_margin_mode.py
delete mode 100644 src/whop_sdk/types/trade_operation_type.py
delete mode 100644 src/whop_sdk/types/trade_order_result.py
delete mode 100644 src/whop_sdk/types/trade_order_result_object.py
delete mode 100644 src/whop_sdk/types/trade_order_result_order_type.py
delete mode 100644 src/whop_sdk/types/trade_order_result_side.py
delete mode 100644 src/whop_sdk/types/trade_order_result_status.py
delete mode 100644 src/whop_sdk/types/trade_requested_order.py
delete mode 100644 src/whop_sdk/types/trade_requested_order_order_type.py
delete mode 100644 src/whop_sdk/types/trade_requested_order_side.py
create mode 100644 src/whop_sdk/types/trade_status_detail.py
rename src/whop_sdk/types/{trade_provider.py => trade_type.py} (52%)
diff --git a/.fern/metadata.json b/.fern/metadata.json
index c93587015..878b35ead 100644
--- a/.fern/metadata.json
+++ b/.fern/metadata.json
@@ -15,7 +15,7 @@
"standardwebhooks": ">=1.0.1,<2"
}
},
- "originGitCommit": "717d8221c5238883c99d81db2f1e391fded6b21f",
+ "originGitCommit": "afd35eaf41c7a23f1ba14e6e439360231ed9c9ef",
"originGitCommitIsDirty": false,
"invokedBy": "ci",
"requestedVersion": "2.2.0",
diff --git a/reference.md b/reference.md
index 6f18757b6..97b612d02 100644
--- a/reference.md
+++ b/reference.md
@@ -41716,7 +41716,7 @@ client.topups.create(
-
-Lists trades you can access, newest first. User credentials see their own trades and those of accounts they belong to, including connected accounts; account credentials see their account and its connected accounts. These are submission records, not fill or position history.
+Lists trades you can access, newest first. User credentials see their own trades and those of accounts they belong to, including connected accounts; account credentials see their account and its connected accounts.
@@ -41763,7 +41763,7 @@ client.trades.list()
-
-**status:** `typing.Optional[ListTradesRequestStatus]` — Only return trades with this submission status.
+**status:** `typing.Optional[ListTradesRequestStatus]` — Only return trades with this status.
@@ -41771,7 +41771,7 @@ client.trades.list()
-
-**operation_type:** `typing.Optional[ListTradesRequestOperationType]` — Only return trades of this kind, such as `create_orders` for order submissions.
+**type:** `typing.Optional[ListTradesRequestType]` — Only return trades of this type.
@@ -41839,7 +41839,7 @@ client.trades.list()
-client.trades.create()
+client.trades.create(...) -> Trade
-
@@ -41851,7 +41851,7 @@ client.trades.list()
-
-Retired. Order batches can no longer be placed. Every caller gets `410 Gone`, whatever the body, and nothing is sent to the trading provider. List and retrieve earlier trades with `GET /trades`.
+Creates a trade on the Whop-managed wallet of an account or user and answers `201` with the trade in `pending`. The trade runs in the background; read it with `GET /trades/{id}` until it is `completed`, `failed` or `in_review`. A `buy` bridges `amount` USDT0 to the trading account, sets `leverage` (cross) on `market`, and places one market buy. If the buy does not fill, its money goes back to the wallet. A `close` closes the position in `market`, if one is open, and sends all withdrawable USDC back to the wallet. One trade runs at a time for each wallet. A retry with the same `Idempotency-Key` returns the same trade.
@@ -41874,7 +41874,11 @@ client = Whop(
environment=WhopEnvironment.PRODUCTION,
)
-client.trades.create()
+client.trades.create(
+ account_id="biz_xxxxxxxxxxxxxx",
+ market="BTC",
+ type="buy",
+)
```
@@ -41890,135 +41894,39 @@ client.trades.create()
-
-**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
+**account_id:** `str` — The account or user whose wallet trades, prefixed `biz_` or `user_`.
-
-
-
-
-
-
-
-
-client.trades.update_leverage()
-
--
-
-#### 📝 Description
-
-
--
-
-
--
-
-Retired. Every caller gets `410 Gone`, and no leverage change is sent to the trading provider.
-
-
-
-
-
-#### 🔌 Usage
-
-
--
-
-
--
-
-```python
-from whop_sdk import Whop
-from whop_sdk.environment import WhopEnvironment
-
-client = Whop(
- token="",
- environment=WhopEnvironment.PRODUCTION,
-)
-
-client.trades.update_leverage()
-
-```
-
-
-
-
-
-#### ⚙️ Parameters
-
-
--
-
-**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
+**market:** `str` — The perpetual market, for example `BTC`.
-
-
-
-
-
-
-
-
-client.trades.retrieve(...) -> Trade
-
--
-
-#### 📝 Description
-
-
--
-
-Retrieves a trade. Order acknowledgements don't update as orders fill. Never resubmit a `submission_unknown` trade with a new idempotency key.
-
-
+**type:** `CreateTradesRequestType` — `buy` or `close`.
+
-#### 🔌 Usage
-
-
--
-
-
-```python
-from whop_sdk import Whop
-from whop_sdk.environment import WhopEnvironment
-
-client = Whop(
- token="",
- environment=WhopEnvironment.PRODUCTION,
-)
-
-client.trades.retrieve(
- id="id",
-)
-
-```
-
-
+**amount:** `typing.Optional[str]` — The USDT0 to send from the wallet for a buy, with at most 6 decimals. Required for a buy.
+
-#### ⚙️ Parameters
-
-
--
-
-
-**id:** `str` — Trade ID, prefixed `trop_`.
+**leverage:** `typing.Optional[int]` — The cross leverage for a buy, from 1 to the market's maximum. Required for a buy.
@@ -42038,7 +41946,7 @@ client.trades.retrieve(
-client.trades.cancel(...)
+client.trades.retrieve(...) -> Trade
-
@@ -42050,7 +41958,7 @@ client.trades.retrieve(
-
-Retired. Every caller gets `410 Gone`, and no cancellation is sent to the trading provider.
+Retrieves a trade. Read it until its `status` is `completed`, `failed` or `in_review`.
@@ -42073,7 +41981,7 @@ client = Whop(
environment=WhopEnvironment.PRODUCTION,
)
-client.trades.cancel(
+client.trades.retrieve(
id="id",
)
@@ -42091,7 +41999,7 @@ client.trades.cancel(
-
-**id:** `str` — ID of the order trade to cancel, prefixed `trop_`.
+**id:** `str` — Trade ID, prefixed `tint_`.
diff --git a/src/whop_sdk/__init__.py b/src/whop_sdk/__init__.py
index 6513ebd73..75f4c1487 100644
--- a/src/whop_sdk/__init__.py
+++ b/src/whop_sdk/__init__.py
@@ -1260,25 +1260,12 @@
TooManyRequestsErrorBodyError,
Topup,
Trade,
- TradeCancellationResult,
- TradeCancellationResultStatus,
TradeFailureCode,
- TradeHyperliquid,
- TradeInstrumentType,
- TradeLeverage,
- TradeLeverageMarginMode,
+ TradeFundsLocation,
TradeObject,
- TradeOperationType,
- TradeOrderResult,
- TradeOrderResultObject,
- TradeOrderResultOrderType,
- TradeOrderResultSide,
- TradeOrderResultStatus,
- TradeProvider,
- TradeRequestedOrder,
- TradeRequestedOrderOrderType,
- TradeRequestedOrderSide,
TradeStatus,
+ TradeStatusDetail,
+ TradeType,
TradingAccount,
TradingAccountObject,
TradingAccountProvider,
@@ -1368,7 +1355,6 @@
BadRequestError,
ConflictError,
ForbiddenError,
- GoneError,
InternalServerError,
NotFoundError,
PaymentRequiredError,
@@ -2910,10 +2896,11 @@
UpdateTeamMembersRequestRole,
)
from .trades import (
+ CreateTradesRequestType,
ListTradesRequestDirection,
- ListTradesRequestOperationType,
ListTradesRequestOrder,
ListTradesRequestStatus,
+ ListTradesRequestType,
ListTradesResponse,
ListTradesResponsePageInfo,
)
@@ -3874,6 +3861,7 @@
"CreateSwapsResponseStatus": ".swaps",
"CreateSwapsResponseToToken": ".swaps",
"CreateTeamMembersRequestRole": ".team_members",
+ "CreateTradesRequestType": ".trades",
"CreateTransfersRequestFeedType": ".transfers",
"CreateTransfersRequestType": ".transfers",
"CreateTransfersResponse": ".transfers",
@@ -4144,7 +4132,6 @@
"GenerateMediaRequestResolution": ".media",
"GenerateMediaRequestType": ".media",
"GlobalAffiliateStatuses": ".types",
- "GoneError": ".errors",
"GrantableAuthorizedUserRoles": ".types",
"IdentityProfile": ".types",
"IdentityProfileBusinessAddress": ".types",
@@ -4602,9 +4589,9 @@
"ListTeamMembersResponse": ".team_members",
"ListTeamMembersResponsePageInfo": ".team_members",
"ListTradesRequestDirection": ".trades",
- "ListTradesRequestOperationType": ".trades",
"ListTradesRequestOrder": ".trades",
"ListTradesRequestStatus": ".trades",
+ "ListTradesRequestType": ".trades",
"ListTradesResponse": ".trades",
"ListTradesResponsePageInfo": ".trades",
"ListTransfersRequestDirection": ".transfers",
@@ -5805,25 +5792,12 @@
"TooManyRequestsErrorBodyError": ".types",
"Topup": ".types",
"Trade": ".types",
- "TradeCancellationResult": ".types",
- "TradeCancellationResultStatus": ".types",
"TradeFailureCode": ".types",
- "TradeHyperliquid": ".types",
- "TradeInstrumentType": ".types",
- "TradeLeverage": ".types",
- "TradeLeverageMarginMode": ".types",
+ "TradeFundsLocation": ".types",
"TradeObject": ".types",
- "TradeOperationType": ".types",
- "TradeOrderResult": ".types",
- "TradeOrderResultObject": ".types",
- "TradeOrderResultOrderType": ".types",
- "TradeOrderResultSide": ".types",
- "TradeOrderResultStatus": ".types",
- "TradeProvider": ".types",
- "TradeRequestedOrder": ".types",
- "TradeRequestedOrderOrderType": ".types",
- "TradeRequestedOrderSide": ".types",
"TradeStatus": ".types",
+ "TradeStatusDetail": ".types",
+ "TradeType": ".types",
"TradingAccount": ".types",
"TradingAccountObject": ".types",
"TradingAccountProvider": ".types",
@@ -6923,6 +6897,7 @@ def __dir__():
"CreateSwapsResponseStatus",
"CreateSwapsResponseToToken",
"CreateTeamMembersRequestRole",
+ "CreateTradesRequestType",
"CreateTransfersRequestFeedType",
"CreateTransfersRequestType",
"CreateTransfersResponse",
@@ -7193,7 +7168,6 @@ def __dir__():
"GenerateMediaRequestResolution",
"GenerateMediaRequestType",
"GlobalAffiliateStatuses",
- "GoneError",
"GrantableAuthorizedUserRoles",
"IdentityProfile",
"IdentityProfileBusinessAddress",
@@ -7651,9 +7625,9 @@ def __dir__():
"ListTeamMembersResponse",
"ListTeamMembersResponsePageInfo",
"ListTradesRequestDirection",
- "ListTradesRequestOperationType",
"ListTradesRequestOrder",
"ListTradesRequestStatus",
+ "ListTradesRequestType",
"ListTradesResponse",
"ListTradesResponsePageInfo",
"ListTransfersRequestDirection",
@@ -8854,25 +8828,12 @@ def __dir__():
"TooManyRequestsErrorBodyError",
"Topup",
"Trade",
- "TradeCancellationResult",
- "TradeCancellationResultStatus",
"TradeFailureCode",
- "TradeHyperliquid",
- "TradeInstrumentType",
- "TradeLeverage",
- "TradeLeverageMarginMode",
+ "TradeFundsLocation",
"TradeObject",
- "TradeOperationType",
- "TradeOrderResult",
- "TradeOrderResultObject",
- "TradeOrderResultOrderType",
- "TradeOrderResultSide",
- "TradeOrderResultStatus",
- "TradeProvider",
- "TradeRequestedOrder",
- "TradeRequestedOrderOrderType",
- "TradeRequestedOrderSide",
"TradeStatus",
+ "TradeStatusDetail",
+ "TradeType",
"TradingAccount",
"TradingAccountObject",
"TradingAccountProvider",
diff --git a/src/whop_sdk/errors/__init__.py b/src/whop_sdk/errors/__init__.py
index ba07e42c6..b66152b6f 100644
--- a/src/whop_sdk/errors/__init__.py
+++ b/src/whop_sdk/errors/__init__.py
@@ -9,7 +9,6 @@
from .bad_request_error import BadRequestError
from .conflict_error import ConflictError
from .forbidden_error import ForbiddenError
- from .gone_error import GoneError
from .internal_server_error import InternalServerError
from .not_found_error import NotFoundError
from .payment_required_error import PaymentRequiredError
@@ -21,7 +20,6 @@
"BadRequestError": ".bad_request_error",
"ConflictError": ".conflict_error",
"ForbiddenError": ".forbidden_error",
- "GoneError": ".gone_error",
"InternalServerError": ".internal_server_error",
"NotFoundError": ".not_found_error",
"PaymentRequiredError": ".payment_required_error",
@@ -57,7 +55,6 @@ def __dir__():
"BadRequestError",
"ConflictError",
"ForbiddenError",
- "GoneError",
"InternalServerError",
"NotFoundError",
"PaymentRequiredError",
diff --git a/src/whop_sdk/errors/gone_error.py b/src/whop_sdk/errors/gone_error.py
deleted file mode 100644
index 004a299ba..000000000
--- a/src/whop_sdk/errors/gone_error.py
+++ /dev/null
@@ -1,11 +0,0 @@
-# This file was auto-generated by Fern from our API Definition.
-
-import typing
-
-from ..core.api_error import ApiError
-from ..types.v1error_response import V1ErrorResponse
-
-
-class GoneError(ApiError):
- def __init__(self, body: V1ErrorResponse, headers: typing.Optional[typing.Dict[str, str]] = None):
- super().__init__(status_code=410, headers=headers, body=body)
diff --git a/src/whop_sdk/trades/__init__.py b/src/whop_sdk/trades/__init__.py
index e8eeec020..b535871b2 100644
--- a/src/whop_sdk/trades/__init__.py
+++ b/src/whop_sdk/trades/__init__.py
@@ -7,18 +7,20 @@
if typing.TYPE_CHECKING:
from .types import (
+ CreateTradesRequestType,
ListTradesRequestDirection,
- ListTradesRequestOperationType,
ListTradesRequestOrder,
ListTradesRequestStatus,
+ ListTradesRequestType,
ListTradesResponse,
ListTradesResponsePageInfo,
)
_dynamic_imports: typing.Dict[str, str] = {
+ "CreateTradesRequestType": ".types",
"ListTradesRequestDirection": ".types",
- "ListTradesRequestOperationType": ".types",
"ListTradesRequestOrder": ".types",
"ListTradesRequestStatus": ".types",
+ "ListTradesRequestType": ".types",
"ListTradesResponse": ".types",
"ListTradesResponsePageInfo": ".types",
}
@@ -46,10 +48,11 @@ def __dir__():
__all__ = [
+ "CreateTradesRequestType",
"ListTradesRequestDirection",
- "ListTradesRequestOperationType",
"ListTradesRequestOrder",
"ListTradesRequestStatus",
+ "ListTradesRequestType",
"ListTradesResponse",
"ListTradesResponsePageInfo",
]
diff --git a/src/whop_sdk/trades/client.py b/src/whop_sdk/trades/client.py
index d438c10b3..ed730731e 100644
--- a/src/whop_sdk/trades/client.py
+++ b/src/whop_sdk/trades/client.py
@@ -7,12 +7,16 @@
from ..core.request_options import RequestOptions
from ..types.trade import Trade
from .raw_client import AsyncRawTradesClient, RawTradesClient
+from .types.create_trades_request_type import CreateTradesRequestType
from .types.list_trades_request_direction import ListTradesRequestDirection
-from .types.list_trades_request_operation_type import ListTradesRequestOperationType
from .types.list_trades_request_order import ListTradesRequestOrder
from .types.list_trades_request_status import ListTradesRequestStatus
+from .types.list_trades_request_type import ListTradesRequestType
from .types.list_trades_response import ListTradesResponse
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
class TradesClient:
def __init__(self, *, client_wrapper: SyncClientWrapper):
@@ -34,7 +38,7 @@ def list(
*,
account_id: typing.Optional[str] = None,
status: typing.Optional[ListTradesRequestStatus] = None,
- operation_type: typing.Optional[ListTradesRequestOperationType] = None,
+ type: typing.Optional[ListTradesRequestType] = None,
order: typing.Optional[ListTradesRequestOrder] = None,
direction: typing.Optional[ListTradesRequestDirection] = None,
first: typing.Optional[int] = None,
@@ -44,7 +48,7 @@ def list(
request_options: typing.Optional[RequestOptions] = None,
) -> SyncPager[Trade, ListTradesResponse]:
"""
- Lists trades you can access, newest first. User credentials see their own trades and those of accounts they belong to, including connected accounts; account credentials see their account and its connected accounts. These are submission records, not fill or position history.
+ Lists trades you can access, newest first. User credentials see their own trades and those of accounts they belong to, including connected accounts; account credentials see their account and its connected accounts.
Parameters
----------
@@ -52,10 +56,10 @@ def list(
Only return trades for this account or user, prefixed `biz_` or `user_`.
status : typing.Optional[ListTradesRequestStatus]
- Only return trades with this submission status.
+ Only return trades with this status.
- operation_type : typing.Optional[ListTradesRequestOperationType]
- Only return trades of this kind, such as `create_orders` for order submissions.
+ type : typing.Optional[ListTradesRequestType]
+ Only return trades of this type.
order : typing.Optional[ListTradesRequestOrder]
Field to sort by.
@@ -102,7 +106,7 @@ def list(
return self._raw_client.list(
account_id=account_id,
status=status,
- operation_type=operation_type,
+ type=type,
order=order,
direction=direction,
first=first,
@@ -112,45 +116,43 @@ def list(
request_options=request_options,
)
- def create(self, *, request_options: typing.Optional[RequestOptions] = None) -> None:
+ def create(
+ self,
+ *,
+ account_id: str,
+ market: str,
+ type: CreateTradesRequestType,
+ amount: typing.Optional[str] = OMIT,
+ leverage: typing.Optional[int] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> Trade:
"""
- Retired. Order batches can no longer be placed. Every caller gets `410 Gone`, whatever the body, and nothing is sent to the trading provider. List and retrieve earlier trades with `GET /trades`.
+ Creates a trade on the Whop-managed wallet of an account or user and answers `201` with the trade in `pending`. The trade runs in the background; read it with `GET /trades/{id}` until it is `completed`, `failed` or `in_review`. A `buy` bridges `amount` USDT0 to the trading account, sets `leverage` (cross) on `market`, and places one market buy. If the buy does not fill, its money goes back to the wallet. A `close` closes the position in `market`, if one is open, and sends all withdrawable USDC back to the wallet. One trade runs at a time for each wallet. A retry with the same `Idempotency-Key` returns the same trade.
Parameters
----------
- request_options : typing.Optional[RequestOptions]
- Request-specific configuration.
+ account_id : str
+ The account or user whose wallet trades, prefixed `biz_` or `user_`.
- Returns
- -------
- None
+ market : str
+ The perpetual market, for example `BTC`.
- Examples
- --------
- from whop_sdk import Whop
+ type : CreateTradesRequestType
+ `buy` or `close`.
- client = Whop(
- "2026-10-07-2",
- idempotency_key="YOUR_IDEMPOTENCY_KEY",
- token="YOUR_TOKEN",
- )
- client.trades.create()
- """
- _response = self._raw_client.create(request_options=request_options)
- return _response.data
+ amount : typing.Optional[str]
+ The USDT0 to send from the wallet for a buy, with at most 6 decimals. Required for a buy.
- def update_leverage(self, *, request_options: typing.Optional[RequestOptions] = None) -> None:
- """
- Retired. Every caller gets `410 Gone`, and no leverage change is sent to the trading provider.
+ leverage : typing.Optional[int]
+ The cross leverage for a buy, from 1 to the market's maximum. Required for a buy.
- Parameters
- ----------
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
- None
+ Trade
+ trade created
Examples
--------
@@ -161,19 +163,30 @@ def update_leverage(self, *, request_options: typing.Optional[RequestOptions] =
idempotency_key="YOUR_IDEMPOTENCY_KEY",
token="YOUR_TOKEN",
)
- client.trades.update_leverage()
+ client.trades.create(
+ account_id="biz_xxxxxxxxxxxxxx",
+ market="BTC",
+ type="buy",
+ )
"""
- _response = self._raw_client.update_leverage(request_options=request_options)
+ _response = self._raw_client.create(
+ account_id=account_id,
+ market=market,
+ type=type,
+ amount=amount,
+ leverage=leverage,
+ request_options=request_options,
+ )
return _response.data
def retrieve(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Trade:
"""
- Retrieves a trade. Order acknowledgements don't update as orders fill. Never resubmit a `submission_unknown` trade with a new idempotency key.
+ Retrieves a trade. Read it until its `status` is `completed`, `failed` or `in_review`.
Parameters
----------
id : str
- Trade ID, prefixed `trop_`.
+ Trade ID, prefixed `tint_`.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -199,38 +212,6 @@ def retrieve(self, id: str, *, request_options: typing.Optional[RequestOptions]
_response = self._raw_client.retrieve(id, request_options=request_options)
return _response.data
- def cancel(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
- """
- Retired. Every caller gets `410 Gone`, and no cancellation is sent to the trading provider.
-
- Parameters
- ----------
- id : str
- ID of the order trade to cancel, prefixed `trop_`.
-
- request_options : typing.Optional[RequestOptions]
- Request-specific configuration.
-
- Returns
- -------
- None
-
- Examples
- --------
- from whop_sdk import Whop
-
- client = Whop(
- "2026-10-07-2",
- idempotency_key="YOUR_IDEMPOTENCY_KEY",
- token="YOUR_TOKEN",
- )
- client.trades.cancel(
- id="id",
- )
- """
- _response = self._raw_client.cancel(id, request_options=request_options)
- return _response.data
-
class AsyncTradesClient:
def __init__(self, *, client_wrapper: AsyncClientWrapper):
@@ -252,7 +233,7 @@ async def list(
*,
account_id: typing.Optional[str] = None,
status: typing.Optional[ListTradesRequestStatus] = None,
- operation_type: typing.Optional[ListTradesRequestOperationType] = None,
+ type: typing.Optional[ListTradesRequestType] = None,
order: typing.Optional[ListTradesRequestOrder] = None,
direction: typing.Optional[ListTradesRequestDirection] = None,
first: typing.Optional[int] = None,
@@ -262,7 +243,7 @@ async def list(
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncPager[Trade, ListTradesResponse]:
"""
- Lists trades you can access, newest first. User credentials see their own trades and those of accounts they belong to, including connected accounts; account credentials see their account and its connected accounts. These are submission records, not fill or position history.
+ Lists trades you can access, newest first. User credentials see their own trades and those of accounts they belong to, including connected accounts; account credentials see their account and its connected accounts.
Parameters
----------
@@ -270,10 +251,10 @@ async def list(
Only return trades for this account or user, prefixed `biz_` or `user_`.
status : typing.Optional[ListTradesRequestStatus]
- Only return trades with this submission status.
+ Only return trades with this status.
- operation_type : typing.Optional[ListTradesRequestOperationType]
- Only return trades of this kind, such as `create_orders` for order submissions.
+ type : typing.Optional[ListTradesRequestType]
+ Only return trades of this type.
order : typing.Optional[ListTradesRequestOrder]
Field to sort by.
@@ -329,7 +310,7 @@ async def main() -> None:
return await self._raw_client.list(
account_id=account_id,
status=status,
- operation_type=operation_type,
+ type=type,
order=order,
direction=direction,
first=first,
@@ -339,53 +320,43 @@ async def main() -> None:
request_options=request_options,
)
- async def create(self, *, request_options: typing.Optional[RequestOptions] = None) -> None:
+ async def create(
+ self,
+ *,
+ account_id: str,
+ market: str,
+ type: CreateTradesRequestType,
+ amount: typing.Optional[str] = OMIT,
+ leverage: typing.Optional[int] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> Trade:
"""
- Retired. Order batches can no longer be placed. Every caller gets `410 Gone`, whatever the body, and nothing is sent to the trading provider. List and retrieve earlier trades with `GET /trades`.
+ Creates a trade on the Whop-managed wallet of an account or user and answers `201` with the trade in `pending`. The trade runs in the background; read it with `GET /trades/{id}` until it is `completed`, `failed` or `in_review`. A `buy` bridges `amount` USDT0 to the trading account, sets `leverage` (cross) on `market`, and places one market buy. If the buy does not fill, its money goes back to the wallet. A `close` closes the position in `market`, if one is open, and sends all withdrawable USDC back to the wallet. One trade runs at a time for each wallet. A retry with the same `Idempotency-Key` returns the same trade.
Parameters
----------
- request_options : typing.Optional[RequestOptions]
- Request-specific configuration.
+ account_id : str
+ The account or user whose wallet trades, prefixed `biz_` or `user_`.
- Returns
- -------
- None
+ market : str
+ The perpetual market, for example `BTC`.
- Examples
- --------
- import asyncio
-
- from whop_sdk import AsyncWhop
+ type : CreateTradesRequestType
+ `buy` or `close`.
- client = AsyncWhop(
- "2026-10-07-2",
- idempotency_key="YOUR_IDEMPOTENCY_KEY",
- token="YOUR_TOKEN",
- )
-
-
- async def main() -> None:
- await client.trades.create()
-
-
- asyncio.run(main())
- """
- _response = await self._raw_client.create(request_options=request_options)
- return _response.data
+ amount : typing.Optional[str]
+ The USDT0 to send from the wallet for a buy, with at most 6 decimals. Required for a buy.
- async def update_leverage(self, *, request_options: typing.Optional[RequestOptions] = None) -> None:
- """
- Retired. Every caller gets `410 Gone`, and no leverage change is sent to the trading provider.
+ leverage : typing.Optional[int]
+ The cross leverage for a buy, from 1 to the market's maximum. Required for a buy.
- Parameters
- ----------
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
- None
+ Trade
+ trade created
Examples
--------
@@ -401,22 +372,33 @@ async def update_leverage(self, *, request_options: typing.Optional[RequestOptio
async def main() -> None:
- await client.trades.update_leverage()
+ await client.trades.create(
+ account_id="biz_xxxxxxxxxxxxxx",
+ market="BTC",
+ type="buy",
+ )
asyncio.run(main())
"""
- _response = await self._raw_client.update_leverage(request_options=request_options)
+ _response = await self._raw_client.create(
+ account_id=account_id,
+ market=market,
+ type=type,
+ amount=amount,
+ leverage=leverage,
+ request_options=request_options,
+ )
return _response.data
async def retrieve(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Trade:
"""
- Retrieves a trade. Order acknowledgements don't update as orders fill. Never resubmit a `submission_unknown` trade with a new idempotency key.
+ Retrieves a trade. Read it until its `status` is `completed`, `failed` or `in_review`.
Parameters
----------
id : str
- Trade ID, prefixed `trop_`.
+ Trade ID, prefixed `tint_`.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -449,43 +431,3 @@ async def main() -> None:
"""
_response = await self._raw_client.retrieve(id, request_options=request_options)
return _response.data
-
- async def cancel(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
- """
- Retired. Every caller gets `410 Gone`, and no cancellation is sent to the trading provider.
-
- Parameters
- ----------
- id : str
- ID of the order trade to cancel, prefixed `trop_`.
-
- request_options : typing.Optional[RequestOptions]
- Request-specific configuration.
-
- Returns
- -------
- None
-
- Examples
- --------
- import asyncio
-
- from whop_sdk import AsyncWhop
-
- client = AsyncWhop(
- "2026-10-07-2",
- idempotency_key="YOUR_IDEMPOTENCY_KEY",
- token="YOUR_TOKEN",
- )
-
-
- async def main() -> None:
- await client.trades.cancel(
- id="id",
- )
-
-
- asyncio.run(main())
- """
- _response = await self._raw_client.cancel(id, request_options=request_options)
- return _response.data
diff --git a/src/whop_sdk/trades/raw_client.py b/src/whop_sdk/trades/raw_client.py
index 0440f552c..35fc85734 100644
--- a/src/whop_sdk/trades/raw_client.py
+++ b/src/whop_sdk/trades/raw_client.py
@@ -14,18 +14,22 @@
from ..errors.bad_request_error import BadRequestError
from ..errors.conflict_error import ConflictError
from ..errors.forbidden_error import ForbiddenError
-from ..errors.gone_error import GoneError
from ..errors.not_found_error import NotFoundError
+from ..errors.service_unavailable_error import ServiceUnavailableError
from ..errors.unauthorized_error import UnauthorizedError
from ..types.trade import Trade
from ..types.v1error_response import V1ErrorResponse
+from .types.create_trades_request_type import CreateTradesRequestType
from .types.list_trades_request_direction import ListTradesRequestDirection
-from .types.list_trades_request_operation_type import ListTradesRequestOperationType
from .types.list_trades_request_order import ListTradesRequestOrder
from .types.list_trades_request_status import ListTradesRequestStatus
+from .types.list_trades_request_type import ListTradesRequestType
from .types.list_trades_response import ListTradesResponse
from pydantic import ValidationError
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
class RawTradesClient:
def __init__(self, *, client_wrapper: SyncClientWrapper):
@@ -36,7 +40,7 @@ def list(
*,
account_id: typing.Optional[str] = None,
status: typing.Optional[ListTradesRequestStatus] = None,
- operation_type: typing.Optional[ListTradesRequestOperationType] = None,
+ type: typing.Optional[ListTradesRequestType] = None,
order: typing.Optional[ListTradesRequestOrder] = None,
direction: typing.Optional[ListTradesRequestDirection] = None,
first: typing.Optional[int] = None,
@@ -46,7 +50,7 @@ def list(
request_options: typing.Optional[RequestOptions] = None,
) -> SyncPager[Trade, ListTradesResponse]:
"""
- Lists trades you can access, newest first. User credentials see their own trades and those of accounts they belong to, including connected accounts; account credentials see their account and its connected accounts. These are submission records, not fill or position history.
+ Lists trades you can access, newest first. User credentials see their own trades and those of accounts they belong to, including connected accounts; account credentials see their account and its connected accounts.
Parameters
----------
@@ -54,10 +58,10 @@ def list(
Only return trades for this account or user, prefixed `biz_` or `user_`.
status : typing.Optional[ListTradesRequestStatus]
- Only return trades with this submission status.
+ Only return trades with this status.
- operation_type : typing.Optional[ListTradesRequestOperationType]
- Only return trades of this kind, such as `create_orders` for order submissions.
+ type : typing.Optional[ListTradesRequestType]
+ Only return trades of this type.
order : typing.Optional[ListTradesRequestOrder]
Field to sort by.
@@ -92,7 +96,7 @@ def list(
params={
"account_id": account_id,
"status": status,
- "operation_type": operation_type,
+ "type": type,
"order": order,
"direction": direction,
"first": first,
@@ -120,7 +124,7 @@ def list(
_get_next = lambda: self.list(
account_id=account_id,
status=status,
- operation_type=operation_type,
+ type=type,
order=order,
direction=direction,
first=first,
@@ -172,94 +176,95 @@ def list(
)
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
- def create(self, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[None]:
+ def create(
+ self,
+ *,
+ account_id: str,
+ market: str,
+ type: CreateTradesRequestType,
+ amount: typing.Optional[str] = OMIT,
+ leverage: typing.Optional[int] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[Trade]:
"""
- Retired. Order batches can no longer be placed. Every caller gets `410 Gone`, whatever the body, and nothing is sent to the trading provider. List and retrieve earlier trades with `GET /trades`.
+ Creates a trade on the Whop-managed wallet of an account or user and answers `201` with the trade in `pending`. The trade runs in the background; read it with `GET /trades/{id}` until it is `completed`, `failed` or `in_review`. A `buy` bridges `amount` USDT0 to the trading account, sets `leverage` (cross) on `market`, and places one market buy. If the buy does not fill, its money goes back to the wallet. A `close` closes the position in `market`, if one is open, and sends all withdrawable USDC back to the wallet. One trade runs at a time for each wallet. A retry with the same `Idempotency-Key` returns the same trade.
Parameters
----------
+ account_id : str
+ The account or user whose wallet trades, prefixed `biz_` or `user_`.
+
+ market : str
+ The perpetual market, for example `BTC`.
+
+ type : CreateTradesRequestType
+ `buy` or `close`.
+
+ amount : typing.Optional[str]
+ The USDT0 to send from the wallet for a buy, with at most 6 decimals. Required for a buy.
+
+ leverage : typing.Optional[int]
+ The cross leverage for a buy, from 1 to the market's maximum. Required for a buy.
+
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
- HttpResponse[None]
+ HttpResponse[Trade]
+ trade created
"""
_response = self._client_wrapper.httpx_client.request(
"trades",
base_url=self._client_wrapper.get_environment().api,
method="POST",
+ json={
+ "account_id": account_id,
+ "amount": amount,
+ "leverage": leverage,
+ "market": market,
+ "type": type,
+ },
+ headers={
+ "content-type": "application/json",
+ },
request_options=request_options,
+ omit=OMIT,
)
try:
if 200 <= _response.status_code < 300:
- return HttpResponse(response=_response, data=None)
- if _response.status_code == 401:
- raise UnauthorizedError(
- headers=dict(_response.headers),
- body=typing.cast(
- typing.Any,
- parse_obj_as(
- type_=typing.Any, # type: ignore
- object_=_response.json(),
- ),
+ _data = typing.cast(
+ Trade,
+ parse_obj_as(
+ type_=Trade, # type: ignore
+ object_=_response.json(),
),
)
- if _response.status_code == 409:
- raise ConflictError(
+ return HttpResponse(response=_response, data=_data)
+ if _response.status_code == 400:
+ raise BadRequestError(
headers=dict(_response.headers),
body=typing.cast(
- V1ErrorResponse,
+ typing.Any,
parse_obj_as(
- type_=V1ErrorResponse, # type: ignore
+ type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
- if _response.status_code == 410:
- raise GoneError(
+ if _response.status_code == 401:
+ raise UnauthorizedError(
headers=dict(_response.headers),
body=typing.cast(
- V1ErrorResponse,
+ typing.Any,
parse_obj_as(
- type_=V1ErrorResponse, # type: ignore
+ type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
- _response_json = _response.json()
- except JSONDecodeError:
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
- except ValidationError as e:
- raise ParsingError(
- status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
- )
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
-
- def update_leverage(self, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[None]:
- """
- Retired. Every caller gets `410 Gone`, and no leverage change is sent to the trading provider.
-
- Parameters
- ----------
- request_options : typing.Optional[RequestOptions]
- Request-specific configuration.
-
- Returns
- -------
- HttpResponse[None]
- """
- _response = self._client_wrapper.httpx_client.request(
- "trades/leverage",
- base_url=self._client_wrapper.get_environment().api,
- method="POST",
- request_options=request_options,
- )
- try:
- if 200 <= _response.status_code < 300:
- return HttpResponse(response=_response, data=None)
- if _response.status_code == 401:
- raise UnauthorizedError(
+ if _response.status_code == 403:
+ raise ForbiddenError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
@@ -280,8 +285,8 @@ def update_leverage(self, *, request_options: typing.Optional[RequestOptions] =
),
),
)
- if _response.status_code == 410:
- raise GoneError(
+ if _response.status_code == 503:
+ raise ServiceUnavailableError(
headers=dict(_response.headers),
body=typing.cast(
V1ErrorResponse,
@@ -302,12 +307,12 @@ def update_leverage(self, *, request_options: typing.Optional[RequestOptions] =
def retrieve(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[Trade]:
"""
- Retrieves a trade. Order acknowledgements don't update as orders fill. Never resubmit a `submission_unknown` trade with a new idempotency key.
+ Retrieves a trade. Read it until its `status` is `completed`, `failed` or `in_review`.
Parameters
----------
id : str
- Trade ID, prefixed `trop_`.
+ Trade ID, prefixed `tint_`.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -375,73 +380,6 @@ def retrieve(self, id: str, *, request_options: typing.Optional[RequestOptions]
)
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
- def cancel(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[None]:
- """
- Retired. Every caller gets `410 Gone`, and no cancellation is sent to the trading provider.
-
- Parameters
- ----------
- id : str
- ID of the order trade to cancel, prefixed `trop_`.
-
- request_options : typing.Optional[RequestOptions]
- Request-specific configuration.
-
- Returns
- -------
- HttpResponse[None]
- """
- _response = self._client_wrapper.httpx_client.request(
- f"trades/{encode_path_param(id)}/cancel",
- base_url=self._client_wrapper.get_environment().api,
- method="POST",
- request_options=request_options,
- )
- try:
- if 200 <= _response.status_code < 300:
- return HttpResponse(response=_response, data=None)
- if _response.status_code == 401:
- raise UnauthorizedError(
- headers=dict(_response.headers),
- body=typing.cast(
- typing.Any,
- parse_obj_as(
- type_=typing.Any, # type: ignore
- object_=_response.json(),
- ),
- ),
- )
- if _response.status_code == 409:
- raise ConflictError(
- headers=dict(_response.headers),
- body=typing.cast(
- V1ErrorResponse,
- parse_obj_as(
- type_=V1ErrorResponse, # type: ignore
- object_=_response.json(),
- ),
- ),
- )
- if _response.status_code == 410:
- raise GoneError(
- headers=dict(_response.headers),
- body=typing.cast(
- V1ErrorResponse,
- parse_obj_as(
- type_=V1ErrorResponse, # type: ignore
- object_=_response.json(),
- ),
- ),
- )
- _response_json = _response.json()
- except JSONDecodeError:
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
- except ValidationError as e:
- raise ParsingError(
- status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
- )
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
-
class AsyncRawTradesClient:
def __init__(self, *, client_wrapper: AsyncClientWrapper):
@@ -452,7 +390,7 @@ async def list(
*,
account_id: typing.Optional[str] = None,
status: typing.Optional[ListTradesRequestStatus] = None,
- operation_type: typing.Optional[ListTradesRequestOperationType] = None,
+ type: typing.Optional[ListTradesRequestType] = None,
order: typing.Optional[ListTradesRequestOrder] = None,
direction: typing.Optional[ListTradesRequestDirection] = None,
first: typing.Optional[int] = None,
@@ -462,7 +400,7 @@ async def list(
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncPager[Trade, ListTradesResponse]:
"""
- Lists trades you can access, newest first. User credentials see their own trades and those of accounts they belong to, including connected accounts; account credentials see their account and its connected accounts. These are submission records, not fill or position history.
+ Lists trades you can access, newest first. User credentials see their own trades and those of accounts they belong to, including connected accounts; account credentials see their account and its connected accounts.
Parameters
----------
@@ -470,10 +408,10 @@ async def list(
Only return trades for this account or user, prefixed `biz_` or `user_`.
status : typing.Optional[ListTradesRequestStatus]
- Only return trades with this submission status.
+ Only return trades with this status.
- operation_type : typing.Optional[ListTradesRequestOperationType]
- Only return trades of this kind, such as `create_orders` for order submissions.
+ type : typing.Optional[ListTradesRequestType]
+ Only return trades of this type.
order : typing.Optional[ListTradesRequestOrder]
Field to sort by.
@@ -508,7 +446,7 @@ async def list(
params={
"account_id": account_id,
"status": status,
- "operation_type": operation_type,
+ "type": type,
"order": order,
"direction": direction,
"first": first,
@@ -538,7 +476,7 @@ async def _get_next():
return await self.list(
account_id=account_id,
status=status,
- operation_type=operation_type,
+ type=type,
order=order,
direction=direction,
first=first,
@@ -591,96 +529,95 @@ async def _get_next():
)
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
- async def create(self, *, request_options: typing.Optional[RequestOptions] = None) -> AsyncHttpResponse[None]:
+ async def create(
+ self,
+ *,
+ account_id: str,
+ market: str,
+ type: CreateTradesRequestType,
+ amount: typing.Optional[str] = OMIT,
+ leverage: typing.Optional[int] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[Trade]:
"""
- Retired. Order batches can no longer be placed. Every caller gets `410 Gone`, whatever the body, and nothing is sent to the trading provider. List and retrieve earlier trades with `GET /trades`.
+ Creates a trade on the Whop-managed wallet of an account or user and answers `201` with the trade in `pending`. The trade runs in the background; read it with `GET /trades/{id}` until it is `completed`, `failed` or `in_review`. A `buy` bridges `amount` USDT0 to the trading account, sets `leverage` (cross) on `market`, and places one market buy. If the buy does not fill, its money goes back to the wallet. A `close` closes the position in `market`, if one is open, and sends all withdrawable USDC back to the wallet. One trade runs at a time for each wallet. A retry with the same `Idempotency-Key` returns the same trade.
Parameters
----------
+ account_id : str
+ The account or user whose wallet trades, prefixed `biz_` or `user_`.
+
+ market : str
+ The perpetual market, for example `BTC`.
+
+ type : CreateTradesRequestType
+ `buy` or `close`.
+
+ amount : typing.Optional[str]
+ The USDT0 to send from the wallet for a buy, with at most 6 decimals. Required for a buy.
+
+ leverage : typing.Optional[int]
+ The cross leverage for a buy, from 1 to the market's maximum. Required for a buy.
+
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
- AsyncHttpResponse[None]
+ AsyncHttpResponse[Trade]
+ trade created
"""
_response = await self._client_wrapper.httpx_client.request(
"trades",
base_url=self._client_wrapper.get_environment().api,
method="POST",
+ json={
+ "account_id": account_id,
+ "amount": amount,
+ "leverage": leverage,
+ "market": market,
+ "type": type,
+ },
+ headers={
+ "content-type": "application/json",
+ },
request_options=request_options,
+ omit=OMIT,
)
try:
if 200 <= _response.status_code < 300:
- return AsyncHttpResponse(response=_response, data=None)
- if _response.status_code == 401:
- raise UnauthorizedError(
- headers=dict(_response.headers),
- body=typing.cast(
- typing.Any,
- parse_obj_as(
- type_=typing.Any, # type: ignore
- object_=_response.json(),
- ),
+ _data = typing.cast(
+ Trade,
+ parse_obj_as(
+ type_=Trade, # type: ignore
+ object_=_response.json(),
),
)
- if _response.status_code == 409:
- raise ConflictError(
+ return AsyncHttpResponse(response=_response, data=_data)
+ if _response.status_code == 400:
+ raise BadRequestError(
headers=dict(_response.headers),
body=typing.cast(
- V1ErrorResponse,
+ typing.Any,
parse_obj_as(
- type_=V1ErrorResponse, # type: ignore
+ type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
- if _response.status_code == 410:
- raise GoneError(
+ if _response.status_code == 401:
+ raise UnauthorizedError(
headers=dict(_response.headers),
body=typing.cast(
- V1ErrorResponse,
+ typing.Any,
parse_obj_as(
- type_=V1ErrorResponse, # type: ignore
+ type_=typing.Any, # type: ignore
object_=_response.json(),
),
),
)
- _response_json = _response.json()
- except JSONDecodeError:
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
- except ValidationError as e:
- raise ParsingError(
- status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
- )
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
-
- async def update_leverage(
- self, *, request_options: typing.Optional[RequestOptions] = None
- ) -> AsyncHttpResponse[None]:
- """
- Retired. Every caller gets `410 Gone`, and no leverage change is sent to the trading provider.
-
- Parameters
- ----------
- request_options : typing.Optional[RequestOptions]
- Request-specific configuration.
-
- Returns
- -------
- AsyncHttpResponse[None]
- """
- _response = await self._client_wrapper.httpx_client.request(
- "trades/leverage",
- base_url=self._client_wrapper.get_environment().api,
- method="POST",
- request_options=request_options,
- )
- try:
- if 200 <= _response.status_code < 300:
- return AsyncHttpResponse(response=_response, data=None)
- if _response.status_code == 401:
- raise UnauthorizedError(
+ if _response.status_code == 403:
+ raise ForbiddenError(
headers=dict(_response.headers),
body=typing.cast(
typing.Any,
@@ -701,8 +638,8 @@ async def update_leverage(
),
),
)
- if _response.status_code == 410:
- raise GoneError(
+ if _response.status_code == 503:
+ raise ServiceUnavailableError(
headers=dict(_response.headers),
body=typing.cast(
V1ErrorResponse,
@@ -725,12 +662,12 @@ async def retrieve(
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> AsyncHttpResponse[Trade]:
"""
- Retrieves a trade. Order acknowledgements don't update as orders fill. Never resubmit a `submission_unknown` trade with a new idempotency key.
+ Retrieves a trade. Read it until its `status` is `completed`, `failed` or `in_review`.
Parameters
----------
id : str
- Trade ID, prefixed `trop_`.
+ Trade ID, prefixed `tint_`.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -797,72 +734,3 @@ async def retrieve(
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
)
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
-
- async def cancel(
- self, id: str, *, request_options: typing.Optional[RequestOptions] = None
- ) -> AsyncHttpResponse[None]:
- """
- Retired. Every caller gets `410 Gone`, and no cancellation is sent to the trading provider.
-
- Parameters
- ----------
- id : str
- ID of the order trade to cancel, prefixed `trop_`.
-
- request_options : typing.Optional[RequestOptions]
- Request-specific configuration.
-
- Returns
- -------
- AsyncHttpResponse[None]
- """
- _response = await self._client_wrapper.httpx_client.request(
- f"trades/{encode_path_param(id)}/cancel",
- base_url=self._client_wrapper.get_environment().api,
- method="POST",
- request_options=request_options,
- )
- try:
- if 200 <= _response.status_code < 300:
- return AsyncHttpResponse(response=_response, data=None)
- if _response.status_code == 401:
- raise UnauthorizedError(
- headers=dict(_response.headers),
- body=typing.cast(
- typing.Any,
- parse_obj_as(
- type_=typing.Any, # type: ignore
- object_=_response.json(),
- ),
- ),
- )
- if _response.status_code == 409:
- raise ConflictError(
- headers=dict(_response.headers),
- body=typing.cast(
- V1ErrorResponse,
- parse_obj_as(
- type_=V1ErrorResponse, # type: ignore
- object_=_response.json(),
- ),
- ),
- )
- if _response.status_code == 410:
- raise GoneError(
- headers=dict(_response.headers),
- body=typing.cast(
- V1ErrorResponse,
- parse_obj_as(
- type_=V1ErrorResponse, # type: ignore
- object_=_response.json(),
- ),
- ),
- )
- _response_json = _response.json()
- except JSONDecodeError:
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
- except ValidationError as e:
- raise ParsingError(
- status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
- )
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
diff --git a/src/whop_sdk/trades/types/__init__.py b/src/whop_sdk/trades/types/__init__.py
index fee68b386..daed999a7 100644
--- a/src/whop_sdk/trades/types/__init__.py
+++ b/src/whop_sdk/trades/types/__init__.py
@@ -6,17 +6,19 @@
from importlib import import_module
if typing.TYPE_CHECKING:
+ from .create_trades_request_type import CreateTradesRequestType
from .list_trades_request_direction import ListTradesRequestDirection
- from .list_trades_request_operation_type import ListTradesRequestOperationType
from .list_trades_request_order import ListTradesRequestOrder
from .list_trades_request_status import ListTradesRequestStatus
+ from .list_trades_request_type import ListTradesRequestType
from .list_trades_response import ListTradesResponse
from .list_trades_response_page_info import ListTradesResponsePageInfo
_dynamic_imports: typing.Dict[str, str] = {
+ "CreateTradesRequestType": ".create_trades_request_type",
"ListTradesRequestDirection": ".list_trades_request_direction",
- "ListTradesRequestOperationType": ".list_trades_request_operation_type",
"ListTradesRequestOrder": ".list_trades_request_order",
"ListTradesRequestStatus": ".list_trades_request_status",
+ "ListTradesRequestType": ".list_trades_request_type",
"ListTradesResponse": ".list_trades_response",
"ListTradesResponsePageInfo": ".list_trades_response_page_info",
}
@@ -44,10 +46,11 @@ def __dir__():
__all__ = [
+ "CreateTradesRequestType",
"ListTradesRequestDirection",
- "ListTradesRequestOperationType",
"ListTradesRequestOrder",
"ListTradesRequestStatus",
+ "ListTradesRequestType",
"ListTradesResponse",
"ListTradesResponsePageInfo",
]
diff --git a/src/whop_sdk/trades/types/create_trades_request_type.py b/src/whop_sdk/trades/types/create_trades_request_type.py
new file mode 100644
index 000000000..a39b00c12
--- /dev/null
+++ b/src/whop_sdk/trades/types/create_trades_request_type.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+CreateTradesRequestType = typing.Union[typing.Literal["buy", "close"], typing.Any]
diff --git a/src/whop_sdk/trades/types/list_trades_request_operation_type.py b/src/whop_sdk/trades/types/list_trades_request_operation_type.py
deleted file mode 100644
index e8c0b7db2..000000000
--- a/src/whop_sdk/trades/types/list_trades_request_operation_type.py
+++ /dev/null
@@ -1,7 +0,0 @@
-# This file was auto-generated by Fern from our API Definition.
-
-import typing
-
-ListTradesRequestOperationType = typing.Union[
- typing.Literal["create_orders", "cancel_orders", "update_leverage"], typing.Any
-]
diff --git a/src/whop_sdk/trades/types/list_trades_request_status.py b/src/whop_sdk/trades/types/list_trades_request_status.py
index 328e82f7d..cd7ed4378 100644
--- a/src/whop_sdk/trades/types/list_trades_request_status.py
+++ b/src/whop_sdk/trades/types/list_trades_request_status.py
@@ -3,5 +3,5 @@
import typing
ListTradesRequestStatus = typing.Union[
- typing.Literal["pending", "submitted", "completed", "failed", "submission_unknown"], typing.Any
+ typing.Literal["pending", "processing", "in_review", "completed", "failed"], typing.Any
]
diff --git a/src/whop_sdk/trades/types/list_trades_request_type.py b/src/whop_sdk/trades/types/list_trades_request_type.py
new file mode 100644
index 000000000..e1402ec9d
--- /dev/null
+++ b/src/whop_sdk/trades/types/list_trades_request_type.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+ListTradesRequestType = typing.Union[typing.Literal["buy", "close"], typing.Any]
diff --git a/src/whop_sdk/types/__init__.py b/src/whop_sdk/types/__init__.py
index e482126c4..006837720 100644
--- a/src/whop_sdk/types/__init__.py
+++ b/src/whop_sdk/types/__init__.py
@@ -1403,25 +1403,12 @@
from .too_many_requests_error_body_error import TooManyRequestsErrorBodyError
from .topup import Topup
from .trade import Trade
- from .trade_cancellation_result import TradeCancellationResult
- from .trade_cancellation_result_status import TradeCancellationResultStatus
from .trade_failure_code import TradeFailureCode
- from .trade_hyperliquid import TradeHyperliquid
- from .trade_instrument_type import TradeInstrumentType
- from .trade_leverage import TradeLeverage
- from .trade_leverage_margin_mode import TradeLeverageMarginMode
+ from .trade_funds_location import TradeFundsLocation
from .trade_object import TradeObject
- from .trade_operation_type import TradeOperationType
- from .trade_order_result import TradeOrderResult
- from .trade_order_result_object import TradeOrderResultObject
- from .trade_order_result_order_type import TradeOrderResultOrderType
- from .trade_order_result_side import TradeOrderResultSide
- from .trade_order_result_status import TradeOrderResultStatus
- from .trade_provider import TradeProvider
- from .trade_requested_order import TradeRequestedOrder
- from .trade_requested_order_order_type import TradeRequestedOrderOrderType
- from .trade_requested_order_side import TradeRequestedOrderSide
from .trade_status import TradeStatus
+ from .trade_status_detail import TradeStatusDetail
+ from .trade_type import TradeType
from .trading_account import TradingAccount
from .trading_account_object import TradingAccountObject
from .trading_account_provider import TradingAccountProvider
@@ -2760,25 +2747,12 @@
"TooManyRequestsErrorBodyError": ".too_many_requests_error_body_error",
"Topup": ".topup",
"Trade": ".trade",
- "TradeCancellationResult": ".trade_cancellation_result",
- "TradeCancellationResultStatus": ".trade_cancellation_result_status",
"TradeFailureCode": ".trade_failure_code",
- "TradeHyperliquid": ".trade_hyperliquid",
- "TradeInstrumentType": ".trade_instrument_type",
- "TradeLeverage": ".trade_leverage",
- "TradeLeverageMarginMode": ".trade_leverage_margin_mode",
+ "TradeFundsLocation": ".trade_funds_location",
"TradeObject": ".trade_object",
- "TradeOperationType": ".trade_operation_type",
- "TradeOrderResult": ".trade_order_result",
- "TradeOrderResultObject": ".trade_order_result_object",
- "TradeOrderResultOrderType": ".trade_order_result_order_type",
- "TradeOrderResultSide": ".trade_order_result_side",
- "TradeOrderResultStatus": ".trade_order_result_status",
- "TradeProvider": ".trade_provider",
- "TradeRequestedOrder": ".trade_requested_order",
- "TradeRequestedOrderOrderType": ".trade_requested_order_order_type",
- "TradeRequestedOrderSide": ".trade_requested_order_side",
"TradeStatus": ".trade_status",
+ "TradeStatusDetail": ".trade_status_detail",
+ "TradeType": ".trade_type",
"TradingAccount": ".trading_account",
"TradingAccountObject": ".trading_account_object",
"TradingAccountProvider": ".trading_account_provider",
@@ -4141,25 +4115,12 @@ def __dir__():
"TooManyRequestsErrorBodyError",
"Topup",
"Trade",
- "TradeCancellationResult",
- "TradeCancellationResultStatus",
"TradeFailureCode",
- "TradeHyperliquid",
- "TradeInstrumentType",
- "TradeLeverage",
- "TradeLeverageMarginMode",
+ "TradeFundsLocation",
"TradeObject",
- "TradeOperationType",
- "TradeOrderResult",
- "TradeOrderResultObject",
- "TradeOrderResultOrderType",
- "TradeOrderResultSide",
- "TradeOrderResultStatus",
- "TradeProvider",
- "TradeRequestedOrder",
- "TradeRequestedOrderOrderType",
- "TradeRequestedOrderSide",
"TradeStatus",
+ "TradeStatusDetail",
+ "TradeType",
"TradingAccount",
"TradingAccountObject",
"TradingAccountProvider",
diff --git a/src/whop_sdk/types/trade.py b/src/whop_sdk/types/trade.py
index d12a62996..12b33c9e6 100644
--- a/src/whop_sdk/types/trade.py
+++ b/src/whop_sdk/types/trade.py
@@ -4,17 +4,12 @@
import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
-from .trade_cancellation_result import TradeCancellationResult
from .trade_failure_code import TradeFailureCode
-from .trade_hyperliquid import TradeHyperliquid
-from .trade_instrument_type import TradeInstrumentType
-from .trade_leverage import TradeLeverage
+from .trade_funds_location import TradeFundsLocation
from .trade_object import TradeObject
-from .trade_operation_type import TradeOperationType
-from .trade_order_result import TradeOrderResult
-from .trade_provider import TradeProvider
-from .trade_requested_order import TradeRequestedOrder
from .trade_status import TradeStatus
+from .trade_status_detail import TradeStatusDetail
+from .trade_type import TradeType
class Trade(UniversalBaseModel):
@@ -23,68 +18,70 @@ class Trade(UniversalBaseModel):
The account that owns the trading wallet, prefixed `biz_`. `null` when a user owns it.
"""
- cancellations: typing.Optional[typing.List[TradeCancellationResult]] = None
- completed_at: typing.Optional[str] = pydantic.Field(default=None)
+ amount: typing.Optional[str] = pydantic.Field(default=None)
"""
- When the submission finished, as an ISO 8601 timestamp, or `null` while it is pending or its outcome is unknown.
+ The USDT0 that a buy sends from the wallet, in native units, as a decimal string. `null` for a close.
"""
- created_at: str = pydantic.Field()
+ average_price: typing.Optional[str] = pydantic.Field(default=None)
"""
- When the trade was submitted, as an ISO 8601 timestamp.
+ The average fill price of the buy, in USD. `null` when it is not known.
"""
- failure_code: typing.Optional[TradeFailureCode] = pydantic.Field(default=None)
+ completed_at: typing.Optional[str] = pydantic.Field(default=None)
"""
- Why the trade failed or has an unknown outcome, or `null` otherwise.
+ When the trade ended as completed or failed, as an ISO 8601 timestamp. `null` before that.
"""
- hyperliquid: typing.Optional[TradeHyperliquid] = pydantic.Field(default=None)
+ created_at: str = pydantic.Field()
"""
- Hyperliquid-specific submission details. Present when `provider` is `hyperliquid`, otherwise `null`.
+ When the trade was created, as an ISO 8601 timestamp.
"""
- id: str = pydantic.Field()
+ failure_code: typing.Optional[TradeFailureCode] = pydantic.Field(default=None)
"""
- Trade ID, prefixed `trop_`.
+ Why the trade failed, or `null`.
"""
- instrument_type: TradeInstrumentType = pydantic.Field()
+ filled_size: typing.Optional[str] = pydantic.Field(default=None)
"""
- The kind of instrument traded.
+ The size that the buy order filled, in units of the market. `null` until the order fills.
"""
- leverage: typing.Optional[TradeLeverage] = pydantic.Field(default=None)
+ funds_location: typing.Optional[TradeFundsLocation] = pydantic.Field(default=None)
"""
- The leverage requested by an `update_leverage` trade. `null` for other trades.
+ Where the money is when the trade did not complete as asked, or after a close: `wallet`, `trading_account`, or `unknown` while a person checks it. `null` otherwise.
"""
- metadata: typing.Dict[str, typing.Any] = pydantic.Field()
+ id: str = pydantic.Field()
"""
- String-to-string annotations you provided when submitting the trade.
+ Trade ID, prefixed `tint_`.
"""
- object: TradeObject
- operation_type: TradeOperationType = pydantic.Field()
+ leverage: typing.Optional[int] = pydantic.Field(default=None)
"""
- `create_orders` places orders, `cancel_orders` cancels a submitted batch, and `update_leverage` sets a market's leverage.
+ The cross leverage of a buy. `null` for a close.
"""
- orders: typing.Optional[typing.List[TradeOrderResult]] = None
- provider: TradeProvider = pydantic.Field()
+ market: str = pydantic.Field()
"""
- Trading venue the trade was submitted to.
+ The perpetual market, for example `BTC`.
"""
- requested_orders: typing.Optional[typing.List[TradeRequestedOrder]] = None
+ object: TradeObject
status: TradeStatus = pydantic.Field()
"""
- Submission status, not fill status. `completed` means the provider response was recorded, even if individual orders were rejected. Never resubmit a `submission_unknown` trade with a new idempotency key.
+ `pending` until the trade starts. `processing` while it runs, also while a failed buy sends its money back. `completed` when it did what was asked. `failed` when it did not; `funds_location` says where the money is. `in_review` when the outcome is unknown and a person checks it.
+ """
+
+ status_detail: typing.Optional[TradeStatusDetail] = pydantic.Field(default=None)
+ """
+ More about the outcome: `partial_fill` (the buy filled only part of its size), `no_position` (the close found no position), `partial_close` (part of the position is still open), or `nothing_to_return` (the close had less than 1 USDC to send back). `null` otherwise.
"""
- trade_id: typing.Optional[str] = pydantic.Field(default=None)
+ type: TradeType = pydantic.Field()
"""
- For a cancellation, the ID of the canceled trade, prefixed `trop_`. `null` otherwise.
+ `buy` bridges USDT0 to the trading account, sets the leverage and places one market buy. `close` closes the position in one market, if one is open, and sends all withdrawable USDC back to the wallet.
"""
updated_at: str = pydantic.Field()
diff --git a/src/whop_sdk/types/trade_cancellation_result.py b/src/whop_sdk/types/trade_cancellation_result.py
deleted file mode 100644
index 6575d8fba..000000000
--- a/src/whop_sdk/types/trade_cancellation_result.py
+++ /dev/null
@@ -1,33 +0,0 @@
-# This file was auto-generated by Fern from our API Definition.
-
-import typing
-
-import pydantic
-from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
-from .trade_cancellation_result_status import TradeCancellationResultStatus
-
-
-class TradeCancellationResult(UniversalBaseModel):
- error: typing.Optional[str] = pydantic.Field(default=None)
- """
- The provider's rejection reason, or `null` when the order was canceled.
- """
-
- id: str = pydantic.Field()
- """
- Client order ID of the order the cancellation targeted, prefixed `trdcloid_`.
- """
-
- status: TradeCancellationResultStatus = pydantic.Field()
- """
- `canceled` when the provider canceled the order; `rejected` when it refused, for example because the order had already filled.
- """
-
- if IS_PYDANTIC_V2:
- model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
- else:
-
- class Config:
- frozen = True
- smart_union = True
- extra = pydantic.Extra.allow
diff --git a/src/whop_sdk/types/trade_cancellation_result_status.py b/src/whop_sdk/types/trade_cancellation_result_status.py
deleted file mode 100644
index f7941ca9b..000000000
--- a/src/whop_sdk/types/trade_cancellation_result_status.py
+++ /dev/null
@@ -1,5 +0,0 @@
-# This file was auto-generated by Fern from our API Definition.
-
-import typing
-
-TradeCancellationResultStatus = typing.Union[typing.Literal["canceled", "rejected"], typing.Any]
diff --git a/src/whop_sdk/types/trade_failure_code.py b/src/whop_sdk/types/trade_failure_code.py
index b963e414a..fb089be1d 100644
--- a/src/whop_sdk/types/trade_failure_code.py
+++ b/src/whop_sdk/types/trade_failure_code.py
@@ -3,5 +3,19 @@
import typing
TradeFailureCode = typing.Union[
- typing.Literal["pre_submission_error", "provider_rejected", "provider_outcome_unknown"], typing.Any
+ typing.Literal[
+ "market_unavailable",
+ "leverage_too_high",
+ "amount_too_small",
+ "isolated_position_open",
+ "trading_paused",
+ "funding_failed",
+ "margin_unavailable",
+ "leverage_rejected",
+ "leverage_unconfirmed",
+ "order_rejected",
+ "close_rejected",
+ "return_failed",
+ ],
+ typing.Any,
]
diff --git a/src/whop_sdk/types/trade_funds_location.py b/src/whop_sdk/types/trade_funds_location.py
new file mode 100644
index 000000000..717665cbc
--- /dev/null
+++ b/src/whop_sdk/types/trade_funds_location.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+TradeFundsLocation = typing.Union[typing.Literal["wallet", "trading_account", "unknown"], typing.Any]
diff --git a/src/whop_sdk/types/trade_hyperliquid.py b/src/whop_sdk/types/trade_hyperliquid.py
deleted file mode 100644
index da854c540..000000000
--- a/src/whop_sdk/types/trade_hyperliquid.py
+++ /dev/null
@@ -1,22 +0,0 @@
-# This file was auto-generated by Fern from our API Definition.
-
-import typing
-
-import pydantic
-from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
-
-
-class TradeHyperliquid(UniversalBaseModel):
- builder_fee_bps: typing.Optional[str] = pydantic.Field(default=None)
- """
- Builder fee Whop charged on the submitted orders, in basis points as a decimal string, or `null` for trades that place no orders.
- """
-
- if IS_PYDANTIC_V2:
- model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
- else:
-
- class Config:
- frozen = True
- smart_union = True
- extra = pydantic.Extra.allow
diff --git a/src/whop_sdk/types/trade_instrument_type.py b/src/whop_sdk/types/trade_instrument_type.py
deleted file mode 100644
index 3dd063ccf..000000000
--- a/src/whop_sdk/types/trade_instrument_type.py
+++ /dev/null
@@ -1,5 +0,0 @@
-# This file was auto-generated by Fern from our API Definition.
-
-import typing
-
-TradeInstrumentType = typing.Union[typing.Literal["perpetual"], typing.Any]
diff --git a/src/whop_sdk/types/trade_leverage.py b/src/whop_sdk/types/trade_leverage.py
deleted file mode 100644
index ad814d36c..000000000
--- a/src/whop_sdk/types/trade_leverage.py
+++ /dev/null
@@ -1,33 +0,0 @@
-# This file was auto-generated by Fern from our API Definition.
-
-import typing
-
-import pydantic
-from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
-from .trade_leverage_margin_mode import TradeLeverageMarginMode
-
-
-class TradeLeverage(UniversalBaseModel):
- leverage: typing.Optional[int] = pydantic.Field(default=None)
- """
- Requested leverage multiplier, such as `10` for 10x, or `null` if the request didn't contain a whole number.
- """
-
- margin_mode: typing.Optional[TradeLeverageMarginMode] = pydantic.Field(default=None)
- """
- `cross` shares margin across positions; `isolated` limits margin to this market's position. `null` if the request didn't contain a supported mode.
- """
-
- market: str = pydantic.Field()
- """
- Market symbol, such as `ETH`.
- """
-
- if IS_PYDANTIC_V2:
- model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
- else:
-
- class Config:
- frozen = True
- smart_union = True
- extra = pydantic.Extra.allow
diff --git a/src/whop_sdk/types/trade_leverage_margin_mode.py b/src/whop_sdk/types/trade_leverage_margin_mode.py
deleted file mode 100644
index 4c7834daa..000000000
--- a/src/whop_sdk/types/trade_leverage_margin_mode.py
+++ /dev/null
@@ -1,5 +0,0 @@
-# This file was auto-generated by Fern from our API Definition.
-
-import typing
-
-TradeLeverageMarginMode = typing.Union[typing.Literal["cross", "isolated"], typing.Any]
diff --git a/src/whop_sdk/types/trade_operation_type.py b/src/whop_sdk/types/trade_operation_type.py
deleted file mode 100644
index 8ca906f53..000000000
--- a/src/whop_sdk/types/trade_operation_type.py
+++ /dev/null
@@ -1,5 +0,0 @@
-# This file was auto-generated by Fern from our API Definition.
-
-import typing
-
-TradeOperationType = typing.Union[typing.Literal["create_orders", "cancel_orders", "update_leverage"], typing.Any]
diff --git a/src/whop_sdk/types/trade_order_result.py b/src/whop_sdk/types/trade_order_result.py
deleted file mode 100644
index 9141c0020..000000000
--- a/src/whop_sdk/types/trade_order_result.py
+++ /dev/null
@@ -1,86 +0,0 @@
-# This file was auto-generated by Fern from our API Definition.
-
-import typing
-
-import pydantic
-from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
-from .money import Money
-from .trade_order_result_object import TradeOrderResultObject
-from .trade_order_result_order_type import TradeOrderResultOrderType
-from .trade_order_result_side import TradeOrderResultSide
-from .trade_order_result_status import TradeOrderResultStatus
-from .trading_hyperliquid_order import TradingHyperliquidOrder
-
-
-class TradeOrderResult(UniversalBaseModel):
- average_price: typing.Optional[Money] = pydantic.Field(default=None)
- """
- Average fill price in USD for an immediate fill, or `null` when nothing filled.
- """
-
- client_order_id: str = pydantic.Field()
- """
- Client order ID Whop assigned to the order, prefixed `trdcloid_`.
- """
-
- error: typing.Optional[str] = pydantic.Field(default=None)
- """
- The provider's rejection reason, or `null` when the order was accepted.
- """
-
- filled_size: typing.Optional[str] = pydantic.Field(default=None)
- """
- Size filled immediately at submission, as a decimal string, or `null` when nothing filled.
- """
-
- hyperliquid: typing.Optional[TradingHyperliquidOrder] = pydantic.Field(default=None)
- """
- Hyperliquid-specific order details. Present on Hyperliquid orders, otherwise `null`.
- """
-
- id: str = pydantic.Field()
- """
- Trading order ID, prefixed `trdord_` once the provider assigns one, otherwise the client order ID prefixed `trdcloid_`.
- """
-
- market: str = pydantic.Field()
- """
- Market symbol on the provider, such as `ETH`.
- """
-
- object: TradeOrderResultObject
- order_type: TradeOrderResultOrderType
- parent_client_order_id: typing.Optional[str] = pydantic.Field(default=None)
- """
- For an attached take-profit or stop-loss, the client order ID of its entry order, prefixed `trdcloid_`. `null` for other orders.
- """
-
- price: Money = pydantic.Field()
- """
- Submitted limit price in USD. For market and trigger orders, the worst price allowed after slippage.
- """
-
- provider_order_id: typing.Optional[str] = pydantic.Field(default=None)
- """
- The provider's own order ID, or `null` until the provider assigns one, such as for a rejected order or a take-profit or stop-loss that hasn't triggered yet.
- """
-
- side: TradeOrderResultSide
- size: str = pydantic.Field()
- """
- Submitted size as a decimal string.
- """
-
- status: TradeOrderResultStatus = pydantic.Field()
- """
- The provider's acknowledgement at submission time, not the current fill status.
- """
-
- if IS_PYDANTIC_V2:
- model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
- else:
-
- class Config:
- frozen = True
- smart_union = True
- extra = pydantic.Extra.allow
diff --git a/src/whop_sdk/types/trade_order_result_object.py b/src/whop_sdk/types/trade_order_result_object.py
deleted file mode 100644
index 95e030458..000000000
--- a/src/whop_sdk/types/trade_order_result_object.py
+++ /dev/null
@@ -1,5 +0,0 @@
-# This file was auto-generated by Fern from our API Definition.
-
-import typing
-
-TradeOrderResultObject = typing.Union[typing.Literal["trading_order"], typing.Any]
diff --git a/src/whop_sdk/types/trade_order_result_order_type.py b/src/whop_sdk/types/trade_order_result_order_type.py
deleted file mode 100644
index 9ead06653..000000000
--- a/src/whop_sdk/types/trade_order_result_order_type.py
+++ /dev/null
@@ -1,5 +0,0 @@
-# This file was auto-generated by Fern from our API Definition.
-
-import typing
-
-TradeOrderResultOrderType = typing.Union[typing.Literal["limit", "market", "take_profit", "stop_loss"], typing.Any]
diff --git a/src/whop_sdk/types/trade_order_result_side.py b/src/whop_sdk/types/trade_order_result_side.py
deleted file mode 100644
index 54bec6e95..000000000
--- a/src/whop_sdk/types/trade_order_result_side.py
+++ /dev/null
@@ -1,5 +0,0 @@
-# This file was auto-generated by Fern from our API Definition.
-
-import typing
-
-TradeOrderResultSide = typing.Union[typing.Literal["buy", "sell"], typing.Any]
diff --git a/src/whop_sdk/types/trade_order_result_status.py b/src/whop_sdk/types/trade_order_result_status.py
deleted file mode 100644
index 8fe5b755e..000000000
--- a/src/whop_sdk/types/trade_order_result_status.py
+++ /dev/null
@@ -1,5 +0,0 @@
-# This file was auto-generated by Fern from our API Definition.
-
-import typing
-
-TradeOrderResultStatus = typing.Union[typing.Literal["open", "filled", "rejected"], typing.Any]
diff --git a/src/whop_sdk/types/trade_requested_order.py b/src/whop_sdk/types/trade_requested_order.py
deleted file mode 100644
index 4bb14950d..000000000
--- a/src/whop_sdk/types/trade_requested_order.py
+++ /dev/null
@@ -1,60 +0,0 @@
-# This file was auto-generated by Fern from our API Definition.
-
-import typing
-
-import pydantic
-from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
-from .money import Money
-from .trade_requested_order_order_type import TradeRequestedOrderOrderType
-from .trade_requested_order_side import TradeRequestedOrderSide
-
-
-class TradeRequestedOrder(UniversalBaseModel):
- client_order_id: str = pydantic.Field()
- """
- Client order ID Whop assigned to the order, prefixed `trdcloid_`. Matches the order in `orders` and on the provider.
- """
-
- market: str = pydantic.Field()
- """
- Market symbol as submitted, such as `ETH`.
- """
-
- order_type: typing.Optional[TradeRequestedOrderOrderType] = pydantic.Field(default=None)
- """
- Submitted order type, or `null` if the request didn't contain a supported type.
- """
-
- parent_client_order_id: typing.Optional[str] = pydantic.Field(default=None)
- """
- For an attached take-profit or stop-loss, the client order ID of its entry order, prefixed `trdcloid_`. `null` for other orders.
- """
-
- price: typing.Optional[Money] = pydantic.Field(default=None)
- """
- Submitted limit price in USD, or `null` for orders submitted without one.
- """
-
- side: typing.Optional[TradeRequestedOrderSide] = pydantic.Field(default=None)
- """
- Submitted side, or `null` if the request didn't contain a supported side.
- """
-
- size: str = pydantic.Field()
- """
- Submitted size as a decimal string.
- """
-
- trigger_price: typing.Optional[Money] = pydantic.Field(default=None)
- """
- Submitted trigger price in USD, or `null` for orders without a trigger.
- """
-
- if IS_PYDANTIC_V2:
- model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
- else:
-
- class Config:
- frozen = True
- smart_union = True
- extra = pydantic.Extra.allow
diff --git a/src/whop_sdk/types/trade_requested_order_order_type.py b/src/whop_sdk/types/trade_requested_order_order_type.py
deleted file mode 100644
index 5455cf8e9..000000000
--- a/src/whop_sdk/types/trade_requested_order_order_type.py
+++ /dev/null
@@ -1,5 +0,0 @@
-# This file was auto-generated by Fern from our API Definition.
-
-import typing
-
-TradeRequestedOrderOrderType = typing.Union[typing.Literal["limit", "market", "take_profit", "stop_loss"], typing.Any]
diff --git a/src/whop_sdk/types/trade_requested_order_side.py b/src/whop_sdk/types/trade_requested_order_side.py
deleted file mode 100644
index eb2b2eae3..000000000
--- a/src/whop_sdk/types/trade_requested_order_side.py
+++ /dev/null
@@ -1,5 +0,0 @@
-# This file was auto-generated by Fern from our API Definition.
-
-import typing
-
-TradeRequestedOrderSide = typing.Union[typing.Literal["buy", "sell"], typing.Any]
diff --git a/src/whop_sdk/types/trade_status.py b/src/whop_sdk/types/trade_status.py
index c8df8d4e9..bdf12b62c 100644
--- a/src/whop_sdk/types/trade_status.py
+++ b/src/whop_sdk/types/trade_status.py
@@ -2,6 +2,4 @@
import typing
-TradeStatus = typing.Union[
- typing.Literal["pending", "submitted", "completed", "failed", "submission_unknown"], typing.Any
-]
+TradeStatus = typing.Union[typing.Literal["pending", "processing", "in_review", "completed", "failed"], typing.Any]
diff --git a/src/whop_sdk/types/trade_status_detail.py b/src/whop_sdk/types/trade_status_detail.py
new file mode 100644
index 000000000..ab0ae2eaf
--- /dev/null
+++ b/src/whop_sdk/types/trade_status_detail.py
@@ -0,0 +1,7 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+TradeStatusDetail = typing.Union[
+ typing.Literal["partial_fill", "no_position", "partial_close", "nothing_to_return"], typing.Any
+]
diff --git a/src/whop_sdk/types/trade_provider.py b/src/whop_sdk/types/trade_type.py
similarity index 52%
rename from src/whop_sdk/types/trade_provider.py
rename to src/whop_sdk/types/trade_type.py
index e99925a03..8e8ac3eb8 100644
--- a/src/whop_sdk/types/trade_provider.py
+++ b/src/whop_sdk/types/trade_type.py
@@ -2,4 +2,4 @@
import typing
-TradeProvider = typing.Union[typing.Literal["hyperliquid"], typing.Any]
+TradeType = typing.Union[typing.Literal["buy", "close"], typing.Any]
From ece1493c20d3f27175a0c81bab482a19b6c47b41 Mon Sep 17 00:00:00 2001
From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com>
Date: Thu, 8 Oct 2026 05:26:01 +0000
Subject: [PATCH 2/2] [fern-replay] advance lockfile
---
.fern/replay.lock | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/.fern/replay.lock b/.fern/replay.lock
index 46d86032a..302cdca64 100644
--- a/.fern/replay.lock
+++ b/.fern/replay.lock
@@ -2082,5 +2082,11 @@ generations:
cli_version: unknown
generator_versions:
fernapi/fern-python-sdk: 5.28.0
-current_generation: a51f4435af5ac576ce26e320152e5f11951ae852
+ - commit_sha: f77163c40be19fa4fa687014b43c50dafea8d80d
+ tree_hash: a88927495df63d4ad4b62b7ce071c97fef60974d
+ timestamp: 2026-10-08T05:25:56.315Z
+ cli_version: unknown
+ generator_versions:
+ fernapi/fern-python-sdk: 5.28.0
+current_generation: f77163c40be19fa4fa687014b43c50dafea8d80d
patches: []