-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbasic_usage.py
More file actions
38 lines (29 loc) · 878 Bytes
/
basic_usage.py
File metadata and controls
38 lines (29 loc) · 878 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
"""
Basic Usage Example
Demonstrates basic usage of the BingX Python SDK.
"""
from bingx import BingXClient
# Initialize client
client = BingXClient(
api_key="your_api_key_here",
api_secret="your_api_secret_here",
signature_encoding="base64" # or "hex"
)
# Get current BTC price
price = client.market().get_latest_price("BTC-USDT")
print(f"BTC Price: {price}")
# Get account balance
balance = client.account().get_balance()
print(f"Balance: {balance}")
# Get all positions
positions = client.account().get_positions()
print(f"Positions: {positions}")
# Get market depth
depth = client.market().get_depth("BTC-USDT", 20)
print(f"Depth: {depth}")
# Get 24hr ticker
ticker = client.market().get_24hr_ticker("BTC-USDT")
print(f"24hr Ticker: {ticker}")
# Get candlestick data
klines = client.market().get_klines("BTC-USDT", "1h", 10)
print(f"Klines: {klines}")