|
1 | | -# about |
| 1 | +# bingx-python |
| 2 | +Python SDK (sync and async) for Bingx with Rest and WS capabilities. |
2 | 3 |
|
3 | | -this is internal dev repo, not meant to be used by end users. |
| 4 | +You can check Bingx's docs here: [Docs](https://ccxt.com) |
4 | 5 |
|
5 | | -# instructions |
6 | 6 |
|
7 | | -- At first, generate `Personal Access Token` under `CCXT` org, with the access to this current repository and also to all other repositories (there are around 20 repositories named like: `github.com/ccxt/{exchange}-python`) with the scopes `actions, commit statuses, contents, workflows` and set that value for action secret with the name `API_TOKEN_FOR_CCXT_SINGLE_EXCHANGES`. |
| 7 | +You can check the SDK docs here: [SDK](https://docs.ccxt.com/#/exchanges/bingx) |
8 | 8 |
|
9 | | -- Then inside `.github/workflows/transfer-all.yml` set the desired array of exchanges in matrix. On `push` event, if commit message contains `[TRANSFER]`, this repo files will be distributed to those dozen exchange repositories. |
| 9 | +*This package derives from CCXT and allows you to call pretty much every endpoint by either using the unified CCXT API or calling the endpoints directly* |
10 | 10 |
|
11 | | -- Immediately, as those repositories get `push` event (if commit message contains the phrase `[BUILD]`) the individual exchange repos start build with `.github/workflows/build-single-exchange.yml` flow, so the exchange-specific package is generated from raw skeleton repo & ccxt files. |
| 11 | +## Installation |
12 | 12 |
|
13 | | -- If commit message also contained the phrase `[PUBLISH]` then they will push a package to pypi.org (you should set `PYPI_API_SECRET_SP` secret with pypi api key, under each repository). Versions are incremental by patch version at this moment. |
| 13 | +``` |
| 14 | +pip install bingx |
| 15 | +``` |
| 16 | + |
| 17 | +## Usage |
| 18 | + |
| 19 | +### Async |
| 20 | + |
| 21 | +```Python |
| 22 | +from bingx import BingxAsync |
| 23 | + |
| 24 | +async def main(): |
| 25 | + instance = BingxAsync({}) |
| 26 | + order = await instance.create_order("BTC/USDC", "limit", "buy", 1, 100000) |
| 27 | +``` |
| 28 | + |
| 29 | +### Sync |
| 30 | + |
| 31 | +```Python |
| 32 | +from bingx import BingxSync |
| 33 | + |
| 34 | +def main(): |
| 35 | + instance = BingxSync({}) |
| 36 | + order = instance.create_order("BTC/USDC", "limit", "buy", 1, 100000) |
| 37 | +``` |
| 38 | + |
| 39 | +### Websockets |
| 40 | + |
| 41 | +```Python |
| 42 | +from bingx import BingxWs |
| 43 | + |
| 44 | +async def main(): |
| 45 | + instance = BingxWs({}) |
| 46 | + while True: |
| 47 | + orders = await instance.watch_orders("BTC/USDC") |
| 48 | +``` |
14 | 49 |
|
15 | | -- All other things are WIP and can be customized. |
|
0 commit comments