python-bitget


Namepython-bitget JSON
Version 1.0.8 PyPI version JSON
download
home_pagehttps://github.com/cuongitl/python-bitget
Summarybitget python wrapper with rest API, websocket API.
upload_time2024-07-08 04:11:40
maintainerNone
docs_urlNone
authorCuongitl
requires_python>=3.6
licenseMIT
keywords cuongitl bitget api restapi websocketapi example-python-bitget
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Python bitget API Library


[![License](https://img.shields.io/badge/license-MIT-green)](https://github.com/cuongitl/python-bitget/-/blob/main/LICENSE)
[![python-bitget Version](https://img.shields.io/pypi/v/python-bitget?logo=pypi)](https://pypi.org/project/python-bitget/)
[![python-bitget Python Versions](https://img.shields.io/pypi/pyversions/python-bitget?logo=pypi)](https://pypi.org/project/python-bitget/)
[![python-bitget Downloads Per Day](https://img.shields.io/pypi/dd/python-bitget?logo=pypi)](https://pypi.org/project/python-bitget/)
[![python-bitget Downloads Per Week](https://img.shields.io/pypi/dw/python-bitget?logo=pypi)](https://pypi.org/project/python-bitget/)
[![python-bitget Downloads Per Month](https://img.shields.io/pypi/dm/python-bitget?logo=pypi)](https://pypi.org/project/python-bitget/)
[![Downloads](https://static.pepy.tech/badge/python-bitget)](https://pypi.org/project/python-bitget/)

[bitget](https://www.bitget.com/en/referral/register?from=referral&clacCode=6EKP94LE) is a cryptocurrency derivatives exchange.

This is a wrapper around the Bitget API as described on Bitget, including all features the API provides using clear and readable objects, both for the REST  as the websocket API.

 
I am in no way affiliated with Bitget, use at your own risk.

**If you think something is broken, something is missing or have any questions, please open an [Issue](https://github.com/cuongitl/python-bitget/issues)**

# Get Started and Documentation
If you're new to Bitget, use the following link to [save 10% on all of your trade fees, and can get rewards up to $5005.](https://www.bitget.com/en/referral/register?from=referral&clacCode=6EKP94LE)
* [Register an account with Bitget.](https://partner.bitget.com/bg/e55g05831674816745836)
* [Generate an API Key and assign relevant permissions.](https://www.bitget.com/en/support/articles/360038968251-API%20Creation%20Guide)
* [Bitget API docs](https://bitgetlimited.github.io/apidoc/en/mix/#welcome)
  * [Example Bitget rest API](https://github.com/cuongitl/python-bitget/blob/master/examples/example_rest_api.py)
  * [Example Bitget websocket API](https://github.com/cuongitl/python-bitget/blob/master/examples/example_websocket_api.py)

# Install
    pip install python-bitget
# Usage

> Change your API KEY and your SECRET KEY.
### Restful Api Sample Code 

```python
from pybitget import Client

api_key = "your-api-key"
api_secret = "your-secret-key"
api_passphrase = "your-api-passphrase"

client = Client(api_key, api_secret, passphrase=api_passphrase)
result = client.mix_get_accounts(productType='UMCBL')
print(result)

```
### Websocket Sample Code 

```python
from pybitget.stream import BitgetWsClient, SubscribeReq, handel_error

from pybitget.enums import *
from pybitget import logger

api_key = "your-api-key"
api_secret = "your-secret-key"
api_passphrase = "your-api-passphrase"

def on_message(message):
    logger.info(message)


# Auth subscribe
client = BitgetWsClient(api_key=api_key,
                        api_secret=api_secret,
                        passphrase=api_passphrase,
                        verbose=True) \
    .error_listener(handel_error) \
    .build()

# multi subscribe  - Public Channels
channels = [SubscribeReq("mc", "ticker", "BTCUSD"), SubscribeReq("SP", "candle1W", "BTCUSDT")]
client.subscribe(channels, on_message)

# single subscribe -     # multi subscribe  Public Channels
channels = [SubscribeReq("mc", "ticker", "BTCUSD")]
client.subscribe(channels, on_message)

# single subscribe - Order Channel - Private Channels
channels = [SubscribeReq(WS_CHANNEL_INSTTYPE, WS_PRIVATE_ORDERS_CHANNEL, WS_CHANNEL_INSTID)]
client.subscribe(channels, on_message)
```

## Donate / Sponsor
I develop and maintain this package on my own for free in my spare time. 
Donations are greatly appreciated. If you prefer to donate any other currency please contact me.

* **Buy me a coffee:** https://buymeacoffee.com/cuongitl

* **BTC**:  `19rvFC79eVoCMHxJ44hB3GLhiD2HHsMJoZ`

* **BTC**:  `0xab4686635a02dff0babedddfee813d325f56cfb8`  (BEP20)

* **USDT**:  `0xab4686635a02dff0babedddfee813d325f56cfb8`  (BEP20)

* **USDT**:  `TCdyZs2mRhwYpCB5dZqiXEUoYRfiVJuq1H`  (TRC20)

* **BGB**:  `0x3ee4ca7cc911ad4e423dec2ae8f2846e9a6a0a77`  (ERC-20)

## Communities - Telegram
* Bitget: [Bitget OPENAPI](https://t.me/bitgetOpenapi)
* Author: [Cuongitl](https://t.me/Cuongitl)

## Release Notes
The release notes can be found
[here.](https://github.com/cuongitl/python-bitget/blob/master/release_notes.md)

## Contribution
* Fork this repository.
* Make pull requests with proper commit message.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/cuongitl/python-bitget",
    "name": "python-bitget",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": "Cuongitl bitget api restapi websocketapi example-python-bitget",
    "author": "Cuongitl",
    "author_email": "mrcuongit@live.com",
    "download_url": "https://files.pythonhosted.org/packages/00/33/c3b1b77bfbbc6e72e10211224298fecd5cd44ab5666ec86f7f613b4b00e0/python_bitget-1.0.8.tar.gz",
    "platform": null,
    "description": "# Python bitget API Library\r\n\r\n\r\n[![License](https://img.shields.io/badge/license-MIT-green)](https://github.com/cuongitl/python-bitget/-/blob/main/LICENSE)\r\n[![python-bitget Version](https://img.shields.io/pypi/v/python-bitget?logo=pypi)](https://pypi.org/project/python-bitget/)\r\n[![python-bitget Python Versions](https://img.shields.io/pypi/pyversions/python-bitget?logo=pypi)](https://pypi.org/project/python-bitget/)\r\n[![python-bitget Downloads Per Day](https://img.shields.io/pypi/dd/python-bitget?logo=pypi)](https://pypi.org/project/python-bitget/)\r\n[![python-bitget Downloads Per Week](https://img.shields.io/pypi/dw/python-bitget?logo=pypi)](https://pypi.org/project/python-bitget/)\r\n[![python-bitget Downloads Per Month](https://img.shields.io/pypi/dm/python-bitget?logo=pypi)](https://pypi.org/project/python-bitget/)\r\n[![Downloads](https://static.pepy.tech/badge/python-bitget)](https://pypi.org/project/python-bitget/)\r\n\r\n[bitget](https://www.bitget.com/en/referral/register?from=referral&clacCode=6EKP94LE) is a cryptocurrency derivatives exchange.\r\n\r\nThis is a wrapper around the Bitget API as described on Bitget, including all features the API provides using clear and readable objects, both for the REST  as the websocket API.\r\n\r\n \r\nI am in no way affiliated with Bitget, use at your own risk.\r\n\r\n**If you think something is broken, something is missing or have any questions, please open an [Issue](https://github.com/cuongitl/python-bitget/issues)**\r\n\r\n# Get Started and Documentation\r\nIf you're new to Bitget, use the following link to [save 10% on all of your trade fees, and can get rewards up to $5005.](https://www.bitget.com/en/referral/register?from=referral&clacCode=6EKP94LE)\r\n* [Register an account with Bitget.](https://partner.bitget.com/bg/e55g05831674816745836)\r\n* [Generate an API Key and assign relevant permissions.](https://www.bitget.com/en/support/articles/360038968251-API%20Creation%20Guide)\r\n* [Bitget API docs](https://bitgetlimited.github.io/apidoc/en/mix/#welcome)\r\n  * [Example Bitget rest API](https://github.com/cuongitl/python-bitget/blob/master/examples/example_rest_api.py)\r\n  * [Example Bitget websocket API](https://github.com/cuongitl/python-bitget/blob/master/examples/example_websocket_api.py)\r\n\r\n# Install\r\n    pip install python-bitget\r\n# Usage\r\n\r\n> Change your API KEY and your SECRET KEY.\r\n### Restful Api Sample Code \r\n\r\n```python\r\nfrom pybitget import Client\r\n\r\napi_key = \"your-api-key\"\r\napi_secret = \"your-secret-key\"\r\napi_passphrase = \"your-api-passphrase\"\r\n\r\nclient = Client(api_key, api_secret, passphrase=api_passphrase)\r\nresult = client.mix_get_accounts(productType='UMCBL')\r\nprint(result)\r\n\r\n```\r\n### Websocket Sample Code \r\n\r\n```python\r\nfrom pybitget.stream import BitgetWsClient, SubscribeReq, handel_error\r\n\r\nfrom pybitget.enums import *\r\nfrom pybitget import logger\r\n\r\napi_key = \"your-api-key\"\r\napi_secret = \"your-secret-key\"\r\napi_passphrase = \"your-api-passphrase\"\r\n\r\ndef on_message(message):\r\n    logger.info(message)\r\n\r\n\r\n# Auth subscribe\r\nclient = BitgetWsClient(api_key=api_key,\r\n                        api_secret=api_secret,\r\n                        passphrase=api_passphrase,\r\n                        verbose=True) \\\r\n    .error_listener(handel_error) \\\r\n    .build()\r\n\r\n# multi subscribe  - Public Channels\r\nchannels = [SubscribeReq(\"mc\", \"ticker\", \"BTCUSD\"), SubscribeReq(\"SP\", \"candle1W\", \"BTCUSDT\")]\r\nclient.subscribe(channels, on_message)\r\n\r\n# single subscribe -     # multi subscribe  Public Channels\r\nchannels = [SubscribeReq(\"mc\", \"ticker\", \"BTCUSD\")]\r\nclient.subscribe(channels, on_message)\r\n\r\n# single subscribe - Order Channel - Private Channels\r\nchannels = [SubscribeReq(WS_CHANNEL_INSTTYPE, WS_PRIVATE_ORDERS_CHANNEL, WS_CHANNEL_INSTID)]\r\nclient.subscribe(channels, on_message)\r\n```\r\n\r\n## Donate / Sponsor\r\nI develop and maintain this package on my own for free in my spare time. \r\nDonations are greatly appreciated. If you prefer to donate any other currency please contact me.\r\n\r\n* **Buy me a coffee:** https://buymeacoffee.com/cuongitl\r\n\r\n* **BTC**:  `19rvFC79eVoCMHxJ44hB3GLhiD2HHsMJoZ`\r\n\r\n* **BTC**:  `0xab4686635a02dff0babedddfee813d325f56cfb8`  (BEP20)\r\n\r\n* **USDT**:  `0xab4686635a02dff0babedddfee813d325f56cfb8`  (BEP20)\r\n\r\n* **USDT**:  `TCdyZs2mRhwYpCB5dZqiXEUoYRfiVJuq1H`  (TRC20)\r\n\r\n* **BGB**:  `0x3ee4ca7cc911ad4e423dec2ae8f2846e9a6a0a77`  (ERC-20)\r\n\r\n## Communities - Telegram\r\n* Bitget: [Bitget OPENAPI](https://t.me/bitgetOpenapi)\r\n* Author: [Cuongitl](https://t.me/Cuongitl)\r\n\r\n## Release Notes\r\nThe release notes can be found\r\n[here.](https://github.com/cuongitl/python-bitget/blob/master/release_notes.md)\r\n\r\n## Contribution\r\n* Fork this repository.\r\n* Make pull requests with proper commit message.\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "bitget python wrapper with rest API, websocket API.",
    "version": "1.0.8",
    "project_urls": {
        "Homepage": "https://github.com/cuongitl/python-bitget"
    },
    "split_keywords": [
        "cuongitl",
        "bitget",
        "api",
        "restapi",
        "websocketapi",
        "example-python-bitget"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "acc184968316908b460fc0977693423bba15f4d2f870b2b8f8e764eac829951c",
                "md5": "a514f4876ac6a100d7d278648156b075",
                "sha256": "ec9ca2aac0bcf45e20556a5cf9a939b5e40fc8fa9afc93b5c76696eab882bf4f"
            },
            "downloads": -1,
            "filename": "python_bitget-1.0.8-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a514f4876ac6a100d7d278648156b075",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": ">=3.6",
            "size": 19565,
            "upload_time": "2024-07-08T04:11:39",
            "upload_time_iso_8601": "2024-07-08T04:11:39.141389Z",
            "url": "https://files.pythonhosted.org/packages/ac/c1/84968316908b460fc0977693423bba15f4d2f870b2b8f8e764eac829951c/python_bitget-1.0.8-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0033c3b1b77bfbbc6e72e10211224298fecd5cd44ab5666ec86f7f613b4b00e0",
                "md5": "3d659051723b480eae4d6f49af128c4f",
                "sha256": "c154869c8ccf651bb5c20307e59abd87f32c275327f1d0fb649abbed02da478d"
            },
            "downloads": -1,
            "filename": "python_bitget-1.0.8.tar.gz",
            "has_sig": false,
            "md5_digest": "3d659051723b480eae4d6f49af128c4f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 20730,
            "upload_time": "2024-07-08T04:11:40",
            "upload_time_iso_8601": "2024-07-08T04:11:40.710207Z",
            "url": "https://files.pythonhosted.org/packages/00/33/c3b1b77bfbbc6e72e10211224298fecd5cd44ab5666ec86f7f613b4b00e0/python_bitget-1.0.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-08 04:11:40",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "cuongitl",
    "github_project": "python-bitget",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "python-bitget"
}
        
Elapsed time: 0.31120s