mirror of
https://github.com/luxfi/dex.git
synced 2026-09-24 00:26:31 +00:00
Decentralized exchange; the engine acts like an order book but is decentralized, so 'Central Limit Order Book' is a misnomer. Branded/service surface → DEX (RegisterDEX, DEXMethod*, dex_* wire). Matching engine + GPU → OrderBook (OrderBookMatch/Source/Arena, source_orderbook.go), preserving the AMM-vs-orderbook distinction. C-ABI → dex_orderbook_* (matches luxcpp). SDKs/clients/docs aligned. CGO=0 + cgo builds clean; full suite 23 pkgs green (dchain/dex/lx/fix/gateway/zapwire). Legit financial-term 'Central Limit Order Book' retained in hummingbot taxonomy.
116 lines
2.3 KiB
Python
116 lines
2.3 KiB
Python
"""
|
|
LX Trading SDK - High-frequency trading with unified liquidity aggregation.
|
|
|
|
Supports:
|
|
- Native LX DEX (OrderBook) 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",
|
|
]
|