binance-sdk-staking 1.0.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.
Files changed (73) hide show
  1. CHANGELOG.md +5 -0
  2. README.md +179 -0
  3. binance_sdk_staking/__init__.py +31 -0
  4. binance_sdk_staking/metadata.py +1 -0
  5. binance_sdk_staking/rest_api/__init__.py +13 -0
  6. binance_sdk_staking/rest_api/api/__init__.py +13 -0
  7. binance_sdk_staking/rest_api/api/eth_staking_api.py +604 -0
  8. binance_sdk_staking/rest_api/api/on_chain_yields_api.py +729 -0
  9. binance_sdk_staking/rest_api/api/sol_staking_api.py +589 -0
  10. binance_sdk_staking/rest_api/models/__init__.py +172 -0
  11. binance_sdk_staking/rest_api/models/claim_boost_rewards_response.py +102 -0
  12. binance_sdk_staking/rest_api/models/enums.py +9 -0
  13. binance_sdk_staking/rest_api/models/eth_staking_account_response.py +139 -0
  14. binance_sdk_staking/rest_api/models/eth_staking_account_response_holdings.py +105 -0
  15. binance_sdk_staking/rest_api/models/eth_staking_account_response_profit.py +110 -0
  16. binance_sdk_staking/rest_api/models/get_bnsol_rate_history_response.py +125 -0
  17. binance_sdk_staking/rest_api/models/get_bnsol_rate_history_response_rows_inner.py +140 -0
  18. binance_sdk_staking/rest_api/models/get_bnsol_rate_history_response_rows_inner_boost_rewards_inner.py +105 -0
  19. binance_sdk_staking/rest_api/models/get_bnsol_rewards_history_response.py +129 -0
  20. binance_sdk_staking/rest_api/models/get_bnsol_rewards_history_response_rows_inner.py +122 -0
  21. binance_sdk_staking/rest_api/models/get_boost_rewards_history_response.py +125 -0
  22. binance_sdk_staking/rest_api/models/get_boost_rewards_history_response_rows_inner.py +120 -0
  23. binance_sdk_staking/rest_api/models/get_current_eth_staking_quota_response.py +115 -0
  24. binance_sdk_staking/rest_api/models/get_eth_redemption_history_response.py +125 -0
  25. binance_sdk_staking/rest_api/models/get_eth_redemption_history_response_rows_inner.py +131 -0
  26. binance_sdk_staking/rest_api/models/get_eth_staking_history_response.py +125 -0
  27. binance_sdk_staking/rest_api/models/get_eth_staking_history_response_rows_inner.py +128 -0
  28. binance_sdk_staking/rest_api/models/get_on_chain_yields_locked_personal_left_quota_response.py +104 -0
  29. binance_sdk_staking/rest_api/models/get_on_chain_yields_locked_product_list_response.py +127 -0
  30. binance_sdk_staking/rest_api/models/get_on_chain_yields_locked_product_list_response_rows_inner.py +134 -0
  31. binance_sdk_staking/rest_api/models/get_on_chain_yields_locked_product_list_response_rows_inner_detail.py +136 -0
  32. binance_sdk_staking/rest_api/models/get_on_chain_yields_locked_product_list_response_rows_inner_quota.py +110 -0
  33. binance_sdk_staking/rest_api/models/get_on_chain_yields_locked_product_position_response.py +127 -0
  34. binance_sdk_staking/rest_api/models/get_on_chain_yields_locked_product_position_response_rows_inner.py +176 -0
  35. binance_sdk_staking/rest_api/models/get_on_chain_yields_locked_redemption_record_response.py +127 -0
  36. binance_sdk_staking/rest_api/models/get_on_chain_yields_locked_redemption_record_response_rows_inner.py +147 -0
  37. binance_sdk_staking/rest_api/models/get_on_chain_yields_locked_rewards_history_response.py +127 -0
  38. binance_sdk_staking/rest_api/models/get_on_chain_yields_locked_rewards_history_response_rows_inner.py +120 -0
  39. binance_sdk_staking/rest_api/models/get_on_chain_yields_locked_subscription_preview_response.py +134 -0
  40. binance_sdk_staking/rest_api/models/get_on_chain_yields_locked_subscription_record_response.py +129 -0
  41. binance_sdk_staking/rest_api/models/get_on_chain_yields_locked_subscription_record_response_rows_inner.py +144 -0
  42. binance_sdk_staking/rest_api/models/get_sol_redemption_history_response.py +125 -0
  43. binance_sdk_staking/rest_api/models/get_sol_redemption_history_response_rows_inner.py +131 -0
  44. binance_sdk_staking/rest_api/models/get_sol_staking_history_response.py +125 -0
  45. binance_sdk_staking/rest_api/models/get_sol_staking_history_response_rows_inner.py +128 -0
  46. binance_sdk_staking/rest_api/models/get_sol_staking_quota_details_response.py +144 -0
  47. binance_sdk_staking/rest_api/models/get_unclaimed_rewards_response.py +81 -0
  48. binance_sdk_staking/rest_api/models/get_unclaimed_rewards_response_inner.py +105 -0
  49. binance_sdk_staking/rest_api/models/get_wbeth_rate_history_response.py +125 -0
  50. binance_sdk_staking/rest_api/models/get_wbeth_rate_history_response_rows_inner.py +112 -0
  51. binance_sdk_staking/rest_api/models/get_wbeth_rewards_history_response.py +129 -0
  52. binance_sdk_staking/rest_api/models/get_wbeth_rewards_history_response_rows_inner.py +122 -0
  53. binance_sdk_staking/rest_api/models/get_wbeth_unwrap_history_response.py +125 -0
  54. binance_sdk_staking/rest_api/models/get_wbeth_unwrap_history_response_rows_inner.py +126 -0
  55. binance_sdk_staking/rest_api/models/get_wbeth_wrap_history_response.py +125 -0
  56. binance_sdk_staking/rest_api/models/get_wbeth_wrap_history_response_rows_inner.py +126 -0
  57. binance_sdk_staking/rest_api/models/on_chain_yields_account_response.py +135 -0
  58. binance_sdk_staking/rest_api/models/redeem_eth_response.py +117 -0
  59. binance_sdk_staking/rest_api/models/redeem_on_chain_yields_locked_product_response.py +105 -0
  60. binance_sdk_staking/rest_api/models/redeem_sol_response.py +117 -0
  61. binance_sdk_staking/rest_api/models/set_on_chain_yields_locked_auto_subscribe_response.py +102 -0
  62. binance_sdk_staking/rest_api/models/set_on_chain_yields_locked_product_redeem_option_response.py +102 -0
  63. binance_sdk_staking/rest_api/models/sol_staking_account_response.py +116 -0
  64. binance_sdk_staking/rest_api/models/subscribe_eth_staking_response.py +110 -0
  65. binance_sdk_staking/rest_api/models/subscribe_on_chain_yields_locked_product_response.py +117 -0
  66. binance_sdk_staking/rest_api/models/subscribe_sol_staking_response.py +110 -0
  67. binance_sdk_staking/rest_api/models/wrap_beth_response.py +110 -0
  68. binance_sdk_staking/rest_api/rest_api.py +1291 -0
  69. binance_sdk_staking/staking.py +34 -0
  70. binance_sdk_staking-1.0.0.dist-info/LICENCE +21 -0
  71. binance_sdk_staking-1.0.0.dist-info/METADATA +207 -0
  72. binance_sdk_staking-1.0.0.dist-info/RECORD +73 -0
  73. binance_sdk_staking-1.0.0.dist-info/WHEEL +4 -0
CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ # Changelog
2
+
3
+ ## 1.0.0 - 2025-07-17
4
+
5
+ - Initial release
README.md ADDED
@@ -0,0 +1,179 @@
1
+ # Binance Python Staking SDK
2
+
3
+ [![Build Status](https://img.shields.io/github/actions/workflow/status/binance/binance-connector-python/ci-staking.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-staking)](https://pypi.python.org/pypi/binance-sdk-staking)
7
+ [![PyPI Downloads](https://img.shields.io/pypi/dm/binance-sdk-staking.svg)](https://pypi.org/project/binance-sdk-staking/)
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 Staking SDK API, enabling developers to interact programmatically with Binance's Staking trading platform. The library provides tools to participate in certain DeFi products, obtains and distributes realized earnings through the REST API:
13
+
14
+ - [REST API](./src/binance_sdk_staking/rest_api/rest_api.py)
15
+
16
+ ## Table of Contents
17
+
18
+ - [Supported Features](#supported-features)
19
+ - [Installation](#installation)
20
+ - [Documentation](#documentation)
21
+ - [REST APIs](#rest-apis)
22
+ - [Testing](#testing)
23
+ - [Migration Guide](#migration-guide)
24
+ - [Contributing](#contributing)
25
+ - [Licence](#licence)
26
+
27
+ ## Supported Features
28
+
29
+ - REST API Endpoints:
30
+ - `/sapi/v1/eth-staking/*`
31
+ - `/sapi/v2/eth-staking/*`
32
+ - `/sapi/v1/sol-staking/*`
33
+ - Inclusion of test cases and examples for quick onboarding.
34
+
35
+ ## Installation
36
+
37
+ To use this library, ensure your environment is running Python version **3.9** or later.
38
+
39
+ ```bash
40
+ pip install binance-sdk-staking
41
+ ```
42
+
43
+ ## Documentation
44
+
45
+ For detailed information, refer to the [Binance API Documentation](https://developers.binance.com/docs/staking/Introduction).
46
+
47
+ ### REST APIs
48
+
49
+ All REST API endpoints are available through the [`rest_api`](./src/binance_sdk_staking/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.
50
+
51
+ ```python
52
+ from binance_common.configuration import ConfigurationRestAPI
53
+ from binance_common.constants import STAKING_REST_API_PROD_URL
54
+ from binance_sdk_staking.staking import Staking
55
+ from binance_sdk_staking.rest_api.models import ClaimBoostRewardsResponse
56
+
57
+ logging.basicConfig(level=logging.INFO)
58
+ configuration = ConfigurationRestAPI(api_key="your-api-key", api_secret="your-api-secret", base_path=STAKING_REST_API_PROD_URL)
59
+
60
+ client = Staking(config_rest_api=configuration)
61
+
62
+ try:
63
+ response = client.rest_api.claim_boost_rewards()
64
+
65
+ data: ClaimBoostRewardsResponse = response.data()
66
+ logging.info(f"claim_boost_rewards() response: {data}")
67
+ except Exception as e:
68
+ logging.error(f"claim_boost_rewards() error: {e}")
69
+ ```
70
+
71
+ More examples can be found in the [`examples/rest_api`](./examples/rest_api/) folder.
72
+
73
+ #### Configuration Options
74
+
75
+ The REST API supports the following advanced configuration options:
76
+
77
+ - `timeout`: Timeout for requests in milliseconds (default: 1000 ms).
78
+ - `proxy`: Proxy configuration:
79
+ - `host`: Proxy server hostname.
80
+ - `port`: Proxy server port.
81
+ - `protocol`: Proxy protocol (http or https).
82
+ - `auth`: Proxy authentication credentials:
83
+ - `username`: Proxy username.
84
+ - `password`: Proxy password.
85
+ - `keep_alive`: Enable HTTP keep-alive (default: true).
86
+ - `compression`: Enable response compression (default: true).
87
+ - `retries`: Number of retry attempts for failed requests (default: 3).
88
+ - `backoff`: Delay in milliseconds between retries (default: 1000 ms).
89
+ - `https_agent`: Custom HTTPS agent for advanced TLS configuration.
90
+ - `private_key`: RSA or ED25519 private key for authentication.
91
+ - `private_key_passphrase`: Passphrase for the private key, if encrypted.
92
+
93
+ ##### Timeout
94
+
95
+ 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.
96
+
97
+ ##### Proxy
98
+
99
+ The REST API supports HTTP/HTTPS proxy configurations. See the [Proxy example](./docs/rest_api/proxy.md) for detailed usage.
100
+
101
+ ##### Keep-Alive
102
+
103
+ Enable HTTP keep-alive for persistent connections. See the [Keep-Alive example](./docs/rest_api/keepAlive.md) for detailed usage.
104
+
105
+ ##### Compression
106
+
107
+ Enable or disable response compression. See the [Compression example](./docs/rest_api/compression.md) for detailed usage.
108
+
109
+ ##### Retries
110
+
111
+ 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.
112
+
113
+ ##### HTTPS Agent
114
+
115
+ Customize the HTTPS agent for advanced TLS configurations. See the [HTTPS Agent example](./docs/rest_api/httpsAgent.md) for detailed usage.
116
+
117
+ ##### Key Pair Based Authentication
118
+
119
+ 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.
120
+
121
+ ##### Certificate Pinning
122
+
123
+ 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.
124
+
125
+ #### Error Handling
126
+
127
+ The REST API provides detailed error types to help you handle issues effectively:
128
+
129
+ - `ClientError`: Represents an error that occurred in the SDK client.
130
+ - `RequiredError`: Thrown when a required parameter is missing or undefined.
131
+ - `UnauthorizedError`: Indicates missing or invalid authentication credentials.
132
+ - `ForbiddenError`: Access to the requested resource is forbidden.
133
+ - `TooManyRequestsError`: Rate limit exceeded.
134
+ - `RateLimitBanError`: IP address banned for exceeding rate limits.
135
+ - `ServerError`: Internal server error, optionally includes a status code.
136
+ - `NetworkError`: Issues with network connectivity.
137
+ - `NotFoundError`: Resource not found.
138
+ - `BadRequestError`: Invalid request or one that cannot be served.
139
+
140
+ See the [Error Handling example](./docs/rest_api/error-handling.md) for detailed usage.
141
+
142
+ If `base_path` is not provided, it defaults to `https://api.binance.com`.
143
+
144
+ ## Testing
145
+
146
+ To run the tests, ensure you have [Poetry](https://python-poetry.org/) installed, then execute the following commands:
147
+
148
+ ```bash
149
+ poetry install
150
+ poetry run pytest ./tests
151
+ ```
152
+
153
+ The tests cover:
154
+ * REST API endpoints
155
+ * Error handling
156
+ * Edge cases
157
+
158
+ ## Migration Guide
159
+
160
+ If you are upgrading to the new modularized structure, refer to the [Migration Guide](./docs/migration_guide_staking_sdk.md) for detailed steps.
161
+
162
+ ## Contributing
163
+
164
+ Contributions are welcome!
165
+
166
+ 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.
167
+
168
+ To contribute:
169
+
170
+ 1. Open a GitHub issue describing your suggestion or the bug you've identified.
171
+ 2. If it's determined that changes are necessary, the maintainers will merge the changes into the main branch.
172
+
173
+ Please ensure that all tests pass if you're making a direct contribution. Submit a pull request only after discussing and confirming the change.
174
+
175
+ Thank you for your contributions!
176
+
177
+ ## Licence
178
+
179
+ This project is licensed under the MIT License. See the [LICENCE](./LICENCE) file for details.
@@ -0,0 +1,31 @@
1
+ from binance_sdk_staking.staking import Staking
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
+ STAKING_REST_API_PROD_URL,
16
+ )
17
+
18
+ __all__ = [
19
+ "Staking",
20
+ "STAKING_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-staking"
@@ -0,0 +1,13 @@
1
+ """
2
+ Binance Staking REST API
3
+
4
+ OpenAPI Specification for the Binance Staking 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 StakingRestAPI
12
+
13
+ __all__ = ["StakingRestAPI"]
@@ -0,0 +1,13 @@
1
+ """
2
+ Binance Staking REST API
3
+
4
+ OpenAPI Specification for the Binance Staking 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 .eth_staking_api import EthStakingApi as EthStakingApi
12
+ from .on_chain_yields_api import OnChainYieldsApi as OnChainYieldsApi
13
+ from .sol_staking_api import SolStakingApi as SolStakingApi