PancakeSwap Perps¶
| Field | Value |
|---|---|
| Module | almanak.connectors.pancakeswap_perps |
| Protocol kind | Perp |
| Aliases | N/A |
Supported Chains And Intents¶
| Chain | Family | Supported Intents |
|---|---|---|
| BNB Chain | EVM | PERP_CLOSE, PERP_OPEN |
API Reference¶
almanak.connectors.pancakeswap_perps
¶
Backwards-compatibility shim for pancakeswap_perps.
PancakeSwap Perps is powered by Aster, formerly ApolloX. The canonical
connector lives in almanak.connectors.aster_perps; this package keeps the
legacy import path and binds broker_id=2 for PancakeSwap attribution.
The package body is intentionally lazy. Importing submodules such as
almanak.connectors.pancakeswap_perps.addresses must stay pure so descriptor
discovery can load connector-owned data without triggering strategy registry
registration. Accessing a legacy public symbol emits a one-shot
DeprecationWarning and resolves the canonical Aster symbol. Strategy
registration is descriptor-owned in connector.py.
PerpOpenOrderResult
dataclass
¶
PerpOpenOrderResult(
success: bool,
error: str | None = None,
tx: AsterPerpsTx | None = None,
pair_base: str | None = None,
margin_token_address: str | None = None,
qty: int = 0,
limit_price: int = 0,
native: bool = False,
amount_in_wei: int = 0,
)
Adapter output for a compiled PERP_OPEN.
属性:
| 名称 | 类型 | 描述 |
|---|---|---|
success |
bool
|
False if validation fails before tx construction. |
error |
str | None
|
description when success is False. |
tx |
AsterPerpsTx | None
|
the built transaction. |
pair_base |
str | None
|
resolved pairBase address for the market. |
margin_token_address |
str | None
|
resolved margin-token address (or NATIVE sentinel). |
qty |
int
|
computed on-wire qty (uint80, 10-decimal). |
limit_price |
int
|
computed acceptable limit price (uint64, 8-decimal). |
native |
bool
|
True if the transaction uses openMarketTradeBNB (value-carrying). |
amount_in_wei |
int
|
margin amount in token-wei (matches OpenTradeStruct.amountIn). |
PancakeSwapPerpsConfig
¶
PancakeSwapPerpsConfig(
chain: str = "bsc",
wallet_address: str | None = None,
broker_id: int = PANCAKESWAP_PERPS_BROKER_ID,
) -> AsterPerpsConfig
Backwards-compatible factory defaulting broker id to PancakeSwap.
build_open_transaction
¶
build_open_transaction(
*,
chain: str = "bsc",
wallet_address: str | None = None,
broker_id: int = PANCAKESWAP_PERPS_BROKER_ID,
**open_kwargs: Any,
) -> PerpOpenOrderResult
Legacy build_open_transaction signature: defaults broker_id=2.
build_close_transaction
¶
build_close_transaction(
*,
trade_hash: Any,
chain: str = "bsc",
wallet_address: str | None = None,
broker_id: int = PANCAKESWAP_PERPS_BROKER_ID,
) -> AsterPerpsTx
Legacy build_close_transaction signature: defaults broker_id=2.