Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/hummingbot/hummingbot/llms.txt

Use this file to discover all available pages before exploring further.

TradeType

Enum defining the types of trades. Source: hummingbot/core/data_type/common.py:62
BUY
int
default:"1"
Buy trade - purchasing the base asset with the quote asset
SELL
int
default:"2"
Sell trade - selling the base asset for the quote asset
RANGE
int
default:"3"
Range trade - used for liquidity provision in a specific price range

LPType

Enum defining liquidity provider operation types. Source: hummingbot/core/data_type/common.py:68
ADD
int
default:"1"
Add liquidity to a pool
REMOVE
int
default:"2"
Remove liquidity from a pool
COLLECT
int
default:"3"
Collect fees from a liquidity position

Trade

NamedTuple representing an executed trade. Source: hummingbot/core/data_type/trade.py:13
trading_pair
str
Trading pair for the trade (e.g., “BTC-USDT”)
side
TradeType
Side of the trade (BUY or SELL)
price
float
Execution price of the trade
amount
float
Amount traded
order_type
OrderType
Type of order that generated the trade
market
str
Exchange/market where the trade was executed
timestamp
float
Trade execution timestamp
trade_fee
TradeFeeBase
Fee associated with the trade

Properties

trade_type
str
Returns the trade side name (“BUY” or “SELL”)

Methods

to_pandas(trades)
classmethod
Converts a list of Trade objects to a pandas DataFrame with columns:
  • trading_pair
  • price
  • quantity
  • order_type
  • trade_side
  • market
  • timestamp
  • fee_percent
  • flat_fee / gas

TradeUpdate

NamedTuple representing an update for a trade execution. Source: hummingbot/core/data_type/in_flight_order.py:48
trade_id
str
Unique identifier for the trade
client_order_id
str
Client-assigned order identifier
exchange_order_id
str
Exchange-assigned order identifier
trading_pair
str
Trading pair for the trade
fill_timestamp
float
Timestamp when the trade was filled (in seconds)
fill_price
Decimal
Price at which the trade was filled
fill_base_amount
Decimal
Amount of base asset filled
fill_quote_amount
Decimal
Amount of quote asset filled
fee
TradeFeeBase
Fee paid for the trade
is_taker
bool
default:"True"
Whether the trade was executed as a taker (CEXs deliver trade events from the taker’s perspective)

Properties

fee_asset
str
The asset in which the fee was paid

Methods

from_json(data)
classmethod
Creates a TradeUpdate instance from a JSON dictionary
to_json()
Dict[str, Any]
Converts the TradeUpdate to a JSON-serializable dictionary

InFlightOrder

Class representing an order that is currently being tracked by the system. Source: hummingbot/core/data_type/in_flight_order.py:91

Constructor Parameters

client_order_id
str
Client-assigned unique identifier for the order
trading_pair
str
Trading pair for the order
order_type
OrderType
Type of the order
trade_type
TradeType
Trade type (BUY or SELL)
amount
Decimal
Order amount
creation_timestamp
float
Timestamp when the order was created
price
Optional[Decimal]
default:"None"
Order price (for limit orders)
exchange_order_id
Optional[str]
default:"None"
Exchange-assigned order identifier
initial_state
OrderState
default:"OrderState.PENDING_CREATE"
Initial state of the order
leverage
int
default:"1"
Leverage for the order (for derivatives)
position
PositionAction
default:"PositionAction.NIL"
Position action (for derivatives)

Properties

base_asset
str
Base asset of the trading pair
quote_asset
str
Quote asset of the trading pair
is_pending_create
bool
True if the order is pending creation
is_pending_cancel_confirmation
bool
True if the order is pending cancellation
is_open
bool
True if the order is open (PENDING_CREATE, OPEN, PARTIALLY_FILLED, or PENDING_CANCEL)
is_done
bool
True if the order is done (CANCELED, FILLED, FAILED, or fully executed)
is_filled
bool
True if the order is completely filled
is_failure
bool
True if the order failed
is_cancelled
bool
True if the order was canceled
average_executed_price
Optional[Decimal]
Average price of all partial fills

Methods

from_json(data)
classmethod
Initializes an InFlightOrder from a JSON object
to_json()
Dict[str, Any]
Returns the InFlightOrder as a JSON object
to_limit_order()
LimitOrder
Converts the InFlightOrder to a LimitOrder object
update_exchange_order_id(exchange_order_id)
None
Updates the exchange order ID
get_exchange_order_id()
async str
Asynchronously waits for and returns the exchange order ID (with 10 second timeout)
cumulative_fee_paid(token, exchange)
Decimal
Returns the total fee paid for all trade updates, expressed in the specified token
update_with_order_update(order_update)
bool
Updates the order with an OrderUpdate (from REST or WebSocket API). Returns True if updated.
update_with_trade_update(trade_update)
bool
Updates the order with a TradeUpdate (from REST or WebSocket API). Returns True if updated.
wait_until_completely_filled()
async None
Waits asynchronously until the order is completely filled
wait_until_processed_by_exchange()
async None
Waits asynchronously until the order is processed by the exchange
build_order_created_message()
str
Builds a human-readable message for when the order is created

PerpetualDerivativeInFlightOrder

Extends InFlightOrder for perpetual derivative orders. Source: hummingbot/core/data_type/in_flight_order.py:398

Methods

build_order_created_message()
str
Builds a human-readable message for when the perpetual derivative order is created, including position information

Build docs developers (and LLMs) love