derive-py 0.1.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. derive_py-0.1.3/LICENSE +21 -0
  2. derive_py-0.1.3/PKG-INFO +374 -0
  3. derive_py-0.1.3/README.md +330 -0
  4. derive_py-0.1.3/derive_py/__init__.py +11 -0
  5. derive_py-0.1.3/derive_py/_clients/__init__.py +14 -0
  6. derive_py-0.1.3/derive_py/_clients/rest/__init__.py +0 -0
  7. derive_py-0.1.3/derive_py/_clients/rest/async_http/__init__.py +1 -0
  8. derive_py-0.1.3/derive_py/_clients/rest/async_http/account.py +277 -0
  9. derive_py-0.1.3/derive_py/_clients/rest/async_http/api.py +2588 -0
  10. derive_py-0.1.3/derive_py/_clients/rest/async_http/client.py +276 -0
  11. derive_py-0.1.3/derive_py/_clients/rest/async_http/collateral.py +192 -0
  12. derive_py-0.1.3/derive_py/_clients/rest/async_http/history.py +282 -0
  13. derive_py-0.1.3/derive_py/_clients/rest/async_http/markets.py +298 -0
  14. derive_py-0.1.3/derive_py/_clients/rest/async_http/mmp.py +75 -0
  15. derive_py-0.1.3/derive_py/_clients/rest/async_http/orders.py +359 -0
  16. derive_py-0.1.3/derive_py/_clients/rest/async_http/positions.py +149 -0
  17. derive_py-0.1.3/derive_py/_clients/rest/async_http/rfq.py +470 -0
  18. derive_py-0.1.3/derive_py/_clients/rest/async_http/session.py +154 -0
  19. derive_py-0.1.3/derive_py/_clients/rest/async_http/subaccount.py +348 -0
  20. derive_py-0.1.3/derive_py/_clients/rest/async_http/system.py +47 -0
  21. derive_py-0.1.3/derive_py/_clients/rest/async_http/vaults.py +774 -0
  22. derive_py-0.1.3/derive_py/_clients/rest/endpoints.py +158 -0
  23. derive_py-0.1.3/derive_py/_clients/rest/http/__init__.py +1 -0
  24. derive_py-0.1.3/derive_py/_clients/rest/http/account.py +277 -0
  25. derive_py-0.1.3/derive_py/_clients/rest/http/api.py +2588 -0
  26. derive_py-0.1.3/derive_py/_clients/rest/http/client.py +274 -0
  27. derive_py-0.1.3/derive_py/_clients/rest/http/collateral.py +190 -0
  28. derive_py-0.1.3/derive_py/_clients/rest/http/history.py +282 -0
  29. derive_py-0.1.3/derive_py/_clients/rest/http/markets.py +294 -0
  30. derive_py-0.1.3/derive_py/_clients/rest/http/mmp.py +75 -0
  31. derive_py-0.1.3/derive_py/_clients/rest/http/orders.py +359 -0
  32. derive_py-0.1.3/derive_py/_clients/rest/http/positions.py +149 -0
  33. derive_py-0.1.3/derive_py/_clients/rest/http/rfq.py +470 -0
  34. derive_py-0.1.3/derive_py/_clients/rest/http/session.py +153 -0
  35. derive_py-0.1.3/derive_py/_clients/rest/http/subaccount.py +345 -0
  36. derive_py-0.1.3/derive_py/_clients/rest/http/system.py +47 -0
  37. derive_py-0.1.3/derive_py/_clients/rest/http/vaults.py +774 -0
  38. derive_py-0.1.3/derive_py/_clients/utils.py +644 -0
  39. derive_py-0.1.3/derive_py/_clients/websockets/__init__.py +1 -0
  40. derive_py-0.1.3/derive_py/_clients/websockets/api.py +2766 -0
  41. derive_py-0.1.3/derive_py/_clients/websockets/client.py +431 -0
  42. derive_py-0.1.3/derive_py/_clients/websockets/session.py +792 -0
  43. derive_py-0.1.3/derive_py/_web3/__init__.py +14 -0
  44. derive_py-0.1.3/derive_py/_web3/abi.py +47 -0
  45. derive_py-0.1.3/derive_py/_web3/action_signing/__init__.py +65 -0
  46. derive_py-0.1.3/derive_py/_web3/action_signing/module_data/__init__.py +47 -0
  47. derive_py-0.1.3/derive_py/_web3/action_signing/module_data/module_data.py +27 -0
  48. derive_py-0.1.3/derive_py/_web3/action_signing/module_data/rfq.py +147 -0
  49. derive_py-0.1.3/derive_py/_web3/action_signing/module_data/session_key.py +54 -0
  50. derive_py-0.1.3/derive_py/_web3/action_signing/module_data/trade.py +40 -0
  51. derive_py-0.1.3/derive_py/_web3/action_signing/module_data/transfer_positions.py +53 -0
  52. derive_py-0.1.3/derive_py/_web3/action_signing/module_data/transfer_spot.py +47 -0
  53. derive_py-0.1.3/derive_py/_web3/action_signing/module_data/transfer_spot_external.py +54 -0
  54. derive_py-0.1.3/derive_py/_web3/action_signing/module_data/vault.py +302 -0
  55. derive_py-0.1.3/derive_py/_web3/action_signing/module_data/whitelisted_recipients.py +32 -0
  56. derive_py-0.1.3/derive_py/_web3/action_signing/module_data/withdraw.py +52 -0
  57. derive_py-0.1.3/derive_py/_web3/action_signing/signed_action.py +129 -0
  58. derive_py-0.1.3/derive_py/_web3/action_signing/utils.py +174 -0
  59. derive_py-0.1.3/derive_py/_web3/async_utils.py +77 -0
  60. derive_py-0.1.3/derive_py/_web3/deposits.py +280 -0
  61. derive_py-0.1.3/derive_py/_web3/erc20.py +69 -0
  62. derive_py-0.1.3/derive_py/_web3/provider.py +456 -0
  63. derive_py-0.1.3/derive_py/_web3/tx.py +264 -0
  64. derive_py-0.1.3/derive_py/cli/__init__.py +60 -0
  65. derive_py-0.1.3/derive_py/cli/_account.py +53 -0
  66. derive_py-0.1.3/derive_py/cli/_collateral.py +30 -0
  67. derive_py-0.1.3/derive_py/cli/_columns.py +238 -0
  68. derive_py-0.1.3/derive_py/cli/_markets.py +318 -0
  69. derive_py-0.1.3/derive_py/cli/_mmp.py +118 -0
  70. derive_py-0.1.3/derive_py/cli/_orders.py +151 -0
  71. derive_py-0.1.3/derive_py/cli/_positions.py +73 -0
  72. derive_py-0.1.3/derive_py/cli/_system.py +58 -0
  73. derive_py-0.1.3/derive_py/cli/_tree.py +115 -0
  74. derive_py-0.1.3/derive_py/cli/_utils.py +225 -0
  75. derive_py-0.1.3/derive_py/config/__init__.py +32 -0
  76. derive_py-0.1.3/derive_py/config/constants.py +46 -0
  77. derive_py-0.1.3/derive_py/config/contracts.py +83 -0
  78. derive_py-0.1.3/derive_py/config/rpc.py +60 -0
  79. derive_py-0.1.3/derive_py/data/abis/erc20.json +222 -0
  80. derive_py-0.1.3/derive_py/data/abis/sepolia/0x1573bde26338A9E6AA358638679A796c81E33246.json +112 -0
  81. derive_py-0.1.3/derive_py/data/abis/sepolia/0x3FB79aafCD401CDD19e3d729241545955DDE0D48.json +112 -0
  82. derive_py-0.1.3/derive_py/data/abis/sepolia/0x3fBcEB634d2582791B462059D946800c9f41bEfB.json +1210 -0
  83. derive_py-0.1.3/derive_py/data/abis/sepolia/0xFbB62CE2BbFdFdc8a60DDC22115aC29cf91B4566.json +112 -0
  84. derive_py-0.1.3/derive_py/data/abis/sepolia/0xc02CdE0d7b7B34C02AAa6cF753D8b4453297236c.json +243 -0
  85. derive_py-0.1.3/derive_py/data/abis/sepolia/0xd3625eCf97E5554C62A48Ac1c9284C9dCeFceB68.json +112 -0
  86. derive_py-0.1.3/derive_py/data/abis/sepolia/0xdBC22b75506FED598b1A114Ba51b9Ca005dE8B65.json +1635 -0
  87. derive_py-0.1.3/derive_py/data/abis/sepolia/0xdFB882fDa2BcdB74358506D56D14E746c76eF864.json +782 -0
  88. derive_py-0.1.3/derive_py/data/abis/sepolia/contracts.json +30 -0
  89. derive_py-0.1.3/derive_py/data/abis/sepolia/proxy_mapping.json +6 -0
  90. derive_py-0.1.3/derive_py/data/templates/api.py.jinja +226 -0
  91. derive_py-0.1.3/derive_py/data/templates/endpoints.py.jinja +45 -0
  92. derive_py-0.1.3/derive_py/data_types/__init__.py +81 -0
  93. derive_py-0.1.3/derive_py/data_types/channel_models.py +235 -0
  94. derive_py-0.1.3/derive_py/data_types/enums.py +257 -0
  95. derive_py-0.1.3/derive_py/data_types/generated_models.py +2665 -0
  96. derive_py-0.1.3/derive_py/data_types/models.py +473 -0
  97. derive_py-0.1.3/derive_py/data_types/utils.py +24 -0
  98. derive_py-0.1.3/derive_py/exceptions.py +159 -0
  99. derive_py-0.1.3/derive_py/utils/__init__.py +7 -0
  100. derive_py-0.1.3/derive_py/utils/logger.py +27 -0
  101. derive_py-0.1.3/pyproject.toml +142 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 derive-py contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,374 @@
