Class: Bybit::RestApi::BotService
- Inherits:
-
BaseService
- Object
- BaseService
- Bybit::RestApi::BotService
- Defined in:
- lib/bybit/rest_api/bot_service.rb
Instance Method Summary collapse
-
#close_combo_bot(bot_id:, **kwargs) ⇒ Hash
Close a running futures combo bot by bot ID.
-
#close_dca_bot(bot_id:, close_mode:, **kwargs) ⇒ Hash
Close a running DCA bot with a specified settlement mode.
-
#close_futures_grid_bot(bot_id:, **kwargs) ⇒ Hash
Close a running futures grid bot by bot ID.
-
#close_futures_martingale_bot(bot_id:, **kwargs) ⇒ Hash
Close a running futures Martingale bot by bot ID.
-
#close_grid_bot(grid_id:, close_mode:, **kwargs) ⇒ Hash
Close a running spot grid bot with a specified settlement mode.
-
#create_combo_bot(leverage:, init_margin:, adjust_position_mode:, symbol_settings:, **kwargs) ⇒ Hash
Create a new futures combo bot with multi-symbol portfolio and rebalancing.
-
#create_dca_bot(parameters:, **kwargs) ⇒ Hash
Create a new DCA (Dollar-Cost Averaging) bot with custom parameters.
-
#create_futures_grid_bot(symbol:, grid_mode:, min_price:, max_price:, cell_number:, leverage:, grid_type:, total_investment:, **kwargs) ⇒ Hash
Create a new futures grid trading bot with specified parameters.
-
#create_futures_martingale_bot(symbol:, martingale_mode:, leverage:, price_float_percent:, add_position_percent:, add_position_num:, init_margin:, round_tp_percent:, **kwargs) ⇒ Hash
Create a new futures Martingale bot with DCA averaging strategy.
-
#create_grid_bot(symbol:, max_price:, min_price:, total_investment:, cell_number:, **kwargs) ⇒ Hash
Create a new spot grid trading bot.
-
#get_combo_detail(bot_id:, **kwargs) ⇒ Hash
Get full details of a futures combo bot including PnL, positions, and status.
-
#get_combo_limit(leverage:, init_margin:, adjust_position_mode:, symbol_settings:, **kwargs) ⇒ Hash
Validate combo bot input parameters and return allowable ranges.
-
#get_futures_grid_detail(bot_id:, **kwargs) ⇒ Hash
Get full details of a futures grid bot including PnL, positions, and status.
-
#get_futures_martingale_detail(bot_id:, **kwargs) ⇒ Hash
Get full details of a futures Martingale bot including PnL, positions, and round progress.
-
#get_futures_martingale_limit(symbol:, martingale_mode:, leverage:, **kwargs) ⇒ Hash
Validate Martingale bot input parameters and return allowable ranges.
-
#get_grid_detail(grid_id:, **kwargs) ⇒ Hash
Query full details of a specific grid bot by grid_id.
-
#validate_futures_grid_input(symbol:, cell_number:, min_price:, max_price:, leverage:, grid_type:, grid_mode:, **kwargs) ⇒ Hash
Validate futures grid bot input parameters and return allowable ranges.
-
#validate_grid_input(symbol:, cell_number:, min_price:, max_price:, total_investment:, **kwargs) ⇒ Hash
Validate spot grid bot parameters before creation.
Methods inherited from BaseService
Constructor Details
This class inherits a constructor from Bybit::RestApi::BaseService
Instance Method Details
#close_combo_bot(bot_id:, **kwargs) ⇒ Hash
Close a running futures combo bot by bot ID
POST /v5/fcombobot/close
38 39 40 41 |
# File 'lib/bybit/rest_api/bot_service.rb', line 38 def close_combo_bot(bot_id:, **kwargs) body = kwargs.merge(bot_id: bot_id) @session.sign_request(method: :post, path: '/v5/fcombobot/close', body: body) end |
#close_dca_bot(bot_id:, close_mode:, **kwargs) ⇒ Hash
Close a running DCA bot with a specified settlement mode
POST /v5/dca/close-bot
13 14 15 16 |
# File 'lib/bybit/rest_api/bot_service.rb', line 13 def close_dca_bot(bot_id:, close_mode:, **kwargs) body = kwargs.merge(bot_id: bot_id, close_mode: close_mode) @session.sign_request(method: :post, path: '/v5/dca/close-bot', body: body) end |
#close_futures_grid_bot(bot_id:, **kwargs) ⇒ Hash
Close a running futures grid bot by bot ID
POST /v5/fgridbot/close
116 117 118 119 |
# File 'lib/bybit/rest_api/bot_service.rb', line 116 def close_futures_grid_bot(bot_id:, **kwargs) body = kwargs.merge(bot_id: bot_id) @session.sign_request(method: :post, path: '/v5/fgridbot/close', body: body) end |
#close_futures_martingale_bot(bot_id:, **kwargs) ⇒ Hash
Close a running futures Martingale bot by bot ID
POST /v5/fmartingalebot/close
218 219 220 221 |
# File 'lib/bybit/rest_api/bot_service.rb', line 218 def close_futures_martingale_bot(bot_id:, **kwargs) body = kwargs.merge(bot_id: bot_id) @session.sign_request(method: :post, path: '/v5/fmartingalebot/close', body: body) end |
#close_grid_bot(grid_id:, close_mode:, **kwargs) ⇒ Hash
Close a running spot grid bot with a specified settlement mode
POST /v5/grid/close-grid
303 304 305 306 |
# File 'lib/bybit/rest_api/bot_service.rb', line 303 def close_grid_bot(grid_id:, close_mode:, **kwargs) body = kwargs.merge(grid_id: grid_id, close_mode: close_mode) @session.sign_request(method: :post, path: '/v5/grid/close-grid', body: body) end |
#create_combo_bot(leverage:, init_margin:, adjust_position_mode:, symbol_settings:, **kwargs) ⇒ Hash
Create a new futures combo bot with multi-symbol portfolio and rebalancing
POST /v5/fcombobot/create
63 64 65 66 67 68 69 70 71 |
# File 'lib/bybit/rest_api/bot_service.rb', line 63 def create_combo_bot(leverage:, init_margin:, adjust_position_mode:, symbol_settings:, **kwargs) body = kwargs.merge( leverage: leverage, init_margin: init_margin, adjust_position_mode: adjust_position_mode, symbol_settings: symbol_settings ) @session.sign_request(method: :post, path: '/v5/fcombobot/create', body: body) end |
#create_dca_bot(parameters:, **kwargs) ⇒ Hash
Create a new DCA (Dollar-Cost Averaging) bot with custom parameters
POST /v5/dca/create-bot
26 27 28 29 |
# File 'lib/bybit/rest_api/bot_service.rb', line 26 def create_dca_bot(parameters:, **kwargs) body = kwargs.merge(parameters: parameters) @session.sign_request(method: :post, path: '/v5/dca/create-bot', body: body) end |
#create_futures_grid_bot(symbol:, grid_mode:, min_price:, max_price:, cell_number:, leverage:, grid_type:, total_investment:, **kwargs) ⇒ Hash
Create a new futures grid trading bot with specified parameters
POST /v5/fgridbot/create
151 152 153 154 155 156 157 158 159 160 161 162 163 |
# File 'lib/bybit/rest_api/bot_service.rb', line 151 def create_futures_grid_bot(symbol:, grid_mode:, min_price:, max_price:, cell_number:, leverage:, grid_type:, total_investment:, **kwargs) body = kwargs.merge( symbol: symbol, grid_mode: grid_mode, min_price: min_price, max_price: max_price, cell_number: cell_number, leverage: leverage, grid_type: grid_type, total_investment: total_investment ) @session.sign_request(method: :post, path: '/v5/fgridbot/create', body: body) end |
#create_futures_martingale_bot(symbol:, martingale_mode:, leverage:, price_float_percent:, add_position_percent:, add_position_num:, init_margin:, round_tp_percent:, **kwargs) ⇒ Hash
Create a new futures Martingale bot with DCA averaging strategy
POST /v5/fmartingalebot/create
245 246 247 248 249 250 251 252 253 254 255 256 257 |
# File 'lib/bybit/rest_api/bot_service.rb', line 245 def create_futures_martingale_bot(symbol:, martingale_mode:, leverage:, price_float_percent:, add_position_percent:, add_position_num:, init_margin:, round_tp_percent:, **kwargs) body = kwargs.merge( symbol: symbol, martingale_mode: martingale_mode, leverage: leverage, price_float_percent: price_float_percent, add_position_percent: add_position_percent, add_position_num: add_position_num, init_margin: init_margin, round_tp_percent: round_tp_percent ) @session.sign_request(method: :post, path: '/v5/fmartingalebot/create', body: body) end |
#create_grid_bot(symbol:, max_price:, min_price:, total_investment:, cell_number:, **kwargs) ⇒ Hash
Create a new spot grid trading bot
POST /v5/grid/create-grid
333 334 335 336 337 338 339 340 341 342 |
# File 'lib/bybit/rest_api/bot_service.rb', line 333 def create_grid_bot(symbol:, max_price:, min_price:, total_investment:, cell_number:, **kwargs) body = kwargs.merge( symbol: symbol, max_price: max_price, min_price: min_price, total_investment: total_investment, cell_number: cell_number ) @session.sign_request(method: :post, path: '/v5/grid/create-grid', body: body) end |
#get_combo_detail(bot_id:, **kwargs) ⇒ Hash
Get full details of a futures combo bot including PnL, positions, and status
POST /v5/fcombobot/detail
79 80 81 82 |
# File 'lib/bybit/rest_api/bot_service.rb', line 79 def get_combo_detail(bot_id:, **kwargs) body = kwargs.merge(bot_id: bot_id) @session.sign_request(method: :post, path: '/v5/fcombobot/detail', body: body) end |
#get_combo_limit(leverage:, init_margin:, adjust_position_mode:, symbol_settings:, **kwargs) ⇒ Hash
Validate combo bot input parameters and return allowable ranges
POST /v5/fcombobot/getlimit
100 101 102 103 104 105 106 107 108 |
# File 'lib/bybit/rest_api/bot_service.rb', line 100 def get_combo_limit(leverage:, init_margin:, adjust_position_mode:, symbol_settings:, **kwargs) body = kwargs.merge( leverage: leverage, init_margin: init_margin, adjust_position_mode: adjust_position_mode, symbol_settings: symbol_settings ) @session.sign_request(method: :post, path: '/v5/fcombobot/getlimit', body: body) end |
#get_futures_grid_detail(bot_id:, **kwargs) ⇒ Hash
Get full details of a futures grid bot including PnL, positions, and status
POST /v5/fgridbot/detail
171 172 173 174 |
# File 'lib/bybit/rest_api/bot_service.rb', line 171 def get_futures_grid_detail(bot_id:, **kwargs) body = kwargs.merge(bot_id: bot_id) @session.sign_request(method: :post, path: '/v5/fgridbot/detail', body: body) end |
#get_futures_martingale_detail(bot_id:, **kwargs) ⇒ Hash
Get full details of a futures Martingale bot including PnL, positions, and round progress
POST /v5/fmartingalebot/detail
265 266 267 268 |
# File 'lib/bybit/rest_api/bot_service.rb', line 265 def get_futures_martingale_detail(bot_id:, **kwargs) body = kwargs.merge(bot_id: bot_id) @session.sign_request(method: :post, path: '/v5/fmartingalebot/detail', body: body) end |
#get_futures_martingale_limit(symbol:, martingale_mode:, leverage:, **kwargs) ⇒ Hash
Validate Martingale bot input parameters and return allowable ranges
POST /v5/fmartingalebot/getlimit
287 288 289 290 291 292 293 294 |
# File 'lib/bybit/rest_api/bot_service.rb', line 287 def get_futures_martingale_limit(symbol:, martingale_mode:, leverage:, **kwargs) body = kwargs.merge( symbol: symbol, martingale_mode: martingale_mode, leverage: leverage ) @session.sign_request(method: :post, path: '/v5/fmartingalebot/getlimit', body: body) end |
#get_grid_detail(grid_id:, **kwargs) ⇒ Hash
Query full details of a specific grid bot by grid_id
POST /v5/grid/query-grid-detail
350 351 352 353 |
# File 'lib/bybit/rest_api/bot_service.rb', line 350 def get_grid_detail(grid_id:, **kwargs) body = kwargs.merge(grid_id: grid_id) @session.sign_request(method: :post, path: '/v5/grid/query-grid-detail', body: body) end |
#validate_futures_grid_input(symbol:, cell_number:, min_price:, max_price:, leverage:, grid_type:, grid_mode:, **kwargs) ⇒ Hash
Validate futures grid bot input parameters and return allowable ranges
POST /v5/fgridbot/validate
198 199 200 201 202 203 204 205 206 207 208 209 |
# File 'lib/bybit/rest_api/bot_service.rb', line 198 def validate_futures_grid_input(symbol:, cell_number:, min_price:, max_price:, leverage:, grid_type:, grid_mode:, **kwargs) body = kwargs.merge( symbol: symbol, cell_number: cell_number, min_price: min_price, max_price: max_price, leverage: leverage, grid_type: grid_type, grid_mode: grid_mode ) @session.sign_request(method: :post, path: '/v5/fgridbot/validate', body: body) end |
#validate_grid_input(symbol:, cell_number:, min_price:, max_price:, total_investment:, **kwargs) ⇒ Hash
Validate spot grid bot parameters before creation
POST /v5/grid/validate-input
374 375 376 377 378 379 380 381 382 383 |
# File 'lib/bybit/rest_api/bot_service.rb', line 374 def validate_grid_input(symbol:, cell_number:, min_price:, max_price:, total_investment:, **kwargs) body = kwargs.merge( symbol: symbol, cell_number: cell_number, min_price: min_price, max_price: max_price, total_investment: total_investment ) @session.sign_request(method: :post, path: '/v5/grid/validate-input', body: body) end |