Skip to main content

bitget python wrapper with rest API, websocket API.

Project description

Python bitget API Library

License python-bitget Version python-bitget Python Versions python-bitget Downloads Per Day python-bitget Downloads Per Week python-bitget Downloads Per Month Downloads

bitget 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

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.

Install

pip install python-bitget

Usage

Change your API KEY and your SECRET KEY.

Restful Api Sample Code

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

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.

  • BTC: 19rvFC79eVoCMHxJ44hB3GLhiD2HHsMJoZ

  • BTC: 0xab4686635a02dff0babedddfee813d325f56cfb8 (BEP20)

  • USDT: 0xab4686635a02dff0babedddfee813d325f56cfb8 (BEP20)

  • USDT: TCdyZs2mRhwYpCB5dZqiXEUoYRfiVJuq1H (TRC20)

  • BGB: 0x3ee4ca7cc911ad4e423dec2ae8f2846e9a6a0a77 (ERC-20)

Communities - Telegram

Release Notes

The release notes can be found here.

Contribution

  • Fork this repository.
  • Make pull requests with proper commit message.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python-bitget-1.0.7.tar.gz (20.5 kB view details)

Uploaded Source

Built Distribution

python_bitget-1.0.7-py2.py3-none-any.whl (19.5 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file python-bitget-1.0.7.tar.gz.

File metadata

  • Download URL: python-bitget-1.0.7.tar.gz
  • Upload date:
  • Size: 20.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.6

File hashes

Hashes for python-bitget-1.0.7.tar.gz
Algorithm Hash digest
SHA256 db2b15697cb2b396621146ed76769d55186510783577d815ff04d270b0ad5393
MD5 7255de7d32dfc6f120a1dccac8a91032
BLAKE2b-256 7654c12d3fb88184bd40b7894de046bb623cb15fa451fa59cdd31f2d85497e1a

See more details on using hashes here.

File details

Details for the file python_bitget-1.0.7-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for python_bitget-1.0.7-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 7621d0b2509164a2df8aeb9614913a71c19172c5e44c6eedc39f1da98d893168
MD5 413e0aec57efeb6c13cef0eb698ff95a
BLAKE2b-256 407432e3ad30c32707875d537e87a20bef9a26f768256f9fa50fc7df7da2436a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page