limeint-sdk 2.18.0__py3-none-any.whl

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.

Potentially problematic release.


This version of limeint-sdk might be problematic. Click here for more details.

Files changed (83) hide show
  1. limeint_sdk-2.18.0.dist-info/METADATA +295 -0
  2. limeint_sdk-2.18.0.dist-info/RECORD +83 -0
  3. limeint_sdk-2.18.0.dist-info/WHEEL +5 -0
  4. limeint_sdk-2.18.0.dist-info/licenses/LICENSE +21 -0
  5. limeint_sdk-2.18.0.dist-info/top_level.txt +1 -0
  6. trade_api/__init__.py +53 -0
  7. trade_api/_metadata.py +69 -0
  8. trade_api/accounts.py +37 -0
  9. trade_api/aio.py +280 -0
  10. trade_api/assets.py +64 -0
  11. trade_api/auth.py +229 -0
  12. trade_api/auth_messages.py +32 -0
  13. trade_api/client.py +254 -0
  14. trade_api/exceptions.py +99 -0
  15. trade_api/market_data.py +63 -0
  16. trade_api/metrics.py +14 -0
  17. trade_api/orders.py +59 -0
  18. trade_api/proto/__init__.py +0 -0
  19. trade_api/proto/grpc/__init__.py +0 -0
  20. trade_api/proto/grpc/gateway/__init__.py +0 -0
  21. trade_api/proto/grpc/gateway/protoc_gen_openapiv2/__init__.py +0 -0
  22. trade_api/proto/grpc/gateway/protoc_gen_openapiv2/options/__init__.py +0 -0
  23. trade_api/proto/grpc/gateway/protoc_gen_openapiv2/options/annotations_pb2.py +37 -0
  24. trade_api/proto/grpc/gateway/protoc_gen_openapiv2/options/annotations_pb2.pyi +55 -0
  25. trade_api/proto/grpc/gateway/protoc_gen_openapiv2/options/annotations_pb2_grpc.py +24 -0
  26. trade_api/proto/grpc/gateway/protoc_gen_openapiv2/options/annotations_pb2_grpc.pyi +20 -0
  27. trade_api/proto/grpc/gateway/protoc_gen_openapiv2/options/openapiv2_pb2.py +148 -0
  28. trade_api/proto/grpc/gateway/protoc_gen_openapiv2/options/openapiv2_pb2.pyi +1743 -0
  29. trade_api/proto/grpc/gateway/protoc_gen_openapiv2/options/openapiv2_pb2_grpc.py +24 -0
  30. trade_api/proto/grpc/gateway/protoc_gen_openapiv2/options/openapiv2_pb2_grpc.pyi +20 -0
  31. trade_api/proto/grpc/tradeapi/__init__.py +0 -0
  32. trade_api/proto/grpc/tradeapi/v1/__init__.py +0 -0
  33. trade_api/proto/grpc/tradeapi/v1/accounts/__init__.py +0 -0
  34. trade_api/proto/grpc/tradeapi/v1/accounts/accounts_service_pb2.py +79 -0
  35. trade_api/proto/grpc/tradeapi/v1/accounts/accounts_service_pb2.pyi +568 -0
  36. trade_api/proto/grpc/tradeapi/v1/accounts/accounts_service_pb2_grpc.py +250 -0
  37. trade_api/proto/grpc/tradeapi/v1/accounts/accounts_service_pb2_grpc.pyi +154 -0
  38. trade_api/proto/grpc/tradeapi/v1/assets/__init__.py +0 -0
  39. trade_api/proto/grpc/tradeapi/v1/assets/assets_service_pb2.py +135 -0
  40. trade_api/proto/grpc/tradeapi/v1/assets/assets_service_pb2.pyi +1110 -0
  41. trade_api/proto/grpc/tradeapi/v1/assets/assets_service_pb2_grpc.py +485 -0
  42. trade_api/proto/grpc/tradeapi/v1/assets/assets_service_pb2_grpc.pyi +285 -0
  43. trade_api/proto/grpc/tradeapi/v1/auth/__init__.py +0 -0
  44. trade_api/proto/grpc/tradeapi/v1/auth/auth_service_pb2.py +60 -0
  45. trade_api/proto/grpc/tradeapi/v1/auth/auth_service_pb2.pyi +264 -0
  46. trade_api/proto/grpc/tradeapi/v1/auth/auth_service_pb2_grpc.py +208 -0
  47. trade_api/proto/grpc/tradeapi/v1/auth/auth_service_pb2_grpc.pyi +145 -0
  48. trade_api/proto/grpc/tradeapi/v1/corporateactions/__init__.py +0 -0
  49. trade_api/proto/grpc/tradeapi/v1/corporateactions/corporate_actions_service_pb2.py +98 -0
  50. trade_api/proto/grpc/tradeapi/v1/corporateactions/corporate_actions_service_pb2.pyi +863 -0
  51. trade_api/proto/grpc/tradeapi/v1/corporateactions/corporate_actions_service_pb2_grpc.py +321 -0
  52. trade_api/proto/grpc/tradeapi/v1/corporateactions/corporate_actions_service_pb2_grpc.pyi +118 -0
  53. trade_api/proto/grpc/tradeapi/v1/marketdata/__init__.py +0 -0
  54. trade_api/proto/grpc/tradeapi/v1/marketdata/marketdata_service_pb2.py +107 -0
  55. trade_api/proto/grpc/tradeapi/v1/marketdata/marketdata_service_pb2.pyi +1026 -0
  56. trade_api/proto/grpc/tradeapi/v1/marketdata/marketdata_service_pb2_grpc.py +425 -0
  57. trade_api/proto/grpc/tradeapi/v1/marketdata/marketdata_service_pb2_grpc.pyi +202 -0
  58. trade_api/proto/grpc/tradeapi/v1/metrics/__init__.py +0 -0
  59. trade_api/proto/grpc/tradeapi/v1/metrics/usage_metrics_service_pb2.py +48 -0
  60. trade_api/proto/grpc/tradeapi/v1/metrics/usage_metrics_service_pb2.pyi +95 -0
  61. trade_api/proto/grpc/tradeapi/v1/metrics/usage_metrics_service_pb2_grpc.py +110 -0
  62. trade_api/proto/grpc/tradeapi/v1/metrics/usage_metrics_service_pb2_grpc.pyi +79 -0
  63. trade_api/proto/grpc/tradeapi/v1/orders/__init__.py +0 -0
  64. trade_api/proto/grpc/tradeapi/v1/orders/orders_service_pb2.py +103 -0
  65. trade_api/proto/grpc/tradeapi/v1/orders/orders_service_pb2.pyi +891 -0
  66. trade_api/proto/grpc/tradeapi/v1/orders/orders_service_pb2_grpc.py +469 -0
  67. trade_api/proto/grpc/tradeapi/v1/orders/orders_service_pb2_grpc.pyi +348 -0
  68. trade_api/proto/grpc/tradeapi/v1/reports/__init__.py +0 -0
  69. trade_api/proto/grpc/tradeapi/v1/reports/reports_service_pb2.py +65 -0
  70. trade_api/proto/grpc/tradeapi/v1/reports/reports_service_pb2.pyi +298 -0
  71. trade_api/proto/grpc/tradeapi/v1/reports/reports_service_pb2_grpc.py +195 -0
  72. trade_api/proto/grpc/tradeapi/v1/reports/reports_service_pb2_grpc.pyi +106 -0
  73. trade_api/proto/grpc/tradeapi/v1/side_pb2.py +37 -0
  74. trade_api/proto/grpc/tradeapi/v1/side_pb2.pyi +41 -0
  75. trade_api/proto/grpc/tradeapi/v1/side_pb2_grpc.py +24 -0
  76. trade_api/proto/grpc/tradeapi/v1/side_pb2_grpc.pyi +20 -0
  77. trade_api/proto/grpc/tradeapi/v1/trade_pb2.py +40 -0
  78. trade_api/proto/grpc/tradeapi/v1/trade_pb2.pyi +93 -0
  79. trade_api/proto/grpc/tradeapi/v1/trade_pb2_grpc.py +24 -0
  80. trade_api/proto/grpc/tradeapi/v1/trade_pb2_grpc.pyi +20 -0
  81. trade_api/py.typed +0 -0
  82. trade_api/reports.py +33 -0
  83. trade_api/retry.py +204 -0
