Server Configuration
Describes the environment variables required to run the server.
Name | Required | Description | Default |
---|---|---|---|
No arguments |
Schema
Prompts
Interactive templates invoked by user choice
Name | Description |
---|---|
prompt |
Resources
Contextual data attached and managed by the client
Name | Description |
---|---|
No resources |
Tools
Functions exposed to the LLM to take actions
Name | Description |
---|---|
get_secret_key | Get secret key from environment variables
:return: Secret key |
get_access_key | Get access key from environment variables
:return: Access key |
get_orderbook | Get orderbook data
:parameter
symbol: Symbol (e.g., BTCUSDT)
limit: Number of orderbook entries to retrieve
category: Category (spot, linear, inverse, etc.)
Args:
category: Category (spot, linear, inverse, etc.)
symbol (str): Symbol (e.g., BTCUSDT)
limit (int): Number of orderbook entries to retrieve
Returns:
Dict: Orderbook data
Example:
get_orderbook("spot", "BTCUSDT", 10)
Reference:
https://bybit-exchange.github.io/docs/v5/market/orderbook |
get_kline | Get K-line (candlestick) data
Args:
category (str): Category (spot, linear, inverse, etc.)
symbol (str): Symbol (e.g., BTCUSDT)
interval (str): Time interval (1, 3, 5, 15, 30, 60, 120, 240, 360, 720, D, W, M)
start (Optional[int]): Start time in milliseconds
end (Optional[int]): End time in milliseconds
limit (int): Number of records to retrieve
Returns:
Dict: K-line data
Example:
get_kline("spot", "BTCUSDT", "1h", 1625097600000, 1625184000000, 100)
Reference:
https://bybit-exchange.github.io/docs/v5/market/kline |
get_tickers | Get ticker information
Args:
category (str): Category (spot, linear, inverse, etc.)
symbol (str): Symbol (e.g., BTCUSDT)
Returns:
Dict: Ticker information
Example:
get_tickers("spot", "BTCUSDT")
Reference:
https://bybit-exchange.github.io/docs/v5/market/tickers |
get_wallet_balance | Get wallet balance
Args:
accountType (str): Account type (UNIFIED, CONTRACT, SPOT)
coin (Optional[str]): Coin symbol
Returns:
Dict: Wallet balance information
Example:
get_wallet_balance("UNIFIED", "BTC")
Reference:
https://bybit-exchange.github.io/docs/v5/account/wallet-balance |
get_positions | Get position information
Args:
category (str): Category (spot, linear, inverse, etc.)
symbol (Optional[str]): Symbol (e.g., BTCUSDT)
Returns:
Dict: Position information
Example:
get_positions("spot", "BTCUSDT")
Reference:
https://bybit-exchange.github.io/docs/v5/position |
place_order | Execute order
Args:
category (str): Category
- spot: Spot trading
* Minimum order quantity: 0.000011 BTC (up to 6 decimal places)
* Minimum order amount: 5 USDT
* If buying at market price, qty should be input in USDT units (e.g., "10" = 10 USDT)
* If selling at market price, qty should be input in BTC units (e.g., "0.000100" = 0.0001 BTC)
* If placing a limit order, qty should be input in BTC units
* positionIdx is not used
- linear: Futures trading (USDT margin)
* positionIdx is required (1: Long, 2: Short)
- inverse: Futures trading (coin margin)
* positionIdx is required (1: Long, 2: Short)
symbol (str): Symbol (e.g., BTCUSDT)
side (str): Order direction (Buy, Sell)
orderType (str): Order type (Market, Limit)
qty (str): Order quantity
- Market Buy: qty should be input in USDT units (e.g., "10" = 10 USDT)
- Market Sell: qty should be input in BTC units (e.g., "0.000100" = 0.0001 BTC, up to 6 decimal places)
- Limit: qty should be input in BTC units (e.g., "0.000100" = 0.0001 BTC, up to 6 decimal places)
price (Optional[str]): Order price (for limit orders)
positionIdx (Optional[str]): Position index
- Required for futures (linear/inverse) trading
- "1": Long position
- "2": Short position
- Not used for spot trading
timeInForce (Optional[str]): Order validity period
- GTC: Good Till Cancel (default, for limit orders)
- IOC: Immediate or Cancel (market order)
- FOK: Fill or Kill
- PostOnly: Post Only
orderLinkId (Optional[str]): Order link ID (unique value)
isLeverage (Optional[int]): Use leverage (0: No, 1: Yes)
orderFilter (Optional[str]): Order filter
- Order: Regular order (default)
- tpslOrder: TP/SL order
- StopOrder: Stop order
triggerPrice (Optional[str]): Trigger price
triggerBy (Optional[str]): Trigger basis
orderIv (Optional[str]): Order volatility
takeProfit (Optional[str]): Take profit price
stopLoss (Optional[str]): Stop loss price
tpTriggerBy (Optional[str]): Take profit trigger basis
slTriggerBy (Optional[str]): Stop loss trigger basis
tpLimitPrice (Optional[str]): Take profit limit price
slLimitPrice (Optional[str]): Stop loss limit price
tpOrderType (Optional[str]): Take profit order type (Market, Limit)
slOrderType (Optional[str]): Stop loss order type (Market, Limit)
Returns:
Dict: Order result
Example:
# Spot trading (SPOT account balance required)
place_order("spot", "BTCUSDT", "Buy", "Market", "10") # Buy market price for 10 USDT
place_order("spot", "BTCUSDT", "Sell", "Market", "0.000100") # Sell market price for 0.0001 BTC
place_order("spot", "BTCUSDT", "Buy", "Limit", "0.000100", price="50000") # Buy limit order for 0.0001 BTC
# Spot trading - limit order + TP/SL
place_order("spot", "BTCUSDT", "Buy", "Limit", "0.000100", price="50000",
takeProfit="55000", stopLoss="45000", # TP/SL setting
tpOrderType="Market", slOrderType="Market") # Execute TP/SL as market order
# Futures trading
place_order("linear", "BTCUSDT", "Buy", "Market", "0.001", positionIdx="1") # Buy market price for long position
place_order("linear", "BTCUSDT", "Sell", "Market", "0.001", positionIdx="2") # Sell market price for short position
Notes:
1. Spot trading order quantity restrictions:
- Minimum order quantity: 0.000011 BTC
- Minimum order amount: 5 USDT
- BTC quantity is only allowed up to 6 decimal places (e.g., 0.000100 O, 0.0001234 X)
2. Pay attention to unit when buying/selling at market price:
- Buying: qty should be input in USDT units (e.g., "10" = 10 USDT)
- Selling: qty should be input in BTC units (e.g., "0.000100" = 0.0001 BTC)
3. Futures trading requires positionIdx:
- Long position: positionIdx="1"
- Short position: positionIdx="2"
4. positionIdx is not used for spot trading
Reference:
https://bybit-exchange.github.io/docs/v5/order/create-order |
cancel_order | Cancel order
Args:
category (str): Category (spot, linear, inverse, etc.)
symbol (str): Symbol (e.g., BTCUSDT)
orderId (Optional[str]): Order ID
orderLinkId (Optional[str]): Order link ID
orderFilter (Optional[str]): Order filter
Returns:
Dict: Cancel result
Example:
cancel_order("spot", "BTCUSDT", "123456789")
Reference:
https://bybit-exchange.github.io/docs/v5/order/cancel-order |
get_order_history | Get order history
Args:
category (str): Category (spot, linear, inverse, etc.)
symbol (Optional[str]): Symbol (e.g., BTCUSDT)
orderId (Optional[str]): Order ID
orderLinkId (Optional[str]): Order link ID
orderFilter (Optional[str]): Order filter
orderStatus (Optional[str]): Order status
startTime (Optional[int]): Start time in milliseconds
endTime (Optional[int]): End time in milliseconds
limit (int): Number of orders to retrieve
Returns:
Dict: Order history
Example:
get_order_history("spot", "BTCUSDT", "123456789", "link123", "Order", "Created", 1625097600000, 1625184000000, 10)
Reference:
https://bybit-exchange.github.io/docs/v5/order/order-list |
get_open_orders | Get open orders
Args:
category (str): Category (spot, linear, inverse, etc.)
symbol (Optional[str]): Symbol (e.g., BTCUSDT)
orderId (Optional[str]): Order ID
orderLinkId (Optional[str]): Order link ID
orderFilter (Optional[str]): Order filter
limit (int): Number of orders to retrieve
Returns:
Dict: Open orders
Example:
get_open_orders("spot", "BTCUSDT", "123456789", "link123", "Order", 10)
Reference:
https://bybit-exchange.github.io/docs/v5/order/open-order |
set_trading_stop | Set trading stop
Args:
category (str): Category (spot, linear, inverse, etc.)
symbol (str): Symbol (e.g., BTCUSDT)
takeProfit (Optional[str]): Take profit price
stopLoss (Optional[str]): Stop loss price
trailingStop (Optional[str]): Trailing stop
positionIdx (Optional[int]): Position index
Returns:
Dict: Setting result
Example:
set_trading_stop("spot", "BTCUSDT", "55000", "45000", "1000", 0)
Reference:
https://bybit-exchange.github.io/docs/v5/position/trading-stop |
set_margin_mode | Set margin mode
Args:
category (str): Category (spot, linear, inverse, etc.)
symbol (str): Symbol (e.g., BTCUSDT)
tradeMode (int): Trading mode (0: Isolated, 1: Cross)
buyLeverage (str): Buying leverage
sellLeverage (str): Selling leverage
Returns:
Dict: Setting result
Example:
set_margin_mode("spot", "BTCUSDT", 0, "10", "10")
Reference:
https://bybit-exchange.github.io/docs/v5/account/set-margin-mode |
get_api_key_information | Get API key information
Returns:
Dict: API key information
Example:
get_api_key_information()
Reference:
https://bybit-exchange.github.io/docs/v5/user/apikey-info |
get_instruments_info | Get exchange information
Args:
category (str): Category (spot, linear, inverse, etc.)
symbol (str): Symbol (e.g., BTCUSDT)
status (Optional[str]): Status
baseCoin (Optional[str]): Base coin
Returns:
Dict: Exchange information
Example:
get_instruments_info("spot", "BTCUSDT", "Trading", "BTC")
Reference:
https://bybit-exchange.github.io/docs/v5/market/instrument |