
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
bitget-python
Advanced tools
A comprehensive Python client for the Bitget API V2, providing extensive functionality for futures trading, account management, and market data access.
# Install using PYPI
pip install bitget-python
from bitpy import BitgetAPI
# For market data only - no API keys needed
client = BitgetAPI(
api_key=None,
secret_key=None,
api_passphrase=None
)
# Get market data without authentication
ticker = client.market.get_ticker(
symbol="BTCUSDT",
product_type="USDT-FUTURES"
)
# Get candlestick data
candles = client.market.get_candlestick(
symbol="BTCUSDT",
product_type="USDT-FUTURES",
granularity="1m",
limit=100
)
For account and position operations, API keys are required:
# For trading operations - API keys required
client = BitgetAPI(
api_key="your_api_key",
secret_key="your_secret_key",
api_passphrase="your_passphrase",
debug=True
)
# Get account information (requires authentication)
account = client.account.get_account(
symbol="BTCUSDT",
product_type="USDT-FUTURES",
margin_coin="USDT"
)
from bitpy import BitgetWebsocketAPI
import asyncio
async def handle_ticker(data: dict):
if "data" in data and len(data["data"]) > 0:
ticker = data["data"][0]
print(f"Symbol: {ticker['instId']}")
print(f"Last Price: {ticker['lastPr']}")
print(f"24h High: {ticker['high24h']}")
print(f"24h Low: {ticker['low24h']}")
print(f"24h Change %: {ticker['change24h']}")
print("-" * 50)
async def main():
# Initialize WebSocket client
api = BitgetWebsocketAPI(is_private=False, debug=False)
ws_client = api.websocket
# Subscribe to channels
subscriptions = [
{
"instType": "SPOT",
"channel": "ticker",
"instId": "BTCUSDT"
}
]
try:
await ws_client.connect()
print("Connected to WebSocket")
await ws_client.subscribe(subscriptions, handle_ticker)
# Keep connection alive
while ws_client.connected:
await asyncio.sleep(1)
except KeyboardInterrupt:
await ws_client.close()
if __name__ == "__main__":
asyncio.run(main())
Account Management
Position Management
Market Data
| Market Type | Description |
|---|---|
| USDT-FUTURES | USDT margined futures |
| COIN-FUTURES | Coin margined futures |
| USDC-FUTURES | USDC margined futures |
| SUSDT-FUTURES | Simulated USDT futures |
| SCOIN-FUTURES | Simulated coin futures |
| SUSDC-FUTURES | Simulated USDC futures |
from bitpy.exceptions import InvalidProductTypeError, BitgetAPIError
try:
positions = client.position.get_all_positions("INVALID-TYPE")
except InvalidProductTypeError as e:
print(f"Invalid product type: {e}")
except BitgetAPIError as e:
print(f"API Error {e.code}: {e.message}")
The client implements a smart token bucket algorithm for rate limiting, automatically tracking and managing request limits per endpoint to ensure optimal API usage.
# Get candlestick data
candles = client.market.get_candlestick(
symbol="BTCUSDT",
product_type="USDT-FUTURES",
granularity="1m",
limit=100
)
# Get market depth
depth = client.market.get_merge_depth(
symbol="BTCUSDT",
product_type="USDT-FUTURES",
precision="0.1"
)
Contributions are welcome! Feel free to submit a Pull Request. For feature requests or bug reports, please open an issue.
This project is licensed under the MIT License.
FAQs
A Python client for the Bitget API with comprehensive position management
We found that bitget-python demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.