python-bingx


Namepython-bingx JSON
Version 1.0.0 PyPI version JSON
download
home_pagehttps://github.com/niewiemczego/python-bingx
SummaryUnofficial Python3 API connector for BingX's HTTP and WebSockets APIs.
upload_time2023-03-24 22:48:43
maintainer
docs_urlNone
authorniewiemczego
requires_python
licenseMIT
keywords bingx exchange rest api bitcoin ethereum btc eth
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Python-BingX

Python-bingx is a powerful and flexible Python package that allows you to easily interact with the BingX API. The package currently supports the Spot API, Standard API, Perpetual Swap API Reference V1, and Perpetual Swap API Reference V2. With python-bingx, you can retrieve real-time market data, manage your account, place trades, and more...

# Installation

To install python-bingx, you can use pip:

```python
pip install python-bingx
```

# Usage

There are multiple ways to use python-bingx, depending on your needs and preferences.

### Using BingX

The most straightforward way to use python-bingx is by importing the `BingX` class and initializing it with your API key and secret key:

```python
from bingX import BingX

bingx_client = BingX(api_key="api_key", secret_key="secret_key")
```

Once you have initialized the client, you can call any of the available APIs, for example:

```python
# Call the Trade API of Perpetual V2
bingx_client.perpetual_v2.trade.trade_order()
```

### Using PerpetualV2

If you prefer to work with a specific API or version, you can import the relevant class and initialize it with your API key and secret key:

```python
from bingX.perpetual.v2 import PerpetualV2

bingx_client = PerpetualV2(api_key="api_key", secret_key="secret_key")
```

Once you have initialized the client, you can call any of the available APIs, for example:

```python
# Call the Trade API of Perpetual V2
bingx_client.trade.trade_order()
```

# Handling Responses

Python-bingx uses requests library to communicate with the API and returns the response in JSON format. You can easily handle the response by accessing the relevant key(s) in the dictionary, for example:

```python
# Get the symbol and last price of BTC/USDT
response = bingx_client.perpetual_v2.market.get_ticker("BTC-USDT")
symbol = response["symbol"]
last_price = response["lastPrice"]
```

# Error Handling

In case of errors or exceptions, python-bingx will raise relevant exceptions with error message and error code. You can catch and handle the exceptions accordingly, for example:

```python
from bingX import ClientError, ServerError

try:
    response = bingx_client.perpetual_v2.trade.create_order()
except (ClientError, ServerError) as e:
    error_code = e.error_code
    error_message = e.error_message
```

# Contributing

Python-bingx welcomes contributions from the community! If you'd like to contribute, please fork the repository, create a feature branch, make your changes, and submit a pull request. Before submitting, please ensure that your code follows the PEP 8 style guide and includes appropriate tests.

# License

