binance-sdk-fiat 5.2.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 (24) hide show
  1. binance_sdk_fiat-5.2.0/CHANGELOG.md +92 -0
  2. binance_sdk_fiat-5.2.0/LICENCE +21 -0
  3. binance_sdk_fiat-5.2.0/PKG-INFO +206 -0
  4. binance_sdk_fiat-5.2.0/README.md +176 -0
  5. binance_sdk_fiat-5.2.0/pyproject.toml +40 -0
  6. binance_sdk_fiat-5.2.0/src/binance_sdk_fiat/__init__.py +31 -0
  7. binance_sdk_fiat-5.2.0/src/binance_sdk_fiat/fiat.py +34 -0
  8. binance_sdk_fiat-5.2.0/src/binance_sdk_fiat/metadata.py +1 -0
  9. binance_sdk_fiat-5.2.0/src/binance_sdk_fiat/rest_api/__init__.py +13 -0
  10. binance_sdk_fiat-5.2.0/src/binance_sdk_fiat/rest_api/api/__init__.py +11 -0
  11. binance_sdk_fiat-5.2.0/src/binance_sdk_fiat/rest_api/api/fiat_api.py +390 -0
  12. binance_sdk_fiat-5.2.0/src/binance_sdk_fiat/rest_api/models/__init__.py +30 -0
  13. binance_sdk_fiat-5.2.0/src/binance_sdk_fiat/rest_api/models/account_info.py +102 -0
  14. binance_sdk_fiat-5.2.0/src/binance_sdk_fiat/rest_api/models/deposit_response.py +118 -0
  15. binance_sdk_fiat-5.2.0/src/binance_sdk_fiat/rest_api/models/deposit_response_data.py +102 -0
  16. binance_sdk_fiat-5.2.0/src/binance_sdk_fiat/rest_api/models/enums.py +9 -0
  17. binance_sdk_fiat-5.2.0/src/binance_sdk_fiat/rest_api/models/fiat_withdraw_response.py +118 -0
  18. binance_sdk_fiat-5.2.0/src/binance_sdk_fiat/rest_api/models/get_fiat_deposit_withdraw_history_response.py +131 -0
  19. binance_sdk_fiat-5.2.0/src/binance_sdk_fiat/rest_api/models/get_fiat_deposit_withdraw_history_response_data_inner.py +132 -0
  20. binance_sdk_fiat-5.2.0/src/binance_sdk_fiat/rest_api/models/get_fiat_payments_history_response.py +131 -0
  21. binance_sdk_fiat-5.2.0/src/binance_sdk_fiat/rest_api/models/get_fiat_payments_history_response_data_inner.py +138 -0
  22. binance_sdk_fiat-5.2.0/src/binance_sdk_fiat/rest_api/models/get_order_detail_response.py +120 -0
  23. binance_sdk_fiat-5.2.0/src/binance_sdk_fiat/rest_api/models/get_order_detail_response_data.py +129 -0
  24. binance_sdk_fiat-5.2.0/src/binance_sdk_fiat/rest_api/rest_api.py +295 -0
