binance-sdk-wallet 1.0.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 (96) hide show
  1. binance_sdk_wallet-1.0.0/CHANGELOG.md +5 -0
  2. binance_sdk_wallet-1.0.0/LICENCE +21 -0
  3. binance_sdk_wallet-1.0.0/PKG-INFO +212 -0
  4. binance_sdk_wallet-1.0.0/README.md +184 -0
  5. binance_sdk_wallet-1.0.0/pyproject.toml +40 -0
  6. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/__init__.py +31 -0
  7. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/metadata.py +1 -0
  8. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/__init__.py +13 -0
  9. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/api/__init__.py +15 -0
  10. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/api/account_api.py +328 -0
  11. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/api/asset_api.py +871 -0
  12. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/api/capital_api.py +533 -0
  13. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/api/others_api.py +103 -0
  14. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/api/travel_rule_api.py +713 -0
  15. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/__init__.py +210 -0
  16. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/account_api_trading_status_response.py +116 -0
  17. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/account_api_trading_status_response_data.py +133 -0
  18. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/account_api_trading_status_response_data_trigger_condition.py +106 -0
  19. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/account_info_response.py +130 -0
  20. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/account_status_response.py +102 -0
  21. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/all_coins_information_response.py +81 -0
  22. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/all_coins_information_response_inner.py +172 -0
  23. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/all_coins_information_response_inner_network_list_inner.py +243 -0
  24. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/all_coins_information_response_inner_network_list_inner_network_list_inner.py +198 -0
  25. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/asset_detail_response.py +128 -0
  26. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/asset_detail_response_ctr.py +122 -0
  27. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/asset_detail_response_sky.py +129 -0
  28. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/asset_dividend_record_response.py +125 -0
  29. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/asset_dividend_record_response_rows_inner.py +123 -0
  30. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/broker_withdraw_response.py +110 -0
  31. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/daily_account_snapshot_response.py +129 -0
  32. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/daily_account_snapshot_response_snapshot_vos_inner.py +122 -0
  33. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/daily_account_snapshot_response_snapshot_vos_inner_data.py +219 -0
  34. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/daily_account_snapshot_response_snapshot_vos_inner_data_assets_inner.py +110 -0
  35. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/daily_account_snapshot_response_snapshot_vos_inner_data_balances_inner.py +110 -0
  36. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/daily_account_snapshot_response_snapshot_vos_inner_data_position_inner.py +122 -0
  37. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/daily_account_snapshot_response_snapshot_vos_inner_data_user_assets_inner.py +123 -0
  38. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/deposit_address_response.py +112 -0
  39. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/deposit_history_response.py +81 -0
  40. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/deposit_history_response_inner.py +147 -0
  41. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/deposit_history_travel_rule_response.py +81 -0
  42. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/deposit_history_travel_rule_response_inner.py +160 -0
  43. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/dust_transfer_response.py +135 -0
  44. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/dust_transfer_response_transfer_result_inner.py +127 -0
  45. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/dustlog_response.py +127 -0
  46. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/dustlog_response_user_asset_dribblets_inner.py +145 -0
  47. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/dustlog_response_user_asset_dribblets_inner_user_asset_dribblet_details_inner.py +127 -0
  48. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/enums.py +9 -0
  49. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/fetch_address_verification_list_response.py +81 -0
  50. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/fetch_address_verification_list_response_inner.py +134 -0
  51. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/fetch_address_verification_list_response_inner_address_questionnaire.py +117 -0
  52. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/fetch_deposit_address_list_with_network_response.py +83 -0
  53. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/fetch_deposit_address_list_with_network_response_inner.py +112 -0
  54. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/fetch_withdraw_address_list_response.py +81 -0
  55. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/fetch_withdraw_address_list_response_inner.py +129 -0
  56. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/fetch_withdraw_quota_response.py +105 -0
  57. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/funding_wallet_response.py +81 -0
  58. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/funding_wallet_response_inner.py +123 -0
  59. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/get_api_key_permission_response.py +160 -0
  60. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/get_assets_that_can_be_converted_into_bnb_response.py +144 -0
  61. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/get_assets_that_can_be_converted_into_bnb_response_details_inner.py +128 -0
  62. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/get_cloud_mining_payment_and_refund_history_response.py +127 -0
  63. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/get_cloud_mining_payment_and_refund_history_response_rows_inner.py +123 -0
  64. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/get_open_symbol_list_response.py +81 -0
  65. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/get_open_symbol_list_response_inner.py +105 -0
  66. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/get_spot_delist_schedule_response.py +81 -0
  67. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/get_spot_delist_schedule_response_inner.py +105 -0
  68. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/get_symbols_delist_schedule_for_spot_response.py +83 -0
  69. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/get_symbols_delist_schedule_for_spot_response_inner.py +105 -0
  70. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/onboarded_vasp_list_response.py +81 -0
  71. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/onboarded_vasp_list_response_inner.py +105 -0
  72. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/one_click_arrival_deposit_apply_response.py +112 -0
  73. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/query_user_delegation_history_response.py +125 -0
  74. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/query_user_delegation_history_response_rows_inner.py +120 -0
  75. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/query_user_universal_transfer_history_response.py +127 -0
  76. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/query_user_universal_transfer_history_response_rows_inner.py +123 -0
  77. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/query_user_wallet_balance_response.py +81 -0
  78. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/query_user_wallet_balance_response_inner.py +110 -0
  79. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/submit_deposit_questionnaire_response.py +110 -0
  80. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/submit_deposit_questionnaire_travel_rule_response.py +110 -0
  81. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/system_status_response.py +103 -0
  82. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/toggle_bnb_burn_on_spot_trade_and_margin_interest_response.py +110 -0
  83. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/trade_fee_response.py +81 -0
  84. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/trade_fee_response_inner.py +110 -0
  85. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/user_asset_response.py +81 -0
  86. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/user_asset_response_inner.py +126 -0
  87. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/user_universal_transfer_response.py +102 -0
  88. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/withdraw_history_response.py +81 -0
  89. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/withdraw_history_response_inner.py +155 -0
  90. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/withdraw_history_v1_response.py +81 -0
  91. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/withdraw_history_v2_response.py +81 -0
  92. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/withdraw_history_v2_response_inner.py +171 -0
  93. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/withdraw_response.py +102 -0
  94. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/models/withdraw_travel_rule_response.py +110 -0
  95. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/rest_api/rest_api.py +1690 -0
  96. binance_sdk_wallet-1.0.0/src/binance_sdk_wallet/wallet.py +34 -0
