typed-nado 0.1.0__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 (167) hide show
  1. typed_nado-0.1.0/LICENSE +21 -0
  2. typed_nado-0.1.0/PKG-INFO +121 -0
  3. typed_nado-0.1.0/README.md +98 -0
  4. typed_nado-0.1.0/pyproject.toml +32 -0
  5. typed_nado-0.1.0/setup.cfg +4 -0
  6. typed_nado-0.1.0/src/typed_nado/__init__.py +14 -0
  7. typed_nado-0.1.0/src/typed_nado/__init__.pyi +33 -0
  8. typed_nado-0.1.0/src/typed_nado/archive/__init__.py +90 -0
  9. typed_nado-0.1.0/src/typed_nado/archive/account_snapshots.py +63 -0
  10. typed_nado-0.1.0/src/typed_nado/archive/backlog.py +44 -0
  11. typed_nado-0.1.0/src/typed_nado/archive/candlesticks.py +137 -0
  12. typed_nado-0.1.0/src/typed_nado/archive/direct_deposit_address.py +54 -0
  13. typed_nado-0.1.0/src/typed_nado/archive/edge_candlesticks.py +137 -0
  14. typed_nado-0.1.0/src/typed_nado/archive/edge_market_snapshots.py +45 -0
  15. typed_nado-0.1.0/src/typed_nado/archive/events.py +144 -0
  16. typed_nado-0.1.0/src/typed_nado/archive/fast_withdrawal_signature.py +81 -0
  17. typed_nado-0.1.0/src/typed_nado/archive/funding_rate.py +38 -0
  18. typed_nado-0.1.0/src/typed_nado/archive/funding_rate_history.py +178 -0
  19. typed_nado-0.1.0/src/typed_nado/archive/funding_rates.py +41 -0
  20. typed_nado-0.1.0/src/typed_nado/archive/interest_and_funding.py +67 -0
  21. typed_nado-0.1.0/src/typed_nado/archive/isolated_subaccounts.py +145 -0
  22. typed_nado-0.1.0/src/typed_nado/archive/linked_signer_rate_limit.py +54 -0
  23. typed_nado-0.1.0/src/typed_nado/archive/linked_signers.py +142 -0
  24. typed_nado-0.1.0/src/typed_nado/archive/liquidation_feed.py +42 -0
  25. typed_nado-0.1.0/src/typed_nado/archive/maker_statistics.py +83 -0
  26. typed_nado-0.1.0/src/typed_nado/archive/market_net_fees.py +63 -0
  27. typed_nado-0.1.0/src/typed_nado/archive/market_snapshots.py +52 -0
  28. typed_nado-0.1.0/src/typed_nado/archive/matches.py +166 -0
  29. typed_nado-0.1.0/src/typed_nado/archive/matches_and_liquidations.py +166 -0
  30. typed_nado-0.1.0/src/typed_nado/archive/nlp_funding_payments.py +61 -0
  31. typed_nado-0.1.0/src/typed_nado/archive/nlp_interest_payments.py +61 -0
  32. typed_nado-0.1.0/src/typed_nado/archive/nlp_snapshots.py +160 -0
  33. typed_nado-0.1.0/src/typed_nado/archive/oracle_price.py +56 -0
  34. typed_nado-0.1.0/src/typed_nado/archive/oracle_snapshots.py +62 -0
  35. typed_nado-0.1.0/src/typed_nado/archive/orders.py +235 -0
  36. typed_nado-0.1.0/src/typed_nado/archive/perp_prices.py +41 -0
  37. typed_nado-0.1.0/src/typed_nado/archive/portfolio.py +58 -0
  38. typed_nado-0.1.0/src/typed_nado/archive/portfolio_calendar.py +59 -0
  39. typed_nado-0.1.0/src/typed_nado/archive/portfolio_history.py +59 -0
  40. typed_nado-0.1.0/src/typed_nado/archive/positions.py +261 -0
  41. typed_nado-0.1.0/src/typed_nado/archive/price.py +33 -0
  42. typed_nado-0.1.0/src/typed_nado/archive/product_snapshots.py +51 -0
  43. typed_nado-0.1.0/src/typed_nado/archive/products.py +142 -0
  44. typed_nado-0.1.0/src/typed_nado/archive/quote_price.py +33 -0
  45. typed_nado-0.1.0/src/typed_nado/archive/referral_code.py +47 -0
  46. typed_nado-0.1.0/src/typed_nado/archive/signatures.py +57 -0
  47. typed_nado-0.1.0/src/typed_nado/archive/subaccounts.py +149 -0
  48. typed_nado-0.1.0/src/typed_nado/archive/tx_hashes.py +56 -0
  49. typed_nado-0.1.0/src/typed_nado/archive_v2/__init__.py +13 -0
  50. typed_nado-0.1.0/src/typed_nado/archive_v2/contracts.py +94 -0
  51. typed_nado-0.1.0/src/typed_nado/archive_v2/symbols.py +134 -0
  52. typed_nado-0.1.0/src/typed_nado/archive_v2/tickers.py +71 -0
  53. typed_nado-0.1.0/src/typed_nado/archive_v2/trades.py +148 -0
  54. typed_nado-0.1.0/src/typed_nado/core/__init__.py +5 -0
  55. typed_nado-0.1.0/src/typed_nado/core/__init__.pyi +72 -0
  56. typed_nado-0.1.0/src/typed_nado/core/appendix.py +173 -0
  57. typed_nado-0.1.0/src/typed_nado/core/auth.py +120 -0
  58. typed_nado-0.1.0/src/typed_nado/core/base.py +183 -0
  59. typed_nado-0.1.0/src/typed_nado/core/endpoint/__init__.py +1 -0
  60. typed_nado-0.1.0/src/typed_nado/core/endpoint/engine.py +134 -0
  61. typed_nado-0.1.0/src/typed_nado/core/endpoint/indexer.py +105 -0
  62. typed_nado-0.1.0/src/typed_nado/core/endpoint/rest.py +75 -0
  63. typed_nado-0.1.0/src/typed_nado/core/endpoint/stream.py +104 -0
  64. typed_nado-0.1.0/src/typed_nado/core/endpoint/wire.py +49 -0
  65. typed_nado-0.1.0/src/typed_nado/core/envelope.py +179 -0
  66. typed_nado-0.1.0/src/typed_nado/core/exc.py +23 -0
  67. typed_nado-0.1.0/src/typed_nado/core/networks.py +91 -0
  68. typed_nado-0.1.0/src/typed_nado/core/signing.py +542 -0
  69. typed_nado-0.1.0/src/typed_nado/core/transport/__init__.py +1 -0
  70. typed_nado-0.1.0/src/typed_nado/core/transport/engine.py +153 -0
  71. typed_nado-0.1.0/src/typed_nado/core/transport/http.py +69 -0
  72. typed_nado-0.1.0/src/typed_nado/core/transport/indexer.py +80 -0
  73. typed_nado-0.1.0/src/typed_nado/core/transport/rest.py +48 -0
  74. typed_nado-0.1.0/src/typed_nado/core/transport/subscriptions.py +241 -0
  75. typed_nado-0.1.0/src/typed_nado/core/transport/ws.py +66 -0
  76. typed_nado-0.1.0/src/typed_nado/core/types.py +97 -0
  77. typed_nado-0.1.0/src/typed_nado/gateway/__init__.py +110 -0
  78. typed_nado-0.1.0/src/typed_nado/gateway/all_products.py +33 -0
  79. typed_nado-0.1.0/src/typed_nado/gateway/burn_nlp.py +51 -0
  80. typed_nado-0.1.0/src/typed_nado/gateway/cached_all_products.py +33 -0
  81. typed_nado-0.1.0/src/typed_nado/gateway/cached_bbo_history.py +88 -0
  82. typed_nado-0.1.0/src/typed_nado/gateway/cached_contracts.py +33 -0
  83. typed_nado-0.1.0/src/typed_nado/gateway/cached_edge_all_products.py +33 -0
  84. typed_nado-0.1.0/src/typed_nado/gateway/cached_health_groups.py +33 -0
  85. typed_nado-0.1.0/src/typed_nado/gateway/cached_nlp_pool_info.py +33 -0
  86. typed_nado-0.1.0/src/typed_nado/gateway/cached_prices.py +46 -0
  87. typed_nado-0.1.0/src/typed_nado/gateway/cached_status.py +37 -0
  88. typed_nado-0.1.0/src/typed_nado/gateway/cached_symbols.py +52 -0
  89. typed_nado-0.1.0/src/typed_nado/gateway/cancel_and_place.py +59 -0
  90. typed_nado-0.1.0/src/typed_nado/gateway/cancel_orders.py +55 -0
  91. typed_nado-0.1.0/src/typed_nado/gateway/cancel_product_orders.py +54 -0
  92. typed_nado-0.1.0/src/typed_nado/gateway/contracts.py +33 -0
  93. typed_nado-0.1.0/src/typed_nado/gateway/dynamic_fee_quote.py +68 -0
  94. typed_nado-0.1.0/src/typed_nado/gateway/edge_all_products.py +33 -0
  95. typed_nado-0.1.0/src/typed_nado/gateway/fee_rates.py +63 -0
  96. typed_nado-0.1.0/src/typed_nado/gateway/health_groups.py +33 -0
  97. typed_nado-0.1.0/src/typed_nado/gateway/insurance.py +40 -0
  98. typed_nado-0.1.0/src/typed_nado/gateway/isolated_positions.py +79 -0
  99. typed_nado-0.1.0/src/typed_nado/gateway/link_signer.py +51 -0
  100. typed_nado-0.1.0/src/typed_nado/gateway/linked_signer.py +50 -0
  101. typed_nado-0.1.0/src/typed_nado/gateway/liquidate_subaccount.py +57 -0
  102. typed_nado-0.1.0/src/typed_nado/gateway/market_liquidity.py +58 -0
  103. typed_nado-0.1.0/src/typed_nado/gateway/market_price.py +41 -0
  104. typed_nado-0.1.0/src/typed_nado/gateway/market_prices.py +41 -0
  105. typed_nado-0.1.0/src/typed_nado/gateway/max_nlp_burnable.py +51 -0
  106. typed_nado-0.1.0/src/typed_nado/gateway/max_nlp_mintable.py +57 -0
  107. typed_nado-0.1.0/src/typed_nado/gateway/max_order_size.py +95 -0
  108. typed_nado-0.1.0/src/typed_nado/gateway/max_withdrawable.py +75 -0
  109. typed_nado-0.1.0/src/typed_nado/gateway/mint_nlp.py +58 -0
  110. typed_nado-0.1.0/src/typed_nado/gateway/nlp_locked_balances.py +65 -0
  111. typed_nado-0.1.0/src/typed_nado/gateway/nlp_pool_info.py +33 -0
  112. typed_nado-0.1.0/src/typed_nado/gateway/nonces.py +50 -0
  113. typed_nado-0.1.0/src/typed_nado/gateway/order.py +45 -0
  114. typed_nado-0.1.0/src/typed_nado/gateway/orders.py +66 -0
  115. typed_nado-0.1.0/src/typed_nado/gateway/ping.py +67 -0
  116. typed_nado-0.1.0/src/typed_nado/gateway/place_order.py +72 -0
  117. typed_nado-0.1.0/src/typed_nado/gateway/place_orders.py +51 -0
  118. typed_nado-0.1.0/src/typed_nado/gateway/status.py +35 -0
  119. typed_nado-0.1.0/src/typed_nado/gateway/subaccount_info.py +57 -0
  120. typed_nado-0.1.0/src/typed_nado/gateway/subaccount_orders.py +59 -0
  121. typed_nado-0.1.0/src/typed_nado/gateway/symbols.py +50 -0
  122. typed_nado-0.1.0/src/typed_nado/gateway/time.py +59 -0
  123. typed_nado-0.1.0/src/typed_nado/gateway/transfer_quote.py +41 -0
  124. typed_nado-0.1.0/src/typed_nado/gateway/transfer_quote_v2.py +46 -0
  125. typed_nado-0.1.0/src/typed_nado/gateway/validate_order.py +55 -0
  126. typed_nado-0.1.0/src/typed_nado/gateway/withdraw_collateral.py +60 -0
  127. typed_nado-0.1.0/src/typed_nado/gateway/withdraw_collateral_v2.py +70 -0
  128. typed_nado-0.1.0/src/typed_nado/gateway_v2/__init__.py +13 -0
  129. typed_nado-0.1.0/src/typed_nado/gateway_v2/apr.py +44 -0
  130. typed_nado-0.1.0/src/typed_nado/gateway_v2/assets.py +50 -0
  131. typed_nado-0.1.0/src/typed_nado/gateway_v2/orderbook.py +58 -0
  132. typed_nado-0.1.0/src/typed_nado/gateway_v2/pairs.py +57 -0
  133. typed_nado-0.1.0/src/typed_nado/main.py +81 -0
  134. typed_nado-0.1.0/src/typed_nado/py.typed +0 -0
  135. typed_nado-0.1.0/src/typed_nado/rewards/__init__.py +22 -0
  136. typed_nado-0.1.0/src/typed_nado/rewards/ink_airdrop.py +42 -0
  137. typed_nado-0.1.0/src/typed_nado/rewards/leaderboard.py +70 -0
  138. typed_nado-0.1.0/src/typed_nado/rewards/leaderboard_contests.py +95 -0
  139. typed_nado-0.1.0/src/typed_nado/rewards/leaderboard_rank.py +49 -0
  140. typed_nado-0.1.0/src/typed_nado/rewards/leaderboard_register.py +55 -0
  141. typed_nado-0.1.0/src/typed_nado/rewards/leaderboard_registrations.py +51 -0
  142. typed_nado-0.1.0/src/typed_nado/schemas.py +997 -0
  143. typed_nado-0.1.0/src/typed_nado/streams/__init__.py +32 -0
  144. typed_nado-0.1.0/src/typed_nado/streams/all_bbo.py +49 -0
  145. typed_nado-0.1.0/src/typed_nado/streams/best_bid_offer.py +57 -0
  146. typed_nado-0.1.0/src/typed_nado/streams/book_depth.py +57 -0
  147. typed_nado-0.1.0/src/typed_nado/streams/fill.py +82 -0
  148. typed_nado-0.1.0/src/typed_nado/streams/funding_payment.py +59 -0
  149. typed_nado-0.1.0/src/typed_nado/streams/funding_rate.py +56 -0
  150. typed_nado-0.1.0/src/typed_nado/streams/latest_candlestick.py +65 -0
  151. typed_nado-0.1.0/src/typed_nado/streams/liquidation.py +60 -0
  152. typed_nado-0.1.0/src/typed_nado/streams/order_update.py +70 -0
  153. typed_nado-0.1.0/src/typed_nado/streams/position_change.py +79 -0
  154. typed_nado-0.1.0/src/typed_nado/streams/trade.py +57 -0
  155. typed_nado-0.1.0/src/typed_nado/trigger/__init__.py +24 -0
  156. typed_nado-0.1.0/src/typed_nado/trigger/cancel_orders.py +35 -0
  157. typed_nado-0.1.0/src/typed_nado/trigger/cancel_product_orders.py +45 -0
  158. typed_nado-0.1.0/src/typed_nado/trigger/list_trigger_orders.py +367 -0
  159. typed_nado-0.1.0/src/typed_nado/trigger/list_twap_executions.py +100 -0
  160. typed_nado-0.1.0/src/typed_nado/trigger/place_order.py +79 -0
  161. typed_nado-0.1.0/src/typed_nado/trigger/place_orders.py +69 -0
  162. typed_nado-0.1.0/src/typed_nado/trigger/update_dependency.py +57 -0
  163. typed_nado-0.1.0/src/typed_nado.egg-info/PKG-INFO +121 -0
  164. typed_nado-0.1.0/src/typed_nado.egg-info/SOURCES.txt +165 -0
  165. typed_nado-0.1.0/src/typed_nado.egg-info/dependency_links.txt +1 -0
  166. typed_nado-0.1.0/src/typed_nado.egg-info/requires.txt +5 -0
  167. typed_nado-0.1.0/src/typed_nado.egg-info/top_level.txt +1 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Tribulnation Labs
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,121 @@
1
+ Metadata-Version: 2.4
2
+ Name: typed-nado
3
+ Version: 0.1.0
4
+ Summary: A fully typed, validated async client for the Nado API.
5
+ Author-email: Marcel Claramunt <marcel@tribulnation.com>
6
+ License-Expression: MIT
7
+ Project-URL: Repository, https://github.com/tribulnation/typed
8
+ Project-URL: Documentation, https://tribulnation.com/typed/nado
9
+ Project-URL: Website, https://tribulnation.com/typed
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.10
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Typing :: Typed
14
+ Requires-Python: >=3.10
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE
17
+ Requires-Dist: typed-core>=0.14
18
+ Requires-Dist: lazy-loader
19
+ Requires-Dist: eth-account>=0.13
20
+ Requires-Dist: httpx>=0.26
21
+ Requires-Dist: pydantic>=2.7
22
+ Dynamic: license-file
23
+
24
+ # Typed Nado
25
+
26
+ <p align="center">
27
+ <em>A fully typed, validated async client for the Nado API.</em>
28
+ </p>
29
+
30
+ <p align="center">
31
+ <a href="https://pypi.org/project/typed-nado/">
32
+ <img src="https://img.shields.io/pypi/v/typed-nado.svg" alt="PyPI version">
33
+ </a>
34
+ <a href="https://pypi.org/project/typed-nado/">
35
+ <img src="https://img.shields.io/pypi/pyversions/typed-nado.svg" alt="Python versions">
36
+ </a>
37
+ <a href="https://tribulnation.com/typed/nado">
38
+ <img src="https://img.shields.io/badge/docs-live-black" alt="Docs">
39
+ </a>
40
+ <a href="LICENSE">
41
+ <img src="https://img.shields.io/pypi/l/typed-nado.svg" alt="License">
42
+ </a>
43
+ </p>
44
+
45
+ ---
46
+
47
+ - **Documentation**: [https://tribulnation.com/typed/nado](https://tribulnation.com/typed/nado)
48
+ - **Source Code**: [https://github.com/tribulnation/typed/tree/main/packages/nado](https://github.com/tribulnation/typed/tree/main/packages/nado)
49
+
50
+ ---
51
+
52
+ ```python
53
+ from typed_nado import Nado
54
+
55
+ async with Nado.new(public=True) as client:
56
+ price = await client.gateway.market_price(2) # BTC-PERP
57
+ print(price['bid_x18'] / 10**18, price['ask_x18'] / 10**18)
58
+ ```
59
+
60
+
61
+ Almost every read is public, including any subaccount's balances, orders and history. A
62
+ wallet key is needed for every signed call: placing, cancelling and replacing orders
63
+ (`gateway` and `trigger`), listing your trigger orders (`trigger.list_trigger_orders`, a
64
+ signed read), withdrawing and transferring collateral, minting and burning NLP, linking a
65
+ signer, liquidating a subaccount, registering for a trading competition, and the private
66
+ order-update stream — see [Authenticated Setup](https://tribulnation.com/typed/nado/authenticated-setup).
67
+
68
+ ## Why Typed Nado?
69
+
70
+ - **🎯 Precise Types**: Typed inputs and responses across the gateway, trigger, archive, rewards and v2 market-data APIs, with x18 prices and amounts as real `int`s and timestamps as `datetime`s, not `dict`/`Any`.
71
+ - **✅ Runtime Validation**: Every REST response, WebSocket reply and stream event is validated by default, not just typed on paper.
72
+ - **⚡ Async First**: Async HTTP plus two WebSockets (gateway RPC and subscriptions), with a per-call `transport='http' | 'ws'` switch on every gateway method.
73
+ - **📚 Full Surface**: Every documented Nado endpoint — spot, perpetuals, trigger and TWAP orders, NLP vault, indexer history, rewards and streams — with EIP-712 signing built in.
74
+
75
+ ## Installation
76
+
77
+ ```bash
78
+ pip install typed-nado
79
+ ```
80
+
81
+ ## Services
82
+
83
+ | Attribute | What it covers |
84
+ | --- | --- |
85
+ | `client.gateway` | Live queries (products, prices, books, subaccounts, open orders) and signed executes (orders, cancels, withdrawals, transfers, NLP, linked signers) |
86
+ | `client.trigger` | Price-triggered and TWAP orders |
87
+ | `client.archive` | Indexed history: candles, matches, orders, events, funding, positions, snapshots |
88
+ | `client.rewards` | Airdrop and trading-competition leaderboards |
89
+ | `client.gateway_v2` | Aggregator-style assets, pairs, order book and APRs |
90
+ | `client.archive_v2` | Aggregator-style symbols, tickers, contracts and trades |
91
+ | `client.streams` | Live trades, book, candles, funding, liquidations, fills, positions and order updates |
92
+
93
+ `Nado.new()` targets mainnet (Ink); pass `network='testnet'` for Ink Sepolia.
94
+
95
+ ## How To
96
+
97
+ - [Fetch Market Data](https://tribulnation.com/typed/nado/how-to/fetch-market-data)
98
+ - [Fetch Account Data](https://tribulnation.com/typed/nado/how-to/fetch-account-data)
99
+ - [Place & Manage Orders](https://tribulnation.com/typed/nado/how-to/place-and-manage-orders)
100
+ - [Paginate Through Results](https://tribulnation.com/typed/nado/how-to/paginate-through-results)
101
+ - [Listen To Live Streams](https://tribulnation.com/typed/nado/how-to/listen-to-live-streams)
102
+ - [Withdraw & Transfer Collateral](https://tribulnation.com/typed/nado/how-to/withdraw-and-transfer-collateral)
103
+ - [Use The NLP Vault](https://tribulnation.com/typed/nado/how-to/use-the-nlp-vault)
104
+
105
+ ## Reference
106
+
107
+ - [Authenticated Setup](https://tribulnation.com/typed/nado/authenticated-setup)
108
+ - [Async Usage](https://tribulnation.com/typed/nado/reference/async-usage)
109
+ - [Error Handling](https://tribulnation.com/typed/nado/reference/error-handling)
110
+ - [Environment Variables](https://tribulnation.com/typed/nado/reference/env-vars)
111
+ - [Timestamps](https://tribulnation.com/typed/nado/reference/timestamps)
112
+
113
+ ## Design Philosophy
114
+
115
+ Typed Nado follows the principles outlined in [this blog post](https://tribulnation.com/blog/clients).
116
+
117
+ *Details matter. Developer experience matters.*
118
+
119
+ ## License
120
+
121
+ MIT — see [LICENSE](LICENSE).
@@ -0,0 +1,98 @@
1
+ # Typed Nado
2
+
3
+ <p align="center">
4
+ <em>A fully typed, validated async client for the Nado API.</em>
5
+ </p>
6
+
7
+ <p align="center">
8
+ <a href="https://pypi.org/project/typed-nado/">
9
+ <img src="https://img.shields.io/pypi/v/typed-nado.svg" alt="PyPI version">
10
+ </a>
11
+ <a href="https://pypi.org/project/typed-nado/">
12
+ <img src="https://img.shields.io/pypi/pyversions/typed-nado.svg" alt="Python versions">
13
+ </a>
14
+ <a href="https://tribulnation.com/typed/nado">
15
+ <img src="https://img.shields.io/badge/docs-live-black" alt="Docs">
16
+ </a>
17
+ <a href="LICENSE">
18
+ <img src="https://img.shields.io/pypi/l/typed-nado.svg" alt="License">
19
+ </a>
20
+ </p>
21
+
22
+ ---
23
+
24
+ - **Documentation**: [https://tribulnation.com/typed/nado](https://tribulnation.com/typed/nado)
25
+ - **Source Code**: [https://github.com/tribulnation/typed/tree/main/packages/nado](https://github.com/tribulnation/typed/tree/main/packages/nado)
26
+
27
+ ---
28
+
29
+ ```python
30
+ from typed_nado import Nado
31
+
32
+ async with Nado.new(public=True) as client:
33
+ price = await client.gateway.market_price(2) # BTC-PERP
34
+ print(price['bid_x18'] / 10**18, price['ask_x18'] / 10**18)
35
+ ```
36
+
37
+
38
+ Almost every read is public, including any subaccount's balances, orders and history. A
39
+ wallet key is needed for every signed call: placing, cancelling and replacing orders
40
+ (`gateway` and `trigger`), listing your trigger orders (`trigger.list_trigger_orders`, a
41
+ signed read), withdrawing and transferring collateral, minting and burning NLP, linking a
42
+ signer, liquidating a subaccount, registering for a trading competition, and the private
43
+ order-update stream — see [Authenticated Setup](https://tribulnation.com/typed/nado/authenticated-setup).
44
+
45
+ ## Why Typed Nado?
46
+
47
+ - **🎯 Precise Types**: Typed inputs and responses across the gateway, trigger, archive, rewards and v2 market-data APIs, with x18 prices and amounts as real `int`s and timestamps as `datetime`s, not `dict`/`Any`.
48
+ - **✅ Runtime Validation**: Every REST response, WebSocket reply and stream event is validated by default, not just typed on paper.
49
+ - **⚡ Async First**: Async HTTP plus two WebSockets (gateway RPC and subscriptions), with a per-call `transport='http' | 'ws'` switch on every gateway method.
50
+ - **📚 Full Surface**: Every documented Nado endpoint — spot, perpetuals, trigger and TWAP orders, NLP vault, indexer history, rewards and streams — with EIP-712 signing built in.
51
+
52
+ ## Installation
53
+
54
+ ```bash
55
+ pip install typed-nado
56
+ ```
57
+
58
+ ## Services
59
+
60
+ | Attribute | What it covers |
61
+ | --- | --- |
62
+ | `client.gateway` | Live queries (products, prices, books, subaccounts, open orders) and signed executes (orders, cancels, withdrawals, transfers, NLP, linked signers) |
63
+ | `client.trigger` | Price-triggered and TWAP orders |
64
+ | `client.archive` | Indexed history: candles, matches, orders, events, funding, positions, snapshots |
65
+ | `client.rewards` | Airdrop and trading-competition leaderboards |
66
+ | `client.gateway_v2` | Aggregator-style assets, pairs, order book and APRs |
67
+ | `client.archive_v2` | Aggregator-style symbols, tickers, contracts and trades |
68
+ | `client.streams` | Live trades, book, candles, funding, liquidations, fills, positions and order updates |
69
+
70
+ `Nado.new()` targets mainnet (Ink); pass `network='testnet'` for Ink Sepolia.
71
+
72
+ ## How To
73
+
74
+ - [Fetch Market Data](https://tribulnation.com/typed/nado/how-to/fetch-market-data)
75
+ - [Fetch Account Data](https://tribulnation.com/typed/nado/how-to/fetch-account-data)
76
+ - [Place & Manage Orders](https://tribulnation.com/typed/nado/how-to/place-and-manage-orders)
77
+ - [Paginate Through Results](https://tribulnation.com/typed/nado/how-to/paginate-through-results)
78
+ - [Listen To Live Streams](https://tribulnation.com/typed/nado/how-to/listen-to-live-streams)
79
+ - [Withdraw & Transfer Collateral](https://tribulnation.com/typed/nado/how-to/withdraw-and-transfer-collateral)
80
+ - [Use The NLP Vault](https://tribulnation.com/typed/nado/how-to/use-the-nlp-vault)
81
+
82
+ ## Reference
83
+
84
+ - [Authenticated Setup](https://tribulnation.com/typed/nado/authenticated-setup)
85
+ - [Async Usage](https://tribulnation.com/typed/nado/reference/async-usage)
86
+ - [Error Handling](https://tribulnation.com/typed/nado/reference/error-handling)
87
+ - [Environment Variables](https://tribulnation.com/typed/nado/reference/env-vars)
88
+ - [Timestamps](https://tribulnation.com/typed/nado/reference/timestamps)
89
+
90
+ ## Design Philosophy
91
+
92
+ Typed Nado follows the principles outlined in [this blog post](https://tribulnation.com/blog/clients).
93
+
94
+ *Details matter. Developer experience matters.*
95
+
96
+ ## License
97
+
98
+ MIT — see [LICENSE](LICENSE).
@@ -0,0 +1,32 @@
1
+ [build-system]
2
+ requires = ["setuptools", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "typed-nado"
7
+ version = "0.1.0"
8
+ authors = [
9
+ {name="Marcel Claramunt", email="marcel@tribulnation.com"}
10
+ ]
11
+ description = "A fully typed, validated async client for the Nado API."
12
+ license = "MIT"
13
+ license-files = ["LICENSE"]
14
+ classifiers = [
15
+ "Programming Language :: Python :: 3",
16
+ "Programming Language :: Python :: 3.10",
17
+ "Programming Language :: Python :: 3.11",
18
+ "Typing :: Typed",
19
+ ]
20
+ dependencies = [
21
+ "typed-core>=0.14", "lazy-loader", "eth-account>=0.13", "httpx>=0.26", "pydantic>=2.7",
22
+ ]
23
+ requires-python = ">=3.10"
24
+ readme = {file="README.md", content-type="text/markdown"}
25
+
26
+ [tool.setuptools.package-data]
27
+ "typed_nado" = ["py.typed", "*.pyi", "**/*.pyi"]
28
+
29
+ [project.urls]
30
+ Repository = "https://github.com/tribulnation/typed"
31
+ Documentation = "https://tribulnation.com/typed/nado"
32
+ Website = "https://tribulnation.com/typed"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,14 @@
1
+ """A fully typed, validated async client for the Nado API.
2
+
3
+ Examples:
4
+ ```python
5
+ from typed_nado import Nado
6
+
7
+ async with Nado.new(public=True) as client:
8
+ print(await client.gateway.status())
9
+ ```
10
+ """
11
+
12
+ import lazy_loader as lazy
13
+
14
+ __getattr__, __dir__, __all__ = lazy.attach_stub(__name__, __file__)
@@ -0,0 +1,33 @@
1
+ from .main import Nado
2
+ from .core import (
3
+ Error,
4
+ NetworkError,
5
+ ValidationError,
6
+ ApiError,
7
+ BadRequest,
8
+ AuthError,
9
+ RateLimited,
10
+ LogicError,
11
+ Network,
12
+ NetworkProfile,
13
+ order_appendix,
14
+ OrderType,
15
+ AppendixTrigger,
16
+ )
17
+
18
+ __all__ = [
19
+ 'Nado',
20
+ 'Error',
21
+ 'NetworkError',
22
+ 'ValidationError',
23
+ 'ApiError',
24
+ 'BadRequest',
25
+ 'AuthError',
26
+ 'RateLimited',
27
+ 'LogicError',
28
+ 'Network',
29
+ 'NetworkProfile',
30
+ 'order_appendix',
31
+ 'OrderType',
32
+ 'AppendixTrigger',
33
+ ]
@@ -0,0 +1,90 @@
1
+ # Generated by typed-dev — see CONTRIBUTING.md.
2
+ from .account_snapshots import AccountSnapshotsEndpoint
3
+ from .backlog import BacklogEndpoint
4
+ from .candlesticks import CandlesticksEndpoint
5
+ from .direct_deposit_address import DirectDepositAddressEndpoint
6
+ from .edge_candlesticks import EdgeCandlesticks
7
+ from .edge_market_snapshots import EdgeMarketSnapshotsEndpoint
8
+ from .events import EventsEndpoint
9
+ from .fast_withdrawal_signature import FastWithdrawalSignatureEndpoint
10
+ from .funding_rate import FundingRateEndpoint
11
+ from .funding_rate_history import FundingRateHistoryEndpoint
12
+ from .funding_rates import FundingRates
13
+ from .interest_and_funding import InterestAndFundingEndpoint
14
+ from .isolated_subaccounts import IsolatedSubaccountsEndpoint
15
+ from .linked_signer_rate_limit import LinkedSignerRateLimitEndpoint
16
+ from .linked_signers import LinkedSignersEndpoint
17
+ from .liquidation_feed import LiquidationFeed
18
+ from .maker_statistics import MakerStatisticsEndpoint
19
+ from .market_net_fees import MarketNetFeesEndpoint
20
+ from .market_snapshots import MarketSnapshotsEndpoint
21
+ from .matches import MatchesEndpoint
22
+ from .matches_and_liquidations import MatchesAndLiquidationsEndpoint
23
+ from .nlp_funding_payments import NlpFundingPaymentsEndpoint
24
+ from .nlp_interest_payments import NlpInterestPaymentsEndpoint
25
+ from .nlp_snapshots import NlpSnapshotsEndpoint
26
+ from .oracle_price import OraclePriceEndpoint
27
+ from .oracle_snapshots import OracleSnapshotsEndpoint
28
+ from .orders import OrdersEndpoint
29
+ from .perp_prices import PerpPricesEndpoint
30
+ from .portfolio import Portfolio
31
+ from .portfolio_calendar import PortfolioCalendarEndpoint
32
+ from .portfolio_history import PortfolioHistoryEndpoint
33
+ from .positions import PositionsEndpoint
34
+ from .price import Price
35
+ from .product_snapshots import ProductSnapshots
36
+ from .products import ProductsEndpoint
37
+ from .quote_price import QuotePriceEndpoint
38
+ from .referral_code import ReferralCodeEndpoint
39
+ from .signatures import SignaturesEndpoint
40
+ from .subaccounts import SubaccountsEndpoint
41
+ from .tx_hashes import TxHashesEndpoint
42
+
43
+
44
+ class Archive(
45
+ AccountSnapshotsEndpoint,
46
+ BacklogEndpoint,
47
+ CandlesticksEndpoint,
48
+ DirectDepositAddressEndpoint,
49
+ EdgeCandlesticks,
50
+ EdgeMarketSnapshotsEndpoint,
51
+ EventsEndpoint,
52
+ FastWithdrawalSignatureEndpoint,
53
+ FundingRateEndpoint,
54
+ FundingRateHistoryEndpoint,
55
+ FundingRates,
56
+ InterestAndFundingEndpoint,
57
+ IsolatedSubaccountsEndpoint,
58
+ LinkedSignerRateLimitEndpoint,
59
+ LinkedSignersEndpoint,
60
+ LiquidationFeed,
61
+ MakerStatisticsEndpoint,
62
+ MarketNetFeesEndpoint,
63
+ MarketSnapshotsEndpoint,
64
+ MatchesEndpoint,
65
+ MatchesAndLiquidationsEndpoint,
66
+ NlpFundingPaymentsEndpoint,
67
+ NlpInterestPaymentsEndpoint,
68
+ NlpSnapshotsEndpoint,
69
+ OraclePriceEndpoint,
70
+ OracleSnapshotsEndpoint,
71
+ OrdersEndpoint,
72
+ PerpPricesEndpoint,
73
+ Portfolio,
74
+ PortfolioCalendarEndpoint,
75
+ PortfolioHistoryEndpoint,
76
+ PositionsEndpoint,
77
+ Price,
78
+ ProductSnapshots,
79
+ ProductsEndpoint,
80
+ QuotePriceEndpoint,
81
+ ReferralCodeEndpoint,
82
+ SignaturesEndpoint,
83
+ SubaccountsEndpoint,
84
+ TxHashesEndpoint,
85
+ ):
86
+ """Archive (indexer): Nado's indexed historical data -- orders, matches, events, candlesticks, snapshots, funding, portfolio and subaccount history.
87
+
88
+ References:
89
+ - [Upstream docs](https://docs.nado.xyz/developer-resources/api/archive-indexer)
90
+ """
@@ -0,0 +1,63 @@
1
+ # Generated by typed-dev — see CONTRIBUTING.md.
2
+ from typing_extensions import NotRequired, TypedDict
3
+ from typed_nado.core import TimestampSeconds
4
+ from typed_nado.core.endpoint.indexer import IndexerEndpoint
5
+ from typed_nado.schemas import Event
6
+
7
+
8
+ class Request(TypedDict):
9
+ subaccounts: list[str]
10
+ """Subaccounts to snapshot."""
11
+ timestamps: list[TimestampSeconds]
12
+ """Times to snapshot at, one snapshot per timestamp."""
13
+ isolated: NotRequired[bool]
14
+ """`true` for only events of isolated positions, `false` for only cross-margin ones; omit for both."""
15
+ active: NotRequired[bool]
16
+ """`true` for only products with a non-zero balance at the timestamp, `false` for every product with event history before it."""
17
+
18
+
19
+ class AccountSnapshots(TypedDict):
20
+ """Point-in-time balance snapshots of the requested subaccounts."""
21
+
22
+ snapshots: dict[str, dict[str, list[Event]]]
23
+ """Map of subaccount to a map of requested timestamp (decimal string) to the latest event of each product at that time."""
24
+
25
+
26
+ class AccountSnapshotsEndpoint(IndexerEndpoint):
27
+ """Get the latest event per product of some subaccounts as of each of some timestamps (a point-in-time balance snapshot)."""
28
+
29
+ async def account_snapshots(
30
+ self,
31
+ subaccounts: list[str],
32
+ *,
33
+ timestamps: list[TimestampSeconds],
34
+ isolated: bool | None = None,
35
+ active: bool | None = None,
36
+ validate: bool | None = None,
37
+ ) -> AccountSnapshots:
38
+ """Get the latest event per product of some subaccounts as of each of some timestamps (a point-in-time balance snapshot).
39
+
40
+ Args:
41
+ subaccounts: Subaccounts to snapshot.
42
+ timestamps: Times to snapshot at, one snapshot per timestamp.
43
+ isolated: `true` for only events of isolated positions, `false` for only cross-margin ones; omit for both.
44
+ active: `true` for only products with a non-zero balance at the timestamp, `false` for every product with event history before it.
45
+ validate: Override this call's response validation; falls back to the client-level default when omitted.
46
+
47
+ References:
48
+ - [Official docs](https://docs.nado.xyz/developer-resources/api/archive-indexer/subaccount-snapshots)
49
+ """
50
+ request: Request = Request(subaccounts=subaccounts, timestamps=timestamps)
51
+ if isolated is not None:
52
+ request['isolated'] = isolated
53
+ if active is not None:
54
+ request['active'] = active
55
+ return await self.request(
56
+ request,
57
+ method='POST',
58
+ path='account_snapshots',
59
+ meta={},
60
+ validate=validate,
61
+ request_type=Request,
62
+ response_type=AccountSnapshots,
63
+ )
@@ -0,0 +1,44 @@
1
+ # Generated by typed-dev — see CONTRIBUTING.md.
2
+ from decimal import Decimal
3
+ from typing_extensions import TypedDict
4
+ from typed_nado.core import IntegerString, TimestampSecondsString
5
+ from typed_nado.core.endpoint.indexer import IndexerEndpoint
6
+
7
+
8
+ class Backlog(TypedDict):
9
+ """The off-chain sequencer's submission backlog."""
10
+
11
+ total_txs: IntegerString
12
+ """Transactions stored in the indexer."""
13
+ total_submissions: IntegerString
14
+ """Transactions submitted on-chain."""
15
+ backlog_size: IntegerString
16
+ """Unsubmitted transactions (`total_txs - total_submissions`)."""
17
+ updated_at: TimestampSecondsString
18
+ """Time the metrics were last updated."""
19
+ backlog_eta_in_seconds: Decimal | None
20
+ """Estimated seconds to clear the backlog, or null when unavailable."""
21
+ txs_per_second: Decimal | None
22
+ """Current submission rate in transactions per second, or null when unavailable."""
23
+
24
+
25
+ class BacklogEndpoint(IndexerEndpoint):
26
+ """Get the off-chain sequencer's submission backlog."""
27
+
28
+ async def backlog(self, *, validate: bool | None = None) -> Backlog:
29
+ """Get the off-chain sequencer's submission backlog.
30
+
31
+ Args:
32
+ validate: Override this call's response validation; falls back to the client-level default when omitted.
33
+
34
+ References:
35
+ - [Official docs](https://docs.nado.xyz/developer-resources/api/archive-indexer/sequencer-backlog)
36
+ """
37
+ return await self.request(
38
+ None,
39
+ method='POST',
40
+ path='backlog',
41
+ meta={},
42
+ validate=validate,
43
+ response_type=Backlog,
44
+ )
@@ -0,0 +1,137 @@
1
+ # Generated by typed-dev — see CONTRIBUTING.md.
2
+ from datetime import datetime
3
+ from typed_core import PaginatedResponse
4
+ from typed_core.exceptions import LogicError
5
+ from typing_extensions import Literal, NotRequired, Sequence, TypedDict, cast
6
+ from typed_nado.core import TimestampSeconds, timestamp_seconds
7
+ from typed_nado.core.endpoint.indexer import IndexerEndpoint
8
+ from typed_nado.schemas import Candlestick, Candlesticks
9
+
10
+
11
+ class Request(TypedDict):
12
+ product_id: int
13
+ """Product to fetch candlesticks for."""
14
+ granularity: Literal[60, 300, 900, 3600, 7200, 14400, 86400, 604800, 2419200]
15
+ """Candle width in seconds."""
16
+ max_time: NotRequired[TimestampSeconds]
17
+ """Only return candlesticks with a timestamp at or before this time."""
18
+ limit: NotRequired[int]
19
+ """Most candlesticks to return."""
20
+
21
+
22
+ class CandlesticksEndpoint(IndexerEndpoint):
23
+ """Get historical candlesticks of one product, newest first."""
24
+
25
+ def candlesticks_paged(
26
+ self,
27
+ *,
28
+ product_id: int,
29
+ granularity: Literal[60, 300, 900, 3600, 7200, 14400, 86400, 604800, 2419200],
30
+ max_time: TimestampSeconds | None = None,
31
+ limit: int | None = None,
32
+ validate: bool | None = None,
33
+ ) -> PaginatedResponse[
34
+ Candlestick, tuple[TimestampSeconds | None, list[Candlestick]]
35
+ ]:
36
+ """Get historical candlesticks of one product, newest first.
37
+
38
+ Paged variant of `candlesticks`: Walks backwards by moving `max_time` to the earliest `timestamp` of each page that came back full and stops on the first page shorter than the venue's row cap. Awaitable (flattens every page) or async-iterable (one page at a time).
39
+
40
+ The boundary row a venue re-serves is dropped by its `timestamp` value, so no row is duplicated or skipped whichever way the venue bounds its ranges.
41
+
42
+ Args:
43
+ product_id: Product to fetch candlesticks for.
44
+ granularity: Candle width in seconds.
45
+ max_time: Only return candlesticks with a timestamp at or before this time.
46
+ limit: Most candlesticks to return.
47
+ validate: Override this call's response validation; falls back to the client-level default when omitted.
48
+
49
+ References:
50
+ - [Official docs](https://docs.nado.xyz/developer-resources/api/archive-indexer/candlesticks)
51
+ """
52
+ cap: int | None = min(limit, 500) if limit is not None else 100
53
+
54
+ async def next(
55
+ state: tuple[TimestampSeconds | None, list[Candlestick]],
56
+ ) -> tuple[
57
+ Sequence[Candlestick], tuple[TimestampSeconds | None, list[Candlestick]] | None
58
+ ]:
59
+ def key_of(item: Candlestick):
60
+ """One row's `timestamp`, normalized to compare against the moving bound."""
61
+ raw = item.get('timestamp') if item is not None else None
62
+ return (
63
+ None
64
+ if raw is None
65
+ else timestamp_seconds.parse(cast(int, raw))
66
+ if not isinstance(raw, datetime)
67
+ else raw
68
+ )
69
+
70
+ pos, carried = state
71
+ response = await self.candlesticks(
72
+ product_id=product_id,
73
+ granularity=granularity,
74
+ max_time=pos,
75
+ limit=limit,
76
+ validate=validate,
77
+ )
78
+ rows = response.get('candlesticks')
79
+ rows = rows if rows is not None else []
80
+ keys = [key_of(item) for item in rows]
81
+ carried_keys = [key_of(item) for item in carried]
82
+ fresh = [item for item, key in zip(rows, keys) if key not in carried_keys]
83
+ values = [key for key in keys if key is not None]
84
+ extreme = min(values) if values else None
85
+ if cap is not None and len(rows) >= cap:
86
+ if extreme is None or extreme == pos:
87
+ raise LogicError(
88
+ f'`candlesticks_paged` requested from {pos} and the venue returned a full page of {len(rows)} rows all sharing one `timestamp` value; the rest of that value is unreachable and advancing would drop it.'
89
+ )
90
+ return fresh, (
91
+ extreme,
92
+ [item for item, key in zip(rows, keys) if key == extreme],
93
+ )
94
+ if cap is None and extreme is not None and extreme != pos:
95
+ return fresh, (
96
+ extreme,
97
+ [item for item, key in zip(rows, keys) if key == extreme],
98
+ )
99
+ return fresh, None
100
+
101
+ return PaginatedResponse((max_time, []), next)
102
+
103
+ async def candlesticks(
104
+ self,
105
+ *,
106
+ product_id: int,
107
+ granularity: Literal[60, 300, 900, 3600, 7200, 14400, 86400, 604800, 2419200],
108
+ max_time: TimestampSeconds | None = None,
109
+ limit: int | None = None,
110
+ validate: bool | None = None,
111
+ ) -> Candlesticks:
112
+ """Get historical candlesticks of one product, newest first.
113
+
114
+ Args:
115
+ product_id: Product to fetch candlesticks for.
116
+ granularity: Candle width in seconds.
117
+ max_time: Only return candlesticks with a timestamp at or before this time.
118
+ limit: Most candlesticks to return.
119
+ validate: Override this call's response validation; falls back to the client-level default when omitted.
120
+
121
+ References:
122
+ - [Official docs](https://docs.nado.xyz/developer-resources/api/archive-indexer/candlesticks)
123
+ """
124
+ request: Request = Request(product_id=product_id, granularity=granularity)
125
+ if max_time is not None:
126
+ request['max_time'] = max_time
127
+ if limit is not None:
128
+ request['limit'] = limit
129
+ return await self.request(
130
+ request,
131
+ method='POST',
132
+ path='candlesticks',
133
+ meta={},
134
+ validate=validate,
135
+ request_type=Request,
136
+ response_type=Candlesticks,
137
+ )