bitexen-python is the official Python client library for Bitexen Cryptocurrency Exchange. It provides a simple, intuitive interface for interacting with the exchange's API endpoints, including market data, order management, and account operations.
pip install bitexen-clientgit clone https://github.com/Bitexen/bitexen-python.git
cd bitexen-python
pip install -e .- Python 3.7 or higher
requestslibrary (automatically installed)
from bitexen_client import API
# Initialize client
api = API()
# Get market information
market_info = api.get_market_info("BTCTRY")
print(market_info)
# Get ticker data
ticker = api.get_ticker("BTCTRY")
print(f"Last Price: {ticker.last_price}")
# Get order book
order_book = api.get_order_book("BTCTRY")
print(f"Bids: {order_book.buyers}")
print(f"Asks: {order_book.sellers}")from bitexen_client import API
# Initialize with credentials
api = API(
uri="https://www.bitexen.com/",
key="your_api_key",
secret="your_api_secret",
username="your_username",
pass_phrase="your_passphrase"
)
# Get account balance
balance = api.get_balance()
print(balance.data)
# Get open orders
orders = api.get_open_orders(account_name="Main", market_code="BTCTRY")
print(orders.data.orders)
# Create a limit buy order
order = api.create_order(
account_name="Main",
market_code="BTCTRY",
buy_sell="B", # "B" for buy, "S" for sell
order_type="limit",
volume=0.001,
price=50000
)
print(f"Order created: {order.data.order_number}")
# Cancel an order
result = api.cancel_order(order_number="123456")
print(result)Create a bitexen_client_settings.py file in your project root:
key = "your_api_key"
secret = "your_api_secret"
api_uri = "https://www.bitexen.com"
pass_phrase = "your_passphrase"
username = "your_username"
LOG_LEVEL = 10 # Optional: logging levelThen use the client without passing credentials:
from bitexen_client import API
api = API() # Automatically loads from settings filefrom bitexen_client import API
api = API(
uri="https://www.bitexen.com/",
key="your_api_key",
secret="your_api_secret",
username="your_username",
pass_phrase="your_passphrase",
timeout=5 # Optional: request timeout in seconds
)Constructor parameters > Settings file
| Method | Description | Parameters |
|---|---|---|
get_market_info(market_code) |
Get market information | market_code: e.g., "BTCTRY" |
get_ticker(market_code) |
Get ticker data | market_code: e.g., "BTCTRY" |
get_order_book(market_code) |
Get order book (bids/asks) | market_code: e.g., "BTCTRY" |
| Method | Description | Parameters |
|---|---|---|
get_balance(account_name) |
Get account balance | account_name: default "Main" |
get_open_orders(account_name, market_code) |
Get open orders | account_name, market_code |
get_closed_orders(account_name, market_code) |
Get closed orders | account_name, market_code |
get_order_status(order_number) |
Get specific order status | order_number: order ID |
create_order(...) |
Create new order | See Order Creation |
cancel_order(order_number) |
Cancel an order | order_number: order ID |
withdraw_request(currency_code, amount, alias) |
Request withdrawal | currency_code, amount, alias |
api.create_order(
account_name="Main", # Account name (default: "Main")
market_code="BTCTRY", # Market pair
buy_sell="B", # "B" for buy, "S" for sell
order_type="limit", # "limit", "market", "stop"
volume=0.001, # Order volume
price=50000, # Order price (required for limit orders)
stop_price=None # Stop price (for stop orders)
)All methods return a dotdict object with dot-notation access:
result = api.get_ticker("BTCTRY")
# Access with dot notation
print(result.status) # "success" or "error"
print(result.data.last) # Last price
print(result.data.high) # 24h high
# Or dictionary access
print(result['data']['last'])from bitexen_client import APIException
try:
order = api.create_order(...)
except APIException as e:
print(f"Error code: {e.code}")
print(f"Error message: {e.value}")Check the examples/ directory for complete working examples:
python examples/example.pyAvailable example functions:
order_book()- Fetch order book dataticker()- Get ticker informationmarket_info()- Market detailsbalance()- Account balance (requires auth)open_orders()- List open orders (requires auth)closed_orders()- List order history (requires auth)create_order()- Place an order (requires auth)cancel_order()- Cancel an order (requires auth)
- β Never commit credentials - Use environment variables or settings files
- β
Add to .gitignore - Exclude
bitexen_client_settings.py - β
Use HTTPS - Always use
https://www.bitexen.com/ - β Rotate API keys - Regularly update your API credentials
- β Limit permissions - Only grant necessary API permissions
The client uses HMAC-SHA256 signature-based authentication:
Signature = HMAC-SHA256(
apikey + username + passphrase + timestamp + request_body,
secret_key
)
Headers sent with each private request:
ACCESS-KEY: Your API keyACCESS-USER: Your usernameACCESS-PASSPHRASE: Your passphraseACCESS-TIMESTAMP: Request timestampACCESS-SIGN: HMAC signature
The client includes automatic rate limit handling:
- Detects
429 Too Many Requestsresponses - Waits 5 seconds before retrying
- Automatically retries once
- Documentation: GitHub Repository
- API Documentation: Bitexen API Docs
- Issues: GitHub Issues
- Email: [email protected]
This project is licensed under the MIT License - see the LICENSE file for details.