@@ -0,0 +1,295 @@
1
+ Metadata-Version: 2.4
2
+ Name: limeint-sdk
3
+ Version: 2.18.0
4
+ Summary: Limeint Python SDK for the Trade API (gRPC)
5
+ Author: Limeint
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/limeint/tradingapi
8
+ Project-URL: Documentation, https://github.com/limeint/tradingapi/tree/main/sdk/python
9
+ Project-URL: Repository, https://github.com/limeint/tradingapi
10
+ Keywords: limeint,trading,grpc,trade-api,brokerage
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: Financial and Insurance Industry
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Topic :: Office/Business :: Financial :: Investment
20
+ Classifier: Typing :: Typed
21
+ Requires-Python: >=3.10
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Requires-Dist: grpcio>=1.83.0
25
+ Requires-Dist: protobuf>=7.35.1
26
+ Requires-Dist: googleapis-common-protos>=1.62
27
+ Provides-Extra: dev
28
+ Requires-Dist: pytest>=7; extra == "dev"
29
+ Requires-Dist: pytest-asyncio>=0.23; extra == "dev"
30
+ Requires-Dist: pytest-cov>=4; extra == "dev"
31
+ Requires-Dist: mypy>=1.8; extra == "dev"
32
+ Requires-Dist: mypy-protobuf==5.1.0; extra == "dev"
33
+ Requires-Dist: ruff>=0.3; extra == "dev"
34
+ Requires-Dist: grpcio-tools==1.83.0; extra == "dev"
35
+ Dynamic: license-file
36
+
37
+ # Limeint Trade API — Python SDK
38
+
39
+ Limeint's Python SDK for the gRPC Trade API. It wraps the generated stubs with:
40
+
41
+ - a single `TradeAPIClient` / `AsyncTradeAPIClient` entry point,
42
+ - automatic JWT issuance and background refresh (via `AuthService.SubscribeJwtRenewal`),
43
+ - typed exceptions mapped from gRPC status codes,
44
+ - exponential-backoff retries on transient failures (`UNAVAILABLE`, `RESOURCE_EXHAUSTED`).
45
+
46
+ Service methods are invoked directly on the generated stubs, so the full proto
47
+ surface is available without an extra translation layer.
48
+
49
+ ## Installation
50
+
51
+ Python 3.10 or newer is required.
52
+
53
+ ```sh
54
+ pip install limeint-sdk
55
+ ```
56
+
57
+ > The PyPI distribution is `limeint-sdk`; the Python import name is `trade_api`.
58
+
59
+ ## Quickstart (sync)
60
+
61
+ ```python
62
+ from trade_api import TradeAPIClient
63
+ from trade_api.accounts import GetAccountRequest
64
+ from trade_api.market_data import SubscribeQuoteRequest
65
+
66
+ with TradeAPIClient(secret="YOUR_API_TOKEN") as client:
67
+ account = client.accounts.GetAccount(GetAccountRequest(account_id="A12345"))
68
+ print(account)
69
+
70
+ # Streaming RPCs return iterators.
71
+ for tick in client.market_data.SubscribeQuote(
72
+ SubscribeQuoteRequest(symbols=["SBER@MISX"])
73
+ ):
74
+ print(tick)
75
+ ```
76
+
77
+ ## Quickstart (asyncio)
78
+
79
+ ```python
80
+ import asyncio
81
+
82
+ from trade_api import AsyncTradeAPIClient
83
+ from trade_api.market_data import SubscribeQuoteRequest
84
+
85
+
86
+ async def main() -> None:
87
+ async with AsyncTradeAPIClient(secret="YOUR_API_TOKEN") as client:
88
+ async for tick in client.market_data.SubscribeQuote(
89
+ SubscribeQuoteRequest(symbols=["SBER@MISX"])
90
+ ):
91
+ print(tick)
92
+
93
+
94
+ asyncio.run(main())
95
+ ```
96
+
97
+ ## Available services
98
+
99
+ The client exposes the full Trade API surface via sub-clients:
100
+
101
+ | Attribute | gRPC service | What it does |
102
+ | -------------------- | ---------------------- | --------------------------------------------- |
103
+ | `client.auth` | `AuthService` | Token issuance + details (usually automatic). |
104
+ | `client.accounts` | `AccountsService` | Accounts, positions, trades, transactions. |
105
+ | `client.assets` | `AssetsService` | Instruments, exchanges, schedules, options. |
106
+ | `client.market_data` | `MarketDataService` | Bars, quotes, order book, trade streams. |
107
+ | `client.orders` | `OrdersService` | Place / cancel orders, order + trade streams. |
108
+ | `client.reports` | `ReportsService` | Account reports. |
109
+ | `client.metrics` | `UsageMetricsService` | API usage / quota metrics. |
110
+
111
+ ## API reference
112
+
113
+ Every RPC defined in the `.proto` files is exposed directly on the sub-client.
114
+ Request and response message types are re-exported from short, per-service
115
+ modules:
116
+
117
+ | Module | Use with |
118
+ | --- | --- |
119
+ | `trade_api.accounts` | `client.accounts.*` |
120
+ | `trade_api.assets` | `client.assets.*` |
121
+ | `trade_api.market_data` | `client.market_data.*` |
122
+ | `trade_api.orders` | `client.orders.*` (includes `Side`) |
123
+ | `trade_api.reports` | `client.reports.*` |
124
+ | `trade_api.metrics` | `client.metrics.*` |
125
+ | `trade_api.auth_messages` | `client.auth.*` (rarely needed — JWT handled automatically) |
126
+
127
+ The original deeply-nested paths
128
+ (`trade_api.proto.grpc.tradeapi.v1.<service>.<service>_service_pb2`)
129
+ still work and remain the source of truth.
130
+
131
+ Legend: ▶ unary · ⇉ server-stream · ⇄ bidi-stream
132
+
133
+ ### `client.auth` — `AuthService`
134
+
135
+ | Method | Kind | Purpose |
136
+ | --- | :---: | --- |
137
+ | `Auth(AuthRequest)` | ▶ | Exchange API secret for a JWT. *Called for you on construction.* |
138
+ | `TokenDetails(TokenDetailsRequest)` | ▶ | Inspect a JWT — expiry, market-data permissions, visible account IDs. |
139
+ | `SubscribeJwtRenewal(SubscribeJwtRenewalRequest)` | ⇉ | Stream of refreshed JWTs. *Consumed for you in the background.* |
140
+
141
+ ### `client.accounts` — `AccountsService`
142
+
143
+ | Method | Kind | Purpose |
144
+ | --- | :---: | --- |
145
+ | `GetAccount(GetAccountRequest)` | ▶ | Account info: equity, cash, positions, margin. |
146
+ | `Trades(TradesRequest)` | ▶ | Historical trades for an account. |
147
+ | `Transactions(TransactionsRequest)` | ▶ | Cash movements and other non-trade transactions. |
148
+ | `SubscribeAccount(GetAccountRequest)` | ⇉ | Streaming account updates. |
149
+
150
+ ### `client.assets` — `AssetsService`
151
+
152
+ | Method | Kind | Purpose |
153
+ | --- | :---: | --- |
154
+ | `Exchanges(ExchangesRequest)` | ▶ | List of supported exchanges. |
155
+ | `Assets(AssetsRequest)` | ▶ | Tradable instruments (filtered). |
156
+ | `AllAssets(AllAssetsRequest)` | ▶ | Full instrument catalog. |
157
+ | `GetAsset(GetAssetRequest)` | ▶ | Single instrument by symbol. |
158
+ | `GetAssetParams(GetAssetParamsRequest)` | ▶ | Trading parameters for an instrument. |
159
+ | `OptionsChain(OptionsChainRequest)` | ▶ | Options chain for an underlying. |
160
+ | `Schedule(ScheduleRequest)` | ▶ | Trading session schedule. |
161
+ | `Clock(ClockRequest)` | ▶ | Server clock (use for time-aligned operations). |
162
+ | `GetConstituents(GetConstituentsRequest)` | ▶ | Index constituents. |
163
+
164
+ ### `client.market_data` — `MarketDataService`
165
+
166
+ | Method | Kind | Purpose |
167
+ | --- | :---: | --- |
168
+ | `Bars(BarsRequest)` | ▶ | OHLC candles (any timeframe via `TimeFrame` enum). |
169
+ | `LastQuote(QuoteRequest)` | ▶ | Most recent quote snapshot. |
170
+ | `OrderBook(OrderBookRequest)` | ▶ | Order book snapshot. |
171
+ | `LatestTrades(LatestTradesRequest)` | ▶ | Most recent trades for a symbol. |
172
+ | `SubscribeQuote(SubscribeQuoteRequest)` | ⇉ | Live quote stream. |
173
+ | `SubscribeOrderBook(SubscribeOrderBookRequest)` | ⇉ | Live order-book updates. |
174
+ | `SubscribeLatestTrades(SubscribeLatestTradesRequest)` | ⇉ | Live trades stream. |
175
+ | `SubscribeBars(SubscribeBarsRequest)` | ⇉ | Live candle stream. |
176
+
177
+ ### `client.orders` — `OrdersService`
178
+
179
+ | Method | Kind | Purpose |
180
+ | --- | :---: | --- |
181
+ | `PlaceOrder(Order)` | ▶ | Place market / limit / stop / stop-limit / multi-leg order. |
182
+ | `PlaceSLTPOrder(SLTPOrder)` | ▶ | Place an SL/TP (stop-loss + take-profit) order. |
183
+ | `CancelOrder(CancelOrderRequest)` | ▶ | Cancel an active order. |
184
+ | `GetOrders(OrdersRequest)` | ▶ | List active orders for an account. |
185
+ | `GetOrder(GetOrderRequest)` | ▶ | Single order by ID. |
186
+ | `SubscribeOrders(SubscribeOrdersRequest)` | ⇉ | Live order-state updates. |
187
+ | `SubscribeTrades(SubscribeTradesRequest)` | ⇉ | Live execution / fill stream. |
188
+ | `SubscribeOrderTrade(stream OrderTradeRequest)` | ⇄ | Bidi stream — order + trade events, request-driven. |
189
+
190
+ ### `client.reports` — `ReportsService`
191
+
192
+ | Method | Kind | Purpose |
193
+ | --- | :---: | --- |
194
+ | `CreateAccountReport(CreateAccountReportRequest)` | ▶ | Generate an account report (async — returns a job handle). |
195
+ | `GetAccountReportInfo(GetAccountReportInfoRequest)` | ▶ | Poll report status. |
196
+ | `SubscribeAccountReportInfo(SubscribeAccountReportInfoRequest)` | ⇉ | Stream report status updates instead of polling. |
197
+
198
+ ### `client.metrics` — `UsageMetricsService`
199
+
200
+ | Method | Kind | Purpose |
201
+ | --- | :---: | --- |
202
+ | `GetUsageMetrics(GetUsageMetricsRequest)` | ▶ | API usage / quota stats for the current token. |
203
+
204
+ ### Client lifecycle
205
+
206
+ | Operation | Sync | Async |
207
+ | --- | --- | --- |
208
+ | Construct | `TradeAPIClient(secret, *, endpoint=DEFAULT_ENDPOINT, retry_policy=DEFAULT_POLICY, channel_options=None)` | `AsyncTradeAPIClient(secret, ...)` — same args |
209
+ | Start | *immediate, blocks for initial JWT* | `await client.start()` — or use `async with` |
210
+ | Current JWT | `client.get_token()` → `str \| None` | `client.get_token()` → `str \| None` (sync read of cached snapshot) |
211
+ | Close | `client.close()` | `await client.close()` |
212
+ | Context manager | `with TradeAPIClient(...) as client:` | `async with AsyncTradeAPIClient(...) as client:` |
213
+ | Testing (no TLS) | `TradeAPIClient.for_testing(secret, endpoint="localhost:50051")` | `AsyncTradeAPIClient.for_testing(secret, endpoint="localhost:50051")` |
214
+
215
+ > `for_testing(...)` opens an insecure (plaintext) channel against an in-process fake server. **Never use against `api.finam.ru`** — it sends your JWT in clear.
216
+
217
+ ## Error handling
218
+
219
+ Wrap raw `grpc.RpcError` into a typed `TradeAPIError`:
220
+
221
+ ```python
222
+ import grpc
223
+ from trade_api import TradeAPIClient, RateLimitError, from_rpc_error
224
+
225
+ with TradeAPIClient(secret="...") as client:
226
+ try:
227
+ client.accounts.GetAccount(GetAccountRequest(account_id="A12345"))
228
+ except grpc.RpcError as raw:
229
+ err = from_rpc_error(raw)
230
+ if isinstance(err, RateLimitError):
231
+ ...
232
+ raise err
233
+ ```
234
+
235
+ Exception classes: `AuthError` (401), `PermissionDeniedError` (403),
236
+ `InvalidArgumentError` (400), `NotFoundError` (404), `RateLimitError` (429),
237
+ `InternalError` (500), `ServiceUnavailableError` (503), `DeadlineExceededError` (504).
238
+ All inherit from `TradeAPIError`.
239
+
240
+ ## Retries
241
+
242
+ Unary RPCs are retried automatically on `UNAVAILABLE` and `RESOURCE_EXHAUSTED`
243
+ with exponential backoff + jitter. Streaming RPCs are *not* retried — the
244
+ caller is expected to handle reconnection at a meaningful boundary
245
+ (e.g. resuming from the last received bar).
246
+
247
+ Override the policy:
248
+
249
+ ```python
250
+ from trade_api import TradeAPIClient, RetryPolicy
251
+
252
+ policy = RetryPolicy(max_attempts=6, initial_backoff=0.5, max_backoff=10.0)
253
+ client = TradeAPIClient(secret="...", retry_policy=policy)
254
+ ```
255
+
256
+ ## Local build
257
+
258
+ From the repository root:
259
+
260
+ ```sh
261
+ cd sdk/python
262
+ pip install -e ".[dev]"
263
+ ./scripts/generate_proto.sh
264
+ ```
265
+
266
+ `scripts/generate_proto.sh` compiles the `.proto` files in `../../proto/` into
267
+ `trade_api/proto/`. Re-run it whenever the protos change.
268
+
269
+ ## Layout
270
+
271
+ ```
272
+ sdk/python/
273
+ ├── pyproject.toml
274
+ ├── README.md
275
+ ├── LICENSE
276
+ ├── scripts/
277
+ │ └── generate_proto.sh # protoc invocation (contributors only)
278
+ ├── examples/ # runnable scripts
279
+ └── trade_api/
280
+ ├── __init__.py
281
+ ├── client.py # TradeAPIClient (sync)
282
+ ├── aio.py # AsyncTradeAPIClient
283
+ ├── auth.py # JWT lifecycle
284
+ ├── retry.py # retry policy + interceptors
285
+ ├── exceptions.py # typed errors
286
+ ├── _metadata.py # Authorization header plumbing
287
+ ├── accounts.py # message re-exports (per-service)
288
+ ├── assets.py
289
+ ├── auth_messages.py
290
+ ├── market_data.py
291
+ ├── orders.py
292
+ ├── reports.py
293
+ ├── metrics.py
294
+ └── proto/ # generated by CI; ships in wheel and sdist
295
+ ```
@@ -0,0 +1,83 @@
1
+ limeint_sdk-2.18.0.dist-info/licenses/LICENSE,sha256=F-hs99Y5UdWSe7ECf7DqvDd8lr7VbzE5w7_Pt_6ja9E,1064
2
+ trade_api/__init__.py,sha256=boX5A5IN2PmjpBVd_J9gcE-3FgVEb2t02pUpJU7UUpg,1502
3
+ trade_api/_metadata.py,sha256=ubY6FL5lee0IrttY_YuVgsQRj67SjL9oBekBWzPQGsQ,2510
4
+ trade_api/accounts.py,sha256=m7bRmkuyp50AXuqhfnX3uqYVO2zenL31gW08w8rCW4k,831
5
+ trade_api/aio.py,sha256=I8h_AT3OT_1NyG0Spy9YoeXd_IS4FYJcMSzkUMNaFTU,12128
6
+ trade_api/assets.py,sha256=FtOoIdW67iVR4ZTvKdqp1SWbOeIXM6SlI9vcKbV98nk,1395
7
+ trade_api/auth.py,sha256=Pq41Wt47ECQYihbBxM4xIQS64GukATd7Vm_MT79bQTc,8667
8
+ trade_api/auth_messages.py,sha256=lJeS5uu7tFUzIqTHOj9MDlbAiTpjmwTFzY1AbR2Ganc,945
9
+ trade_api/client.py,sha256=9x2ztiQqvk8Io0TwvQoDJ7nPXr2VzAOKcEkstmNkUgU,11484
10
+ trade_api/exceptions.py,sha256=d5BEm5jqYogKgj-2ixcZK8GD7_7j61mI1ayeS2XkH4w,2976
11
+ trade_api/market_data.py,sha256=tWacpP_m_kWOQzJWjuPuMS55WkcjSzV-D1VykJ-NMHg,1462
12
+ trade_api/metrics.py,sha256=NaFLWJQ5bdLs8YbK1GZ1RwIstM7_2RJl_Hi7C-_LL44,384
13
+ trade_api/orders.py,sha256=yuI9MqVRiFLqymxdnUzci6Afk53l65VCArGaszEMFMQ,1428
14
+ trade_api/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
+ trade_api/reports.py,sha256=wlY-tX4gOogN4vp5boupvs4k1thOKBOaCkzIV2NJQ_8,871
16
+ trade_api/retry.py,sha256=S--2F8xAbXD-Clknv1_FarSPWzq58rAxin5tyzaLFf8,7679
17
+ trade_api/proto/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
+ trade_api/proto/grpc/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
+ trade_api/proto/grpc/gateway/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
+ trade_api/proto/grpc/gateway/protoc_gen_openapiv2/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
21
+ trade_api/proto/grpc/gateway/protoc_gen_openapiv2/options/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
22
+ trade_api/proto/grpc/gateway/protoc_gen_openapiv2/options/annotations_pb2.py,sha256=C2mqaYC5ZpqCIl71RGs0nCLsSOLcuTfxMIr_CsCAHNg,2731
23
+ trade_api/proto/grpc/gateway/protoc_gen_openapiv2/options/annotations_pb2.pyi,sha256=9T2k0vkgAxzvCtfHQT8aNdfssktEOZ3Cae-Szb7uYf4,2658
24
+ trade_api/proto/grpc/gateway/protoc_gen_openapiv2/options/annotations_pb2_grpc.py,sha256=fMSspB063yIHyY6QCBW5ELKKglIv_eH6izkWseqGz8c,933
25
+ trade_api/proto/grpc/gateway/protoc_gen_openapiv2/options/annotations_pb2_grpc.pyi,sha256=uC9Wnq6uyg488QiONpJ0ba1s_iouQCOYsjd_FDd1XUM,495
26
+ trade_api/proto/grpc/gateway/protoc_gen_openapiv2/options/openapiv2_pb2.py,sha256=fw14umPd7yR9j3qikTNdLucPJP-WgsozhyEydtE_Y9k,19786
27
+ trade_api/proto/grpc/gateway/protoc_gen_openapiv2/options/openapiv2_pb2.pyi,sha256=4vr3jvWeYNN1v1i4VqdPs0FVggDZbcyBqQ_gdf8qHSc,74636
28
+ trade_api/proto/grpc/gateway/protoc_gen_openapiv2/options/openapiv2_pb2_grpc.py,sha256=xiKaCb-9bQJpFjiJl50aM9AHhtcIP0qmhAqglbvzl6M,931
29
+ trade_api/proto/grpc/gateway/protoc_gen_openapiv2/options/openapiv2_pb2_grpc.pyi,sha256=uC9Wnq6uyg488QiONpJ0ba1s_iouQCOYsjd_FDd1XUM,495
30
+ trade_api/proto/grpc/tradeapi/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
31
+ trade_api/proto/grpc/tradeapi/v1/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
32
+ trade_api/proto/grpc/tradeapi/v1/side_pb2.py,sha256=94xRnOAikLBgI1tjGcY19ZDm4znIDCOE0w0ey_8lFqs,1566
33
+ trade_api/proto/grpc/tradeapi/v1/side_pb2.pyi,sha256=_NcSofgLty4IeoFwkvXE610mRRuqXSNTxNvivlYCNnU,1169
34
+ trade_api/proto/grpc/tradeapi/v1/side_pb2_grpc.py,sha256=PvEfFaTjMBO5o94zPxITl2CadU3u3ykVW2k-GIJxhkc,901
35
+ trade_api/proto/grpc/tradeapi/v1/side_pb2_grpc.pyi,sha256=uC9Wnq6uyg488QiONpJ0ba1s_iouQCOYsjd_FDd1XUM,495
36
+ trade_api/proto/grpc/tradeapi/v1/trade_pb2.py,sha256=ExLnl1hnpHPXK5jwSm4FTRkFrBKEzaoLv2d8VnukjRg,2439
37
+ trade_api/proto/grpc/tradeapi/v1/trade_pb2.pyi,sha256=doPR49cmyeoJnPcBA7NMV2e8K580Gthoz87gtn-Jyoc,3595
38
+ trade_api/proto/grpc/tradeapi/v1/trade_pb2_grpc.py,sha256=m3Ay3fMTB1QK4qq1AHuPWTKAnNkNHKWWtTfs1psuFPY,902
39
+ trade_api/proto/grpc/tradeapi/v1/trade_pb2_grpc.pyi,sha256=uC9Wnq6uyg488QiONpJ0ba1s_iouQCOYsjd_FDd1XUM,495
40
+ trade_api/proto/grpc/tradeapi/v1/accounts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
41
+ trade_api/proto/grpc/tradeapi/v1/accounts/accounts_service_pb2.py,sha256=PZF8k-1AzI4wyt9qhjbLAb8GPnwMVjRLBg36J4PtnkQ,11053
42
+ trade_api/proto/grpc/tradeapi/v1/accounts/accounts_service_pb2.pyi,sha256=lmmD0PXo8iB-xf4bDp3rUbxgDVRUAW1bhj7vaKXuxqM,24430
43
+ trade_api/proto/grpc/tradeapi/v1/accounts/accounts_service_pb2_grpc.py,sha256=k4CWF7T061A3vteGRRxjoJDkHTNE5u1qKej-gsYxubc,10688
44
+ trade_api/proto/grpc/tradeapi/v1/accounts/accounts_service_pb2_grpc.pyi,sha256=AL7EiWw9i-e8Rim4AgxqGug0g0jxCdKGU-9k7QjyFCE,6322
45
+ trade_api/proto/grpc/tradeapi/v1/assets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
46
+ trade_api/proto/grpc/tradeapi/v1/assets/assets_service_pb2.py,sha256=gsVa1gEJ-PgyPtWBFlgvqjB8H4GkjMIOP1a_-WYA74Q,19892
47
+ trade_api/proto/grpc/tradeapi/v1/assets/assets_service_pb2.pyi,sha256=lEuFJuXev6WF4wtzqe7PON7Xl8pxF9Qui9vH-DzldVc,45568
48
+ trade_api/proto/grpc/tradeapi/v1/assets/assets_service_pb2_grpc.py,sha256=D66Gq-YCVA0KgsrrUtqw1C7ShKwMJe8KRESQ66Og3vM,20912
49
+ trade_api/proto/grpc/tradeapi/v1/assets/assets_service_pb2_grpc.pyi,sha256=S0O_UnGFJ6fu0PijBDs-HpkRU-uIz-Ch_DJiTjIJ6yg,11584
50
+ trade_api/proto/grpc/tradeapi/v1/auth/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
51
+ trade_api/proto/grpc/tradeapi/v1/auth/auth_service_pb2.py,sha256=IffbO43rs-8UZBQe5-z6cARDYpbxwHLsy511AatvVmE,6423
52
+ trade_api/proto/grpc/tradeapi/v1/auth/auth_service_pb2.pyi,sha256=mWIY7SPvq9pVcrCR9-lNzQ37bBVlQZewyDpx7yic8xE,10537
53
+ trade_api/proto/grpc/tradeapi/v1/auth/auth_service_pb2_grpc.py,sha256=OIGpw1lwIRkJxyYm529bpXbP5g7LsktOiBNqbf88aUo,8272
54
+ trade_api/proto/grpc/tradeapi/v1/auth/auth_service_pb2_grpc.pyi,sha256=LHPtlcyiEeBBAmfrETWrWCnyY2H6OWau8i7uWQ9V5Eo,4940
55
+ trade_api/proto/grpc/tradeapi/v1/corporateactions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
56
+ trade_api/proto/grpc/tradeapi/v1/corporateactions/corporate_actions_service_pb2.py,sha256=LO6AeYEFxXYI1k2D5CRYaDU1Yv3gQ3ouLrFPXA_VfoM,16389
57
+ trade_api/proto/grpc/tradeapi/v1/corporateactions/corporate_actions_service_pb2.pyi,sha256=8JiJqsyGUcDbT0r7Rsmy_4SePEcPYZdFFrA90OIOphc,37282
58
+ trade_api/proto/grpc/tradeapi/v1/corporateactions/corporate_actions_service_pb2_grpc.py,sha256=iK3D1cA-CqBqaICQXES2MaCauQv0mIgnwpA2sYDAzZY,15724
59
+ trade_api/proto/grpc/tradeapi/v1/corporateactions/corporate_actions_service_pb2_grpc.pyi,sha256=5nWqe3CMgmxhlZpMgKNM_OucjOp9P39YvU1tzZy__mA,6829
60
+ trade_api/proto/grpc/tradeapi/v1/marketdata/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
61
+ trade_api/proto/grpc/tradeapi/v1/marketdata/marketdata_service_pb2.py,sha256=5TEWaSBJrDkkwLV5oueIV19G28J-8IoFd6v17fJsmeU,16472
62
+ trade_api/proto/grpc/tradeapi/v1/marketdata/marketdata_service_pb2.pyi,sha256=GbHcT26QGi_JLTwNsLxZbEBHfNs5XV9XMvjCl1FgYd0,39782
63
+ trade_api/proto/grpc/tradeapi/v1/marketdata/marketdata_service_pb2_grpc.py,sha256=LffAIjidQk0W2UynOFW8ORSfV7menhJBnjPEkKVpQes,19357
64
+ trade_api/proto/grpc/tradeapi/v1/marketdata/marketdata_service_pb2_grpc.pyi,sha256=zMXl7tXbZMUsUysr8xCUwDgj9F0YKTei4nUGhO1WUR4,9594
65
+ trade_api/proto/grpc/tradeapi/v1/metrics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
66
+ trade_api/proto/grpc/tradeapi/v1/metrics/usage_metrics_service_pb2.py,sha256=VELQLo6SEZL5IL0-2R8yqf0G7vA9u9lkPn88YLP1Crk,4607
67
+ trade_api/proto/grpc/tradeapi/v1/metrics/usage_metrics_service_pb2.pyi,sha256=x1j8Dw8isuKz-p-u00-8-Dvp-UBWE_tzYPOVIPIy5ec,3651
68
+ trade_api/proto/grpc/tradeapi/v1/metrics/usage_metrics_service_pb2_grpc.py,sha256=qIjF3-YtZEApsl4iFQ3d2kXqXb-0U5mMkpaIxGf8raU,4583
69
+ trade_api/proto/grpc/tradeapi/v1/metrics/usage_metrics_service_pb2_grpc.pyi,sha256=6BYEFOcfCJRU45TlwqgLkuiCLOU1ejJ7KKeX9bMfLi8,2964
70
+ trade_api/proto/grpc/tradeapi/v1/orders/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
71
+ trade_api/proto/grpc/tradeapi/v1/orders/orders_service_pb2.py,sha256=YOqH9GqqRXVXuIT5-cujy574aX5bvmdN0CXU_RShxXc,17126
72
+ trade_api/proto/grpc/tradeapi/v1/orders/orders_service_pb2.pyi,sha256=cPbhYJo8JkCZ4tbuSdGsbLA-InWlIA4fBWIM7Nc_E-4,36454
73
+ trade_api/proto/grpc/tradeapi/v1/orders/orders_service_pb2_grpc.py,sha256=YvnT5Jgh6jhK9UOfP454ELyHUUhVM0rBuR9olenBsZ4,19568
74
+ trade_api/proto/grpc/tradeapi/v1/orders/orders_service_pb2_grpc.pyi,sha256=iHtk0UTSDy3YO8vNjA-zxLtFOlGZwTHKSfeWFF5YG9s,12440
75
+ trade_api/proto/grpc/tradeapi/v1/reports/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
76
+ trade_api/proto/grpc/tradeapi/v1/reports/reports_service_pb2.py,sha256=E9VlGtkHRtyzJSm-SIMSosy4obyIS-qLcER9j8ikbbI,7474
77
+ trade_api/proto/grpc/tradeapi/v1/reports/reports_service_pb2.pyi,sha256=eu0F2iOi0HRpQg1AzQlQxiovRdPnaK7l0F0af7nzui8,11723
78
+ trade_api/proto/grpc/tradeapi/v1/reports/reports_service_pb2_grpc.py,sha256=FYK5iAbCpoymqplzgbOlf5GKQNRT0FT-FlqgckPlct4,8644
79
+ trade_api/proto/grpc/tradeapi/v1/reports/reports_service_pb2_grpc.pyi,sha256=u4y521T2lWYXjiG-qdyA-dtnuQm2i2Cfghs6Wx3iiDo,4691
80
+ limeint_sdk-2.18.0.dist-info/METADATA,sha256=ZEXzWUW96Gi7T4Dm2B9iayg-Yd_jzM_DfDOpyusaLLs,12025
81
+ limeint_sdk-2.18.0.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
82
+ limeint_sdk-2.18.0.dist-info/top_level.txt,sha256=9-L6HqeGi3sk7POcpKun_tmvy7W4IveY_35xbevjFj8,10
83
+ limeint_sdk-2.18.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (83.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Limeint
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 @@
1
+ trade_api
trade_api/__init__.py ADDED
@@ -0,0 +1,53 @@
1
+ """Limeint Trade API — Python SDK.
2
+
3
+ Thin ergonomic wrapper over the generated gRPC stubs. Handles channel
4
+ construction, JWT issuance + auto-refresh, retries on transient failures,
5
+ and error mapping. Service methods are invoked directly on the generated
6
+ stubs (e.g. ``client.orders.PlaceOrder(...)``) using proto request/response
7
+ messages.
8
+
9
+ Public surface:
10
+
11
+ - :class:`TradeAPIClient` — synchronous client.
12
+ - :class:`AsyncTradeAPIClient` — asyncio client.
13
+ - :class:`RetryPolicy` — exponential-backoff configuration.
14
+ - :mod:`trade_api.exceptions` — typed errors mapped from gRPC status codes.
15
+ - :func:`from_rpc_error` — convert a raw ``grpc.RpcError`` into a typed :class:`TradeAPIError`.
16
+ """
17
+
18
+ from .aio import AsyncTradeAPIClient
19
+ from .client import DEFAULT_ENDPOINT, TradeAPIClient
20
+ from .exceptions import (
21
+ AuthError,
22
+ DeadlineExceededError,
23
+ TradeAPIError,
24
+ InternalError,
25
+ InvalidArgumentError,
26
+ NotFoundError,
27
+ PermissionDeniedError,
28
+ RateLimitError,
29
+ ServiceUnavailableError,
30
+ from_rpc_error,
31
+ )
32
+ from .retry import DEFAULT_POLICY, RetryPolicy
33
+
34
+ __version__ = "2.18.0"
35
+
36
+ __all__ = [
37
+ "TradeAPIClient",
38
+ "AsyncTradeAPIClient",
39
+ "DEFAULT_ENDPOINT",
40
+ "RetryPolicy",
41
+ "DEFAULT_POLICY",
42
+ "TradeAPIError",
43
+ "AuthError",
44
+ "PermissionDeniedError",
45
+ "RateLimitError",
46
+ "InvalidArgumentError",
47
+ "NotFoundError",
48
+ "ServiceUnavailableError",
49
+ "DeadlineExceededError",
50
+ "InternalError",
51
+ "from_rpc_error",
52
+ "__version__",
53
+ ]
trade_api/_metadata.py ADDED
@@ -0,0 +1,69 @@
1
+ """Per-call metadata plumbing for injecting the JWT into every RPC.
2
+
3
+ We use `grpc.metadata_call_credentials` so the Authorization header is attached
4
+ at call time, picking up whichever JWT the TokenManager currently holds. This
5
+ avoids the rebuild-the-channel-on-refresh dance.
6
+ """
7
+
8
+ from __future__ import annotations
9
+
10
+ from typing import TYPE_CHECKING
11
+
12
+ import grpc
13
+
14
+ if TYPE_CHECKING: # pragma: no cover
15
+ from .auth import AsyncTokenManager, TokenManager
16
+
17
+
18
+ class _SyncAuthPlugin(grpc.AuthMetadataPlugin):
19
+ def __init__(self, token_manager: "TokenManager") -> None:
20
+ self._token_manager = token_manager
21
+
22
+ def __call__(
23
+ self,
24
+ context: grpc.AuthMetadataContext,
25
+ callback: grpc.AuthMetadataPluginCallback,
26
+ ) -> None:
27
+ token = self._token_manager.get_token()
28
+ callback((("authorization", token),), None)
29
+
30
+
31
+ class _AsyncAuthPlugin(grpc.AuthMetadataPlugin):
32
+ """Async variant — grpc.aio still drives the plugin synchronously, so we
33
+ rely on the AsyncTokenManager exposing the current token without awaiting."""
34
+
35
+ def __init__(self, token_manager: "AsyncTokenManager") -> None:
36
+ self._token_manager = token_manager
37
+
38
+ def __call__(
39
+ self,
40
+ context: grpc.AuthMetadataContext,
41
+ callback: grpc.AuthMetadataPluginCallback,
42
+ ) -> None:
43
+ token = self._token_manager._token # noqa: SLF001 — intentional fast-path read
44
+ if token is None:
45
+ # AsyncTradeAPIClient.start() awaits the initial Auth before building
46
+ # the application channel, so the token is always set before any
47
+ # RPC reaches this plugin. A None here means the SDK was used
48
+ # without start() — surface as a clear error instead of an empty
49
+ # Authorization header that the server would reject as 401.
50
+ callback(
51
+ (),
52
+ RuntimeError(
53
+ "AsyncTradeAPIClient JWT is not available — "
54
+ "did you call await client.start()?"
55
+ ),
56
+ )
57
+ return
58
+ callback((("authorization", token),), None)
59
+
60
+
61
+ def sync_call_credentials(token_manager: "TokenManager") -> grpc.CallCredentials:
62
+ return grpc.metadata_call_credentials(_SyncAuthPlugin(token_manager))
63
+
64
+
65
+ def async_call_credentials(token_manager: "AsyncTokenManager") -> grpc.CallCredentials:
66
+ return grpc.metadata_call_credentials(_AsyncAuthPlugin(token_manager))
67
+
68
+
69
+ __all__ = ["sync_call_credentials", "async_call_credentials"]
trade_api/accounts.py ADDED
@@ -0,0 +1,37 @@
1
+ """Account-service message types.
2
+
3
+ Re-exports the proto request/response messages used with
4
+ ``client.accounts.*`` RPCs so callers don't need to import them from the
5
+ deeply nested generated module path.
6
+
7
+ from trade_api.accounts import GetAccountRequest
8
+ client.accounts.GetAccount(GetAccountRequest(account_id="A12345"))
9
+ """
10
+
11
+ from .proto.grpc.tradeapi.v1.accounts.accounts_service_pb2 import (
12
+ FORTS,
13
+ MC,
14
+ MCT,
15
+ GetAccountRequest,
16
+ GetAccountResponse,
17
+ Position,
18
+ TradesRequest,
19
+ TradesResponse,
20
+ Transaction,
21
+ TransactionsRequest,
22
+ TransactionsResponse,
23
+ )
24
+
25
+ __all__ = [
26
+ "GetAccountRequest",
27
+ "GetAccountResponse",
28
+ "TradesRequest",
29
+ "TradesResponse",
30
+ "TransactionsRequest",
31
+ "TransactionsResponse",
32
+ "Position",
33
+ "Transaction",
34
+ "FORTS",
35
+ "MC",
36
+ "MCT",
37
+ ]