bitget python wrapper with rest API, websocket API.
Project description
Python bitget API Library
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.
- Register an account with Bitget.
- Generate an API Key and assign relevant permissions.
- Bitget API docs
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:
3LrqgdMbToh1mAD3sjhbv3oaEppXY7hkae
-
BTC:
0x329a9F2b01aDA25F15eAE4C633d3bed8442c7BC6
(BSC) -
USDT:
0x329a9F2b01aDA25F15eAE4C633d3bed8442c7BC6
(BSC) -
BGB:
0x3ee4ca7cc911ad4e423dec2ae8f2846e9a6a0a77
(ERC-20)
Communities
- Telegram: Python-bitget API
Release Notes
The release notes can be found here.
Contribution
- Fork this repository.
- Make pull requests with proper commit message.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file python-bitget-1.0.3.tar.gz
.
File metadata
- Download URL: python-bitget-1.0.3.tar.gz
- Upload date:
- Size: 16.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f2e7550b32987a3917724e73caa7bf521b3cb0d382df4f795fb4a74c5bdc9252 |
|
MD5 | cc520010445aca3cdde0f5a654435259 |
|
BLAKE2b-256 | 6da7ae4631877ac8640ea39c80c43fedf714e06c827d20f81682f77bd74e6572 |
File details
Details for the file python_bitget-1.0.3-py2.py3-none-any.whl
.
File metadata
- Download URL: python_bitget-1.0.3-py2.py3-none-any.whl
- Upload date:
- Size: 15.1 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 336879da9cb3d76c22ab5cd102366026b1435b2ee9f42595d530df8e4eeaecc8 |
|
MD5 | a31e29dcd27ddca241df99eab00a930c |
|
BLAKE2b-256 | 5f6fccdfd9cd13465ed3503e0990dde9727d12ece965105910fa13e7bc397eb9 |