1
+ Metadata-Version: 2.4
2
+ Name: derive-py
3
+ Version: 0.1.3
4
+ Summary: Python client for the Derive v3 API
5
+ License: MIT
6
+ License-File: LICENSE
7
+ Keywords: derive,trading,options,perpetuals,defi,ethereum
8
+ Author: 8baller
9
+ Author-email: 8baller@station.codes
10
+ Requires-Python: >=3.11,<3.15
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: Financial and Insurance Industry
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Programming Language :: Python :: 3.14
20
+ Classifier: Topic :: Office/Business :: Financial :: Investment
21
+ Classifier: Typing :: Typed
22
+ Requires-Dist: aiohttp (>=3.13)
23
+ Requires-Dist: click (>=8.3)
24
+ Requires-Dist: eth-abi (>=5.2)
25
+ Requires-Dist: eth-account (>=0.13.7)
26
+ Requires-Dist: eth-typing (>=5.2)
27
+ Requires-Dist: eth-utils (>=5.3)
28
+ Requires-Dist: hexbytes (>=1.3)
29
+ Requires-Dist: more-itertools (>=10.8)
30
+ Requires-Dist: msgspec (>=0.19,<1.0)
31
+ Requires-Dist: pandas (>=2,<4)
32
+ Requires-Dist: pydantic (>=2.11.3)
33
+ Requires-Dist: python-dotenv (>=0.14)
34
+ Requires-Dist: requests (>=2.31)
35
+ Requires-Dist: rich (>=14)
36
+ Requires-Dist: rich-click (>=1.7.1)
37
+ Requires-Dist: web3 (>=7.14,<8)
38
+ Requires-Dist: websockets (>=15)
39
+ Project-URL: Documentation, https://docs.derive.xyz/
40
+ Project-URL: Homepage, https://github.com/derivexyz/derive-py
41
+ Project-URL: Repository, https://github.com/derivexyz/derive-py
42
+ Description-Content-Type: text/markdown
43
+
44
+ <div align="center">
45
+
46
+ # derive-py
47
+
48
+ [![PyPI](https://img.shields.io/pypi/v/derive-py)](https://pypi.org/project/derive-py/)
49
+ [![CI](https://github.com/derivexyz/derive-py/actions/workflows/common_check.yaml/badge.svg)](https://github.com/derivexyz/derive-py/actions/workflows/common_check.yaml)
50
+ [![Licence](https://img.shields.io/github/license/derivexyz/derive-py)](https://github.com/derivexyz/derive-py/blob/main/LICENSE)
51
+
52
+ **Official Python SDK for the Derive Protocol**
53
+
54
+ Market data, orders, RFQs, transfers, withdrawals, deposits, vaults and session
55
+ keys over HTTP or WebSocket, synchronously or asynchronously, plus a `drv`
56
+ command line tool.
57
+
58
+ [Documentation](https://docs.derive.xyz/) ·
59
+ [Quickstart](#quickstart) ·
60
+ [Examples](#examples) ·
61
+ [CLI](#cli) ·
62
+ [Contributing](#contributors)
63
+
64
+ </div>
65
+
66
+ ---
67
+
68
+ ## Documentation
69
+
70
+ Protocol semantics are documented by Derive and are not repeated here. Read them
71
+ first, then come back for the Python bindings.
72
+
73
+ - [Derive v3 documentation](https://docs.derive.xyz/)
74
+ - [Quickstart](https://docs.derive.xyz/getting-started/quickstart) and [depositing](https://docs.derive.xyz/getting-started/depositing)
75
+ - [Action signing](https://docs.derive.xyz/authentication/action-signing), [session keys](https://docs.derive.xyz/authentication/session-keys) and [access scopes](https://docs.derive.xyz/authentication/access-scopes)
76
+ - [Migrating from v2](https://docs.derive.xyz/migrating/breaking-changes), written to double as a `SKILL.md` for a coding agent
77
+ - [llms.txt](https://docs.derive.xyz/llms.txt), an index of every page for agents
78
+ - Machine readable specs, which this client is generated from:
79
+ [openapi.json](https://docs.derive.xyz/openapi.json),
80
+ [websocket.asyncapi.json](https://docs.derive.xyz/websocket.asyncapi.json),
81
+ [subscriptions.asyncapi.json](https://docs.derive.xyz/subscriptions.asyncapi.json)
82
+
83
+ ## Install
84
+
85
+ ```bash
86
+ pip install derive-py
87
+ ```
88
+
89
+ Python 3.11 or newer.
90
+
91
+ ## Configure
92
+
93
+ Credentials come from the environment, or from a `.env` file in the working
94
+ directory (default), or from a custom path.
95
+
96
+ | Variable | Required | Notes |
97
+ | --- | --- | --- |
98
+ | `DERIVE_WALLET` | yes | The owner wallet, your own EOA or multisig |
99
+ | `DERIVE_SESSION_KEY` | yes | Private key of the signer, a session key or the owner |
100
+ | `DERIVE_SUBACCOUNT_ID` | yes | Subaccount the client acts on by default |
101
+ | `DERIVE_ETH_CHAIN` | no | `SEPOLIA` or `ETHEREUM`, defaults to `SEPOLIA` |
102
+ | `DERIVE_ETH_RPC_ENDPOINTS` | no | Comma separated L1 RPC URLs, only used by the deposit flows |
103
+
104
+ `from_env()` takes a `session_key_path` if you would rather keep the key in a
105
+ file than in the environment, and an `env_file` to point at a `.env` elsewhere.
106
+
107
+ `.env.template` holds working testnet credentials. They are published on purpose
108
+ so the examples run with no setup, and they are worthless: never reuse that key
109
+ for anything else.
110
+
111
+ ## Quickstart
112
+
113
+ ```python
114
+ from derive_py import HTTPClient
115
+ from derive_py.data_types import D, Direction, OrderType
116
+
117
+ client = HTTPClient.from_env()
118
+
119
+ # Public market data needs no credentials and no connect().
120
+ ticker = client.markets.get_ticker(instrument_name="ETH-PERP")
121
+
122
+ # connect() validates the credentials and warms the instrument cache.
123
+ # Anything touching subaccount state needs it.
124
+ client.connect()
125
+
126
+ order = client.orders.create(
127
+ instrument_name="ETH-PERP",
128
+ amount=D("0.1"),
129
+ limit_price=D("1000"),
130
+ direction=Direction.buy,
131
+ order_type=OrderType.limit,
132
+ )
133
+
134
+ client.disconnect()
135
+ ```
136
+
137
+ `D` builds a `Decimal`. Pass decimals, never floats: amounts and prices are
138
+ quantized to the instrument's `amount_step` and `tick_size`, and the protocol
139
+ rejects rather than truncates excess precision.
140
+
141
+ ## Clients
142
+
143
+ | Client | Transport | Concurrency |
144
+ | --- | --- | --- |
145
+ | `HTTPClient` | JSON-RPC over HTTP | Blocking. Not thread safe, use one client per thread |
146
+ | `AsyncHTTPClient` | JSON-RPC over HTTP | Safe for concurrent tasks on a single event loop, not safe to share between threads |
147
+ | `WebSocketClient` | JSON-RPC over WebSocket | Safe for concurrent tasks on a single event loop, not safe to share between threads |
148
+
149
+ Only `WebSocketClient` carries subscriptions. It also holds one connection open
150
+ rather than paying setup on every call, so it is the one to reach for when
151
+ latency matters. Its `connect()` is mandatory, since there is no transport
152
+ before it. Both HTTP clients open their session lazily on first use, so they
153
+ need `connect()` only for credential validation and cached state.
154
+
155
+ All three expose the same operations:
156
+
157
+ | Attribute | What it does |
158
+ | --- | --- |
159
+ | `client.markets` | Currencies, instruments, tickers, risk universes. Public |
160
+ | `client.system` | Server time, rate limits, operation lookup by uuid. Public |
161
+ | `client.account` | The wallet: session keys, whitelisted recipients, subaccounts, portfolios |
162
+ | `client.orders` | Create, replace, cancel, query |
163
+ | `client.positions` | Open positions and position transfers |
164
+ | `client.collateral` | Balances, margin, withdrawals, spot transfers |
165
+ | `client.rfq` | Taker and maker RFQ flows |
166
+ | `client.history` | Trades, orders, deposits, withdrawals, funding, interest |
167
+ | `client.mmp` | Market maker protection config and reset |
168
+ | `client.vaults` | Shareholder and curator operations |
169
+ | `client.active_subaccount` | The subaccount the above act on, with `cached_subaccounts` for the rest |
170
+ | `client.plan_deposit_to_new_subaccount` | On-chain deposit that creates a subaccount as it funds it |
171
+
172
+ `WebSocketClient` adds `public_channels`, `private_channels`, `subscriptions`,
173
+ `connection_state` and `on_state_change`. Every operation is also reachable per
174
+ subaccount, `subaccount.orders` and so on, when one client drives several.
175
+
176
+ Anything not wrapped is reachable through `client.public_api` and
177
+ `client.private_api`, which are generated from the specs above and cover the
178
+ whole RPC surface.
179
+
180
+ ## Examples
181
+
182
+ Runnable and heavily commented, ordered by the v3 onboarding flow: your first
183
+ deposit creates the account, then session keys, then the rest.
184
+
185
+ ```bash
186
+ git clone git@github.com:derivexyz/derive-py.git
187
+ cd derive-py
188
+ pip install -e .
189
+ cp .env.template .env
190
+ python examples/03-market-data.py
191
+ ```
192
+
193
+ <!-- examples:start -->
194
+ | Example | What it covers |
195
+ | --- | --- |
196
+ | [`01-deposit.py`](https://github.com/derivexyz/derive-py/blob/main/examples/01-deposit.py) | Deposit: the only way an account or subaccount comes into existence |
197
+ | [`02-session-keys.py`](https://github.com/derivexyz/derive-py/blob/main/examples/02-session-keys.py) | Session keys: register a scoped, expiring key, edit it, retire it |
198
+ | [`03-market-data.py`](https://github.com/derivexyz/derive-py/blob/main/examples/03-market-data.py) | Public market data: currencies, instruments, tickers |
199
+ | [`04-subscribe.py`](https://github.com/derivexyz/derive-py/blob/main/examples/04-subscribe.py) | Websocket subscriptions: two public channels over one socket |
200
+ | [`05-place-order.py`](https://github.com/derivexyz/derive-py/blob/main/examples/05-place-order.py) | Order lifecycle: place, inspect, cancel |
201
+ | [`06-rfq-taker.py`](https://github.com/derivexyz/derive-py/blob/main/examples/06-rfq-taker.py) | RFQ taker: request quotes for a package, execute the best one |
202
+ | [`07-rfq-maker.py`](https://github.com/derivexyz/derive-py/blob/main/examples/07-rfq-maker.py) | RFQ maker: a bounded quoting loop |
203
+ | [`08-transfers.py`](https://github.com/derivexyz/derive-py/blob/main/examples/08-transfers.py) | Spot transfers: between your own subaccounts, and out to another owner |
204
+ | [`09-withdraw.py`](https://github.com/derivexyz/derive-py/blob/main/examples/09-withdraw.py) | Withdraw collateral to L1 |
205
+ | [`10-vaults.py`](https://github.com/derivexyz/derive-py/blob/main/examples/10-vaults.py) | Vaults: browse, queue a deposit, cancel it |
206
+ | [`11-position-transfer.py`](https://github.com/derivexyz/derive-py/blob/main/examples/11-position-transfer.py) | Position transfers: moving part of an open position between two subaccounts owned by the same wallet |
207
+ <!-- examples:end -->
208
+
209
+ `01-deposit.py` is the only one needing a funded L1 key and an RPC endpoint. The
210
+ rest run against testnet with the credentials in `.env.template`.
211
+
212
+ ## CLI
213
+
214
+ ```bash
215
+ drv --help # every command
216
+ drv tree # the tree below, from your installed version
217
+ drv market ticker ETH-PERP
218
+ ```
219
+
220
+ ![CLI demo](https://raw.githubusercontent.com/derivexyz/derive-py/main/.github/assets/cli_demo.gif)
221
+
222
+ <!-- cli-tree:start -->
223
+ ```
224
+ drv
225
+ ├── account.......... Account details.
226
+ │ ├── get.......... Account details.
227
+ │ └── portfolios... Get all portfolios of a wallet.
228
+ ├── collateral....... Manage collateral.
229
+ │ └── get.......... Get subaccount collaterals.
230
+ ├── market........... Query market data: currencies, instruments, tickers.
231
+ │ ├── currency..... Get currency details.
232
+ │ ├── instrument... Get instrument details.
233
+ │ ├── ticker....... Get ticker details.
234
+ │ └── universe..... List risk universes, their managers and accepted collaterals.
235
+ ├── mmp.............. Market maker protection configuration.
236
+ │ ├── get-config... Get the current mmp config for a subaccount (optionally filtered by currency).
237
+ │ ├── reset........ Resets (unfreezes) the mmp state for a subaccount (optionally filtered by currency).
238
+ │ └── set-config... Set the mmp config for the subaccount and currency.
239
+ ├── order............ Create, view, list, and cancel orders.
240
+ │ ├── cancel....... Cancel a single order.
241
+ │ ├── cancel-all... Cancel all orders.
242
+ │ ├── create....... Create a new order.
243
+ │ ├── get.......... Get state of an order by order id.
244
+ │ └── list-open.... List all open orders of a subaccount.
245
+ ├── position......... Inspect and transfer positions across subaccounts.
246
+ │ ├── list......... List active positions of a subaccount.
247
+ │ └── transfer..... Transfer part of a position to another subaccount of the same wallet.
248
+ ├── system........... Query system-level information.
249
+ │ ├── rate-limits.. Get the caller's current rate limits.
250
+ │ ├── time......... Get the current system time.
251
+ │ └── transaction.. Get a transaction by its operation UUID.
252
+ └── tree............. Print the command tree structure.
253
+ ```
254
+ <!-- cli-tree:end -->
255
+
256
+ ## Development
257
+
258
+ ```bash
259
+ git clone git@github.com:derivexyz/derive-py.git
260
+ cd derive-py
261
+ make install # dependencies and git hooks
262
+ ```
263
+
264
+ ```bash
265
+ make fmt lint typecheck # while working
266
+ make tests # hits the live testnet API
267
+ make all # everything CI runs, in the order CI runs it
268
+ ```
269
+
270
+ `make all` regenerates the client from the published specs, the API reference
271
+ and the generated blocks in this README, then formats, lints, type checks and
272
+ tests. CI runs the same targets and fails on a dirty tree, so run it before
273
+ pushing and commit whatever it regenerates.
274
+
275
+ ```bash
276
+ make codegen-all # regenerate models, API and tests from the specs
277
+ make docs # regenerate the README blocks and build the site
278
+ make demo # re-record the CLI gif, needs cowsay, gum, asciinema, agg
279
+ ```
280
+
281
+ `shell.nix` provides all of it, recording tools included.
282
+
283
+ ### Releasing
284
+
285
+ ```bash
286
+ poetry run tbump 0.1.1
287
+ ```
288
+
289
+ Tagging triggers the release workflow, which builds, creates a GitHub release
290
+ and publishes to PyPI.
291
+
292
+ ## Contributors
293
+
294
+ <!-- readme: contributors -start -->
295
+ <table>
296
+ <tbody>
297
+ <tr>
298
+ <td align="center">
299
+ <a href="https://github.com/Karrenbelt">
300
+ <img src="https://avatars.githubusercontent.com/u/16686216?v=4" width="100;" alt="Karrenbelt"/>
301
+ <br />
302
+ <sub><b>Zarathustra</b></sub>
303
+ </a>
304
+ </td>
305
+ <td align="center">
306
+ <a href="https://github.com/8ball030">
307
+ <img src="https://avatars.githubusercontent.com/u/35799987?v=4" width="100;" alt="8ball030"/>
308
+ <br />
309
+ <sub><b>8ball030</b></sub>
310
+ </a>
311
+ </td>
312
+ <td align="center">
313
+ <a href="https://github.com/8ball030-max">
314
+ <img src="https://avatars.githubusercontent.com/u/326239837?v=4" width="100;" alt="8ball030-max"/>
315
+ <br />
316
+ <sub><b>8ball030-max</b></sub>
317
+ </a>
318
+ </td>
319
+ <td align="center">
320
+ <a href="https://github.com/Aviksaikat">
321
+ <img src="https://avatars.githubusercontent.com/u/31238298?v=4" width="100;" alt="Aviksaikat"/>
322
+ <br />
323
+ <sub><b>Saikat K</b></sub>
324
+ </a>
325
+ </td>
326
+ <td align="center">
327
+ <a href="https://github.com/andreiaugustin">
328
+ <img src="https://avatars.githubusercontent.com/u/36695484?v=4" width="100;" alt="andreiaugustin"/>
329
+ <br />
330
+ <sub><b>Andrei Augustin</b></sub>
331
+ </a>
332
+ </td>
333
+ <td align="center">
334
+ <a href="https://github.com/0xdomrom">
335
+ <img src="https://avatars.githubusercontent.com/u/11264336?v=4" width="100;" alt="0xdomrom"/>
336
+ <br />
337
+ <sub><b>DomRom</b></sub>
338
+ </a>
339
+ </td>
340
+ </tr>
341
+ <tr>
342
+ <td align="center">
343
+ <a href="https://github.com/DeBelg">
344
+ <img src="https://avatars.githubusercontent.com/u/38403795?v=4" width="100;" alt="DeBelg"/>
345
+ <br />
346
+ <sub><b>Mf</b></sub>
347
+ </a>
348
+ </td>
349
+ </tr>
350
+ <tbody>
351
+ </table>
352
+ <!-- readme: contributors -end -->
353
+
354
+ This client library is developed with support from Derive, who host it under their
355
+ organization. Requests include default `referral_code` and `client` identifiers.
356
+ All code is open source and auditable.
357
+
358
+ ## Resources
359
+
360
+ - [Derive](https://derive.xyz)
361
+ - [Protocol documentation](https://docs.derive.xyz)
362
+ - [Discord](https://discord.gg/derive)
363
+ - [X / Twitter](https://twitter.com/derivexyz)
364
+ - Sibling SDKs: [derive-ts](https://github.com/derivexyz/derive-ts), [derive-rs](https://github.com/derivexyz/derive-rs)
365
+
366
+ ## Licence
367
+
368
+ MIT, see [LICENSE](https://github.com/derivexyz/derive-py/blob/main/LICENSE).
369
+
370
+ ## Disclaimer
371
+
372
+ This software is provided as-is, without warranty. Trading derivatives involves
373
+ substantial risk of loss.
374
+