Skip to main content

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.

  • 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

Release Notes

The release notes can be found here.

Contribution

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

Metadata

Release files for python-bitget 1.0.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python-bitget 1.0.8
File Size Uploaded
python_bitget-1.0.8.tar.gz 20.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for python-bitget 1.0.8
File Interpreter ABI Platform
python_bitget-1.0.8-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 40.3 kB

Release files / python_bitget-1.0.8.tar.gz

Download URL python_bitget-1.0.8.tar.gz
Size 20.7 kB
Tags Source
SHA-256 checksum
How to use checksums
c154869c8ccf651bb5c20307e59abd87f32c275327f1d0fb649abbed02da478d
BLAKE2b-256 checksum
How to use checksums
0033c3b1b77bfbbc6e72e10211224298fecd5cd44ab5666ec86f7f613b4b00e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.19

Release files / python_bitget-1.0.8-py2.py3-none-any.whl

Download URL python_bitget-1.0.8-py2.py3-none-any.whl
Size 19.6 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
ec9ca2aac0bcf45e20556a5cf9a939b5e40fc8fa9afc93b5c76696eab882bf4f
BLAKE2b-256 checksum
How to use checksums
acc184968316908b460fc0977693423bba15f4d2f870b2b8f8e764eac829951c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.19

Release history Release notifications | RSS feed

This release

1.0.8 This release

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page