@@ -0,0 +1,5 @@
1
+ # Changelog
2
+
3
+ ## 1.0.0 - 2025-07-17
4
+
5
+ - Initial release
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Binance
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,212 @@
1
+ Metadata-Version: 2.1
2
+ Name: binance-sdk-wallet
3
+ Version: 1.0.0
4
+ Summary: Official Binance Wallet SDK - A lightweight library that provides a convenient interface to Binance's Wallet REST API
5
+ License: MIT
6
+ Author: Binance
7
+ Requires-Python: >=3.9,<=3.13
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Programming Language :: Python :: 3.9
11
+ Classifier: Programming Language :: Python :: 3.10
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Programming Language :: Python :: 3.13
15
+ Provides-Extra: dev
16
+ Requires-Dist: aiohttp (>=3.9,<4.0)
17
+ Requires-Dist: binance-common (==1.0.0)
18
+ Requires-Dist: black (>=25.1.0,<26.0.0)
19
+ Requires-Dist: pycryptodome (>=3.17,<4.0)
20
+ Requires-Dist: pydantic (>=2.10.0)
21
+ Requires-Dist: pytest (>=6.2.5) ; extra == "dev"
22
+ Requires-Dist: requests (>=2.31.0)
23
+ Requires-Dist: ruff (>=0.12.0,<0.13.0)
24
+ Requires-Dist: websocket-client (>=1.6.3)
25
+ Requires-Dist: websockets (>=15.0.1,<16.0.0)
26
+ Description-Content-Type: text/markdown
27
+
28
+ # Binance Python Wallet SDK
29
+
30
+ [![Build Status](https://img.shields.io/github/actions/workflow/status/binance/binance-connector-python/ci-wallet.yml)](https://github.com/binance/binance-connector-python/actions)
31
+ [![Open Issues](https://img.shields.io/github/issues/binance/binance-connector-python)](https://github.com/binance/binance-connector-python/issues)
32
+ [![Code Style: Black](https://img.shields.io/badge/code_style-black-black)](https://black.readthedocs.io/en/stable/)
33
+ [![PyPI version](https://img.shields.io/pypi/v/binance-sdk-wallet)](https://pypi.python.org/pypi/binance-sdk-wallet)
34
+ [![PyPI Downloads](https://img.shields.io/pypi/dm/binance-sdk-wallet.svg)](https://pypi.org/project/binance-sdk-wallet/)
35
+ [![Python version](https://img.shields.io/pypi/pyversions/binance-connector)](https://www.python.org/downloads/)
36
+ [![Known Vulnerabilities](https://img.shields.io/badge/security-scanned-brightgreen)](https://github.com/binance/binance-connector-python/security)
37
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
38
+
39
+ This is a client library for the Binance Wallet SDK API, enabling developers to interact programmatically with Binance's Wallet trading platform. The library provides tools to interact with wallet related functions like dust convert/ query balance etc through the REST API:
40
+ - [REST API](./src/binance_sdk_wallet/rest_api/rest_api.py)
41
+
42
+ ## Table of Contents
43
+
44
+ - [Supported Features](#supported-features)
45
+ - [Installation](#installation)
46
+ - [Documentation](#documentation)
47
+ - [REST APIs](#rest-apis)
48
+ - [Testing](#testing)
49
+ - [Migration Guide](#migration-guide)
50
+ - [Contributing](#contributing)
51
+ - [Licence](#licence)
52
+
53
+ ## Supported Features
54
+
55
+ - REST API Endpoints:
56
+ - `/sapi/v1/account/*`
57
+ - `/sapi/v1/accountSnapshot/*`
58
+ - `/sapi/v1/asset/*`
59
+ - `/sapi/v3/asset/*`
60
+ - `/sapi/v1/capital/*`
61
+ - `/sapi/v1/spot/*`
62
+ - `/sapi/v1/system/*`
63
+ - `/sapi/v1/localentity/*`
64
+ - `/sapi/v2/localentity/*`
65
+ - Inclusion of test cases and examples for quick onboarding.
66
+
67
+ ## Installation
68
+
69
+ To use this library, ensure your environment is running Python version **3.9** or later.
70
+
71
+ ```bash
72
+ pip install binance-sdk-wallet
73
+ ```
74
+
75
+ ## Documentation
76
+
77
+ For detailed information, refer to the [Binance API Documentation](https://developers.binance.com/docs/wallet/Introduction).
78
+
79
+ ### REST APIs
80
+
81
+ All REST API endpoints are available through the [`rest_api`](./src/binance_sdk_wallet/rest_api/rest_api.py) module. The REST API enables you to fetch market data, manage trades, and access account information. Note that some endpoints require authentication using your Binance API credentials.
82
+
83
+ ```python
84
+ from binance_common.configuration import ConfigurationRestAPI
85
+ from binance_common.constants import WALLET_REST_API_PROD_URL
86
+ from binance_sdk_wallet.wallet import Wallet
87
+ from binance_sdk_wallet.rest_api.models import AccountInfoResponse
88
+
89
+ logging.basicConfig(level=logging.INFO)
90
+ configuration = ConfigurationRestAPI(api_key="your-api-key", api_secret="your-api-secret", base_path=WALLET_REST_API_PROD_URL)
91
+
92
+ client = Wallet(config_rest_api=configuration)
93
+
94
+ try:
95
+ response = client.rest_api.account_info()
96
+
97
+ data: AccountInfoResponse = response.data()
98
+ logging.info(f"account_info() response: {data}")
99
+ except Exception as e:
100
+ logging.error(f"account_info() error: {e}")
101
+ ```
102
+
103
+ More examples can be found in the [`examples/rest_api`](./examples/rest_api/) folder.
104
+
105
+ #### Configuration Options
106
+
107
+ The REST API supports the following advanced configuration options:
108
+
109
+ - `timeout`: Timeout for requests in milliseconds (default: 1000 ms).
110
+ - `proxy`: Proxy configuration:
111
+ - `host`: Proxy server hostname.
112
+ - `port`: Proxy server port.
113
+ - `protocol`: Proxy protocol (http or https).
114
+ - `auth`: Proxy authentication credentials:
115
+ - `username`: Proxy username.
116
+ - `password`: Proxy password.
117
+ - `keep_alive`: Enable HTTP keep-alive (default: true).
118
+ - `compression`: Enable response compression (default: true).
119
+ - `retries`: Number of retry attempts for failed requests (default: 3).
120
+ - `backoff`: Delay in milliseconds between retries (default: 1000 ms).
121
+ - `https_agent`: Custom HTTPS agent for advanced TLS configuration.
122
+ - `private_key`: RSA or ED25519 private key for authentication.
123
+ - `private_key_passphrase`: Passphrase for the private key, if encrypted.
124
+
125
+ ##### Timeout
126
+
127
+ You can configure a timeout for requests in milliseconds. If the request exceeds the specified timeout, it will be aborted. See the [Timeout example](./docs/rest_api/timeout.md) for detailed usage.
128
+
129
+ ##### Proxy
130
+
131
+ The REST API supports HTTP/HTTPS proxy configurations. See the [Proxy example](./docs/rest_api/proxy.md) for detailed usage.
132
+
133
+ ##### Keep-Alive
134
+
135
+ Enable HTTP keep-alive for persistent connections. See the [Keep-Alive example](./docs/rest_api/keepAlive.md) for detailed usage.
136
+
137
+ ##### Compression
138
+
139
+ Enable or disable response compression. See the [Compression example](./docs/rest_api/compression.md) for detailed usage.
140
+
141
+ ##### Retries
142
+
143
+ Configure the number of retry attempts and delay in milliseconds between retries for failed requests. See the [Retries example](./docs/rest_api/retries.md) for detailed usage.
144
+
145
+ ##### HTTPS Agent
146
+
147
+ Customize the HTTPS agent for advanced TLS configurations. See the [HTTPS Agent example](./docs/rest_api/httpsAgent.md) for detailed usage.
148
+
149
+ ##### Key Pair Based Authentication
150
+
151
+ The REST API supports key pair-based authentication for secure communication. You can use `RSA` or `ED25519` keys for signing requests. See the [Key Pair Based Authentication example](./docs/rest_api/key-pair-authentication.md) for detailed usage.
152
+
153
+ ##### Certificate Pinning
154
+
155
+ To enhance security, you can use certificate pinning with the `https_agent` option in the configuration. This ensures the client only communicates with servers using specific certificates. See the [Certificate Pinning example](./docs/rest_api/certificate-pinning.md) for detailed usage.
156
+
157
+ #### Error Handling
158
+
159
+ The REST API provides detailed error types to help you handle issues effectively:
160
+
161
+ - `ClientError`: Represents an error that occurred in the SDK client.
162
+ - `RequiredError`: Thrown when a required parameter is missing or undefined.
163
+ - `UnauthorizedError`: Indicates missing or invalid authentication credentials.
164
+ - `ForbiddenError`: Access to the requested resource is forbidden.
165
+ - `TooManyRequestsError`: Rate limit exceeded.
166
+ - `RateLimitBanError`: IP address banned for exceeding rate limits.
167
+ - `ServerError`: Internal server error, optionally includes a status code.
168
+ - `NetworkError`: Issues with network connectivity.
169
+ - `NotFoundError`: Resource not found.
170
+ - `BadRequestError`: Invalid request or one that cannot be served.
171
+
172
+ See the [Error Handling example](./docs/rest_api/error-handling.md) for detailed usage.
173
+
174
+ If `base_path` is not provided, it defaults to `https://api.binance.com`.
175
+
176
+ ## Testing
177
+
178
+ To run the tests, ensure you have [Poetry](https://python-poetry.org/) installed, then execute the following commands:
179
+
180
+ ```bash
181
+ poetry install
182
+ poetry run pytest ./tests
183
+ ```
184
+
185
+ The tests cover:
186
+ * REST API endpoints
187
+ * Error handling
188
+ * Edge cases
189
+
190
+ ## Migration Guide
191
+
192
+ If you are upgrading to the new modularized structure, refer to the [Migration Guide](./docs/migration_guide_wallet_sdk.md) for detailed steps.
193
+
194
+ ## Contributing
195
+
196
+ Contributions are welcome!
197
+
198
+ Since this repository contains auto-generated code, we encourage you to start by opening a GitHub issue to discuss your ideas or suggest improvements. This helps ensure that changes align with the project's goals and auto-generation processes.
199
+
200
+ To contribute:
201
+
202
+ 1. Open a GitHub issue describing your suggestion or the bug you've identified.
203
+ 2. If it's determined that changes are necessary, the maintainers will merge the changes into the main branch.
204
+
205
+ Please ensure that all tests pass if you're making a direct contribution. Submit a pull request only after discussing and confirming the change.
206
+
207
+ Thank you for your contributions!
208
+
209
+ ## Licence
210
+
211
+ This project is licensed under the MIT License. See the [LICENCE](./LICENCE) file for details.
212
+
@@ -0,0 +1,184 @@
1
+ # Binance Python Wallet SDK
2
+
3
+ [![Build Status](https://img.shields.io/github/actions/workflow/status/binance/binance-connector-python/ci-wallet.yml)](https://github.com/binance/binance-connector-python/actions)
4
+ [![Open Issues](https://img.shields.io/github/issues/binance/binance-connector-python)](https://github.com/binance/binance-connector-python/issues)
5
+ [![Code Style: Black](https://img.shields.io/badge/code_style-black-black)](https://black.readthedocs.io/en/stable/)
6
+ [![PyPI version](https://img.shields.io/pypi/v/binance-sdk-wallet)](https://pypi.python.org/pypi/binance-sdk-wallet)
7
+ [![PyPI Downloads](https://img.shields.io/pypi/dm/binance-sdk-wallet.svg)](https://pypi.org/project/binance-sdk-wallet/)
8
+ [![Python version](https://img.shields.io/pypi/pyversions/binance-connector)](https://www.python.org/downloads/)
9
+ [![Known Vulnerabilities](https://img.shields.io/badge/security-scanned-brightgreen)](https://github.com/binance/binance-connector-python/security)
10
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
11
+
12
+ This is a client library for the Binance Wallet SDK API, enabling developers to interact programmatically with Binance's Wallet trading platform. The library provides tools to interact with wallet related functions like dust convert/ query balance etc through the REST API:
13
+ - [REST API](./src/binance_sdk_wallet/rest_api/rest_api.py)
14
+
15
+ ## Table of Contents
16
+
17
+ - [Supported Features](#supported-features)
18
+ - [Installation](#installation)
19
+ - [Documentation](#documentation)
20
+ - [REST APIs](#rest-apis)
21
+ - [Testing](#testing)
22
+ - [Migration Guide](#migration-guide)
23
+ - [Contributing](#contributing)
24
+ - [Licence](#licence)
25
+
26
+ ## Supported Features
27
+
28
+ - REST API Endpoints:
29
+ - `/sapi/v1/account/*`
30
+ - `/sapi/v1/accountSnapshot/*`
31
+ - `/sapi/v1/asset/*`
32
+ - `/sapi/v3/asset/*`
33
+ - `/sapi/v1/capital/*`
34
+ - `/sapi/v1/spot/*`
35
+ - `/sapi/v1/system/*`
36
+ - `/sapi/v1/localentity/*`
37
+ - `/sapi/v2/localentity/*`
38
+ - Inclusion of test cases and examples for quick onboarding.
39
+
40
+ ## Installation
41
+
42
+ To use this library, ensure your environment is running Python version **3.9** or later.
43
+
44
+ ```bash
45
+ pip install binance-sdk-wallet
46
+ ```
47
+
48
+ ## Documentation
49
+
50
+ For detailed information, refer to the [Binance API Documentation](https://developers.binance.com/docs/wallet/Introduction).
51
+
52
+ ### REST APIs
53
+
54
+ All REST API endpoints are available through the [`rest_api`](./src/binance_sdk_wallet/rest_api/rest_api.py) module. The REST API enables you to fetch market data, manage trades, and access account information. Note that some endpoints require authentication using your Binance API credentials.
55
+
56
+ ```python
57
+ from binance_common.configuration import ConfigurationRestAPI
58
+ from binance_common.constants import WALLET_REST_API_PROD_URL
59
+ from binance_sdk_wallet.wallet import Wallet
60
+ from binance_sdk_wallet.rest_api.models import AccountInfoResponse
61
+
62
+ logging.basicConfig(level=logging.INFO)
63
+ configuration = ConfigurationRestAPI(api_key="your-api-key", api_secret="your-api-secret", base_path=WALLET_REST_API_PROD_URL)
64
+
65
+ client = Wallet(config_rest_api=configuration)
66
+
67
+ try:
68
+ response = client.rest_api.account_info()
69
+
70
+ data: AccountInfoResponse = response.data()
71
+ logging.info(f"account_info() response: {data}")
72
+ except Exception as e:
73
+ logging.error(f"account_info() error: {e}")
74
+ ```
75
+
76
+ More examples can be found in the [`examples/rest_api`](./examples/rest_api/) folder.
77
+
78
+ #### Configuration Options
79
+
80
+ The REST API supports the following advanced configuration options:
81
+
82
+ - `timeout`: Timeout for requests in milliseconds (default: 1000 ms).
83
+ - `proxy`: Proxy configuration:
84
+ - `host`: Proxy server hostname.
85
+ - `port`: Proxy server port.
86
+ - `protocol`: Proxy protocol (http or https).
87
+ - `auth`: Proxy authentication credentials:
88
+ - `username`: Proxy username.
89
+ - `password`: Proxy password.
90
+ - `keep_alive`: Enable HTTP keep-alive (default: true).
91
+ - `compression`: Enable response compression (default: true).
92
+ - `retries`: Number of retry attempts for failed requests (default: 3).
93
+ - `backoff`: Delay in milliseconds between retries (default: 1000 ms).
94
+ - `https_agent`: Custom HTTPS agent for advanced TLS configuration.
95
+ - `private_key`: RSA or ED25519 private key for authentication.
96
+ - `private_key_passphrase`: Passphrase for the private key, if encrypted.
97
+
98
+ ##### Timeout
99
+
100
+ You can configure a timeout for requests in milliseconds. If the request exceeds the specified timeout, it will be aborted. See the [Timeout example](./docs/rest_api/timeout.md) for detailed usage.
101
+
102
+ ##### Proxy
103
+
104
+ The REST API supports HTTP/HTTPS proxy configurations. See the [Proxy example](./docs/rest_api/proxy.md) for detailed usage.
105
+
106
+ ##### Keep-Alive
107
+
108
+ Enable HTTP keep-alive for persistent connections. See the [Keep-Alive example](./docs/rest_api/keepAlive.md) for detailed usage.
109
+
110
+ ##### Compression
111
+
112
+ Enable or disable response compression. See the [Compression example](./docs/rest_api/compression.md) for detailed usage.
113
+
114
+ ##### Retries
115
+
116
+ Configure the number of retry attempts and delay in milliseconds between retries for failed requests. See the [Retries example](./docs/rest_api/retries.md) for detailed usage.
117
+
118
+ ##### HTTPS Agent
119
+
120
+ Customize the HTTPS agent for advanced TLS configurations. See the [HTTPS Agent example](./docs/rest_api/httpsAgent.md) for detailed usage.
121
+
122
+ ##### Key Pair Based Authentication
123
+
124
+ The REST API supports key pair-based authentication for secure communication. You can use `RSA` or `ED25519` keys for signing requests. See the [Key Pair Based Authentication example](./docs/rest_api/key-pair-authentication.md) for detailed usage.
125
+
126
+ ##### Certificate Pinning
127
+
128
+ To enhance security, you can use certificate pinning with the `https_agent` option in the configuration. This ensures the client only communicates with servers using specific certificates. See the [Certificate Pinning example](./docs/rest_api/certificate-pinning.md) for detailed usage.
129
+
130
+ #### Error Handling
131
+
132
+ The REST API provides detailed error types to help you handle issues effectively:
133
+
134
+ - `ClientError`: Represents an error that occurred in the SDK client.
135
+ - `RequiredError`: Thrown when a required parameter is missing or undefined.
136
+ - `UnauthorizedError`: Indicates missing or invalid authentication credentials.
137
+ - `ForbiddenError`: Access to the requested resource is forbidden.
138
+ - `TooManyRequestsError`: Rate limit exceeded.
139
+ - `RateLimitBanError`: IP address banned for exceeding rate limits.
140
+ - `ServerError`: Internal server error, optionally includes a status code.
141
+ - `NetworkError`: Issues with network connectivity.
142
+ - `NotFoundError`: Resource not found.
143
+ - `BadRequestError`: Invalid request or one that cannot be served.
144
+
145
+ See the [Error Handling example](./docs/rest_api/error-handling.md) for detailed usage.
146
+
147
+ If `base_path` is not provided, it defaults to `https://api.binance.com`.
148
+
149
+ ## Testing
150
+
151
+ To run the tests, ensure you have [Poetry](https://python-poetry.org/) installed, then execute the following commands:
152
+
153
+ ```bash
154
+ poetry install
155
+ poetry run pytest ./tests
156
+ ```
157
+
158
+ The tests cover:
159
+ * REST API endpoints
160
+ * Error handling
161
+ * Edge cases
162
+
163
+ ## Migration Guide
164
+
165
+ If you are upgrading to the new modularized structure, refer to the [Migration Guide](./docs/migration_guide_wallet_sdk.md) for detailed steps.
166
+
167
+ ## Contributing
168
+
169
+ Contributions are welcome!
170
+
171
+ Since this repository contains auto-generated code, we encourage you to start by opening a GitHub issue to discuss your ideas or suggest improvements. This helps ensure that changes align with the project's goals and auto-generation processes.
172
+
173
+ To contribute:
174
+
175
+ 1. Open a GitHub issue describing your suggestion or the bug you've identified.
176
+ 2. If it's determined that changes are necessary, the maintainers will merge the changes into the main branch.
177
+
178
+ Please ensure that all tests pass if you're making a direct contribution. Submit a pull request only after discussing and confirming the change.
179
+
180
+ Thank you for your contributions!
181
+
182
+ ## Licence
183
+
184
+ This project is licensed under the MIT License. See the [LICENCE](./LICENCE) file for details.
@@ -0,0 +1,40 @@
1
+ [tool.poetry]
2
+ name = "binance-sdk-wallet"
3
+ version = "1.0.0"
4
+ description = "Official Binance Wallet SDK - A lightweight library that provides a convenient interface to Binance's Wallet REST API"
5
+ authors = ["Binance"]
6
+ license = "MIT"
7
+ readme = "README.md"
8
+ include = ["CHANGELOG.md", "LICENSE", "README.md"]
9
+ packages = [
10
+ { include = "binance_sdk_wallet", from = "src" }
11
+ ]
12
+
13
+ [tool.poetry.dependencies]
14
+ python = ">=3.9,<=3.13"
15
+ requests = ">=2.31.0"
16
+ pydantic = ">=2.10.0"
17
+ websockets = "^15.0.1"
18
+ websocket-client = ">=1.6.3"
19
+ black = "^25.1.0"
20
+ ruff = "^0.12.0"
21
+ pycryptodome = "^3.17"
22
+ aiohttp = "^3.9"
23
+ binance-common = "1.0.0"
24
+ pytest = { version = ">=6.2.5", optional = true }
25
+
26
+ [tool.poetry.extras]
27
+ dev = ["pytest"]
28
+
29
+ [tool.poetry.group.dev.dependencies]
30
+ tox = "^4.27.0"
31
+ pytest = ">=8.4.1"
32
+ pytest-asyncio = "^1.0.0"
33
+
34
+ [tool.ruff]
35
+ exclude = [".git", ".tox", "build", "dist"]
36
+ lint.ignore = ["E741"]
37
+
38
+ [build-system]
39
+ requires = ["poetry-core>=1.0.0"]
40
+ build-backend = "poetry.core.masonry.api"
@@ -0,0 +1,31 @@
1
+ from binance_sdk_wallet.wallet import Wallet
2
+ from binance_common.errors import (
3
+ ClientError,
4
+ RequiredError,
5
+ UnauthorizedError,
6
+ ForbiddenError,
7
+ TooManyRequestsError,
8
+ RateLimitBanError,
9
+ ServerError,
10
+ NetworkError,
11
+ NotFoundError,
12
+ BadRequestError,
13
+ )
14
+ from binance_common.constants import (
15
+ WALLET_REST_API_PROD_URL,
16
+ )
17
+
18
+ __all__ = [
19
+ "Wallet",
20
+ "WALLET_REST_API_PROD_URL",
21
+ "ClientError",
22
+ "RequiredError",
23
+ "UnauthorizedError",
24
+ "ForbiddenError",
25
+ "TooManyRequestsError",
26
+ "RateLimitBanError",
27
+ "ServerError",
28
+ "NetworkError",
29
+ "NotFoundError",
30
+ "BadRequestError",
31
+ ]
@@ -0,0 +1 @@
1
+ NAME = "binance-sdk-wallet"
@@ -0,0 +1,13 @@
1
+ """
2
+ Binance Wallet REST API
3
+
4
+ OpenAPI Specification for the Binance Wallet REST API
5
+ The version of the OpenAPI document: 1.0.0
6
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
7
+
8
+ Do not edit the class manually.
9
+ """
10
+
11
+ from .rest_api import WalletRestAPI
12
+
13
+ __all__ = ["WalletRestAPI"]
@@ -0,0 +1,15 @@
1
+ """
2
+ Binance Wallet REST API
3
+
4
+ OpenAPI Specification for the Binance Wallet REST API
5
+ The version of the OpenAPI document: 1.0.0
6
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
7
+
8
+ Do not edit the class manually.
9
+ """
10
+
11
+ from .account_api import AccountApi as AccountApi
12
+ from .asset_api import AssetApi as AssetApi
13
+ from .capital_api import CapitalApi as CapitalApi
14
+ from .others_api import OthersApi as OthersApi
15
+ from .travel_rule_api import TravelRuleApi as TravelRuleApi