Files
dex/sdk/lx-trading-py/python/lx_trading/__init__.py
zeekay 9a97d82e99 fix(sdk/cpp): resolve integer overflow in AggregatedOrderbook best venue methods
The best_venue_buy() and best_venue_sell() methods used Decimal::from_double(1e18)
as a sentinel value, which caused integer overflow (1e18 * 1e8 scale = 1e26 exceeds
int64_t max ~9.2e18). This resulted in undefined behavior during price comparisons.

Changed to use std::optional<Decimal> for safe sentinel-free comparisons.
2025-12-11 22:27:56 -08:00

116 lines
2.3 KiB
Python

"""
LX Trading SDK - High-frequency trading with unified liquidity aggregation.
Supports:
- Native LX DEX (CLOB) and LX AMM
- CCXT exchanges (Binance, MEXC, OKX, etc.)
- Hummingbot Gateway connectors
Example:
>>> from lx_trading import Client, Config
>>>
>>> config = Config.from_file("config.toml")
>>> client = Client(config)
>>> await client.connect()
>>>
>>> # Smart order routing across all venues
>>> order = await client.buy("BTC-USDC", 1.0)
>>>
>>> # Or target specific venue
>>> order = await client.buy("BTC-USDC", 1.0, venue="binance")
"""
__version__ = "0.1.0"
from lx_trading.client import Client
from lx_trading.config import Config
from lx_trading.types import (
Balance,
Fee,
LpPosition,
Order,
OrderRequest,
OrderStatus,
OrderType,
PoolInfo,
Side,
SwapQuote,
Ticker,
TimeInForce,
Trade,
TradingPair,
)
from lx_trading.adapters import (
CcxtAdapter,
HummingbotAdapter,
LxDexAdapter,
LxAmmAdapter,
)
from lx_trading.orderbook import Orderbook, AggregatedOrderbook
from lx_trading.risk import RiskManager
from lx_trading.execution import TwapExecutor, VwapExecutor, IcebergExecutor, SniperExecutor
from lx_trading.math import (
# Pricing
black_scholes,
implied_volatility,
greeks,
# AMM
constant_product_price,
concentrated_liquidity_price,
# Statistics
volatility,
sharpe_ratio,
sortino_ratio,
max_drawdown,
var,
cvar,
)
__all__ = [
# Core
"Client",
"Config",
# Types
"Balance",
"Fee",
"LpPosition",
"Order",
"OrderRequest",
"OrderStatus",
"OrderType",
"PoolInfo",
"Side",
"SwapQuote",
"Ticker",
"TimeInForce",
"Trade",
"TradingPair",
# Adapters
"CcxtAdapter",
"HummingbotAdapter",
"LxDexAdapter",
"LxAmmAdapter",
# Orderbook
"Orderbook",
"AggregatedOrderbook",
# Risk
"RiskManager",
# Execution
"TwapExecutor",
"VwapExecutor",
"IcebergExecutor",
"SniperExecutor",
# Math
"black_scholes",
"implied_volatility",
"greeks",
"constant_product_price",
"concentrated_liquidity_price",
"volatility",
"sharpe_ratio",
"sortino_ratio",
"max_drawdown",
"var",
"cvar",
]