bitunix 0.1.2
An open source, unofficial Python client for the BitUnix cryptocurrency exchange API
Requires Python: >=3.7

# Bitunix Python Client

An unofficial opensource Python client for interacting with the Bitunix cryptocurrency exchange API.

## Version 0.1.2 updates
- add better documentation
- add license
- link to github for license and contributing

## ToDo
- add a WebSocket client
- add technical indicators for Websocket Streams
- add trading strategies

## Installation
You can install the BitUnix Client package using pip:
```bash
pip install bitunix
```

## Usage

```python
from bitunix import BitunixClient

# Initialize the client with your API key and secret
client = BitunixClient(api_key, api_secret)
  
# Get latest price for BTC/USDT
latest_price = client.get_latest_price("BTCUSDT")
print(f"Latest BTC/USDT price: {latest_price}")
  
# Get depth data for ETH/USDT with precision 4
depth_data = client.get_depth_data("ETHUSDT", 4)
print(f"ETH/USDT depth data: {depth_data}")
  
# Get 1-hour K-line data for BNB/USDT
kline_data = client.get_kline_data("BNBUSDT", "60")
print(f"BNB/USDT 1-hour K-line data: {kline_data}")
  
# Get all trading pairs
trading_pairs = client.get_trading_pairs()
print(f"Trading pairs: {trading_pairs}")
  
# Get rate data
rate_data = client.get_rate_data()
print(f"Rate data: {rate_data}")
  
# Get token data
token_data = client.get_token_data()
print(f"Token data: {token_data}")
  
# Get account balance
account_balance = client.get_account_balance()
print(f"Account balance: {account_balance}")
  
# Place a market buy order, note that price is ignored. For buy side amount is in the denominated currency, ex for BTCUSDT a volume of 100 is 100 USDT worth of BTC
order = client.place_order(side=2, order_type=2, volume="100",price="0", symbol="BTCUSDT")
print(f"Placed order: {order}")

# Place a market sell order, note that price is ignored. For sell side volume is in the cryptocurrency to be traded, ex for BTCUSDTa volume of 0.5 is 0.5 BTC
order = client.place_order(side=1, order_type=2, volume="0.5",price="0", symbol="BTCUSDT")
print(f"Placed order: {order}")


# Place a limit buy order, note that volume is in the cryptocurrency to be traded, ex for BTCUSDT a volume of 0.001 is 0.001 BTC
order = client.place_order(side=2, order_type=1, volume="0.001",price="30000", symbol="BTCUSDT")
print(f"Placed order: {order}")


# Place a limit sell order, note that volume is in the cryptocurrency to be traded, ex for BTCUSDT a volume of 0.001 is 0.001 BTC
order = client.place_order(side=1, order_type=1, volume="0.001",price="30000", symbol="BTCUSDT")
print(f"Placed order: {order}")

# Place batch orders
batch_orders = client.place_batch_orders([
    {"side": 2, "type": 1, "volume": "0.001", "price": "30000", "symbol": "BTCUSDT"},
    {"side": 1, "type": 1, "volume": "0.1", "price": "2000", "symbol": "ETHUSDT"}
])
print(f"Placed batch orders: {batch_orders}")
  
# Cancel orders
cancel_result = client.cancel_orders([
    {"orderId": "123456", "symbol": "BTCUSDT"},
    {"orderId": "789012", "symbol": "ETHUSDT"}
])
print(f"Cancelled orders: {cancel_result}")
  
# Query matching orders
matching_orders = client.query_matching_orders(order_id="123456",symbol="BTCUSDT")
print(f"Matching orders: {matching_orders}")
  
# Query order history
order_history = client.query_order_history(symbol="BTCUSDT", page=1,page_size=10)
print(f"Order history: {order_history}")
  
# Query current orders
current_orders = client.query_current_orders(symbol="BTCUSDT")
print(f"Current orders: {current_orders}")
  

```

## Documentation

For more details, please refer to the [Bitunix API documentation](https://api-doc.bitunix.com/en_us/).

## License

This project is licensed under the MIT License. See the [LICENSE](https://github.com/0xCherryBlueZu/bitunix/blob/main/LICENSE) file for more details.

## Contribution

Want to contribute to this project? Please read the [CONTRIBUTING.md](https://github.com/0xCherryBlueZu/bitunix/blob/main/CONTRIBUTING.md) file for more details.

## Support the author of this project project:
ETH:  
0xefFC273c7452B6A7753B757333FCF7022785d44E

SOL:  
3FdyCqV7rebU4zJXwQ6vfb9TVkPs25y64NDkAQdSLFf6