Class: Bitget::V2::Client
- Inherits:
-
Object
- Object
- Bitget::V2::Client
- Defined in:
- lib/Bitget/V2/Client.rb
Direct Known Subclasses
Constant Summary collapse
- API_HOST =
'api.bitget.com'
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#api_passphrase ⇒ Object
Returns the value of attribute api_passphrase.
-
#api_secret ⇒ Object
Returns the value of attribute api_secret.
-
#debug ⇒ Object
Returns the value of attribute debug.
-
#logger ⇒ Object
Returns the value of attribute logger.
Class Method Summary collapse
Instance Method Summary collapse
-
#spot_account_assets(coin: nil, asset_type: nil) ⇒ Hash
Get Account Assets GET /api/v2/spot/account/assets.
-
#spot_account_bills(coin: nil, group_type: nil, business_type: nil, start_time: nil, end_time: nil, limit: nil, id_less_than: nil) ⇒ Hash
Get Account Bills GET /api/v2/spot/account/bills.
-
#spot_account_deduct_info ⇒ Hash
Get BGB Deduct Info GET /api/v2/spot/account/deduct-info.
-
#spot_account_info ⇒ Hash
Get Account Information GET /api/v2/spot/account/info.
-
#spot_account_sub_main_trans_record(coin: nil, role: nil, subaccount_user_id: nil, start_time: nil, end_time: nil, client_order_id: nil, limit: nil, id_less_than: nil) ⇒ Hash
Get MainSub Transfer Record GET /api/v2/spot/account/sub-main-trans-record.
-
#spot_account_subaccount_assets(id_less_than: nil, limit: nil) ⇒ Hash
Get Sub-accounts Assets GET /api/v2/spot/account/subaccount-assets.
-
#spot_account_switch_deduct(deduct:) ⇒ Hash
Switch BGB Deduct POST /api/v2/spot/account/switch-deduct.
-
#spot_account_transfer_records(coin: nil, from_type: nil, start_time: nil, end_time: nil, client_order_id: nil, page_number: nil, limit: nil, id_less_than: nil) ⇒ Hash
Get Transfer Record GET /api/v2/spot/account/transferRecords.
-
#spot_market_candles(symbol:, granularity:, start_time: nil, end_time: nil, limit: nil) ⇒ Hash
Get Candlestick Data GET /api/v2/spot/market/candles.
-
#spot_market_fills(symbol:, limit: nil) ⇒ Hash
Get Recent Trades GET /api/v2/spot/market/fills.
-
#spot_market_fills_history(symbol:, limit: nil, id_less_than: nil, start_time: nil, end_time: nil) ⇒ Hash
Get Market Trades GET /api/v2/spot/market/fills-history.
-
#spot_market_history_candles(symbol:, granularity:, end_time:, limit: nil) ⇒ Hash
Get History Candlestick Data GET /api/v2/spot/market/history-candles.
-
#spot_market_merge_depth(symbol:, precision: nil, limit: nil) ⇒ Hash
Get Merge Depth GET /api/v2/spot/market/merge-depth.
-
#spot_market_orderbook(symbol:, type: nil, limit: nil) ⇒ Hash
Get OrderBook Depth GET /api/v2/spot/market/orderbook.
-
#spot_market_tickers(symbol: nil) ⇒ Hash
Get Ticker Information GET /api/v2/spot/market/tickers.
-
#spot_market_vip_fee_rate ⇒ Hash
Get VIP Fee Rate GET /api/v2/spot/market/vip-fee-rate.
-
#spot_public_coins(coin: nil) ⇒ Hash
Get Coin Info GET /api/v2/spot/public/coins.
-
#spot_public_symbols(symbol: nil) ⇒ Hash
Get Symbol Info GET /api/v2/spot/public/symbols.
-
#spot_trade_batch_cancel_order(symbol: nil, batch_mode: nil, order_list:) ⇒ Hash
Batch Cancel Orders POST /api/v2/spot/trade/batch-cancel-order.
-
#spot_trade_batch_cancel_plan_order(symbol_list:) ⇒ Hash
Cancel Plan Orders in Batch POST /api/v2/spot/trade/batch-cancel-plan-order.
-
#spot_trade_batch_cancel_replace_order(order_list:) ⇒ Hash
Batch Cancel Existing Order and Send New Orders POST /api/v2/spot/trade/batch-cancel-replace-order.
-
#spot_trade_batch_orders(symbol: nil, batch_mode: nil, order_list:) ⇒ Hash
Batch Place Orders POST /api/v2/spot/trade/batch-orders.
-
#spot_trade_cancel_order(symbol:, tpsl_type: nil, order_id: nil, client_order_id: nil) ⇒ Hash
Cancel Order POST /api/v2/spot/trade/cancel-order.
-
#spot_trade_cancel_plan_order(order_id:) ⇒ Hash
Cancel Plan Order POST /api/v2/spot/trade/cancel-plan-order.
-
#spot_trade_cancel_replace_order(symbol:, price:, size:, client_order_id: nil, order_id: nil, new_client_order_id: nil, preset_take_profit_price: nil, execute_take_profit_price: nil, preset_stop_loss_price: nil, execute_stop_loss_price: nil) ⇒ Hash
Cancel an Existing Order and Send a New Order POST /api/v2/spot/trade/cancel-replace-order.
-
#spot_trade_cancel_symbol_order(symbol:) ⇒ Hash
Cancel Order by Symbol POST /api/v2/spot/trade/cancel-symbol-order.
-
#spot_trade_current_plan_order(symbol:, order_type: nil, side: nil, start_time: nil, end_time: nil, limit: nil) ⇒ Hash
Get Current Plan Orders GET /api/v2/spot/trade/current-plan-order.
-
#spot_trade_fills(symbol: nil, order_id: nil, start_time: nil, end_time: nil, limit: nil, id_less_than: nil) ⇒ Hash
Get Fills GET /api/v2/spot/trade/fills.
-
#spot_trade_history_orders(symbol: nil, start_time: nil, end_time: nil, id_less_than: nil, limit: nil, order_id: nil, tpsl_type: nil, request_time: nil, receive_window: nil) ⇒ Hash
Get History Orders GET /api/v2/spot/trade/history-orders.
-
#spot_trade_history_plan_order(symbol:, start_time:, end_time:, limit: nil) ⇒ Hash
Get History Plan Orders GET /api/v2/spot/trade/history-plan-order.
-
#spot_trade_modify_plan_order(order_id:, trigger_price: nil, execute_price: nil, size: nil, order_type: nil) ⇒ Hash
Modify Plan Order POST /api/v2/spot/trade/modify-plan-order.
-
#spot_trade_order_info(order_id: nil, client_order_id: nil, request_time: nil, receive_window: nil) ⇒ Hash
Get Order Info GET /api/v2/spot/trade/orderInfo.
-
#spot_trade_place_order(symbol:, side:, order_type:, force:, price: nil, size:, client_order_id: nil, trigger_price: nil, tpsl_type: nil, request_time: nil, receive_window: nil, stp_mode: nil, preset_take_profit_price: nil, execute_take_profit_price: nil, preset_stop_loss_price: nil, execute_stop_loss_price: nil) ⇒ Hash
Place Order POST /api/v2/spot/trade/place-order.
-
#spot_trade_place_plan_order(symbol:, side:, trigger_price:, order_type:, execute_price: nil, plan_type: nil, size: nil, trigger_type: nil, client_order_id: nil, stp_mode: nil) ⇒ Hash
Place Plan Order POST /api/v2/spot/trade/place-plan-order.
-
#spot_trade_plan_sub_order(order_id:) ⇒ Hash
Get Plan Sub Order GET /api/v2/spot/trade/plan-sub-order.
-
#spot_trade_unfilled_orders(symbol: nil, start_time: nil, end_time: nil, id_less_than: nil, limit: nil, order_id: nil, tpsl_type: nil, request_time: nil, receive_window: nil) ⇒ Hash
Get Current Orders GET /api/v2/spot/trade/unfilled-orders.
-
#spot_wallet_cancel_withdrawal(order_id:) ⇒ Hash
Cancel Withdrawal POST /api/v2/spot/wallet/cancel-withdrawal.
-
#spot_wallet_deposit_address(coin:, chain: nil, size: nil) ⇒ Hash
Get Deposit Address GET /api/v2/spot/wallet/deposit-address.
-
#spot_wallet_deposit_records(coin: nil, order_id: nil, start_time:, end_time:, id_less_than: nil, limit: nil) ⇒ Hash
Get Deposit Records GET /api/v2/spot/wallet/deposit-records.
-
#spot_wallet_modify_deposit_account(account_type:, coin:) ⇒ Hash
Modify Deposit Account POST /api/v2/spot/wallet/modify-deposit-account.
-
#spot_wallet_subaccount_deposit_address(subaccount_user_id:, coin:, chain: nil, size: nil) ⇒ Hash
Get SubAccount Deposit Address GET /api/v2/spot/wallet/subaccount-deposit-address.
-
#spot_wallet_subaccount_deposit_records(subaccount_user_id:, coin: nil, start_time: nil, end_time: nil, id_less_than: nil, limit: nil) ⇒ Hash
Get SubAccount Deposit Records GET /api/v2/spot/wallet/subaccount-deposit-records.
-
#spot_wallet_subaccount_transfer(from_type:, to_type:, amount:, coin:, symbol: nil, client_order_id: nil, from_user_id: nil, to_user_id: nil) ⇒ Hash
Sub Transfer POST /api/v2/spot/wallet/subaccount-transfer.
-
#spot_wallet_transfer(from_type:, to_type:, amount:, coin:, symbol:, client_order_id: nil) ⇒ Hash
Transfer POST /api/v2/spot/wallet/transfer.
-
#spot_wallet_transfer_coin_info(from_type:, to_type:) ⇒ Array<Hash>
GET Transferable Coin List GET /api/v2/spot/wallet/transfer-coin-info.
-
#spot_wallet_withdrawal(coin:, transfer_type:, address:, chain: nil, inner_to_type: nil, area_code: nil, tag: nil, size:, remark: nil, client_order_id: nil, member_code: nil, identity_type: nil, company_name: nil, first_name: nil, last_name: nil) ⇒ Hash
Withdraw POST /api/v2/spot/wallet/withdrawal.
-
#spot_wallet_withdrawal_records(coin: nil, client_order_id: nil, start_time:, end_time:, id_less_than: nil, order_id: nil, limit: nil) ⇒ Hash
Get Withdrawal Records GET /api/v2/spot/wallet/withdrawal-records.
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
1806 1807 1808 |
# File 'lib/Bitget/V2/Client.rb', line 1806 def api_key @api_key end |
#api_passphrase ⇒ Object
Returns the value of attribute api_passphrase.
1806 1807 1808 |
# File 'lib/Bitget/V2/Client.rb', line 1806 def api_passphrase @api_passphrase end |
#api_secret ⇒ Object
Returns the value of attribute api_secret.
1806 1807 1808 |
# File 'lib/Bitget/V2/Client.rb', line 1806 def api_secret @api_secret end |
#debug ⇒ Object
Returns the value of attribute debug.
1806 1807 1808 |
# File 'lib/Bitget/V2/Client.rb', line 1806 def debug @debug end |
#logger ⇒ Object
Returns the value of attribute logger.
1806 1807 1808 |
# File 'lib/Bitget/V2/Client.rb', line 1806 def logger @logger end |
Class Method Details
.path_prefix ⇒ Object
22 23 24 |
# File 'lib/Bitget/V2/Client.rb', line 22 def path_prefix '/api/v2' end |
Instance Method Details
#spot_account_assets(coin: nil, asset_type: nil) ⇒ Hash
Get Account Assets GET /api/v2/spot/account/assets
Frequency limit: 10 times/1s (User ID) Note: This endpoint retrieves detailed balance information for all assets in the spot account
1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 |
# File 'lib/Bitget/V2/Client.rb', line 1157 def spot_account_assets(coin: nil, asset_type: nil) response = get( path: '/spot/account/assets', args: { coin: coin, assetType: asset_type, } ) handle_response(response) end |
#spot_account_bills(coin: nil, group_type: nil, business_type: nil, start_time: nil, end_time: nil, limit: nil, id_less_than: nil) ⇒ Hash
Get Account Bills GET /api/v2/spot/account/bills
Frequency limit: 10 times/1s (User ID) Note: This endpoint retrieves the account's transaction history including deposits, withdrawals, trades, etc.
1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 |
# File 'lib/Bitget/V2/Client.rb', line 1259 def spot_account_bills(coin: nil, group_type: nil, business_type: nil, start_time: nil, end_time: nil, limit: nil, id_less_than: nil) response = get( path: '/spot/account/bills', args: { coin: coin, groupType: group_type, businessType: business_type, startTime: start_time, endTime: end_time, limit: limit, idLessThan: id_less_than, } ) handle_response(response) end |
#spot_account_deduct_info ⇒ Hash
Get BGB Deduct Info GET /api/v2/spot/account/deduct-info
Rate limit: 5 req/sec/UID Note: This endpoint retrieves the current BGB fee deduction settings
1647 1648 1649 1650 |
# File 'lib/Bitget/V2/Client.rb', line 1647 def spot_account_deduct_info response = get(path: '/spot/account/deduct-info') handle_response(response) end |
#spot_account_info ⇒ Hash
Get Account Information GET /api/v2/spot/account/info
Frequency limit: 1 time/1s (User ID) Note: This endpoint retrieves basic information about the user's spot account
1133 1134 1135 1136 |
# File 'lib/Bitget/V2/Client.rb', line 1133 def spot_account_info response = get(path: '/spot/account/info') handle_response(response) end |
#spot_account_sub_main_trans_record(coin: nil, role: nil, subaccount_user_id: nil, start_time: nil, end_time: nil, client_order_id: nil, limit: nil, id_less_than: nil) ⇒ Hash
Get MainSub Transfer Record GET /api/v2/spot/account/sub-main-trans-record
Rate limit: 20 req/sec/UID Note: This endpoint retrieves transfer records between main and sub-accounts
1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 |
# File 'lib/Bitget/V2/Client.rb', line 1478 def spot_account_sub_main_trans_record(coin: nil, role: nil, subaccount_user_id: nil, start_time: nil, end_time: nil, client_order_id: nil, limit: nil, id_less_than: nil) response = get( path: '/spot/account/sub-main-trans-record', args: { coin: coin, role: role, subUid: subaccount_user_id, startTime: start_time, endTime: end_time, clientOid: client_order_id, limit: limit, idLessThan: id_less_than, } ) handle_response(response) end |
#spot_account_subaccount_assets(id_less_than: nil, limit: nil) ⇒ Hash
Get Sub-accounts Assets GET /api/v2/spot/account/subaccount-assets
Frequency limit: 10 times/1s (User ID) Note: This endpoint retrieves asset information for all sub-accounts Returns only sub-accounts which have assets > 0 Note: ND Brokers are not allowed to call this endpoint
1192 1193 1194 1195 1196 1197 1198 1199 1200 |
# File 'lib/Bitget/V2/Client.rb', line 1192 def spot_account_subaccount_assets(id_less_than: nil, limit: nil) response = get(path: '/spot/account/subaccount-assets', args: { idLessThan: id_less_than, limit: limit } ) handle_response(response) end |
#spot_account_switch_deduct(deduct:) ⇒ Hash
Switch BGB Deduct POST /api/v2/spot/account/switch-deduct
Rate Limit: 1 req/sec/UID Note: This endpoint enables or disables BGB fee deduction for spot trading
1566 1567 1568 1569 |
# File 'lib/Bitget/V2/Client.rb', line 1566 def spot_account_switch_deduct(deduct:) response = post(path: '/spot/account/switch-deduct', args: {deduct: deduct}) handle_response(response) end |
#spot_account_transfer_records(coin: nil, from_type: nil, start_time: nil, end_time: nil, client_order_id: nil, page_number: nil, limit: nil, id_less_than: nil) ⇒ Hash
Get Transfer Record GET /api/v2/spot/account/transferRecords
Frequency limit: 20 times/1s (User ID) Note: This endpoint retrieves transfer records between different account types
1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 |
# File 'lib/Bitget/V2/Client.rb', line 1534 def spot_account_transfer_records(coin: nil, from_type: nil, start_time: nil, end_time: nil, client_order_id: nil, page_number: nil, limit: nil, id_less_than: nil) response = get( path: '/spot/account/transferRecords', args: { coin: coin, fromType: from_type, startTime: start_time, endTime: end_time, clientOid: client_order_id, pageNum: page_number, limit: limit, idLessThan: id_less_than, } ) handle_response(response) end |
#spot_market_candles(symbol:, granularity:, start_time: nil, end_time: nil, limit: nil) ⇒ Hash
Get Candlestick Data GET /api/v2/spot/market/candles
Rate Limit: 20 times/1s (IP) Note: This endpoint retrieves candlestick/kline data for a trading pair
250 251 252 253 254 255 256 257 258 259 260 261 262 |
# File 'lib/Bitget/V2/Client.rb', line 250 def spot_market_candles(symbol:, granularity:, start_time: nil, end_time: nil, limit: nil) response = get( path: '/spot/market/candles', args: { symbol: symbol, granularity: granularity, startTime: start_time, endTime: end_time, limit: limit, } ) handle_response(response) end |
#spot_market_fills(symbol:, limit: nil) ⇒ Hash
Get Recent Trades GET /api/v2/spot/market/fills
Rate Limit: 10 times/1s (IP) Note: This endpoint retrieves recent trades for a trading pair
320 321 322 323 |
# File 'lib/Bitget/V2/Client.rb', line 320 def spot_market_fills(symbol:, limit: nil) response = get(path: '/spot/market/fills', args: {symbol: symbol, limit: limit}) handle_response(response) end |
#spot_market_fills_history(symbol:, limit: nil, id_less_than: nil, start_time: nil, end_time: nil) ⇒ Hash
Get Market Trades GET /api/v2/spot/market/fills-history
Rate Limit: 10 req/sec/IP Note: This endpoint retrieves historical trades for a trading pair
347 348 349 350 351 352 353 354 355 356 357 358 359 |
# File 'lib/Bitget/V2/Client.rb', line 347 def spot_market_fills_history(symbol:, limit: nil, id_less_than: nil, start_time: nil, end_time: nil) response = get( path: '/spot/market/fills-history', args: { symbol: symbol, limit: limit, idLessThan: id_less_than, startTime: start_time, endTime: end_time, } ) handle_response(response) end |
#spot_market_history_candles(symbol:, granularity:, end_time:, limit: nil) ⇒ Hash
Get History Candlestick Data GET /api/v2/spot/market/history-candles
Rate Limit: 20 times/1s (IP) Note: This endpoint retrieves historical candlestick/kline data for a trading pair
288 289 290 291 292 293 294 295 296 297 298 299 |
# File 'lib/Bitget/V2/Client.rb', line 288 def spot_market_history_candles(symbol:, granularity:, end_time:, limit: nil) response = get( path: '/spot/market/history-candles', args: { symbol: symbol, granularity: granularity, endTime: end_time, limit: limit, } ) handle_response(response) end |
#spot_market_merge_depth(symbol:, precision: nil, limit: nil) ⇒ Hash
Get Merge Depth GET /api/v2/spot/market/merge-depth
Rate Limit: 20 times/1s (IP) Note: This endpoint retrieves the merged order book depth for a trading pair
183 184 185 186 187 188 189 190 191 192 193 |
# File 'lib/Bitget/V2/Client.rb', line 183 def spot_market_merge_depth(symbol:, precision: nil, limit: nil) response = get( path: '/spot/market/merge-depth', args: { symbol: symbol, precision: precision, limit: limit, } ) handle_response(response) end |
#spot_market_orderbook(symbol:, type: nil, limit: nil) ⇒ Hash
Get OrderBook Depth GET /api/v2/spot/market/orderbook
Rate Limit: 20 times/1s (IP) Note: This endpoint retrieves the order book depth for a trading pair
213 214 215 216 217 218 219 220 221 222 223 |
# File 'lib/Bitget/V2/Client.rb', line 213 def spot_market_orderbook(symbol:, type: nil, limit: nil) response = get( path: '/spot/market/orderbook', args: { symbol: symbol, type: type, limit: limit, } ) handle_response(response) end |
#spot_market_tickers(symbol: nil) ⇒ Hash
Get Ticker Information GET /api/v2/spot/market/tickers
Rate Limit: 20 times/1s (IP) Note: This endpoint retrieves 24-hour trading information for trading pairs
153 154 155 156 |
# File 'lib/Bitget/V2/Client.rb', line 153 def spot_market_tickers(symbol: nil) response = get(path: '/spot/market/tickers', args: {symbol: symbol}) handle_response(response) end |
#spot_market_vip_fee_rate ⇒ Hash
Get VIP Fee Rate GET /api/v2/spot/market/vip-fee-rate
Rate Limit: 10 times/1s (IP) Note: This endpoint retrieves the current VIP fee rates for the user
120 121 122 123 |
# File 'lib/Bitget/V2/Client.rb', line 120 def spot_market_vip_fee_rate response = get(path: '/spot/market/vip-fee-rate') handle_response(response) end |
#spot_public_coins(coin: nil) ⇒ Hash
Get Coin Info GET /api/v2/spot/public/coins
Rate Limit: 3 times/1s (IP) Note: This endpoint retrieves information about supported cryptocurrencies
62 63 64 65 |
# File 'lib/Bitget/V2/Client.rb', line 62 def spot_public_coins(coin: nil) response = get(path: '/spot/public/coins', args: {coin: coin}) handle_response(response) end |
#spot_public_symbols(symbol: nil) ⇒ Hash
Get Symbol Info GET /api/v2/spot/public/symbols
Rate Limit: 20 times/1s (IP) Note: This endpoint retrieves information about supported trading pairs
97 98 99 100 |
# File 'lib/Bitget/V2/Client.rb', line 97 def spot_public_symbols(symbol: nil) response = get(path: '/spot/public/symbols', args: {symbol: symbol}) handle_response(response) end |
#spot_trade_batch_cancel_order(symbol: nil, batch_mode: nil, order_list:) ⇒ Hash
Batch Cancel Orders POST /api/v2/spot/trade/batch-cancel-order
Frequency limit:10 times/1s (UID) Note: This endpoint cancels multiple orders in a single request
644 645 646 647 648 649 650 651 652 653 654 |
# File 'lib/Bitget/V2/Client.rb', line 644 def spot_trade_batch_cancel_order(symbol: nil, batch_mode: nil, order_list:) response = post( path: '/spot/trade/batch-cancel-order', args: { symbol: symbol, batchMode: batch_mode, orderList: order_list, } ) handle_response(response) end |
#spot_trade_batch_cancel_plan_order(symbol_list:) ⇒ Hash
Cancel Plan Orders in Batch POST /api/v2/spot/trade/batch-cancel-plan-order
Rate limit: 5 req/sec/UID Note: This endpoint cancels all trigger/plan orders for the specified trading pairs
1103 1104 1105 1106 1107 1108 1109 |
# File 'lib/Bitget/V2/Client.rb', line 1103 def spot_trade_batch_cancel_plan_order(symbol_list:) response = post( path: '/spot/trade/batch-cancel-plan-order', args: {symbolList: symbol_list} ) handle_response(response) end |
#spot_trade_batch_cancel_replace_order(order_list:) ⇒ Hash
Batch Cancel Existing Order and Send New Orders POST /api/v2/spot/trade/batch-cancel-replace-order
Rate Limit: 5 requests/second/UID Note: This endpoint cancels multiple existing orders and places new ones atomically
526 527 528 529 |
# File 'lib/Bitget/V2/Client.rb', line 526 def spot_trade_batch_cancel_replace_order(order_list:) response = post(path: '/spot/trade/batch-cancel-replace-order', args: {orderList: order_list}) handle_response(response) end |
#spot_trade_batch_orders(symbol: nil, batch_mode: nil, order_list:) ⇒ Hash
Batch Place Orders POST /api/v2/spot/trade/batch-orders
Rate limit: Frequency limit: 5 times/1s (UID)Trader frequency limit: 1 times/1s (UID) Note: This endpoint places multiple orders in a single request
599 600 601 602 603 604 605 606 607 608 609 |
# File 'lib/Bitget/V2/Client.rb', line 599 def spot_trade_batch_orders(symbol: nil, batch_mode: nil, order_list:) response = post( path: '/spot/trade/batch-orders', args: { symbol: symbol, batchMode: batch_mode, orderList: order_list, } ) handle_response(response) end |
#spot_trade_cancel_order(symbol:, tpsl_type: nil, order_id: nil, client_order_id: nil) ⇒ Hash
Cancel Order POST /api/v2/spot/trade/cancel-order
Frequency limit:10 times/1s (UID) Note: This endpoint cancels an existing order
549 550 551 552 553 554 555 556 557 558 559 560 |
# File 'lib/Bitget/V2/Client.rb', line 549 def spot_trade_cancel_order(symbol:, tpsl_type: nil, order_id: nil, client_order_id: nil) response = post( path: '/spot/trade/cancel-order', args: { symbol: symbol, tpslType: tpsl_type, orderId: order_id, clientOid: client_order_id, } ) handle_response(response) end |
#spot_trade_cancel_plan_order(order_id:) ⇒ Hash
Cancel Plan Order POST /api/v2/spot/trade/cancel-plan-order
Frequency limit: 20 times/1s (UID) Note: This endpoint cancels an existing trigger/plan order
977 978 979 980 981 982 983 |
# File 'lib/Bitget/V2/Client.rb', line 977 def spot_trade_cancel_plan_order(order_id:) response = post( path: '/spot/trade/cancel-plan-order', args: {orderId: order_id} ) handle_response(response) end |
#spot_trade_cancel_replace_order(symbol:, price:, size:, client_order_id: nil, order_id: nil, new_client_order_id: nil, preset_take_profit_price: nil, execute_take_profit_price: nil, preset_stop_loss_price: nil, execute_stop_loss_price: nil) ⇒ Hash
Cancel an Existing Order and Send a New Order POST /api/v2/spot/trade/cancel-replace-order
Rate Limit: Rate limit: 5 requests/second/UID Note: This endpoint cancels an existing order and places a new one atomically
465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 |
# File 'lib/Bitget/V2/Client.rb', line 465 def spot_trade_cancel_replace_order( symbol:, price:, size:, client_order_id: nil, order_id: nil, new_client_order_id: nil, preset_take_profit_price: nil, execute_take_profit_price: nil, preset_stop_loss_price: nil, execute_stop_loss_price: nil ) response = post( path: '/spot/trade/cancel-replace-order', args: { symbol: symbol, price: price, size: size, clientOid: client_order_id, orderId: order_id, newClientOid: new_client_order_id, presetTakeProfitPrice: preset_take_profit_price, executeTakeProfitPrice: execute_take_profit_price, presetStopLossPrice: preset_stop_loss_price, executeStopLossPrice: execute_stop_loss_price, } ) handle_response(response) end |
#spot_trade_cancel_symbol_order(symbol:) ⇒ Hash
Cancel Order by Symbol POST /api/v2/spot/trade/cancel-symbol-order
Rate Limit: Frequency limit: 5 times/1s (UID) Note: This endpoint cancels all orders for a specific trading pair
671 672 673 674 |
# File 'lib/Bitget/V2/Client.rb', line 671 def spot_trade_cancel_symbol_order(symbol:) response = post(path: '/spot/trade/cancel-symbol-order', args: {symbol: symbol}) handle_response(response) end |
#spot_trade_current_plan_order(symbol:, order_type: nil, side: nil, start_time: nil, end_time: nil, limit: nil) ⇒ Hash
Get Current Plan Orders GET /api/v2/spot/trade/current-plan-order
Frequency limit: 20 times/1s (UID) Note: This endpoint retrieves all active trigger/plan orders
1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 |
# File 'lib/Bitget/V2/Client.rb', line 1005 def spot_trade_current_plan_order(symbol:, order_type: nil, side: nil, start_time: nil, end_time: nil, limit: nil) response = get( path: '/spot/trade/current-plan-order', args: { symbol: symbol, orderType: order_type, side: side, startTime: start_time, endTime: end_time, limit: limit, } ) handle_response(response) end |
#spot_trade_fills(symbol: nil, order_id: nil, start_time: nil, end_time: nil, limit: nil, id_less_than: nil) ⇒ Hash
Get Fills GET /api/v2/spot/trade/fills
Frequency limit:10 times/1s (UID) Note: This endpoint retrieves trade execution details for orders
873 874 875 876 877 878 879 880 881 882 883 884 885 886 |
# File 'lib/Bitget/V2/Client.rb', line 873 def spot_trade_fills(symbol: nil, order_id: nil, start_time: nil, end_time: nil, limit: nil, id_less_than: nil) response = get( path: '/spot/trade/fills', args: { symbol: symbol, orderId: order_id, startTime: start_time, endTime: end_time, limit: limit, idLessThan: id_less_than, } ) handle_response(response) end |
#spot_trade_history_orders(symbol: nil, start_time: nil, end_time: nil, id_less_than: nil, limit: nil, order_id: nil, tpsl_type: nil, request_time: nil, receive_window: nil) ⇒ Hash
Get History Orders GET /api/v2/spot/trade/history-orders
Frequency limit: 20 times/1s (UID) Note: This endpoint retrieves historical orders (filled, cancelled, etc.)
821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 |
# File 'lib/Bitget/V2/Client.rb', line 821 def spot_trade_history_orders(symbol: nil, start_time: nil, end_time: nil, id_less_than: nil, limit: nil, order_id: nil, tpsl_type: nil, request_time: nil, receive_window: nil) response = get( path: '/spot/trade/history-orders', args: { symbol: symbol, startTime: start_time, endTime: end_time, idLessThan: id_less_than, limit: limit, orderId: order_id, tpslType: tpsl_type, requestTime: request_time, receiveWindow: receive_window, } ) handle_response(response) end |
#spot_trade_history_plan_order(symbol:, start_time:, end_time:, limit: nil) ⇒ Hash
Get History Plan Orders GET /api/v2/spot/trade/history-plan-order
Frequency limit: 20 times/1s (UID) Note: This endpoint retrieves historical trigger/plan orders (executed, cancelled, etc.)
1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 |
# File 'lib/Bitget/V2/Client.rb', line 1076 def spot_trade_history_plan_order(symbol:, start_time:, end_time:, limit: nil) response = get( path: '/spot/trade/history-plan-order', args: { symbol: symbol, startTime: start_time, endTime: end_time, limit: limit, } ) handle_response(response) end |
#spot_trade_modify_plan_order(order_id:, trigger_price: nil, execute_price: nil, size: nil, order_type: nil) ⇒ Hash
Modify Plan Order POST /api/v2/spot/trade/modify-plan-order
Frequency limit: 20 times/1s (UID) Note: This endpoint modifies an existing trigger/plan order
950 951 952 953 954 955 956 957 958 959 960 961 962 |
# File 'lib/Bitget/V2/Client.rb', line 950 def spot_trade_modify_plan_order(order_id:, trigger_price: nil, execute_price: nil, size: nil, order_type: nil) response = post( path: '/spot/trade/modify-plan-order', args: { orderId: order_id, triggerPrice: trigger_price, executePrice: execute_price, size: size, orderType: order_type, } ) handle_response(response) end |
#spot_trade_order_info(order_id: nil, client_order_id: nil, request_time: nil, receive_window: nil) ⇒ Hash
Get Order Info GET /api/v2/spot/trade/orderInfo
Frequency limit: 20 times/1s (UID) Note: This endpoint retrieves detailed information about a specific order
710 711 712 713 714 715 716 717 718 719 720 721 |
# File 'lib/Bitget/V2/Client.rb', line 710 def spot_trade_order_info(order_id: nil, client_order_id: nil, request_time: nil, receive_window: nil) response = get( path: '/spot/trade/orderInfo', args: { orderId: order_id, clientOid: client_order_id, requestTime: request_time, receiveWindow: receive_window, } ) handle_response(response) end |
#spot_trade_place_order(symbol:, side:, order_type:, force:, price: nil, size:, client_order_id: nil, trigger_price: nil, tpsl_type: nil, request_time: nil, receive_window: nil, stp_mode: nil, preset_take_profit_price: nil, execute_take_profit_price: nil, preset_stop_loss_price: nil, execute_stop_loss_price: nil) ⇒ Hash
Place Order POST /api/v2/spot/trade/place-order
Rate limit: 10 requests/second/UID Rate limit: 1 request/second/UID for copy trading traders Note: This endpoint places a new order for spot trading
397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 |
# File 'lib/Bitget/V2/Client.rb', line 397 def spot_trade_place_order( symbol:, side:, order_type:, force:, price: nil, size:, client_order_id: nil, trigger_price: nil, tpsl_type: nil, request_time: nil, receive_window: nil, stp_mode: nil, preset_take_profit_price: nil, execute_take_profit_price: nil, preset_stop_loss_price: nil, execute_stop_loss_price: nil ) response = post( path: '/spot/trade/place-order', args: { symbol: symbol, side: side, orderType: order_type, force: force, price: price, size: size, clientOid: client_order_id, triggerPrice: trigger_price, tpslType: tpsl_type, requestTime: request_time, receiveWindow: receive_window, stpMode: stp_mode, presetTakeProfitPrice: preset_take_profit_price, executeTakeProfitPrice: execute_take_profit_price, presetStopLossPrice: preset_stop_loss_price, executeStopLossPrice: execute_stop_loss_price, } ) handle_response(response) end |
#spot_trade_place_plan_order(symbol:, side:, trigger_price:, order_type:, execute_price: nil, plan_type: nil, size: nil, trigger_type: nil, client_order_id: nil, stp_mode: nil) ⇒ Hash
Place Plan Order POST /api/v2/spot/trade/place-plan-order
Frequency limit: 20 times/1s (UID) Note: This endpoint places a trigger/plan order that executes when price conditions are met
913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 |
# File 'lib/Bitget/V2/Client.rb', line 913 def spot_trade_place_plan_order(symbol:, side:, trigger_price:, order_type:, execute_price: nil, plan_type: nil, size: nil, trigger_type: nil, client_order_id: nil, stp_mode: nil) response = post( path: '/spot/trade/place-plan-order', args: { symbol: symbol, side: side, triggerPrice: trigger_price, orderType: order_type, executePrice: execute_price, planType: plan_type, size: size, triggerType: trigger_type, clientOid: client_order_id, stpMode: stp_mode, } ) handle_response(response) end |
#spot_trade_plan_sub_order(order_id:) ⇒ Hash
Get Plan Sub Order GET /api/v2/spot/trade/plan-sub-order
Frequency limit: 20 times/1s (UID) Note: This endpoint retrieves the executed sub-orders of a trigger/plan order
1036 1037 1038 1039 1040 1041 1042 |
# File 'lib/Bitget/V2/Client.rb', line 1036 def spot_trade_plan_sub_order(order_id:) response = get( path: '/spot/trade/plan-sub-order', args: {orderId: order_id} ) handle_response(response) end |
#spot_trade_unfilled_orders(symbol: nil, start_time: nil, end_time: nil, id_less_than: nil, limit: nil, order_id: nil, tpsl_type: nil, request_time: nil, receive_window: nil) ⇒ Hash
Get Current Orders GET /api/v2/spot/trade/unfilled-orders
Frequency limit: 20 times/1s (UID) Note: This endpoint retrieves all unfilled (open) orders for the account
763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 |
# File 'lib/Bitget/V2/Client.rb', line 763 def spot_trade_unfilled_orders(symbol: nil, start_time: nil, end_time: nil, id_less_than: nil, limit: nil, order_id: nil, tpsl_type: nil, request_time: nil, receive_window: nil) response = get( path: '/spot/trade/unfilled-orders', args: { symbol: symbol, startTime: start_time, endTime: end_time, idLessThan: id_less_than, limit: limit, orderId: order_id, tpslType: tpsl_type, requestTime: request_time, receiveWindow: receive_window, } ) handle_response(response) end |
#spot_wallet_cancel_withdrawal(order_id:) ⇒ Hash
Cancel Withdrawal POST /api/v2/spot/wallet/cancel-withdrawal
Frequency limit:10 times/1s (User ID) Note: This endpoint cancels a pending withdrawal request
1664 1665 1666 1667 |
# File 'lib/Bitget/V2/Client.rb', line 1664 def spot_wallet_cancel_withdrawal(order_id:) response = post(path: '/spot/wallet/cancel-withdrawal', args: {orderId: order_id}) handle_response(response) end |
#spot_wallet_deposit_address(coin:, chain: nil, size: nil) ⇒ Hash
Get Deposit Address GET /api/v2/spot/wallet/deposit-address
Frequency limit: 10 times/1s (User ID) Note: This endpoint retrieves the deposit address for a specific cryptocurrency
1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 |
# File 'lib/Bitget/V2/Client.rb', line 1590 def spot_wallet_deposit_address(coin:, chain: nil, size: nil) response = get( path: '/spot/wallet/deposit-address', args: { coin: coin, chain: chain, size: size, } ) handle_response(response) end |
#spot_wallet_deposit_records(coin: nil, order_id: nil, start_time:, end_time:, id_less_than: nil, limit: nil) ⇒ Hash
Get Deposit Records GET /api/v2/spot/wallet/deposit-records
Frequency limit:10 times/1s (UID) Note: This endpoint retrieves deposit records for the account
1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 |
# File 'lib/Bitget/V2/Client.rb', line 1791 def spot_wallet_deposit_records(coin: nil, order_id: nil, start_time:, end_time:, id_less_than: nil, limit: nil) response = get( path: '/spot/wallet/deposit-records', args: { coin: coin, orderId: order_id, startTime: start_time, endTime: end_time, idLessThan: id_less_than, limit: limit, } ) handle_response(response) end |
#spot_wallet_modify_deposit_account(account_type:, coin:) ⇒ Hash
Modify Deposit Account POST /api/v2/spot/wallet/modify-deposit-account
Frequency limit:10 times/1s (User ID) Note: This endpoint modifies the deposit account type for a specific cryptocurrency
1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 |
# File 'lib/Bitget/V2/Client.rb', line 1220 def spot_wallet_modify_deposit_account(account_type:, coin:) response = post( path: '/spot/wallet/modify-deposit-account', args: { accountType: account_type, coin: coin, } ) handle_response(response) end |
#spot_wallet_subaccount_deposit_address(subaccount_user_id:, coin:, chain: nil, size: nil) ⇒ Hash
Get SubAccount Deposit Address GET /api/v2/spot/wallet/subaccount-deposit-address
Rate limit: 10 req/sec/UID Note: This endpoint retrieves the deposit address for a specific cryptocurrency in a sub-account
1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 |
# File 'lib/Bitget/V2/Client.rb', line 1622 def spot_wallet_subaccount_deposit_address(subaccount_user_id:, coin:, chain: nil, size: nil) response = get( path: '/spot/wallet/subaccount-deposit-address', args: { subUid: subaccount_user_id, coin: coin, chain: chain, size: size, } ) handle_response(response) end |
#spot_wallet_subaccount_deposit_records(subaccount_user_id:, coin: nil, start_time: nil, end_time: nil, id_less_than: nil, limit: nil) ⇒ Hash
Get SubAccount Deposit Records GET /api/v2/spot/wallet/subaccount-deposit-records
Frequency limit:10 times/1s (UID) Note: This endpoint retrieves deposit records for a specific sub-account
1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 |
# File 'lib/Bitget/V2/Client.rb', line 1697 def spot_wallet_subaccount_deposit_records(subaccount_user_id:, coin: nil, start_time: nil, end_time: nil, id_less_than: nil, limit: nil) response = get( path: '/spot/wallet/subaccount-deposit-records', args: { subUid: subaccount_user_id, coin: coin, startTime: start_time, endTime: end_time, idLessThan: id_less_than, limit: limit, } ) handle_response(response) end |
#spot_wallet_subaccount_transfer(from_type:, to_type:, amount:, coin:, symbol: nil, client_order_id: nil, from_user_id: nil, to_user_id: nil) ⇒ Hash
Sub Transfer POST /api/v2/spot/wallet/subaccount-transfer
Rate limit: 10 req/sec/UID Note: This endpoint requires IP whitelist. Transfer between fromUserId and toUserId should have direct/brother relationship.
1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 |
# File 'lib/Bitget/V2/Client.rb', line 1373 def spot_wallet_subaccount_transfer(from_type:, to_type:, amount:, coin:, symbol: nil, client_order_id: nil, from_user_id: nil, to_user_id: nil) response = post( path: '/spot/wallet/subaccount-transfer', args: { fromType: from_type, toType: to_type, amount: amount, coin: coin, clientOid: client_order_id, fromUserId: from_user_id, toUserId: to_user_id, } ) handle_response(response) end |
#spot_wallet_transfer(from_type:, to_type:, amount:, coin:, symbol:, client_order_id: nil) ⇒ Hash
Transfer POST /api/v2/spot/wallet/transfer
RRate limit: 10 requests/second/UID Note: This endpoint transfers assets between different account types within Bitget Note: Only available for main accounts, not sub-accounts
1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 |
# File 'lib/Bitget/V2/Client.rb', line 1298 def spot_wallet_transfer(from_type:, to_type:, amount:, coin:, symbol:, client_order_id: nil) response = post( path: '/spot/wallet/transfer', args: { fromType: from_type, toType: to_type, amount: amount, coin: coin, symbol: symbol, clientOid: client_order_id, } ) handle_response(response) end |
#spot_wallet_transfer_coin_info(from_type:, to_type:) ⇒ Array<Hash>
GET Transferable Coin List GET /api/v2/spot/wallet/transfer-coin-info
Frequency limit:10 times/1s (User ID) Note: This endpoint retrieves the list of coins that can be transferred between specified account types
1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 |
# File 'lib/Bitget/V2/Client.rb', line 1333 def spot_wallet_transfer_coin_info(from_type:, to_type:) response = get( path: '/spot/wallet/transfer-coin-info', args: { fromType: from_type, toType: to_type, } ) handle_response(response) end |
#spot_wallet_withdrawal(coin:, transfer_type:, address:, chain: nil, inner_to_type: nil, area_code: nil, tag: nil, size:, remark: nil, client_order_id: nil, member_code: nil, identity_type: nil, company_name: nil, first_name: nil, last_name: nil) ⇒ Hash
Withdraw POST /api/v2/spot/wallet/withdrawal
Rate limit:5 req/sec/UID Note: This endpoint requires withdrawal permission and IP whitelist.
1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 |
# File 'lib/Bitget/V2/Client.rb', line 1422 def spot_wallet_withdrawal(coin:, transfer_type:, address:, chain: nil, inner_to_type: nil, area_code: nil, tag: nil, size:, remark: nil, client_order_id: nil, member_code: nil, identity_type: nil, company_name: nil, first_name: nil, last_name: nil) response = post( path: '/spot/wallet/withdrawal', args: { coin: coin, transferType: transfer_type, address: address, chain: chain, innerToType: inner_to_type, areaCode: area_code, tag: tag, size: size, remark: remark, clientOid: client_order_id, memberCode: member_code, identityType: identity_type, companyName: company_name, firstName: first_name, lastName: last_name, } ) handle_response(response) end |
#spot_wallet_withdrawal_records(coin: nil, client_order_id: nil, start_time:, end_time:, id_less_than: nil, order_id: nil, limit: nil) ⇒ Hash
Get Withdrawal Records GET /api/v2/spot/wallet/withdrawal-records
Frequency limit:10 times/1s (User ID) Note: This endpoint retrieves withdrawal records for the account
1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 |
# File 'lib/Bitget/V2/Client.rb', line 1746 def spot_wallet_withdrawal_records(coin: nil, client_order_id: nil, start_time:, end_time:, id_less_than: nil, order_id: nil, limit: nil) response = get( path: '/spot/wallet/withdrawal-records', args: { coin: coin, clientOid: client_order_id, startTime: start_time, endTime: end_time, idLessThan: id_less_than, orderId: order_id, limit: limit, } ) handle_response(response) end |