@@ -0,0 +1,92 @@
1
+ # Changelog
2
+
3
+ ## 5.2.0 - 2026-01-29
4
+
5
+ ### Changed (1)
6
+
7
+ - Updated `binance-common` library to version `3.5.0`
8
+
9
+ ## 5.1.0 - 2026-01-23
10
+
11
+ ### Changed (1)
12
+
13
+ - Updated `binance-common` library to version `3.4.1`
14
+
15
+ ## 5.0.0 - 2025-01-13
16
+
17
+ ### Changed (1)
18
+
19
+ - Updated `binance-common` library to version `3.4.0`
20
+
21
+ ### Removed (2)
22
+
23
+ - `fiat_withdraw()` (`GET /sapi/v2/fiat/withdraw`)
24
+ - `get_order_detail()` (`GET /sapi/v1/fiat/get-order-detail`)
25
+
26
+ ## 4.0.0 - 2025-12-22
27
+
28
+ ### Changed (2)
29
+
30
+ - Updated `binance-common` library to version `3.3.0`
31
+ - Add `Body` to Rest API request
32
+
33
+ ## 3.0.0 - 2025-11-24
34
+
35
+ ### Removed (2)
36
+
37
+ - `fiat_withdraw()` (`GET /sapi/v2/fiat/withdraw`)
38
+ - `get_order_detail()` (`GET /sapi/v1/fiat/get-order-detail`)
39
+
40
+ ## 2.0.0 - 2025-11-14
41
+
42
+ ### Added (2)
43
+
44
+ - `fiat_withdraw()` (`GET /sapi/v2/fiat/withdraw`)
45
+ - `get_order_detail()` (`GET /sapi/v1/fiat/get-order-detail`)
46
+
47
+ ## 1.7.0 - 2025-10-10
48
+
49
+ ### Changed (1)
50
+
51
+ - Updated `binance-common` library to version `3.2.0`
52
+
53
+ ## 1.6.0 - 2025-09-16
54
+
55
+ ### Changed (1)
56
+
57
+ - Updated `binance-common` library to version `3.1.1`
58
+
59
+ ## 1.5.0 - 2025-09-12
60
+
61
+ ### Changed (1)
62
+
63
+ - Updated `binance-common` library to version `3.1.0`
64
+
65
+ ## 1.4.0 - 2025-09-05
66
+
67
+ ### Changed (1)
68
+
69
+ - Updated `binance-common` library to version `3.0.0`
70
+
71
+ ## 1.3.0 - 2025-08-22
72
+
73
+ ### Changed (1)
74
+
75
+ - Standardized type hints for required parameters by replacing `default = None` annotations with `Union[..., None]`
76
+
77
+ ## 1.2.0 - 2025-08-07
78
+
79
+ ### Changed (1)
80
+
81
+ - Updated `binance-common` library to version `1.2.0`
82
+
83
+ ## 1.1.0 - 2025-08-06
84
+
85
+ ### Changed (2)
86
+
87
+ - Updated `binance-common` library to version `1.1.0`
88
+ - Added python version `3.13`
89
+
90
+ ## 1.0.0 - 2025-07-17
91
+
92
+ - 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,206 @@
1
+ Metadata-Version: 2.4
2
+ Name: binance-sdk-fiat
3
+ Version: 5.2.0
4
+ Summary: Official Binance Fiat SDK - A lightweight library that provides a convenient interface to Binance's Fiat REST API
5
+ License: MIT
6
+ License-File: LICENCE
7
+ Author: Binance
8
+ Requires-Python: >=3.9,<3.15
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.9
12
+ Classifier: Programming Language :: Python :: 3.10
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Programming Language :: Python :: 3.14
17
+ Provides-Extra: dev
18
+ Requires-Dist: aiohttp (>=3.9,<4.0)
19
+ Requires-Dist: binance-common (==3.5.0)
20
+ Requires-Dist: black (>=25.1.0,<26.0.0)
21
+ Requires-Dist: pycryptodome (>=3.17,<4.0)
22
+ Requires-Dist: pydantic (>=2.10.0)
23
+ Requires-Dist: pytest (>=6.2.5) ; extra == "dev"
24
+ Requires-Dist: requests (>=2.31.0)
25
+ Requires-Dist: ruff (>=0.12.0,<0.13.0)
26
+ Requires-Dist: websocket-client (>=1.6.3)
27
+ Requires-Dist: websockets (>=15.0.1,<16.0.0)
28
+ Description-Content-Type: text/markdown
29
+
30
+ # Binance Python Fiat SDK
31
+
32
+ [![Build Status](https://img.shields.io/github/actions/workflow/status/binance/binance-connector-python/ci.yaml)](https://github.com/binance/binance-connector-python/actions)
33
+ [![Open Issues](https://img.shields.io/github/issues/binance/binance-connector-python)](https://github.com/binance/binance-connector-python/issues)
34
+ [![Code Style: Black](https://img.shields.io/badge/code_style-black-black)](https://black.readthedocs.io/en/stable/)
35
+ [![PyPI version](https://img.shields.io/pypi/v/binance-sdk-fiat)](https://pypi.python.org/pypi/binance-sdk-fiat)
36
+ [![PyPI Downloads](https://img.shields.io/pypi/dm/binance-sdk-fiat.svg)](https://pypi.org/project/binance-sdk-fiat/)
37
+ [![Python version](https://img.shields.io/pypi/pyversions/binance-sdk-fiat)](https://www.python.org/downloads/)
38
+ [![Known Vulnerabilities](https://img.shields.io/badge/security-scanned-brightgreen)](https://github.com/binance/binance-connector-python/security)
39
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
40
+
41
+ This is a client library for the Binance Fiat SDK API, enabling developers to interact programmatically with Binance's Fiat trading platform. The library provides tools to get Binance Fiat SDK Deposit/Withdraw history through the REST API:
42
+ - [REST API](./src/binance_sdk_fiat/rest_api/rest_api.py)
43
+
44
+ ## Table of Contents
45
+
46
+ - [Supported Features](#supported-features)
47
+ - [Installation](#installation)
48
+ - [Documentation](#documentation)
49
+ - [REST APIs](#rest-apis)
50
+ - [Testing](#testing)
51
+ - [Migration Guide](#migration-guide)
52
+ - [Contributing](#contributing)
53
+ - [Licence](#licence)
54
+
55
+ ## Supported Features
56
+
57
+ - REST API Endpoints:
58
+ - `/sapi/v1/fiat/*`
59
+ - Inclusion of test cases and examples for quick onboarding.
60
+
61
+ ## Installation
62
+
63
+ To use this library, ensure your environment is running Python version **3.9** or later.
64
+
65
+ ```bash
66
+ pip install binance-sdk-fiat
67
+ ```
68
+
69
+ ## Documentation
70
+
71
+ For detailed information, refer to the [Binance API Documentation](https://developers.binance.com/docs/fiat/Introduction).
72
+
73
+ ### REST APIs
74
+
75
+ All REST API endpoints are available through the [`rest_api`](./src/binance_sdk_fiat/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.
76
+
77
+ ```python
78
+ from binance_common.configuration import ConfigurationRestAPI
79
+ from binance_common.constants import FIAT_REST_API_PROD_URL
80
+ from binance_sdk_fiat.fiat import Fiat
81
+ from binance_sdk_fiat.rest_api.models import GetFiatDepositWithdrawHistoryResponse
82
+
83
+ logging.basicConfig(level=logging.INFO)
84
+ configuration = ConfigurationRestAPI(api_key="your-api-key", api_secret="your-api-secret", base_path=FIAT_REST_API_PROD_URL)
85
+
86
+ client = Fiat(config_rest_api=configuration)
87
+
88
+ try:
89
+ response = client.rest_api.get_fiat_deposit_withdraw_history()
90
+
91
+ data: GetFiatDepositWithdrawHistoryResponse = response.data()
92
+ logging.info(f"get_fiat_deposit_withdraw_history() response: {data}")
93
+ except Exception as e:
94
+ logging.error(f"get_fiat_deposit_withdraw_history() error: {e}")
95
+ ```
96
+
97
+ More examples can be found in the [`examples/rest_api`](./examples/rest_api/) folder.
98
+
99
+ #### Configuration Options
100
+
101
+ The REST API supports the following advanced configuration options:
102
+
103
+ - `timeout`: Timeout for requests in milliseconds (default: 1000 ms).
104
+ - `proxy`: Proxy configuration:
105
+ - `host`: Proxy server hostname.
106
+ - `port`: Proxy server port.
107
+ - `protocol`: Proxy protocol (http or https).
108
+ - `auth`: Proxy authentication credentials:
109
+ - `username`: Proxy username.
110
+ - `password`: Proxy password.
111
+ - `keep_alive`: Enable HTTP keep-alive (default: true).
112
+ - `compression`: Enable response compression (default: true).
113
+ - `retries`: Number of retry attempts for failed requests (default: 3).
114
+ - `backoff`: Delay in milliseconds between retries (default: 1000 ms).
115
+ - `https_agent`: Custom HTTPS agent for advanced TLS configuration.
116
+ - `private_key`: RSA or ED25519 private key for authentication.
117
+ - `private_key_passphrase`: Passphrase for the private key, if encrypted.
118
+
119
+ ##### Timeout
120
+
121
+ 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.
122
+
123
+ ##### Proxy
124
+
125
+ The REST API supports HTTP/HTTPS proxy configurations. See the [Proxy example](./docs/rest_api/proxy.md) for detailed usage.
126
+
127
+ ##### Keep-Alive
128
+
129
+ Enable HTTP keep-alive for persistent connections. See the [Keep-Alive example](./docs/rest_api/keepAlive.md) for detailed usage.
130
+
131
+ ##### Compression
132
+
133
+ Enable or disable response compression. See the [Compression example](./docs/rest_api/compression.md) for detailed usage.
134
+
135
+ ##### Retries
136
+
137
+ 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.
138
+
139
+ ##### HTTPS Agent
140
+
141
+ Customize the HTTPS agent for advanced TLS configurations. See the [HTTPS Agent example](./docs/rest_api/httpsAgent.md) for detailed usage.
142
+
143
+ ##### Key Pair Based Authentication
144
+
145
+ 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.
146
+
147
+ ##### Certificate Pinning
148
+
149
+ 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.
150
+
151
+ #### Error Handling
152
+
153
+ The REST API provides detailed error types to help you handle issues effectively:
154
+
155
+ - `ClientError`: Represents an error that occurred in the SDK client.
156
+ - `RequiredError`: Thrown when a required parameter is missing or undefined.
157
+ - `UnauthorizedError`: Indicates missing or invalid authentication credentials.
158
+ - `ForbiddenError`: Access to the requested resource is forbidden.
159
+ - `TooManyRequestsError`: Rate limit exceeded.
160
+ - `RateLimitBanError`: IP address banned for exceeding rate limits.
161
+ - `ServerError`: Internal server error, optionally includes a status code.
162
+ - `NetworkError`: Issues with network connectivity.
163
+ - `NotFoundError`: Resource not found.
164
+ - `BadRequestError`: Invalid request or one that cannot be served.
165
+
166
+ See the [Error Handling example](./docs/rest_api/error-handling.md) for detailed usage.
167
+
168
+ If `base_path` is not provided, it defaults to `https://api.binance.com`.
169
+
170
+ ## Testing
171
+
172
+ To run the tests, ensure you have [Poetry](https://python-poetry.org/) installed, then execute the following commands:
173
+
174
+ ```bash
175
+ poetry install
176
+ poetry run pytest ./tests
177
+ ```
178
+
179
+ The tests cover:
180
+ * REST API endpoints
181
+ * Error handling
182
+ * Edge cases
183
+
184
+ ## Migration Guide
185
+
186
+ If you are upgrading to the new modularized structure, refer to the [Migration Guide](./docs/migration_guide_fiat_sdk.md) for detailed steps.
187
+
188
+ ## Contributing
189
+
190
+ Contributions are welcome!
191
+
192
+ 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.
193
+
194
+ To contribute:
195
+
196
+ 1. Open a GitHub issue describing your suggestion or the bug you've identified.
197
+ 2. If it's determined that changes are necessary, the maintainers will merge the changes into the main branch.
198
+
199
+ Please ensure that all tests pass if you're making a direct contribution. Submit a pull request only after discussing and confirming the change.
200
+
201
+ Thank you for your contributions!
202
+
203
+ ## Licence
204
+
205
+ This project is licensed under the MIT License. See the [LICENCE](./LICENCE) file for details.
206
+
@@ -0,0 +1,176 @@
1
+ # Binance Python Fiat SDK
2
+
3
+ [![Build Status](https://img.shields.io/github/actions/workflow/status/binance/binance-connector-python/ci.yaml)](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-fiat)](https://pypi.python.org/pypi/binance-sdk-fiat)
7
+ [![PyPI Downloads](https://img.shields.io/pypi/dm/binance-sdk-fiat.svg)](https://pypi.org/project/binance-sdk-fiat/)
8
+ [![Python version](https://img.shields.io/pypi/pyversions/binance-sdk-fiat)](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 Fiat SDK API, enabling developers to interact programmatically with Binance's Fiat trading platform. The library provides tools to get Binance Fiat SDK Deposit/Withdraw history through the REST API:
13
+ - [REST API](./src/binance_sdk_fiat/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/fiat/*`
30
+ - Inclusion of test cases and examples for quick onboarding.
31
+
32
+ ## Installation
33
+
34
+ To use this library, ensure your environment is running Python version **3.9** or later.
35
+
36
+ ```bash
37
+ pip install binance-sdk-fiat
38
+ ```
39
+
40
+ ## Documentation
41
+
42
+ For detailed information, refer to the [Binance API Documentation](https://developers.binance.com/docs/fiat/Introduction).
43
+
44
+ ### REST APIs
45
+
46
+ All REST API endpoints are available through the [`rest_api`](./src/binance_sdk_fiat/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.
47
+
48
+ ```python
49
+ from binance_common.configuration import ConfigurationRestAPI
50
+ from binance_common.constants import FIAT_REST_API_PROD_URL
51
+ from binance_sdk_fiat.fiat import Fiat
52
+ from binance_sdk_fiat.rest_api.models import GetFiatDepositWithdrawHistoryResponse
53
+
54
+ logging.basicConfig(level=logging.INFO)
55
+ configuration = ConfigurationRestAPI(api_key="your-api-key", api_secret="your-api-secret", base_path=FIAT_REST_API_PROD_URL)
56
+
57
+ client = Fiat(config_rest_api=configuration)
58
+
59
+ try:
60
+ response = client.rest_api.get_fiat_deposit_withdraw_history()
61
+
62
+ data: GetFiatDepositWithdrawHistoryResponse = response.data()
63
+ logging.info(f"get_fiat_deposit_withdraw_history() response: {data}")
64
+ except Exception as e:
65
+ logging.error(f"get_fiat_deposit_withdraw_history() error: {e}")
66
+ ```
67
+
68
+ More examples can be found in the [`examples/rest_api`](./examples/rest_api/) folder.
69
+
70
+ #### Configuration Options
71
+
72
+ The REST API supports the following advanced configuration options:
73
+
74
+ - `timeout`: Timeout for requests in milliseconds (default: 1000 ms).
75
+ - `proxy`: Proxy configuration:
76
+ - `host`: Proxy server hostname.
77
+ - `port`: Proxy server port.
78
+ - `protocol`: Proxy protocol (http or https).
79
+ - `auth`: Proxy authentication credentials:
80
+ - `username`: Proxy username.
81
+ - `password`: Proxy password.
82
+ - `keep_alive`: Enable HTTP keep-alive (default: true).
83
+ - `compression`: Enable response compression (default: true).
84
+ - `retries`: Number of retry attempts for failed requests (default: 3).
85
+ - `backoff`: Delay in milliseconds between retries (default: 1000 ms).
86
+ - `https_agent`: Custom HTTPS agent for advanced TLS configuration.
87
+ - `private_key`: RSA or ED25519 private key for authentication.
88
+ - `private_key_passphrase`: Passphrase for the private key, if encrypted.
89
+
90
+ ##### Timeout
91
+
92
+ 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.
93
+
94
+ ##### Proxy
95
+
96
+ The REST API supports HTTP/HTTPS proxy configurations. See the [Proxy example](./docs/rest_api/proxy.md) for detailed usage.
97
+
98
+ ##### Keep-Alive
99
+
100
+ Enable HTTP keep-alive for persistent connections. See the [Keep-Alive example](./docs/rest_api/keepAlive.md) for detailed usage.
101
+
102
+ ##### Compression
103
+
104
+ Enable or disable response compression. See the [Compression example](./docs/rest_api/compression.md) for detailed usage.
105
+
106
+ ##### Retries
107
+
108
+ 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.
109
+
110
+ ##### HTTPS Agent
111
+
112
+ Customize the HTTPS agent for advanced TLS configurations. See the [HTTPS Agent example](./docs/rest_api/httpsAgent.md) for detailed usage.
113
+
114
+ ##### Key Pair Based Authentication
115
+
116
+ 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.
117
+
118
+ ##### Certificate Pinning
119
+
120
+ 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.
121
+
122
+ #### Error Handling
123
+
124
+ The REST API provides detailed error types to help you handle issues effectively:
125
+
126
+ - `ClientError`: Represents an error that occurred in the SDK client.
127
+ - `RequiredError`: Thrown when a required parameter is missing or undefined.
128
+ - `UnauthorizedError`: Indicates missing or invalid authentication credentials.
129
+ - `ForbiddenError`: Access to the requested resource is forbidden.
130
+ - `TooManyRequestsError`: Rate limit exceeded.
131
+ - `RateLimitBanError`: IP address banned for exceeding rate limits.
132
+ - `ServerError`: Internal server error, optionally includes a status code.
133
+ - `NetworkError`: Issues with network connectivity.
134
+ - `NotFoundError`: Resource not found.
135
+ - `BadRequestError`: Invalid request or one that cannot be served.
136
+
137
+ See the [Error Handling example](./docs/rest_api/error-handling.md) for detailed usage.
138
+
139
+ If `base_path` is not provided, it defaults to `https://api.binance.com`.
140
+
141
+ ## Testing
142
+
143
+ To run the tests, ensure you have [Poetry](https://python-poetry.org/) installed, then execute the following commands:
144
+
145
+ ```bash
146
+ poetry install
147
+ poetry run pytest ./tests
148
+ ```
149
+
150
+ The tests cover:
151
+ * REST API endpoints
152
+ * Error handling
153
+ * Edge cases
154
+
155
+ ## Migration Guide
156
+
157
+ If you are upgrading to the new modularized structure, refer to the [Migration Guide](./docs/migration_guide_fiat_sdk.md) for detailed steps.
158
+
159
+ ## Contributing
160
+
161
+ Contributions are welcome!
162
+
163
+ 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.
164
+
165
+ To contribute:
166
+
167
+ 1. Open a GitHub issue describing your suggestion or the bug you've identified.
168
+ 2. If it's determined that changes are necessary, the maintainers will merge the changes into the main branch.
169
+
170
+ Please ensure that all tests pass if you're making a direct contribution. Submit a pull request only after discussing and confirming the change.
171
+
172
+ Thank you for your contributions!
173
+
174
+ ## Licence
175
+
176
+ 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-fiat"
3
+ version = "5.2.0"
4
+ description = "Official Binance Fiat SDK - A lightweight library that provides a convenient interface to Binance's Fiat 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_fiat", from = "src" }
11
+ ]
12
+
13
+ [tool.poetry.dependencies]
14
+ python = ">=3.9,<3.15"
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 = "3.5.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_fiat.fiat import Fiat
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
+ FIAT_REST_API_PROD_URL,
16
+ )
17
+
18
+ __all__ = [
19
+ "Fiat",
20
+ "FIAT_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,34 @@
1
+ import platform
2
+ from importlib.metadata import version
3
+
4
+ from binance_common.configuration import ConfigurationRestAPI
5
+ from binance_common.constants import FIAT_REST_API_PROD_URL
6
+ from . import metadata
7
+ from .rest_api import FiatRestAPI
8
+
9
+ LIB_NAME = metadata.NAME
10
+ LIB_VERSION = version(LIB_NAME)
11
+
12
+
13
+ class Fiat:
14
+ """Fiat API that exposes REST APIs in a single interface."""
15
+
16
+ def __init__(self, config_rest_api: ConfigurationRestAPI = None) -> None:
17
+ self._rest_api = None
18
+ self._rest_api_config = (
19
+ ConfigurationRestAPI() if config_rest_api is None else config_rest_api
20
+ )
21
+
22
+ @property
23
+ def rest_api(self) -> FiatRestAPI:
24
+ if self._rest_api is None and self._rest_api_config:
25
+ self._rest_api_config.base_headers["User-Agent"] = (
26
+ f"{LIB_NAME}/{LIB_VERSION} (Python/{platform.python_version()}; {platform.system()}; {platform.machine()})"
27
+ )
28
+ self._rest_api_config.base_path = (
29
+ FIAT_REST_API_PROD_URL
30
+ if self._rest_api_config.base_path is None
31
+ else self._rest_api_config.base_path
32
+ )
33
+ self._rest_api = FiatRestAPI(self._rest_api_config)
34
+ return self._rest_api
@@ -0,0 +1 @@
1
+ NAME = "binance-sdk-fiat"
@@ -0,0 +1,13 @@
1
+ """
2
+ Binance Fiat REST API
3
+
4
+ OpenAPI Specification for the Binance Fiat 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 FiatRestAPI
12
+
13
+ __all__ = ["FiatRestAPI"]
@@ -0,0 +1,11 @@
1
+ """
2
+ Binance Fiat REST API
3
+
4
+ OpenAPI Specification for the Binance Fiat 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 .fiat_api import FiatApi as FiatApi