@@ -5,15 +5,7 @@ An async Python client for the Hummingbot API with modular router support.
5
5
## Installation
6
6
7
7
``` bash
8
- # Using uv (recommended)
9
- uv venv && source .venv/bin/activate
10
- uv pip install aiohttp
11
-
12
- # Or using pip
13
- pip install aiohttp
14
-
15
- # Install the package
16
- pip install -e .
8
+ pip install hummingbot-api-client
17
9
```
18
10
19
11
## Quick Start
@@ -57,44 +49,190 @@ The client provides access to all Hummingbot API functionality through specializ
57
49
58
50
### Core Routers
59
51
60
- - ** 🐳 Docker** (` client.docker ` ): Container and image management
61
- - List/start/stop containers
62
- - Pull images with progress monitoring
63
- - Clean up exited containers
64
-
65
- - ** 👤 Accounts** (` client.accounts ` ): Account and credential management
66
- - Create/delete accounts
67
- - Manage exchange credentials
68
- - List configured connectors per account
69
-
70
- - ** 💰 Trading** (` client.trading ` ): Order and position management
71
- - Place/cancel orders
72
- - Monitor positions and PnL
73
- - Access trade history with pagination
74
- - Configure perpetual trading modes
75
-
76
- - ** 💼 Portfolio** (` client.portfolio ` ): Portfolio monitoring and analysis
77
- - Real-time portfolio state
78
- - Token and account distribution
79
- - Historical portfolio tracking
80
-
81
- - ** 🔌 Connectors** (` client.connectors ` ): Exchange connector information
82
- - List available connectors
83
- - Get configuration requirements
84
- - Access trading rules and order types
52
+ #### 🐳 Docker Router (` client.docker ` )
53
+ Container and image management for Hummingbot Docker instances.
54
+
55
+ ** Key features:**
56
+ - Check Docker daemon status
57
+ - List/start/stop/remove containers
58
+ - Pull Docker images with progress monitoring
59
+ - Clean up exited containers
60
+ - Filter containers by name
61
+
62
+ ** Common methods:**
63
+ - ` is_running() ` - Check if Docker is running
64
+ - ` get_active_containers() ` - List all running containers
65
+ - ` start_container(name) ` - Start a stopped container
66
+ - ` stop_container(name) ` - Stop a running container
67
+ - ` pull_image(name, tag) ` - Pull a Docker image
68
+
69
+ #### 👤 Accounts Router (` client.accounts ` )
70
+ Manage trading accounts and exchange credentials.
71
+
72
+ ** Key features:**
73
+ - Create and delete trading accounts
74
+ - Add/update/delete exchange credentials
75
+ - List configured connectors per account
76
+ - Secure credential storage
77
+
78
+ ** Common methods:**
79
+ - ` list_accounts() ` - Get all account names
80
+ - ` add_account(name) ` - Create new account
81
+ - ` add_credential(account, connector, credentials) ` - Add exchange credentials
82
+ - ` list_account_credentials(account) ` - List connectors with credentials
83
+
84
+ #### 💰 Trading Router (` client.trading ` )
85
+ Execute trades and manage orders across exchanges.
86
+
87
+ ** Key features:**
88
+ - Place market and limit orders
89
+ - Cancel active orders
90
+ - Monitor open positions
91
+ - Track trade history with pagination
92
+ - Access funding payments (perpetuals)
93
+ - Configure leverage and position modes
94
+
95
+ ** Common methods:**
96
+ - ` place_order(account, connector, pair, type, amount, ...) ` - Place an order
97
+ - ` cancel_order(account, connector, order_id) ` - Cancel an order
98
+ - ` get_active_orders() ` - List all active orders
99
+ - ` get_positions() ` - Get current positions
100
+ - ` get_trades() ` - Get trade history
101
+ - ` set_leverage(account, connector, pair, leverage) ` - Set leverage
102
+
103
+ #### 💼 Portfolio Router (` client.portfolio ` )
104
+ Monitor and analyze portfolio performance.
105
+
106
+ ** Key features:**
107
+ - Real-time portfolio state across all accounts
108
+ - Token distribution analysis
109
+ - Account balance tracking
110
+ - Historical portfolio data
111
+ - Value calculations in USD
112
+
113
+ ** Common methods:**
114
+ - ` get_state() ` - Get current portfolio state
115
+ - ` get_total_value() ` - Calculate total portfolio value
116
+ - ` get_distribution() ` - Get token distribution percentages
117
+ - ` get_token_holdings(token) ` - Find specific token holdings
118
+ - ` get_portfolio_summary() ` - Get comprehensive summary
119
+
120
+ #### 🔌 Connectors Router (` client.connectors ` )
121
+ Access exchange connector information.
122
+
123
+ ** Key features:**
124
+ - List available exchange connectors
125
+ - Get configuration requirements
126
+ - Access trading rules (min/max amounts, tick sizes)
127
+ - Supported order types per exchange
128
+
129
+ ** Common methods:**
130
+ - ` list_connectors() ` - List all available connectors
131
+ - ` get_config_map(connector) ` - Get required configuration fields
132
+ - ` get_trading_rules(connector, pairs) ` - Get trading rules
133
+ - ` get_supported_order_types(connector) ` - Get supported order types
85
134
86
135
### Bot Management Routers
87
136
88
- - ** 🤖 Bot Orchestration** (` client.bot_orchestration ` ): Bot lifecycle management
89
- - Start/stop bots
90
- - Deploy strategies
91
- - Monitor bot status via MQTT
92
-
93
- - ** 📋 Controllers** (` client.controllers ` ): Advanced strategy controllers
94
- - ** 📜 Scripts** (` client.scripts ` ): Traditional Hummingbot scripts
95
- - ** 📊 Backtesting** (` client.backtesting ` ): Strategy backtesting
96
- - ** 🗄️ Archived Bots** (` client.archived_bots ` ): Analysis of stopped bots
97
- - ** 📈 Markets** (` client.markets ` ): Market data and candles
137
+ #### 🤖 Bot Orchestration Router (` client.bot_orchestration ` )
138
+ Manage bot lifecycle and deployment.
139
+
140
+ ** Key features:**
141
+ - Start/stop/restart bots
142
+ - Deploy V2 scripts and controllers
143
+ - Monitor bot status via MQTT
144
+ - Get bot performance metrics
145
+ - Archive bot data
146
+ - Track bot runs with filtering
147
+
148
+ ** Common methods:**
149
+ - ` start_bot(name, script, config) ` - Start a bot
150
+ - ` stop_bot(name) ` - Stop a bot
151
+ - ` get_bot_status(name) ` - Get bot status
152
+ - ` deploy_v2_script(name, profile, script, config) ` - Deploy a script bot
153
+ - ` deploy_v2_controllers(name, profile, controllers) ` - Deploy controller bot
154
+ - ` get_bot_runs() ` - Get bot run history
155
+
156
+ #### 📋 Controllers Router (` client.controllers ` )
157
+ Manage V2 strategy controllers.
158
+
159
+ ** Key features:**
160
+ - List available controller types
161
+ - Create/update/delete controllers
162
+ - Manage controller configurations
163
+ - Get controller templates
164
+ - Bot-specific controller configs
165
+
166
+ ** Common methods:**
167
+ - ` list_controllers() ` - List all controllers by type
168
+ - ` get_controller(type, name) ` - Get controller content
169
+ - ` create_or_update_controller(type, name, data) ` - Create/update controller
170
+ - ` list_controller_configs() ` - List all configurations
171
+ - ` get_bot_controller_configs(bot) ` - Get bot's controller configs
172
+
173
+ #### 📜 Scripts Router (` client.scripts ` )
174
+ Manage traditional Hummingbot scripts.
175
+
176
+ ** Key features:**
177
+ - List available scripts
178
+ - Create/update/delete scripts
179
+ - Manage script configurations
180
+ - Get configuration templates
181
+
182
+ ** Common methods:**
183
+ - ` list_scripts() ` - List all scripts
184
+ - ` get_script(name) ` - Get script content
185
+ - ` create_or_update_script(name, data) ` - Create/update script
186
+ - ` list_script_configs() ` - List all script configurations
187
+ - ` get_script_config_template(name) ` - Get config template
188
+
189
+ #### 📊 Backtesting Router (` client.backtesting ` )
190
+ Run strategy backtests.
191
+
192
+ ** Key features:**
193
+ - Run backtesting simulations
194
+ - Configure time periods and resolution
195
+ - Set trading costs
196
+ - Custom configuration options
197
+
198
+ ** Common methods:**
199
+ - ` run_backtesting(start_time, end_time, resolution, trade_cost, config) ` - Run backtest
200
+
201
+ #### 🗄️ Archived Bots Router (` client.archived_bots ` )
202
+ Analyze historical bot data.
203
+
204
+ ** Key features:**
205
+ - List database files
206
+ - Get performance analysis
207
+ - Access trade/order history
208
+ - View executor and position data
209
+ - Analyze controller configurations
210
+
211
+ ** Common methods:**
212
+ - ` list_databases() ` - List all database files
213
+ - ` get_database_performance(db) ` - Get performance metrics
214
+ - ` get_database_trades(db, limit, offset) ` - Get trade history
215
+ - ` get_database_orders(db, limit, offset, status) ` - Get order history
216
+ - ` get_database_positions(db) ` - Get position data
217
+
218
+ #### 📈 Market Data Router (` client.market_data ` )
219
+ Access real-time and historical market data.
220
+
221
+ ** Key features:**
222
+ - Real-time price feeds
223
+ - Historical candle data (OHLCV)
224
+ - Order book snapshots
225
+ - Funding rates (perpetuals)
226
+ - Volume/price analysis
227
+ - VWAP calculations
228
+
229
+ ** Common methods:**
230
+ - ` get_candles(connector, pair, interval, max_records) ` - Get real-time candles
231
+ - ` get_historical_candles(connector, pair, interval, start, end) ` - Get historical data
232
+ - ` get_prices(connector, pairs) ` - Get current prices
233
+ - ` get_order_book(connector, pair, depth) ` - Get order book
234
+ - ` get_funding_info(connector, pair) ` - Get funding rates
235
+ - ` get_vwap_for_volume(connector, pair, volume, is_buy) ` - Calculate VWAP
98
236
99
237
## Examples
100
238
0 commit comments