bitget-python


Namebitget-python JSON
Version 1.0.3 PyPI version JSON
download
home_pageNone
SummaryA Python client for the Bitget API with comprehensive position management
upload_time2025-01-07 16:42:39
maintainerNone
docs_urlNone
authorTentoxa
requires_python>=3.9
licenseMIT
keywords bitget api trading cryptocurrency
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 🚀 Bitget API V2 Python Client

A comprehensive Python client for the Bitget API V2, providing extensive functionality for futures trading, account management, and market data access.

## ✨ Features

- 📊 Complete futures market trading capabilities
- 💼 Account management and settings
- 📈 Real-time and historical market data
- 🔄 Automatic rate limiting and request handling
- 🛡️ Comprehensive error handling and validation
- 📝 Detailed debug logging capabilities
- 🎯 Type hints and dataclass models for better code completion

## 🛠️ Installation

```bash
# Install using PYPI
pip install bitget-python
```

## 🔧 Quick Start

```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:

```python
# 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"
)
```

## 🔑 Core Components

**Account Management**
- Account information and settings
- Leverage and margin configuration
- Position mode management
- Asset mode settings
- Interest and bill history

**Position Management**
- Position tracking and history
- Position tier information
- Multiple position modes support

**Market Data**
- Real-time tickers and depth
- Candlestick data with multiple timeframes
- Funding rates and open interest
- Historical transaction data
- Contract specifications

## 💹 Supported Markets

| 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 |

## ⚠️ Error Handling

```python
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}")
```

## 🔄 Rate Limiting

The client implements a smart token bucket algorithm for rate limiting, automatically tracking and managing request limits per endpoint to ensure optimal API usage.

## 📊 Advanced Market Data

```python
# 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"
)
```

## 🤝 Contributing

Contributions are welcome! Feel free to submit a Pull Request. For feature requests or bug reports, please open an issue.

## 📄 License

This project is licensed under the MIT License. 

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "bitget-python",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "bitget, api, trading, cryptocurrency",
    "author": "Tentoxa",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/82/6f/ee273a3fe9b5dfd93473d76fe834561fe1e3ab0b880f94a9e0332fddc792/bitget_python-1.0.3.tar.gz",
    "platform": null,
    "description": "# \ud83d\ude80 Bitget API V2 Python Client\n\nA comprehensive Python client for the Bitget API V2, providing extensive functionality for futures trading, account management, and market data access.\n\n## \u2728 Features\n\n- \ud83d\udcca Complete futures market trading capabilities\n- \ud83d\udcbc Account management and settings\n- \ud83d\udcc8 Real-time and historical market data\n- \ud83d\udd04 Automatic rate limiting and request handling\n- \ud83d\udee1\ufe0f Comprehensive error handling and validation\n- \ud83d\udcdd Detailed debug logging capabilities\n- \ud83c\udfaf Type hints and dataclass models for better code completion\n\n## \ud83d\udee0\ufe0f Installation\n\n```bash\n# Install using PYPI\npip install bitget-python\n```\n\n## \ud83d\udd27 Quick Start\n\n```python\nfrom bitpy import BitgetAPI\n\n# For market data only - no API keys needed\nclient = BitgetAPI(\n    api_key=None,\n    secret_key=None,\n    api_passphrase=None\n)\n\n# Get market data without authentication\nticker = client.market.get_ticker(\n    symbol=\"BTCUSDT\",\n    product_type=\"USDT-FUTURES\"\n)\n\n# Get candlestick data\ncandles = client.market.get_candlestick(\n    symbol=\"BTCUSDT\",\n    product_type=\"USDT-FUTURES\",\n    granularity=\"1m\",\n    limit=100\n)\n```\n\nFor account and position operations, API keys are required:\n\n```python\n# For trading operations - API keys required\nclient = BitgetAPI(\n    api_key=\"your_api_key\",\n    secret_key=\"your_secret_key\",\n    api_passphrase=\"your_passphrase\",\n    debug=True\n)\n\n# Get account information (requires authentication)\naccount = client.account.get_account(\n    symbol=\"BTCUSDT\",\n    product_type=\"USDT-FUTURES\",\n    margin_coin=\"USDT\"\n)\n```\n\n## \ud83d\udd11 Core Components\n\n**Account Management**\n- Account information and settings\n- Leverage and margin configuration\n- Position mode management\n- Asset mode settings\n- Interest and bill history\n\n**Position Management**\n- Position tracking and history\n- Position tier information\n- Multiple position modes support\n\n**Market Data**\n- Real-time tickers and depth\n- Candlestick data with multiple timeframes\n- Funding rates and open interest\n- Historical transaction data\n- Contract specifications\n\n## \ud83d\udcb9 Supported Markets\n\n| Market Type | Description |\n|------------|-------------|\n| USDT-FUTURES | USDT margined futures |\n| COIN-FUTURES | Coin margined futures |\n| USDC-FUTURES | USDC margined futures |\n| SUSDT-FUTURES| Simulated USDT futures |\n| SCOIN-FUTURES| Simulated coin futures |\n| SUSDC-FUTURES| Simulated USDC futures |\n\n## \u26a0\ufe0f Error Handling\n\n```python\nfrom bitpy.exceptions import InvalidProductTypeError, BitgetAPIError\n\ntry:\n    positions = client.position.get_all_positions(\"INVALID-TYPE\")\nexcept InvalidProductTypeError as e:\n    print(f\"Invalid product type: {e}\")\nexcept BitgetAPIError as e:\n    print(f\"API Error {e.code}: {e.message}\")\n```\n\n## \ud83d\udd04 Rate Limiting\n\nThe client implements a smart token bucket algorithm for rate limiting, automatically tracking and managing request limits per endpoint to ensure optimal API usage.\n\n## \ud83d\udcca Advanced Market Data\n\n```python\n# Get candlestick data\ncandles = client.market.get_candlestick(\n    symbol=\"BTCUSDT\",\n    product_type=\"USDT-FUTURES\",\n    granularity=\"1m\",\n    limit=100\n)\n\n# Get market depth\ndepth = client.market.get_merge_depth(\n    symbol=\"BTCUSDT\",\n    product_type=\"USDT-FUTURES\",\n    precision=\"0.1\"\n)\n```\n\n## \ud83e\udd1d Contributing\n\nContributions are welcome! Feel free to submit a Pull Request. For feature requests or bug reports, please open an issue.\n\n## \ud83d\udcc4 License\n\nThis project is licensed under the MIT License. \n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A Python client for the Bitget API with comprehensive position management",
    "version": "1.0.3",
    "project_urls": {
        "Documentation": "https://github.com/Tentoxa/bitpy#readme",
        "Homepage": "https://github.com/Tentoxa/bitpy",
        "Repository": "https://github.com/Tentoxa/bitpy"
    },
    "split_keywords": [
        "bitget",
        " api",
        " trading",
        " cryptocurrency"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0f73beb0cdfddf1c56e137848fc50c2831826025267ff3d7e041f730b288d545",
                "md5": "a9083b4e4c31c9afd87314d4f3b678c5",
                "sha256": "ea36e383e20f35dd8a5fcc6e48d0904b1b9c9ad6601c4f7302e2189219feca2c"
            },
            "downloads": -1,
            "filename": "bitget_python-1.0.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a9083b4e4c31c9afd87314d4f3b678c5",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 15920,
            "upload_time": "2025-01-07T16:42:38",
            "upload_time_iso_8601": "2025-01-07T16:42:38.819450Z",
            "url": "https://files.pythonhosted.org/packages/0f/73/beb0cdfddf1c56e137848fc50c2831826025267ff3d7e041f730b288d545/bitget_python-1.0.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "826fee273a3fe9b5dfd93473d76fe834561fe1e3ab0b880f94a9e0332fddc792",
                "md5": "945da4203f1d3814a03b35746d0f6f47",
                "sha256": "4abbd1690d068cb09810dd2f0032ac46558b6d3a3ffe3fc48e68da63b8ca2995"
            },
            "downloads": -1,
            "filename": "bitget_python-1.0.3.tar.gz",
            "has_sig": false,
            "md5_digest": "945da4203f1d3814a03b35746d0f6f47",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 12345,
            "upload_time": "2025-01-07T16:42:39",
            "upload_time_iso_8601": "2025-01-07T16:42:39.700972Z",
            "url": "https://files.pythonhosted.org/packages/82/6f/ee273a3fe9b5dfd93473d76fe834561fe1e3ab0b880f94a9e0332fddc792/bitget_python-1.0.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-07 16:42:39",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Tentoxa",
    "github_project": "bitpy#readme",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "bitget-python"
}
        
Elapsed time: 0.43109s