API Reference¶
Exchange wrappers¶
- class ccxt_pandas.CCXTPandasExchange(exchange: Exchange = <factory>, exchange_name: str | None = None, account_name: str | None = None, dropna_fields: bool = True, attach_trades_to_orders: bool = False, max_order_cost: float = 10000, max_number_of_orders: int = 1000, markets_cache_time: int = 3600, errors: Literal['ignore', 'raise', 'warn']='raise', cost_out_of_range: Literal['warn', 'clip']='warn', amount_out_of_range: Literal['warn', 'clip']='warn', price_out_of_range: Literal['warn', 'clip']='warn', validate_schemas: bool = False, strict_validation: bool = False)[source]¶
Bases:
CCXTPandasExchangeTypedCCXTPandasExchange is a wrapper for the CCXT library that integrates with Pandas to provide streamlined data processing for cryptocurrency exchanges. It enables users to seamlessly create orders, fetch market data, and process exchange responses as Pandas DataFrames.
Supports advanced features including: - Multi-symbol operations: pass a list of symbols to fetch data for all at once - Date range pagination: use from_date/to_date to paginate through historical data - Caching: use cache=True to incrementally build a local cache of fetched data - Order DataFrame batching: use _from_dataframe methods to batch order operations - Error handling modes: “raise”, “warn”, or “ignore” errors from exchange calls
- exchange¶
An instance of the CCXT exchange client.
- Type:
ccxt.Exchange
- exchange_name¶
The name of the exchange to interact with.
- Type:
str | None
- account_name¶
The account name, if required for tracking.
- Type:
str | None
- dropna_fields¶
Determines whether empty (NaN) columns are removed from DataFrame outputs.
- Type:
bool
- attach_trades_to_orders¶
Determines whether trades are attached to orders when processing orders.
- Type:
bool
- max_order_cost¶
Maximum cost value for any single order.
- Type:
float
- max_number_of_orders¶
Maximum number of orders to process in a single operation.
- Type:
int
- markets_cache_time¶
Cache duration (in seconds) for markets data.
- Type:
int
- errors¶
Error handling mode: “raise”, “warn”, or “ignore”.
- Type:
str
- cost_out_of_range¶
Behavior when cost exceeds ranges: “warn” or “clip”.
- Type:
str
- amount_out_of_range¶
Behavior when amount exceeds ranges: “warn” or “clip”.
- Type:
str
- price_out_of_range¶
Behavior when price exceeds ranges: “warn” or “clip”.
- Type:
str
- account_name: str | None = None¶
- amount_out_of_range: Literal['warn', 'clip'] = 'warn'¶
- attach_trades_to_orders: bool = False¶
- cost_out_of_range: Literal['warn', 'clip'] = 'warn'¶
- dropna_fields: bool = True¶
- errors: Literal['ignore', 'raise', 'warn'] = 'raise'¶
- exchange: Exchange¶
- exchange_name: str | None = None¶
- fetch_markets_with_balances(markets_params: dict | None = None, balance_params: dict | None = None, reload_markets: bool = False) DataFrame[source]¶
- markets_cache_time: int = 3600¶
- max_number_of_orders: int = 1000¶
- max_order_cost: float = 10000¶
- price_out_of_range: Literal['warn', 'clip'] = 'warn'¶
- strict_validation: bool = False¶
- validate_schemas: bool = False¶
- class ccxt_pandas.AsyncCCXTPandasExchange(exchange: Exchange, exchange_name: str | None = None, account_name: str | None = None, dropna_fields: bool = True, attach_trades_to_orders: bool = False, max_order_cost: float = 10000, max_number_of_orders: int = 1000, markets_cache_time: int = 3600, errors: Literal['ignore', 'raise', 'warn'] = 'raise', cost_out_of_range: Literal['warn', 'clip'] = 'warn', amount_out_of_range: Literal['warn', 'clip'] = 'warn', price_out_of_range: Literal['warn', 'clip'] = 'warn', validate_schemas: bool = False, strict_validation: bool = False, semaphore_value: int = 1000)[source]¶
Bases:
AsyncCCXTPandasExchangeTypedAn asynchronous wrapper class for CCXT Pro Exchange that integrates pandas for enhanced data handling and provides preprocessing utilities for working with cryptocurrency trading data.
Supports advanced features including: - Multi-symbol operations: pass a list of symbols to create concurrent async tasks - Date range pagination: use from_date/to_date to create paginated async task lists - Order DataFrame batching: use _from_dataframe methods to batch async order operations - Semaphore-based concurrency control - Error handling modes: “raise”, “warn”, or “ignore” errors from exchange calls
Methods always return coroutines. Multi-symbol and paginated calls are gathered and concatenated internally via async_concat_results().
Note: the cache=True parameter available on the sync wrapper is not supported here. For incremental local caching in async contexts, manage a DataFrame externally and pass it to async_concat_results().
- exchange¶
The CCXT Pro exchange instance.
- Type:
ccxt.Exchange
- exchange_name¶
The name of the exchange.
- Type:
str | None
- account_name¶
The account name for tracking.
- Type:
str | None
- dropna_fields¶
Whether to remove all-NaN columns.
- Type:
bool
- attach_trades_to_orders¶
Whether to attach trades to orders.
- Type:
bool
- max_order_cost¶
Maximum cost for a single order.
- Type:
float
- max_number_of_orders¶
Maximum number of orders in batch operations.
- Type:
int
- markets_cache_time¶
Cache duration for market data in seconds.
- Type:
int
- errors¶
Error handling mode: “raise”, “warn”, or “ignore”.
- Type:
str
- cost_out_of_range¶
Behavior when cost exceeds ranges: “warn” or “clip”.
- Type:
str
- amount_out_of_range¶
Behavior when amount exceeds ranges: “warn” or “clip”.
- Type:
str
- price_out_of_range¶
Behavior when price exceeds ranges: “warn” or “clip”.
- Type:
str
- semaphore_value¶
Concurrency limit for async operations.
- Type:
int
- account_name: str | None = None¶
- amount_out_of_range: Literal['warn', 'clip'] = 'warn'¶
- attach_trades_to_orders: bool = False¶
- cost_out_of_range: Literal['warn', 'clip'] = 'warn'¶
- async create_orders_from_dataframe(orders: DataFrame, chunk_size: int = 5, **kwargs) DataFrame[source]¶
- dropna_fields: bool = True¶
- async edit_orders_from_dataframe(orders: DataFrame, chunk_size: int = 5, **kwargs) DataFrame[source]¶
- errors: Literal['ignore', 'raise', 'warn'] = 'raise'¶
- exchange: Exchange¶
- exchange_name: str | None = None¶
- markets_cache_time: int = 3600¶
- max_number_of_orders: int = 1000¶
- max_order_cost: float = 10000¶
- price_out_of_range: Literal['warn', 'clip'] = 'warn'¶
- semaphore_value: int = 1000¶
- strict_validation: bool = False¶
- validate_schemas: bool = False¶
- class ccxt_pandas.CCXTPandasMultiExchange(exchange_names: tuple = (), exchanges: dict[str, CCXTPandasExchange] | None = None, errors: Literal['ignore', 'raise', 'warn'] = 'raise')[source]¶
Bases:
objectManages multiple cryptocurrency exchanges and aggregates method call results into unified DataFrames.
- exchange_names¶
Exchange identifiers to initialize.
- Type:
tuple
- exchanges¶
Exchange ID → client mapping.
- Type:
dict[str, CCXTPandasExchange]
- errors¶
Error handling mode: “raise”, “warn”, or “ignore”.
- Type:
str
- errors: Literal['ignore', 'raise', 'warn'] = 'raise'¶
- exchange_names: tuple = ()¶
- exchanges: dict[str, CCXTPandasExchange] | None = None¶
- class ccxt_pandas.AsyncCCXTPandasMultiExchange(exchange_names: tuple = (), exchanges: dict[str, AsyncCCXTPandasExchange] | None = None)[source]¶
Bases:
objectManages multiple CCXT Pro-based asynchronous exchanges, returning task lists for unified concurrent execution across exchanges.
- exchange_names¶
Exchange identifiers to initialize.
- Type:
tuple
- exchanges¶
Exchange ID → async client mapping.
- Type:
dict[str, AsyncCCXTPandasExchange]
- exchange_names: tuple = ()¶
- exchanges: dict[str, AsyncCCXTPandasExchange] | None = None¶
- class ccxt_pandas.CCXTPandasMultiAccount(accounts: dict[str, ExchangeClientConfig] = None, clients: dict[str, CCXTPandasExchange] = None, errors: Literal['ignore', 'raise', 'warn'] = 'raise')[source]¶
Bases:
objectManages multiple CCXT accounts and delegates method calls to each, aggregating results into unified DataFrames.
- accounts¶
Account name → config mapping.
- Type:
dict[str, ExchangeClientConfig]
- clients¶
Account name → exchange client mapping.
- Type:
dict[str, CCXTPandasExchange]
- errors¶
Error handling mode: “raise”, “warn”, or “ignore”.
- Type:
str
- accounts: dict[str, ExchangeClientConfig] = None¶
- clients: dict[str, CCXTPandasExchange] = None¶
- errors: Literal['ignore', 'raise', 'warn'] = 'raise'¶
- class ccxt_pandas.AsyncCCXTPandasMultiAccount(accounts: dict[str, ExchangeClientConfig] = None, clients: dict[str, AsyncCCXTPandasExchange] = None)[source]¶
Bases:
objectManages multiple asynchronous CCXT exchange clients, enabling unified multi-account operations that return task lists for concurrent execution.
- accounts¶
Account name → config mapping.
- Type:
dict[str, ExchangeClientConfig]
- clients¶
Account name → async client mapping.
- Type:
dict[str, AsyncCCXTPandasExchange]
- accounts: dict[str, ExchangeClientConfig] = None¶
- clients: dict[str, AsyncCCXTPandasExchange] = None¶
Exceptions¶
- exception ccxt_pandas.CCXTPandasError[source]¶
Bases:
ExceptionBase exception for all ccxt-pandas errors.
- exception ccxt_pandas.CCXTPandasOrderError[source]¶
Bases:
CCXTPandasError,ValueErrorRaised when order preprocessing or validation fails (limits, price, schema).
- exception ccxt_pandas.CCXTPandasSchemaError[source]¶
Bases:
CCXTPandasError,ValueErrorRaised when a response fails pandera schema validation.
- exception ccxt_pandas.CCXTPandasMethodError[source]¶
Bases:
CCXTPandasError,AttributeErrorRaised when an unsupported method is requested via __getattribute__.
Calculation utilities¶
- ccxt_pandas.calculate_delta_exposure(balance: DataFrame[BalanceSchema] | DataFrame[MarginsBalanceSchema], positions: DataFrame[PositionsSchema], markets: DataFrame[MarketSchema], balance_amount: Literal['free', 'used', 'total'] = 'total', amount_column: str = 'amount') DataFrame[source]¶
Calculate net delta exposure across spot, swap, and futures positions.
This function combines spot balances with derivatives positions to calculate the total exposure in each base currency, useful for delta hedging strategies.
Supports both spot balances (BalanceSchema) and margin balances (MarginsBalanceSchema).
- Parameters:
balance –
Balance DataFrame from fetch_balance. Can be either: - BalanceSchema: Spot balances with ‘code’, ‘free’, ‘used’, ‘total’ columns - MarginsBalanceSchema: Margin balances with ‘symbol’, ‘base’, ‘base_free’,
’base_used’, ‘base_total’ columns
positions – Positions DataFrame from fetch_positions (must have ‘symbol’, ‘contracts’, ‘contractSize’, and ‘side’ columns).
markets – Markets DataFrame from load_markets (must have ‘symbol’ and ‘base’ columns).
balance_amount – Which balance amount to use - ‘free’, ‘used’, or ‘total’ (default: ‘total’).
amount_column – Output column name for amount/quantity (default: ‘amount’).
- Returns:
[‘base’, amount_column] showing net exposure in each base currency.
- Return type:
DataFrame with columns
Example
>>> import ccxt_pandas as cpd >>> exchange = cpd.CCXTPandasExchange(ccxt.binance())
>>> # Spot balances >>> balance = exchange.fetch_balance() >>> positions = exchange.fetch_positions() >>> markets = exchange.load_markets() >>> delta = calculate_delta_exposure(balance, positions, markets) >>> print(delta) base amount 0 BTC 1.234567 1 ETH 12.345678 2 USDT 1000.00
>>> # Margin balances (also supported) >>> margin_balance = exchange.fetch_balance() # In margin mode >>> delta = calculate_delta_exposure(margin_balance, positions, markets)
- Raises:
pandera.errors.SchemaError – If any DataFrame doesn’t match its schema - balance must match BalanceSchema or MarginsBalanceSchema - positions must match PositionsSchema - markets must match MarketSchema
Notes
For positions, ‘long’ side is treated as positive exposure
For positions, ‘short’ side is treated as negative exposure
Amounts are converted using contractSize for derivatives
Spot balances: uses ‘code’ column (currency code) renamed to ‘base’
Margin balances: uses ‘base’ column directly and ‘base_*’ amount columns
Automatically detects balance type based on columns present
Input validation performed via Pandera schemas
- ccxt_pandas.calculate_mid_price_and_spread(data: DataFrame, price_col: str = 'price', by_exchange: bool = False) DataFrame[source]¶
Calculate mid price, spread, and relative spread from order book for all symbols.
Computes best bid/ask, mid price, absolute spread, and relative spread for each symbol (and optionally exchange) using pandas pivot for efficient calculation.
- Parameters:
data – Order book DataFrame (should be sorted)
price_col – Name of price column (default: ‘price’)
by_exchange – Include exchange in grouping (default: False)
- Returns:
bid, ask, mid_price, spread, relative_spread Indexed by symbol (and optionally exchange)
- Return type:
DataFrame with columns
Examples
>>> orderbook = pd.DataFrame({ ... 'symbol': ['BTC/USDT', 'BTC/USDT', 'ETH/USDT', 'ETH/USDT'], ... 'side': ['bids', 'asks', 'bids', 'asks'], ... 'price': [99.5, 100.5, 1800, 1820], ... 'qty': [10, 10, 5, 5] ... }) >>> result = calculate_mid_price_and_spread(orderbook) >>> print(result) bid ask mid_price spread relative_spread symbol BTC/USDT 99.5 100.5 100.0 1.0 0.010000 ETH/USDT 1800.0 1820.0 1810.0 20.0 0.011050
>>> # Access specific columns >>> result['mid_price'] symbol BTC/USDT 100.0 ETH/USDT 1810.0
>>> result['spread'] symbol BTC/USDT 1.0 ETH/USDT 20.0
Notes
Order book should be sorted first (use sort_orderbook)
Uses pandas pivot for efficient calculation
mid_price = (bid + ask) / 2
spread = ask - bid (absolute)
relative_spread = spread / mid_price (as decimal, multiply by 100 for %)
Tighter spreads indicate higher liquidity
- ccxt_pandas.calculate_notional(data: DataFrame, price_col: str = 'price', qty_col: str = 'qty') Series[source]¶
Calculate notional value (price × quantity).
- Parameters:
data – DataFrame with price and quantity columns
price_col – Name of price column (default: ‘price’)
qty_col – Name of quantity column (default: ‘qty’)
- Returns:
Series with notional values
Examples
>>> orderbook = pd.DataFrame({'price': [100, 101], 'qty': [1.5, 2.0]}) >>> calculate_notional(orderbook) 0 150.0 1 202.0 dtype: float64
Notes
Notional = price × quantity
Represents total value at each price level
Used in VWAP and depth calculations
- ccxt_pandas.calculate_vwap_by_depth(data: DataFrame, depths: list | tuple | set, group_by: list[str] | None = None, price_col: str = 'price', qty_col: str = 'qty') DataFrame[source]¶
Calculate Volume-Weighted Average Price (VWAP) at various depth levels.
Computes the average execution price for buying/selling up to a certain notional depth. Useful for estimating market impact and slippage.
- Parameters:
data – Order book DataFrame with price, qty, symbol, and side columns
depths – List of notional depths to calculate VWAP for (e.g., [1000, 5000, 10000])
group_by – Columns to group by (default: [‘symbol’, ‘side’] + ‘exchange’ if present)
price_col – Name of price column (default: ‘price’)
qty_col – Name of quantity column (default: ‘qty’)
- Returns:
[*group_by, depth, qty, notional, price] where ‘price’ is the VWAP at each depth level
- Return type:
DataFrame with columns
Examples
>>> # Calculate VWAP for buying $1000 and $5000 worth >>> orderbook = pd.DataFrame({ ... 'symbol': ['BTC/USDT'] * 4, ... 'side': ['asks'] * 4, ... 'price': [100, 101, 102, 103], ... 'qty': [10, 10, 10, 10] ... }) >>> vwap = calculate_vwap_by_depth(orderbook, depths=[500, 1500]) >>> # Shows average price to buy $500 worth (≈100) and $1500 worth (≈101)
Notes
VWAP = total notional / total quantity
Accounts for partial fills at the last price level
Order book should be pre-sorted (use sort_orderbook first)
Higher depths = more market impact = higher VWAP for asks, lower for bids
Useful for: - Market impact analysis - Slippage estimation - Liquidity assessment - Order size optimization
- ccxt_pandas.aggregate_trades(trades: DataFrame[MyTradesSchema], group_by: list[str] | tuple = ('symbol', 'side'), freq: str | None = None, include_fees: bool = True) DataFrame[source]¶
Aggregate trades by specified columns with optional time resampling.
Groups trades and calculates total amounts, costs, fees, and trade counts. Useful for summarizing trading activity across symbols, sides, or time periods.
- Parameters:
trades – Trades DataFrame from fetch_my_trades() with required columns: - symbol: Trading pair - side: ‘buy’ or ‘sell’ - amount: Trade amount - cost: Trade cost/value - timestamp: Trade timestamp (required if freq is provided) - fee_cost: Fee amount (optional, required if include_fees=True)
group_by – Columns to group by. Default: (“symbol”, “side”)
freq – Optional pandas frequency string for time aggregation (e.g., “1H”, “1D”, “1W”). If provided, groups by timestamp.
include_fees – Whether to include fee_cost in aggregation. Default: True
- Returns:
{group_by columns}: Grouping columns
amount: Total amount traded
cost: Total cost/value
n_trades: Number of trades
fee_cost: Total fees (if include_fees=True and fee_cost exists)
signed_amount: Amount with buy=+, sell=-
signed_cost: Cost with buy=+, sell=-
- Return type:
Aggregated DataFrame with columns
Examples
>>> # Aggregate by symbol and side >>> summary = aggregate_trades(trades) >>> print(summary) symbol side amount cost n_trades fee_cost signed_amount signed_cost 0 BTC/USDT buy 1.5 45000 10 45.0 1.5 45000.0 1 BTC/USDT sell 1.0 31000 5 31.0 -1.0 -31000.0
>>> # Aggregate by symbol only (combines buy/sell) >>> summary = aggregate_trades(trades, group_by=["symbol"])
>>> # Aggregate by hour >>> hourly = aggregate_trades(trades, freq="1H")
- Raises:
pandera.errors.SchemaError – If trades DataFrame doesn’t match MyTradesSchema
Notes
If trades is empty, returns empty DataFrame with correct columns
signed_amount: positive for buys, negative for sells
signed_cost: positive for buys, negative for sells
If ‘side’ is in group_by, it’s converted to Categorical for proper ordering
Input validation performed via Pandera MyTradesSchema
- ccxt_pandas.calculate_realized_pnl(trades: DataFrame[MyTradesSchema], group_by: list[str] | tuple = ('symbol',), freq: str | None = None, include_totals: bool = False) DataFrame[source]¶
Calculate realized PnL metrics by matching buy and sell trades.
Pivots trades by side (buy/sell) and calculates: - Average buy/sell prices - Price spread - Matched amounts (trades that entered and exited) - Net position (unmatched trades) - Realized PnL from matched trades
- Parameters:
trades – Trades DataFrame from fetch_my_trades() with required columns: - symbol: Trading pair - side: ‘buy’ or ‘sell’ - amount: Trade amount - cost: Trade cost/value - timestamp: Trade timestamp (required if freq is provided) - fee_cost: Fee amount (optional)
group_by – Columns to group by. Default: (“symbol”,)
freq – Optional pandas frequency string for time aggregation (e.g., “1H”, “1D”, “1W”). If provided, groups by timestamp.
include_totals – Whether to include “All” totals row. Default: False
- Returns:
{group_by columns}: Grouping columns
amount_buy, amount_sell: Total amounts per side
cost_buy, cost_sell: Total costs per side
n_trades_buy, n_trades_sell: Trade counts per side
fee_cost_buy, fee_cost_sell: Fees per side (if fee_cost exists)
price_buy, price_sell: Average prices (cost/amount)
spread: Price difference (sell - buy)
amount_in_out: Matched amount (min of buy/sell)
amount_net: Net position (buy - sell)
pnl_in_out: Realized PnL (matched_amount * spread)
- Return type:
DataFrame with columns
Examples
>>> # Calculate PnL per symbol >>> pnl = calculate_realized_pnl(trades) >>> print(pnl) symbol amount_buy amount_sell price_buy price_sell spread amount_in_out amount_net pnl_in_out 0 BTC/USDT 1.5 1.0 30000.0 31000.0 1000.0 1.0 0.5 1000.0
>>> # Calculate daily PnL >>> daily_pnl = calculate_realized_pnl(trades, freq="1D")
>>> # PnL with totals row >>> pnl = calculate_realized_pnl(trades, include_totals=True)
- Raises:
pandera.errors.SchemaError – If trades DataFrame doesn’t match MyTradesSchema
Notes
Only calculates PnL for trades that have both buys and sells
Net position shows unmatched trades (inventory)
Fees are not included in PnL calculation (shown separately)
Price calculations handle division by zero (returns 0)
If trades is empty, returns empty DataFrame with correct columns
Input validation performed via Pandera MyTradesSchema
- ccxt_pandas.floor_series(data: Series, digits: int = 0) Series[source]¶
Round Series values down to specified decimal places.
- Parameters:
data – Series to round
digits – Number of decimal places (default: 0)
- Returns:
Series with values rounded down
Examples
>>> prices = pd.Series([1.2345, 2.6789, 3.9999]) >>> floor_series(prices, digits=2) 0 1.23 1 2.67 2 3.99 dtype: float64
>>> # Round to nearest integer (floor) >>> floor_series(prices) 0 1.0 1 2.0 2 3.0 dtype: float64
Notes
Uses numpy floor to round down
Useful for price/amount precision requirements
For rounding up, use ceil_series()
- ccxt_pandas.ceil_series(data: Series, digits: int = 0) Series[source]¶
Round Series values up to specified decimal places.
- Parameters:
data – Series to round
digits – Number of decimal places (default: 0)
- Returns:
Series with values rounded up
Examples
>>> prices = pd.Series([1.2345, 2.6789, 3.0001]) >>> ceil_series(prices, digits=2) 0 1.24 1 2.68 2 3.01 dtype: float64
>>> # Round to nearest integer (ceil) >>> ceil_series(prices) 0 2.0 1 3.0 2 4.0 dtype: float64
Notes
Uses numpy ceil to round up
Useful for minimum order size requirements
For rounding down, use floor_series()
- ccxt_pandas.create_mirrored_sides(data: DataFrame, sides: tuple[str, str] = ('buy', 'sell')) DataFrame[source]¶
Create mirrored order book sides for testing or simulation.
Takes a DataFrame and duplicates it for each side, useful for creating synthetic order books or testing strategies with symmetric orders.
- Parameters:
data – DataFrame with order data (price, qty, etc.)
sides – Tuple of side values to create (default: (“buy”, “sell”))
- Returns:
DataFrame with rows duplicated for each side
Examples
>>> # Create buy and sell orders from a single set >>> orders = pd.DataFrame({'price': [100, 101], 'qty': [1.0, 2.0]}) >>> mirrored = create_mirrored_sides(orders) >>> print(mirrored) price qty side 0 100 1.0 buy 1 101 2.0 buy 0 100 1.0 sell 1 101 2.0 sell
Notes
Useful for creating symmetric order books
Does not modify price levels (you may want to mirror prices around mid)
Original index is preserved (use ignore_index=True in concat if needed)
- ccxt_pandas.is_ask_side(data: DataFrame) Series[source]¶
Identify ask side rows in order book.
Handles both order book format (‘asks’/’bids’) and order format (‘sell’/’buy’).
- Parameters:
data – DataFrame with ‘side’ column
- Returns:
Boolean Series where True indicates ask/sell side
Examples
>>> orderbook = pd.DataFrame({'side': ['bids', 'asks', 'bids']}) >>> is_ask_side(orderbook) 0 False 1 True 2 False dtype: bool
>>> orders = pd.DataFrame({'side': ['buy', 'sell', 'buy']}) >>> is_ask_side(orders) 0 False 1 True 2 False dtype: bool
Notes
Returns True for ‘asks’ or ‘sell’
Returns False for ‘bids’ or ‘buy’
- ccxt_pandas.side_sign(data: DataFrame) Series[source]¶
Get directional sign for order book sides.
Returns +1 for asks/sell (taking liquidity), -1 for bids/buy (providing liquidity).
- Parameters:
data – DataFrame with ‘side’ column
- Returns:
Series with +1 for asks/sell, -1 for bids/buy
Examples
>>> orderbook = pd.DataFrame({'side': ['bids', 'asks', 'bids']}) >>> side_sign(orderbook) 0 -1 1 1 2 -1 dtype: int64
Notes
Useful for signed price calculations
Convention: asks = +1, bids = -1
- ccxt_pandas.signed_price(data: DataFrame, price_col: str = 'price') Series[source]¶
Calculate signed price based on side.
Multiplies price by side sign (+1 for asks, -1 for bids), useful for sorting order books or calculating spreads.
- Parameters:
data – DataFrame with ‘side’ and price columns
price_col – Name of price column (default: ‘price’)
- Returns:
Series with signed prices
Examples
>>> orderbook = pd.DataFrame({ ... 'side': ['bids', 'asks'], ... 'price': [99.5, 100.5] ... }) >>> signed_price(orderbook) 0 -99.5 1 100.5 dtype: float64
Notes
Bids get negative prices
Asks get positive prices
Useful for sorting: best bid (highest) and best ask (lowest) both sort first
- ccxt_pandas.sort_orderbook(data: DataFrame, by_symbol: bool = True, by_exchange: bool = False, price_col: str = 'price') DataFrame[source]¶
Sort order book by symbol, side, and price levels.
Sorts so that best bid (highest price) and best ask (lowest price) appear first within each symbol/exchange group.
- Parameters:
data – Order book DataFrame with ‘symbol’, ‘side’, and price columns
by_symbol – Include symbol in sort (default: True)
by_exchange – Include exchange in sort (default: False)
price_col – Name of price column (default: ‘price’)
- Returns:
Sorted DataFrame with best prices first
Examples
>>> orderbook = pd.DataFrame({ ... 'symbol': ['BTC/USDT', 'BTC/USDT', 'BTC/USDT'], ... 'side': ['asks', 'bids', 'asks'], ... 'price': [101, 99, 100], ... 'qty': [1.0, 2.0, 1.5] ... }) >>> sorted_ob = sort_orderbook(orderbook) >>> # Result: bids@99 (best bid), asks@100 (best ask), asks@101
Notes
Uses signed price for correct sorting
Best bid = highest bid price = most negative signed price
Best ask = lowest ask price = least positive signed price
Reset index after sort (ignore_index=True)
Pandera schemas¶
- class ccxt_pandas.OHLCVSchema(*args, **kwargs)[source]¶
Bases:
BaseExchangeSchemaOHLCV candlestick data schema.
Used by methods like fetch_ohlcv, watch_ohlcv.
All OHLCV fields (timestamp, OHLC prices, volume) are required. Symbol is optional as it may not be present in single-symbol queries.
- close: Series[float] = 'close'¶
- high: Series[float] = 'high'¶
- low: Series[float] = 'low'¶
- open: Series[float] = 'open'¶
- symbol: Series[str] | None = 'symbol'¶
- timestamp: Series[Timestamp] = 'timestamp'¶
- volume: Series[float] = 'volume'¶
- class ccxt_pandas.OrderBookSchema(*args, **kwargs)[source]¶
Bases:
BaseExchangeSchemaOrder book data schema.
Used by methods like fetch_order_book, watch_order_book.
Order books are returned as DataFrames with bids and asks combined, differentiated by the ‘side’ column.
- datetime: Series[Timestamp] | None = 'datetime'¶
- nonce: Series[int] | None = 'nonce'¶
- price: Series[float] = 'price'¶
- qty: Series[float] = 'qty'¶
- side: Series[str] = 'side'¶
- symbol: Series[str] | None = 'symbol'¶
- timestamp: Series[Timestamp] | None = 'timestamp'¶
- class ccxt_pandas.TradeSchema(*args, **kwargs)[source]¶
Bases:
BaseExchangeSchemaPublic trade data schema.
Used by methods like fetch_trades.
These are public market trades visible to all users. Most fields are required except fees and exchange.
- amount: Series[float] = 'amount'¶
- cost: Series[float] = 'cost'¶
- datetime: Series[Timestamp] = 'datetime'¶
- fees: Series[object] | None = 'fees'¶
- id: Series[str] = 'id'¶
- price: Series[float] = 'price'¶
- side: Series[str] = 'side'¶
- symbol: Series[str] = 'symbol'¶
- timestamp: Series[Timestamp] = 'timestamp'¶
- class ccxt_pandas.MyTradesSchema(*args, **kwargs)[source]¶
Bases:
TradeSchema,FeeFieldsMixinUser trades (my trades) data schema.
Used by methods like fetch_my_trades, fetch_order_trades.
Returns the authenticated user’s trade history including fees and order references. Inherits all fields from TradeSchema and FeeFieldsMixin, and adds: - order (order ID that generated the trade) - takerOrMaker (whether trade was taker or maker)
- order: Series[str] = 'order'¶
- takerOrMaker: Series[str] = 'takerOrMaker'¶
- class ccxt_pandas.OrderSchema(*args, **kwargs)[source]¶
Bases:
BaseExchangeSchemaOrder schema for any exchange.
Used for validating order DataFrames before submission via create_order_from_dataframe and similar methods.
- amount: float | None = 'amount'¶
- id: str | None = 'id'¶
- params: dict | None = 'params'¶
- price: float | None = 'price'¶
- side: str = 'side'¶
- symbol: str = 'symbol'¶
- type: str = 'type'¶
- class ccxt_pandas.OrdersSchema(*args, **kwargs)[source]¶
Bases:
BaseExchangeSchema,FeeFieldsMixinOrders data schema.
Used by methods like fetch_open_orders, fetch_closed_orders, fetch_canceled_orders.
Returns order information for both open and closed orders. Fields like clientOrderId, lastTradeTimestamp, timeInForce, and average are optional as they may not be present in open orders.
- amount: Series[float] = 'amount'¶
- average: Series[float] | None = 'average'¶
- clientOrderId: Series[str] | None = 'clientOrderId'¶
- cost: Series[float] = 'cost'¶
- datetime: Series[Timestamp] = 'datetime'¶
- fees: Series[object] = 'fees'¶
- filled: Series[float] = 'filled'¶
- id: Series[str] = 'id'¶
- lastTradeTimestamp: Series[Timestamp] | None = 'lastTradeTimestamp'¶
- lastUpdateTimestamp: Series[Timestamp] = 'lastUpdateTimestamp'¶
- postOnly: Series[bool] | None = 'postOnly'¶
- price: Series[float] = 'price'¶
- reduceOnly: Series[bool] | None = 'reduceOnly'¶
- remaining: Series[float] = 'remaining'¶
- side: Series[str] = 'side'¶
- status: Series[str] = 'status'¶
- symbol: Series[str] = 'symbol'¶
- timeInForce: Series[str] | None = 'timeInForce'¶
- timestamp: Series[Timestamp] = 'timestamp'¶
- trades: Series[object] = 'trades'¶
- type: Series[str] = 'type'¶
- class ccxt_pandas.BalanceSchema(*args, **kwargs)[source]¶
Bases:
BaseExchangeSchemaBalance/wallet data schema for spot balances.
Used by methods like fetch_balance, watch_balance.
Returns balance information for spot/wallet accounts with currency code and balance amounts (free, used, total, debt).
- code: Series[str] = 'code'¶
- debt: Series[float] | None = 'debt'¶
- free: Series[float] = 'free'¶
- total: Series[float] = 'total'¶
- used: Series[float] = 'used'¶
- class ccxt_pandas.PositionsSchema(*args, **kwargs)[source]¶
Bases:
BaseExchangeSchemaPositions data schema.
Used by methods like fetch_positions, fetch_position.
Returns open positions for derivatives contracts including margin details, PnL, and risk metrics.
- collateral: Series[float] = 'collateral'¶
- contractSize: Series[float] = 'contractSize'¶
- contracts: Series[float] = 'contracts'¶
- datetime: Series[Timestamp] = 'datetime'¶
- entryPrice: Series[float] = 'entryPrice'¶
- hedged: Series[bool] = 'hedged'¶
- id: Series[str] = 'id'¶
- initialMargin: Series[float] = 'initialMargin'¶
- initialMarginPercentage: Series[float] = 'initialMarginPercentage'¶
- lastUpdateTimestamp: Series[Timestamp] = 'lastUpdateTimestamp'¶
- leverage: Series[float] = 'leverage'¶
- liquidationPrice: Series[float] = 'liquidationPrice'¶
- maintenanceMargin: Series[float] = 'maintenanceMargin'¶
- maintenanceMarginPercentage: Series[float] = 'maintenanceMarginPercentage'¶
- marginMode: Series[str] = 'marginMode'¶
- marginRatio: Series[float] = 'marginRatio'¶
- markPrice: Series[float] = 'markPrice'¶
- notional: Series[float] = 'notional'¶
- percentage: Series[float] = 'percentage'¶
- realizedPnl: Series[float] = 'realizedPnl'¶
- side: Series[str] = 'side'¶
- symbol: Series[str] = 'symbol'¶
- timestamp: Series[Timestamp] = 'timestamp'¶
- unrealizedPnl: Series[float] = 'unrealizedPnl'¶
- class ccxt_pandas.PositionsHistorySchema(*args, **kwargs)[source]¶
Bases:
BaseExchangeSchemaPositions history data schema.
Used by methods like fetch_positions_history.
Returns historical (closed) positions for derivatives contracts including entry/exit details and realized PnL.
- contractSize: Series[float] = 'contractSize'¶
- datetime: Series[Timestamp] = 'datetime'¶
- entryPrice: Series[float] = 'entryPrice'¶
- hedged: Series[bool] = 'hedged'¶
- id: Series[str] = 'id'¶
- initialMarginPercentage: Series[float] | None = 'initialMarginPercentage'¶
- lastPrice: Series[float] = 'lastPrice'¶
- lastUpdateTimestamp: Series[Timestamp] = 'lastUpdateTimestamp'¶
- leverage: Series[float] = 'leverage'¶
- maintenanceMarginPercentage: Series[float] = 'maintenanceMarginPercentage'¶
- marginMode: Series[str] = 'marginMode'¶
- realizedPnl: Series[float] = 'realizedPnl'¶
- side: Series[str] = 'side'¶
- symbol: Series[str] = 'symbol'¶
- timestamp: Series[Timestamp] = 'timestamp'¶
- class ccxt_pandas.PositionsADLRankSchema(*args, **kwargs)[source]¶
Bases:
BaseExchangeSchemaPositions ADL (Auto De-Leverage) rank schema.
Used by fetch_positions_adl_rank.
Returns the ADL risk ranking for each position, indicating the likelihood of auto-deleveraging. A higher rank/percent means higher ADL risk.
- datetime: Series[Timestamp] = 'datetime'¶
- percent: Series[float] = 'percent'¶
- rank: Series[int] = 'rank'¶
- rating: Series[str] = 'rating'¶
- symbol: Series[str] = 'symbol'¶
- timestamp: Series[Timestamp] = 'timestamp'¶
- class ccxt_pandas.MarketSchema(*args, **kwargs)[source]¶
Bases:
BaseExchangeSchemaMarket/ticker/funding rate data schema.
Used by methods like load_markets, fetch_tickers, fetch_funding_rates, fetch_market_leverage_tiers, etc.
Based on analysis of 20 exchanges, only 13 fields are ALWAYS present. All other fields are Optional even if very common.
- active: Series[bool] | None = 'active'¶
- base: Series[str] = 'base'¶
- baseId: Series[str] = 'baseId'¶
- contract: Series[bool] = 'contract'¶
- contractSize: Series[float] | None = 'contractSize'¶
- created: Series[Timestamp] | None = 'created'¶
- expiry: Series[Timestamp] | None = 'expiry'¶
- expiryDatetime: Series[Timestamp] | None = 'expiryDatetime'¶
- feeSide: Series[str] | None = 'feeSide'¶
- future: Series[bool] = 'future'¶
- id: Series[str] = 'id'¶
- index: Series[str] | None = 'index'¶
- inverse: Series[bool] | None = 'inverse'¶
- limits_amount_max: Series[float] | None = 'limits_amount_max'¶
- limits_amount_min: Series[float] | None = 'limits_amount_min'¶
- limits_cost_max: Series[float] | None = 'limits_cost_max'¶
- limits_cost_min: Series[float] | None = 'limits_cost_min'¶
- limits_leverage_max: Series[float] | None = 'limits_leverage_max'¶
- limits_leverage_min: Series[float] | None = 'limits_leverage_min'¶
- limits_market_max: Series[float] | None = 'limits_market_max'¶
- limits_market_min: Series[float] | None = 'limits_market_min'¶
- limits_price_max: Series[float] | None = 'limits_price_max'¶
- limits_price_min: Series[float] | None = 'limits_price_min'¶
- linear: Series[bool] | None = 'linear'¶
- lowercaseId: Series[str] | None = 'lowercaseId'¶
- maker: Series[float] | None = 'maker'¶
- margin: Series[bool] | None = 'margin'¶
- marginModes_cross: Series[bool] | None = 'marginModes_cross'¶
- marginModes_isolated: Series[bool] | None = 'marginModes_isolated'¶
- option: Series[bool] = 'option'¶
- optionType: Series[str] | None = 'optionType'¶
- percentage: Series[bool] | None = 'percentage'¶
- precision_amount: Series[float] | None = 'precision_amount'¶
- precision_base: Series[float] | None = 'precision_base'¶
- precision_price: Series[float] | None = 'precision_price'¶
- precision_quote: Series[float] | None = 'precision_quote'¶
- quote: Series[str] = 'quote'¶
- quoteId: Series[str] = 'quoteId'¶
- settle: Series[str] | None = 'settle'¶
- settleId: Series[str] | None = 'settleId'¶
- spot: Series[bool] = 'spot'¶
- strike: Series[float] | None = 'strike'¶
- subType: Series[str] | None = 'subType'¶
- swap: Series[bool] = 'swap'¶
- symbol: Series[str] = 'symbol'¶
- taker: Series[float] | None = 'taker'¶
- tierBased: Series[bool] | None = 'tierBased'¶
- type: Series[str] = 'type'¶
- class ccxt_pandas.CurrencySchema(*args, **kwargs)[source]¶
Bases:
BaseExchangeSchemaCurrency data schema with network information.
Used by methods like fetch_currencies, fetch_deposit_withdraw_fees.
Returns currency information including deposit/withdrawal capabilities and network-specific details.
- active: Series[bool] | None = 'active'¶
- code: Series[str] = 'code'¶
- deposit: Series[bool] | None = 'deposit'¶
- fee: Series[float] | None = 'fee'¶
- id: Series[str] = 'id'¶
- limits_deposit_min: Series[float] | None = 'limits_deposit_min'¶
- limits_withdraw_min: Series[float] | None = 'limits_withdraw_min'¶
- name: Series[str] = 'name'¶
- network: Series[str] = 'network'¶
- network_active: Series[bool] | None = 'network_active'¶
- network_deposit: Series[bool] | None = 'network_deposit'¶
- network_fee: Series[float] | None = 'network_fee'¶
- network_id: Series[str] = 'network_id'¶
- network_limits_deposit_min: Series[float] | None = 'network_limits_deposit_min'¶
- network_limits_withdraw_min: Series[float] | None = 'network_limits_withdraw_min'¶
- network_precision: Series[float] = 'network_precision'¶
- network_withdraw: Series[bool] | None = 'network_withdraw'¶
- precision: Series[float] = 'precision'¶
- type: Series[str] = 'type'¶
- withdraw: Series[bool] | None = 'withdraw'¶
- class ccxt_pandas.TickersSchema(*args, **kwargs)[source]¶
Bases:
BaseExchangeSchemaTickers data schema.
Used by methods like fetch_tickers, fetch_ticker.
Returns 24-hour ticker statistics for trading pairs including price, volume, and percentage changes.
- ask: Series[float] | None = 'ask'¶
- askVolume: Series[float] | None = 'askVolume'¶
- average: Series[float] | None = 'average'¶
- baseVolume: Series[float] | None = 'baseVolume'¶
- bid: Series[float] | None = 'bid'¶
- bidVolume: Series[float] | None = 'bidVolume'¶
- change: Series[float] | None = 'change'¶
- close: Series[float] | None = 'close'¶
- datetime: Series[Timestamp] | None = 'datetime'¶
- high: Series[float] | None = 'high'¶
- indexPrice: Series[float] | None = 'indexPrice'¶
- last: Series[float] | None = 'last'¶
- low: Series[float] | None = 'low'¶
- markPrice: Series[float] | None = 'markPrice'¶
- open: Series[float] | None = 'open'¶
- percentage: Series[float] | None = 'percentage'¶
- previousClose: Series[float] | None = 'previousClose'¶
- quoteVolume: Series[float] | None = 'quoteVolume'¶
- symbol: Series[str] = 'symbol'¶
- timestamp: Series[Timestamp] | None = 'timestamp'¶
- vwap: Series[float] | None = 'vwap'¶
- class ccxt_pandas.BidsAsksSchema(*args, **kwargs)[source]¶
Bases:
BaseExchangeSchemaBids/Asks ticker data schema.
Used by methods like fetch_bids_asks.
Returns best bid/ask prices with volumes and optional ticker data.
- ask: Series[float] = 'ask'¶
- askVolume: Series[float] = 'askVolume'¶
- average: Series[float] | None = 'average'¶
- baseVolume: Series[float] | None = 'baseVolume'¶
- bid: Series[float] = 'bid'¶
- bidVolume: Series[float] = 'bidVolume'¶
- change: Series[float] | None = 'change'¶
- close: Series[float] | None = 'close'¶
- high: Series[float] | None = 'high'¶
- indexPrice: Series[float] | None = 'indexPrice'¶
- last: Series[float] | None = 'last'¶
- low: Series[float] | None = 'low'¶
- markPrice: Series[float] | None = 'markPrice'¶
- open: Series[float] | None = 'open'¶
- percentage: Series[float] | None = 'percentage'¶
- quoteVolume: Series[float] | None = 'quoteVolume'¶
- symbol: Series[str] = 'symbol'¶
- vwap: Series[float] | None = 'vwap'¶
- class ccxt_pandas.MarkPricesSchema(*args, **kwargs)[source]¶
Bases:
BaseExchangeSchemaMark prices data schema.
Used by methods like fetch_mark_prices.
Returns mark prices (and optionally index prices) for derivatives contracts.
- datetime: Series[Timestamp] | None = 'datetime'¶
- indexPrice: Series[float] | None = 'indexPrice'¶
- markPrice: Series[float] = 'markPrice'¶
- symbol: Series[str] = 'symbol'¶
- timestamp: Series[Timestamp] | None = 'timestamp'¶
- class ccxt_pandas.LastPricesSchema(*args, **kwargs)[source]¶
Bases:
BaseExchangeSchemaLast prices data schema.
Used by methods like fetch_last_prices.
Returns the last traded price for each symbol.
- datetime: Series[Timestamp] | None = 'datetime'¶
- price: Series[float] = 'price'¶
- symbol: Series[str] = 'symbol'¶
- timestamp: Series[Timestamp] | None = 'timestamp'¶
- class ccxt_pandas.FundingRateSchema(*args, **kwargs)[source]¶
Bases:
BaseExchangeSchemaFunding rate data schema.
Used by methods like fetch_funding_rates.
Returns current and historical funding rates for perpetual swap contracts. Only symbol and fundingRate are required, all other fields are optional.
- datetime: Series[Timestamp] | None = 'datetime'¶
- estimatedSettlePrice: Series[float] | None = 'estimatedSettlePrice'¶
- fundingDatetime: Series[Timestamp] | None = 'fundingDatetime'¶
- fundingRate: Series[float] = 'fundingRate'¶
- fundingTimestamp: Series[Timestamp] | None = 'fundingTimestamp'¶
- indexPrice: Series[float] | None = 'indexPrice'¶
- interestRate: Series[float] | None = 'interestRate'¶
- interval: Series[str] | None = 'interval'¶
- markPrice: Series[float] | None = 'markPrice'¶
- nextFundingDatetime: Series[Timestamp] | None = 'nextFundingDatetime'¶
- nextFundingRate: Series[float] | None = 'nextFundingRate'¶
- nextFundingTimestamp: Series[Timestamp] | None = 'nextFundingTimestamp'¶
- previousFundingDatetime: Series[Timestamp] | None = 'previousFundingDatetime'¶
- previousFundingRate: Series[float] | None = 'previousFundingRate'¶
- previousFundingTimestamp: Series[Timestamp] | None = 'previousFundingTimestamp'¶
- symbol: Series[str] = 'symbol'¶
- timestamp: Series[Timestamp] | None = 'timestamp'¶
- class ccxt_pandas.FundingRateHistorySchema(*args, **kwargs)[source]¶
Bases:
BaseExchangeSchemaFunding rate history data schema.
Used by methods like fetch_funding_rate_history.
Returns historical funding rate data over time. Requires symbol, fundingRate, and timestamps.
- datetime: Series[Timestamp] = 'datetime'¶
- fundingRate: Series[float] = 'fundingRate'¶
- indexPrice: Series[float] | None = 'indexPrice'¶
- markPrice: Series[float] | None = 'markPrice'¶
- nextFundingDatetime: Series[Timestamp] | None = 'nextFundingDatetime'¶
- nextFundingRate: Series[float] | None = 'nextFundingRate'¶
- nextFundingTimestamp: Series[Timestamp] | None = 'nextFundingTimestamp'¶
- symbol: Series[str] = 'symbol'¶
- timestamp: Series[Timestamp] = 'timestamp'¶
- class ccxt_pandas.FundingHistorySchema(*args, **kwargs)[source]¶
Bases:
BaseExchangeSchemaFunding history data schema.
Used by methods like fetch_funding_history.
Returns historical funding payments for derivatives positions, showing amounts paid or received at each funding interval.
- amount: Series[float] = 'amount'¶
- code: Series[str] = 'code'¶
- datetime: Series[Timestamp] = 'datetime'¶
- id: Series[str] = 'id'¶
- symbol: Series[str] = 'symbol'¶
- timestamp: Series[Timestamp] = 'timestamp'¶
- class ccxt_pandas.FundingIntervalsSchema(*args, **kwargs)[source]¶
Bases:
BaseExchangeSchemaFunding intervals data schema.
Used by methods like fetch_funding_intervals.
Returns the funding rate payment interval for derivatives contracts, indicating how often funding payments are made (e.g., 8h, 4h).
- interval: Series[str] = 'interval'¶
- symbol: Series[str] = 'symbol'¶
- class ccxt_pandas.OpenInterestHistorySchema(*args, **kwargs)[source]¶
Bases:
BaseExchangeSchemaOpen interest history data schema.
Used by methods like fetch_open_interest_history.
Returns historical open interest data for derivatives contracts.
- baseVolume: Series[float] | None = 'baseVolume'¶
- datetime: Series[Timestamp] | None = 'datetime'¶
- openInterestAmount: Series[float] = 'openInterestAmount'¶
- openInterestValue: Series[float] | None = 'openInterestValue'¶
- quoteVolume: Series[float] | None = 'quoteVolume'¶
- symbol: Series[str] = 'symbol'¶
- timestamp: Series[Timestamp] | None = 'timestamp'¶
- class ccxt_pandas.LongShortRatioSchema(*args, **kwargs)[source]¶
Bases:
BaseExchangeSchemaLong/short ratio data schema.
Used by methods like fetch_long_short_ratio.
Returns the ratio of long positions to short positions for a trading pair.
- datetime: Series[Timestamp] = 'datetime'¶
- longShortRatio: Series[float] = 'longShortRatio'¶
- symbol: Series[str] = 'symbol'¶
- timestamp: Series[Timestamp] = 'timestamp'¶
- class ccxt_pandas.LiquidationsSchema(*args, **kwargs)[source]¶
Bases:
BaseExchangeSchemaLiquidations data schema.
Used by methods like fetch_liquidations.
Returns liquidation events for derivatives contracts, showing forced closures of positions due to insufficient margin.
- baseValue: Series[float] | None = 'baseValue'¶
- contracts: Series[float] = 'contracts'¶
- datetime: Series[Timestamp] = 'datetime'¶
- price: Series[float] = 'price'¶
- quoteValue: Series[float] | None = 'quoteValue'¶
- side: Series[str] | None = 'side'¶
- symbol: Series[str] = 'symbol'¶
- timestamp: Series[Timestamp] = 'timestamp'¶
- class ccxt_pandas.GreeksSchema(*args, **kwargs)[source]¶
Bases:
BaseExchangeSchemaOptions Greeks data schema.
Used by methods like fetch_all_greeks, fetch_greeks.
Returns option Greeks (delta, gamma, vega, theta, rho) and related pricing data.
- askImpliedVolatility: Series[float] | None = 'askImpliedVolatility'¶
- askPrice: Series[float] | None = 'askPrice'¶
- askSize: Series[float] | None = 'askSize'¶
- bidImpliedVolatility: Series[float] | None = 'bidImpliedVolatility'¶
- bidPrice: Series[float] | None = 'bidPrice'¶
- bidSize: Series[float] | None = 'bidSize'¶
- datetime: Series[Timestamp] | None = 'datetime'¶
- delta: Series[float] = 'delta'¶
- gamma: Series[float] = 'gamma'¶
- lastPrice: Series[float] | None = 'lastPrice'¶
- markImpliedVolatility: Series[float] | None = 'markImpliedVolatility'¶
- markPrice: Series[float] = 'markPrice'¶
- rho: Series[float] | None = 'rho'¶
- symbol: Series[str] = 'symbol'¶
- theta: Series[float] | None = 'theta'¶
- timestamp: Series[Timestamp] | None = 'timestamp'¶
- underlyingPrice: Series[float] | None = 'underlyingPrice'¶
- vega: Series[float] = 'vega'¶
- class ccxt_pandas.VolatilityHistorySchema(*args, **kwargs)[source]¶
Bases:
BaseExchangeSchemaVolatility history data schema.
Used by methods like fetch_volatility_history.
Returns historical volatility data for a trading pair, typically used in options pricing and risk management.
- datetime: Series[Timestamp] = 'datetime'¶
- timestamp: Series[Timestamp] = 'timestamp'¶
- volatility: Series[float] = 'volatility'¶
- class ccxt_pandas.LedgerSchema(*args, **kwargs)[source]¶
Bases:
BaseExchangeSchema,FeeFieldsMixinLedger data schema.
Used by methods like fetch_ledger.
Returns ledger entries showing account balance changes from trades, deposits, withdrawals, and other transactions.
- account: Series[str] = 'account'¶
- after: Series[float] = 'after'¶
- amount: Series[float] = 'amount'¶
- before: Series[float] = 'before'¶
- currency: Series[str] = 'currency'¶
- datetime: Series[Timestamp] = 'datetime'¶
- direction: Series[str] = 'direction'¶
- id: Series[str] = 'id'¶
- referenceAccount: Series[str] = 'referenceAccount'¶
- referenceId: Series[str] = 'referenceId'¶
- status: Series[str] = 'status'¶
- timestamp: Series[Timestamp] = 'timestamp'¶
- type: Series[str] = 'type'¶
- class ccxt_pandas.TransactionsSchema(*args, **kwargs)[source]¶
Bases:
BaseExchangeSchema,FeeFieldsMixinTransactions data schema.
Used by methods like fetch_deposits, fetch_withdrawals, fetch_deposits_withdrawals.
Returns transaction history for deposits and withdrawals including addresses, amounts, fees, and transaction status.
- address: Series[str] | None = 'address'¶
- addressFrom: Series[str] | None = 'addressFrom'¶
- addressTo: Series[str] | None = 'addressTo'¶
- amount: Series[float] = 'amount'¶
- comment: Series[str] | None = 'comment'¶
- currency: Series[str] = 'currency'¶
- datetime: Series[Timestamp] = 'datetime'¶
- id: Series[str] = 'id'¶
- status: Series[str] = 'status'¶
- tag: Series[str] | None = 'tag'¶
- tagFrom: Series[str] | None = 'tagFrom'¶
- tagTo: Series[str] | None = 'tagTo'¶
- timestamp: Series[Timestamp] = 'timestamp'¶
- txid: Series[str] = 'txid'¶
- type: Series[str] = 'type'¶
- updated: Series[Timestamp] | None = 'updated'¶
- class ccxt_pandas.TransfersSchema(*args, **kwargs)[source]¶
Bases:
BaseExchangeSchemaTransfers data schema.
Used by methods like fetch_transfers.
Returns internal transfer history between user accounts (e.g., trading to funding, spot to futures).
- amount: Series[float] = 'amount'¶
- code: Series[str] = 'code'¶
- currency: Series[str] = 'currency'¶
- datetime: Series[Timestamp] = 'datetime'¶
- fromAccount: Series[str] = 'fromAccount'¶
- id: Series[str] = 'id'¶
- timestamp: Series[Timestamp] = 'timestamp'¶
- toAccount: Series[str] = 'toAccount'¶
- class ccxt_pandas.AddressesSchema(*args, **kwargs)[source]¶
Bases:
BaseExchangeSchemaAddresses data schema.
Used by methods like fetch_deposit_addresses.
Returns deposit address information for receiving cryptocurrency deposits, including network details and optional tags/memos for currencies that require them.
- address: Series[str] = 'address'¶
- currency: Series[str] = 'currency'¶
- network: Series[str] = 'network'¶
- tag: Series[str] | None = 'tag'¶
- class ccxt_pandas.AccountsSchema(*args, **kwargs)[source]¶
Bases:
BaseExchangeSchemaAccounts data schema.
Used by methods like fetch_accounts.
Returns user account information including account ID and type, often used for subaccount management.
- id: Series[str] = 'id'¶
- type: Series[str] = 'type'¶
- class ccxt_pandas.PortfoliosSchema(*args, **kwargs)[source]¶
Bases:
BaseExchangeSchemaPortfolios data schema.
Used by methods like fetch_portfolios.
Returns user’s portfolios or trading accounts on the exchange, such as default accounts, futures accounts, or other account types.
- id: Series[str] = 'id'¶
- type: Series[str] = 'type'¶
- class ccxt_pandas.PortfolioDetailsSchema(*args, **kwargs)[source]¶
Bases:
BaseExchangeSchemaPortfolio details data schema.
Used by methods like fetch_portfolio_details.
Returns detailed portfolio information including balances, holdings, P&L, cost basis, and asset allocation.
- account_id: Series[str] = 'account_id'¶
- account_type: Series[str] = 'account_type'¶
- account_uuid: Series[str] = 'account_uuid'¶
- allocation: Series[float] = 'allocation'¶
- asset_color: Series[str] = 'asset_color'¶
- asset_uuid: Series[str] = 'asset_uuid'¶
- available_balance: Series[float] = 'available_balance'¶
- available_to_trade_crypto: Series[float] = 'available_to_trade_crypto'¶
- available_to_trade_fiat: Series[float] = 'available_to_trade_fiat'¶
- available_to_transfer_crypto: Series[float] = 'available_to_transfer_crypto'¶
- available_to_transfer_fiat: Series[float] = 'available_to_transfer_fiat'¶
- average_entry_price: Series[float] = 'average_entry_price'¶
- average_entry_price_currency: Series[str] = 'average_entry_price_currency'¶
- cost_basis: Series[float] = 'cost_basis'¶
- cost_basis_currency: Series[str] = 'cost_basis_currency'¶
- currency: Series[str] = 'currency'¶
- hold_amount: Series[int] = 'hold_amount'¶
- is_cash: Series[bool] = 'is_cash'¶
- total_balance_crypto: Series[float] = 'total_balance_crypto'¶
- total_balance_fiat: Series[float] = 'total_balance_fiat'¶
- unrealized_pnl: Series[float] = 'unrealized_pnl'¶
- wallet_name: Series[str] = 'wallet_name'¶
- class ccxt_pandas.MarginsBalanceSchema(*args, **kwargs)[source]¶
Bases:
BaseExchangeSchemaMargins balance data schema for margin/cross margin accounts.
Used by methods like fetch_balance (when in margin mode).
Returns balance information for margin accounts with separate base/quote currency balances and debt tracking per trading pair.
- base: Series[str] | None = 'base'¶
- base_debt: Series[float] | None = 'base_debt'¶
- base_free: Series[float] = 'base_free'¶
- base_total: Series[float] = 'base_total'¶
- base_used: Series[float] = 'base_used'¶
- datetime: Series[Timestamp] | None = 'datetime'¶
- quote: Series[str] | None = 'quote'¶
- quote_debt: Series[float] | None = 'quote_debt'¶
- quote_free: Series[float] = 'quote_free'¶
- quote_total: Series[float] = 'quote_total'¶
- quote_used: Series[float] = 'quote_used'¶
- symbol: Series[str] = 'symbol'¶
- timestamp: Series[Timestamp] | None = 'timestamp'¶
- class ccxt_pandas.LeveragesSchema(*args, **kwargs)[source]¶
Bases:
BaseExchangeSchemaLeverages data schema.
Used by methods like fetch_leverages.
Returns maximum leverage available for each trading pair, with separate limits for long and short positions.
- longLeverage: Series[int] = 'longLeverage'¶
- marginMode: Series[str] = 'marginMode'¶
- shortLeverage: Series[int] = 'shortLeverage'¶
- symbol: Series[str] = 'symbol'¶
- class ccxt_pandas.BorrowInterestSchema(*args, **kwargs)[source]¶
Bases:
BaseExchangeSchemaBorrow interest data schema.
Used by methods like fetch_borrow_interest.
Returns historical borrow interest charges for margin/leveraged positions, showing the interest accrued on borrowed funds.
- account: Series[str] = 'account'¶
- amountBorrowed: Series[float] = 'amountBorrowed'¶
- currency: Series[str] = 'currency'¶
- datetime: Series[Timestamp] = 'datetime'¶
- interest: Series[float] = 'interest'¶
- interestRate: Series[float] = 'interestRate'¶
- timestamp: Series[Timestamp] = 'timestamp'¶
- class ccxt_pandas.CrossBorrowRatesSchema(*args, **kwargs)[source]¶
Bases:
BaseExchangeSchemaCross borrow rates data schema.
Used by methods like fetch_cross_borrow_rates.
Returns borrowing interest rates for cross-margin trading, showing the cost of borrowing assets for margin positions.
- currency: Series[str] = 'currency'¶
- period: Series[int] = 'period'¶
- rate: Series[float] = 'rate'¶
- class ccxt_pandas.IsolatedBorrowRatesSchema(*args, **kwargs)[source]¶
Bases:
BaseExchangeSchemaIsolated borrow rates data schema.
Used by methods like fetch_isolated_borrow_rates.
Returns borrowing interest rates for isolated-margin trading pairs, showing separate rates for base and quote currencies.
- base: Series[str] = 'base'¶
- baseRate: Series[float] = 'baseRate'¶
- period: Series[int] = 'period'¶
- quote: Series[str] = 'quote'¶
- quoteRate: Series[float] = 'quoteRate'¶
- symbol: Series[str] = 'symbol'¶
- class ccxt_pandas.TradingFeesSchema(*args, **kwargs)[source]¶
Bases:
BaseExchangeSchemaTrading fees data schema.
Used by methods like fetch_trading_fees.
Returns maker and taker fee rates for each trading pair.
- maker: Series[float] = 'maker'¶
- symbol: Series[str] = 'symbol'¶
- taker: Series[float] = 'taker'¶
- class ccxt_pandas.DepositWithdrawFeesSchema(*args, **kwargs)[source]¶
Bases:
BaseExchangeSchemaDeposit and withdrawal fees data schema.
Used by methods like fetch_deposit_withdraw_fees.
Returns deposit and withdrawal fee information per currency and network, including fixed fees and percentage-based fees.
- id: Series[str] = 'id'¶
- network: Series[str] = 'network'¶
- network_withdraw_fee: Series[float] = 'network_withdraw_fee'¶
- network_withdraw_percentage: Series[bool] | None = 'network_withdraw_percentage'¶
- withdraw_fee: Series[float] = 'withdraw_fee'¶
- withdraw_percentage: Series[bool] | None = 'withdraw_percentage'¶