Python-bingx is licensed under the MIT License. See the LICENSE file for more information.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/niewiemczego/python-bingx",
    "name": "python-bingx",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "bingx exchange rest api bitcoin ethereum btc eth",
    "author": "niewiemczego",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/e2/8e/a5ebfe7b107bbb8d2822d3c784e19e1bcbc5c3142f9fdac92b2de095ff49/python-bingx-1.0.0.tar.gz",
    "platform": null,
    "description": "# Python-BingX\n\nPython-bingx is a powerful and flexible Python package that allows you to easily interact with the BingX API. The package currently supports the Spot API, Standard API, Perpetual Swap API Reference V1, and Perpetual Swap API Reference V2. With python-bingx, you can retrieve real-time market data, manage your account, place trades, and more...\n\n# Installation\n\nTo install python-bingx, you can use pip:\n\n```python\npip install python-bingx\n```\n\n# Usage\n\nThere are multiple ways to use python-bingx, depending on your needs and preferences.\n\n### Using BingX\n\nThe most straightforward way to use python-bingx is by importing the `BingX` class and initializing it with your API key and secret key:\n\n```python\nfrom bingX import BingX\n\nbingx_client = BingX(api_key=\"api_key\", secret_key=\"secret_key\")\n```\n\nOnce you have initialized the client, you can call any of the available APIs, for example:\n\n```python\n# Call the Trade API of Perpetual V2\nbingx_client.perpetual_v2.trade.trade_order()\n```\n\n### Using PerpetualV2\n\nIf you prefer to work with a specific API or version, you can import the relevant class and initialize it with your API key and secret key:\n\n```python\nfrom bingX.perpetual.v2 import PerpetualV2\n\nbingx_client = PerpetualV2(api_key=\"api_key\", secret_key=\"secret_key\")\n```\n\nOnce you have initialized the client, you can call any of the available APIs, for example:\n\n```python\n# Call the Trade API of Perpetual V2\nbingx_client.trade.trade_order()\n```\n\n# Handling Responses\n\nPython-bingx uses requests library to communicate with the API and returns the response in JSON format. You can easily handle the response by accessing the relevant key(s) in the dictionary, for example:\n\n```python\n# Get the symbol and last price of BTC/USDT\nresponse = bingx_client.perpetual_v2.market.get_ticker(\"BTC-USDT\")\nsymbol = response[\"symbol\"]\nlast_price = response[\"lastPrice\"]\n```\n\n# Error Handling\n\nIn case of errors or exceptions, python-bingx will raise relevant exceptions with error message and error code. You can catch and handle the exceptions accordingly, for example:\n\n```python\nfrom bingX import ClientError, ServerError\n\ntry:\n    response = bingx_client.perpetual_v2.trade.create_order()\nexcept (ClientError, ServerError) as e:\n    error_code = e.error_code\n    error_message = e.error_message\n```\n\n# Contributing\n\nPython-bingx welcomes contributions from the community! If you'd like to contribute, please fork the repository, create a feature branch, make your changes, and submit a pull request. Before submitting, please ensure that your code follows the PEP 8 style guide and includes appropriate tests.\n\n# License\n\nPython-bingx is licensed under the MIT License. See the LICENSE file for more information.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Unofficial Python3 API connector for BingX's HTTP and WebSockets APIs.",
    "version": "1.0.0",
    "split_keywords": [
        "bingx",
        "exchange",
        "rest",
        "api",
        "bitcoin",
        "ethereum",
        "btc",
        "eth"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8dca0fc21d5fd19e3b4235d37ca3453d12e71b55546f6c8f05921fb40a6cbad5",
                "md5": "d1e97971abb5c3cee3ee987fbee4646e",
                "sha256": "592a23ba6de6b6ee06866774523f15372428d7125354d8f197bcdfd8c674ff79"
            },
            "downloads": -1,
            "filename": "python_bingx-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d1e97971abb5c3cee3ee987fbee4646e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 19810,
            "upload_time": "2023-03-24T22:48:41",
            "upload_time_iso_8601": "2023-03-24T22:48:41.285766Z",
            "url": "https://files.pythonhosted.org/packages/8d/ca/0fc21d5fd19e3b4235d37ca3453d12e71b55546f6c8f05921fb40a6cbad5/python_bingx-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e28ea5ebfe7b107bbb8d2822d3c784e19e1bcbc5c3142f9fdac92b2de095ff49",
                "md5": "e870c99720cf2b6a325aac97ce10e323",
                "sha256": "ad9369f2b35213aaafe64aca2ed5c6e6aa010a01e1a31e0aea33e6ed45b3fb72"
            },
            "downloads": -1,
            "filename": "python-bingx-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "e870c99720cf2b6a325aac97ce10e323",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 14667,
            "upload_time": "2023-03-24T22:48:43",
            "upload_time_iso_8601": "2023-03-24T22:48:43.619523Z",
            "url": "https://files.pythonhosted.org/packages/e2/8e/a5ebfe7b107bbb8d2822d3c784e19e1bcbc5c3142f9fdac92b2de095ff49/python-bingx-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-03-24 22:48:43",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "niewiemczego",
    "github_project": "python-bingx",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "python-bingx"
}
        
Elapsed time: 0.05071s