Smart Contract Python Bindings Reference
afp.bindings
Typed bindings around the smart contracts of the Autonomous Futures Protocol.
Classes:
- AuctionConfig – Port of
struct AuctionConfigon the IAuctioneer contract. - AuctionData – Port of
struct AuctionDataon the IAuctioneer contract. - BidData – Port of
struct BidDataon the IAuctioneer contract. - ClearingConfig – Port of
struct ClearingConfigon the IClearing contract. - ClearingDiamond – ClearingDiamond contract binding.
- Config – Port of
struct Configon the IClearing contract. - Intent – Port of
struct Intenton the IClearing contract. - IntentData – Port of
struct IntentDataon the IClearing contract. - LAAData – Port of
struct LAADataon the IBankruptcy contract. - MarginAccount – MarginAccount contract binding.
- MarginAccountRegistry – MarginAccountRegistry contract binding.
- OracleProvider – OracleProvider contract binding.
- OracleSpecification – Port of
struct OracleSpecificationon the IProductRegistry contract. - PositionData – Port of
struct PositionDataon the IMarginAccount contract. - PositionLossData – Port of
struct PositionLossDataon the IBankruptcy contract. - Product – Port of
struct Producton the IProductRegistry contract. - ProductMetadata – Port of
struct ProductMetadataon the IProductRegistry contract. - ProductRegistry – ProductRegistry contract binding.
- ProductState – Port of
enum ProductStateon the ProductRegistry contract. - Settlement – Port of
struct Settlementon the IMarginAccount contract. - Side – Port of
enum Sideon the ClearingFacet contract. - SystemViewer – SystemViewer contract binding.
- Trade – Port of
struct Tradeon the IClearing contract. - TradingProtocol – TradingProtocol contract binding.
- UserMarginAccountData – Port of
struct UserMarginAccountDataon the ISystemViewer contract.
afp.bindings.AuctionConfig
AuctionConfig(restoration_buffer, liquidation_duration)Port of struct AuctionConfig on the IAuctioneer contract.
Attributes:
- liquidation_duration (
int) – - restoration_buffer (
int) –
afp.bindings.AuctionConfig.liquidation_duration
liquidation_duration: intafp.bindings.AuctionConfig.restoration_buffer
restoration_buffer: intafp.bindings.AuctionData
AuctionData(start_block, mae_at_initiation, mmu_at_initiation, mae_now, mmu_now)Port of struct AuctionData on the IAuctioneer contract.
Attributes:
- mae_at_initiation (
int) – - mae_now (
int) – - mmu_at_initiation (
int) – - mmu_now (
int) – - start_block (
int) –
afp.bindings.AuctionData.mae_at_initiation
mae_at_initiation: intafp.bindings.AuctionData.mae_now
mae_now: intafp.bindings.AuctionData.mmu_at_initiation
mmu_at_initiation: intafp.bindings.AuctionData.mmu_now
mmu_now: intafp.bindings.AuctionData.start_block
start_block: intafp.bindings.BidData
BidData(product_id, price, quantity, side)Port of struct BidData on the IAuctioneer contract.
Attributes:
afp.bindings.BidData.price
price: intafp.bindings.BidData.product_id
product_id: hexbytes.HexBytesafp.bindings.BidData.quantity
quantity: intafp.bindings.BidData.side
side: Sideafp.bindings.ClearingConfig
ClearingConfig(clearing_fee_rate)Port of struct ClearingConfig on the IClearing contract.
Attributes:
- clearing_fee_rate (
int) –
afp.bindings.ClearingConfig.clearing_fee_rate
clearing_fee_rate: intafp.bindings.ClearingDiamond
ClearingDiamond(w3, address=defaults.CLEARING_DIAMOND_ADDRESS)Bases: AuctioneerFacet, BankruptcyFacet, ClearingFacet, FinalSettlementFacet, MarkPriceTrackerFacet
ClearingDiamond contract binding.
Includes all functions inherited from various facets.
Parameters:
- w3 (
Web3) –
Functions:
- auction_config – Binding for
auctionConfigon the AuctioneerFacet contract. - auction_data – Binding for
auctionDataon the AuctioneerFacet contract. - bid_auction – Binding for
bidAuctionon the AuctioneerFacet contract. - can_terminate_auctions – Binding for
canTerminateAuctionson the AuctioneerFacet contract. - clearing_fee_rate – Binding for
clearingFeeRateon the ClearingFacet contract. - closeout_fee_rate – Binding for
CLOSEOUT_FEE_RATEon the FinalSettlementFacet contract. - closeout_reward_rate – Binding for
CLOSEOUT_REWARD_RATEon the FinalSettlementFacet contract. - config – Binding for
configon the ClearingFacet contract. - estimate_fees – Binding for
estimateFeeson the ClearingFacet contract. - execute – Binding for
executeon the ClearingFacet contract. - finalize_fsp – Binding for
finalizeFspon the FinalSettlementFacet contract. - finalize_initialization – Binding for
finalizeInitializationon the ClearingFacet contract. - get_admin – Binding for
getAdminon the ClearingFacet contract. - get_fsp – Binding for
getFspon the FinalSettlementFacet contract. - get_margin_account_registry – Binding for
getMarginAccountRegistryon the ClearingFacet contract. - get_product_registry – Binding for
getProductRegistryon the ClearingFacet contract. - get_treasury – Binding for
getTreasuryon the ClearingFacet contract. - hash_intent – Binding for
hashIntenton the ClearingFacet contract. - initialize – Binding for
initializeon the ClearingFacet contract. - initiate_final_settlement – Binding for
initiateFinalSettlementon the FinalSettlementFacet contract. - is_admin_active – Binding for
isAdminActiveon the ClearingFacet contract. - is_liquidatable – Binding for
isLiquidatableon the AuctioneerFacet contract. - is_liquidating – Binding for
isLiquidatingon the AuctioneerFacet contract. - last_traded_timestamp – Binding for
lastTradedTimestampon the BankruptcyFacet contract. - mae_check_on_bid – Binding for
maeCheckOnBidon the AuctioneerFacet contract. - max_mae_offered – Binding for
maxMaeOfferedon the AuctioneerFacet contract. - max_trading_fee_rate – Binding for
MAX_TRADING_FEE_RATEon the ClearingFacet contract. - mutualize_losses – Binding for
mutualizeLosseson the BankruptcyFacet contract. - open_interest – Binding for
openIntereston the FinalSettlementFacet contract. - request_liquidation – Binding for
requestLiquidationon the AuctioneerFacet contract. - set_active – Binding for
setActiveon the ClearingFacet contract. - set_admin – Binding for
setAdminon the ClearingFacet contract. - set_config – Binding for
setConfigon the ClearingFacet contract. - set_treasury – Binding for
setTreasuryon the ClearingFacet contract. - terminate_auctions – Binding for
terminateAuctionson the AuctioneerFacet contract. - unique_trader_count – Binding for
uniqueTraderCounton the BankruptcyFacet contract. - validate_auctions – Binding for
validateAuctionson the AuctioneerFacet contract. - validate_la_as – Binding for
validateLAAson the BankruptcyFacet contract. - valuation – Binding for
valuationon the MarkPriceTrackerFacet contract. - valuation_after_trade – Binding for
valuationAfterTradeon the MarkPriceTrackerFacet contract. - version – Binding for
versionon the ClearingFacet contract.
Attributes:
- Auctioned (
ContractEvent) – Binding forevent Auctionedon the AuctioneerFacet contract. - FSPFinalized (
ContractEvent) – Binding forevent FSPFinalizedon the FinalSettlementFacet contract. - FinalSettlementCloseout (
ContractEvent) – Binding forevent FinalSettlementCloseouton the FinalSettlementFacet contract. - LiquidationStarted (
ContractEvent) – Binding forevent LiquidationStartedon the AuctioneerFacet contract. - LiquidationTerminated (
ContractEvent) – Binding forevent LiquidationTerminatedon the AuctioneerFacet contract. - LossMutualized (
ContractEvent) – Binding forevent LossMutualizedon the BankruptcyFacet contract. - TradeExecuted (
ContractEvent) – Binding forevent TradeExecutedon the ClearingFacet contract.
afp.bindings.ClearingDiamond.Auctioned
Auctioned: contract.ContractEventBinding for event Auctioned on the AuctioneerFacet contract.
afp.bindings.ClearingDiamond.FSPFinalized
FSPFinalized: contract.ContractEventBinding for event FSPFinalized on the FinalSettlementFacet contract.
afp.bindings.ClearingDiamond.FinalSettlementCloseout
FinalSettlementCloseout: contract.ContractEventBinding for event FinalSettlementCloseout on the FinalSettlementFacet contract.
afp.bindings.ClearingDiamond.LiquidationStarted
LiquidationStarted: contract.ContractEventBinding for event LiquidationStarted on the AuctioneerFacet contract.
afp.bindings.ClearingDiamond.LiquidationTerminated
LiquidationTerminated: contract.ContractEventBinding for event LiquidationTerminated on the AuctioneerFacet contract.
afp.bindings.ClearingDiamond.LossMutualized
LossMutualized: contract.ContractEventBinding for event LossMutualized on the BankruptcyFacet contract.
afp.bindings.ClearingDiamond.TradeExecuted
TradeExecuted: contract.ContractEventBinding for event TradeExecuted on the ClearingFacet contract.
afp.bindings.ClearingDiamond.auction_config
auction_config()Binding for auctionConfig on the AuctioneerFacet contract.
Returns:
afp.bindings.ClearingDiamond.auction_data
auction_data(margin_account_id, collateral)Binding for auctionData on the AuctioneerFacet contract.
Parameters:
- margin_account_id (
ChecksumAddress) – - collateral (
ChecksumAddress) –
Returns:
afp.bindings.ClearingDiamond.bid_auction
bid_auction(margin_account_id, collateral_token, bids)Binding for bidAuction on the AuctioneerFacet contract.
Parameters:
- margin_account_id (
ChecksumAddress) – - collateral_token (
ChecksumAddress) – - bids (
List[BidData]) –
Returns:
ContractFunction– A contract function instance to be sent in a transaction.
afp.bindings.ClearingDiamond.can_terminate_auctions
can_terminate_auctions(margin_account_id, collateral)Binding for canTerminateAuctions on the AuctioneerFacet contract.
Parameters:
- margin_account_id (
ChecksumAddress) – - collateral (
ChecksumAddress) –
Returns:
bool–
afp.bindings.ClearingDiamond.clearing_fee_rate
clearing_fee_rate()Binding for clearingFeeRate on the ClearingFacet contract.
Returns:
int–
afp.bindings.ClearingDiamond.closeout_fee_rate
closeout_fee_rate()Binding for CLOSEOUT_FEE_RATE on the FinalSettlementFacet contract.
Returns:
int–
afp.bindings.ClearingDiamond.closeout_reward_rate
closeout_reward_rate()Binding for CLOSEOUT_REWARD_RATE on the FinalSettlementFacet contract.
Returns:
int–
afp.bindings.ClearingDiamond.config
config()Binding for config on the ClearingFacet contract.
Returns:
Config–
afp.bindings.ClearingDiamond.estimate_fees
estimate_fees(product_id, price, quantity, trading_fee_rate)Binding for estimateFees on the ClearingFacet contract.
Parameters:
Returns:
afp.bindings.ClearingDiamond.execute
execute(trade, fallback_on_failure)Binding for execute on the ClearingFacet contract.
Parameters:
Returns:
ContractFunction– A contract function instance to be sent in a transaction.
afp.bindings.ClearingDiamond.finalize_fsp
finalize_fsp(product_id)Binding for finalizeFsp on the FinalSettlementFacet contract.
Parameters:
- product_id (
HexBytes) –
Returns:
ContractFunction– A contract function instance to be sent in a transaction.
afp.bindings.ClearingDiamond.finalize_initialization
finalize_initialization(margin_account_registry)Binding for finalizeInitialization on the ClearingFacet contract.
Parameters:
- margin_account_registry (
ChecksumAddress) –
Returns:
ContractFunction– A contract function instance to be sent in a transaction.
afp.bindings.ClearingDiamond.get_admin
get_admin()Binding for getAdmin on the ClearingFacet contract.
Returns:
afp.bindings.ClearingDiamond.get_fsp
get_fsp(product_id)Binding for getFsp on the FinalSettlementFacet contract.
Parameters:
- product_id (
HexBytes) –
Returns:
afp.bindings.ClearingDiamond.get_margin_account_registry
get_margin_account_registry()Binding for getMarginAccountRegistry on the ClearingFacet contract.
Returns:
afp.bindings.ClearingDiamond.get_product_registry
get_product_registry()Binding for getProductRegistry on the ClearingFacet contract.
Returns:
afp.bindings.ClearingDiamond.get_treasury
get_treasury()Binding for getTreasury on the ClearingFacet contract.
Returns:
afp.bindings.ClearingDiamond.hash_intent
hash_intent(intent)Binding for hashIntent on the ClearingFacet contract.
Parameters:
- intent (
Intent) –
Returns:
HexBytes–
afp.bindings.ClearingDiamond.initialize
initialize(_product_registry, _treasury)Binding for initialize on the ClearingFacet contract.
Parameters:
- _product_registry (
ChecksumAddress) – - _treasury (
ChecksumAddress) –
Returns:
ContractFunction– A contract function instance to be sent in a transaction.
afp.bindings.ClearingDiamond.initiate_final_settlement
initiate_final_settlement(product_id, accounts)Binding for initiateFinalSettlement on the FinalSettlementFacet contract.
Parameters:
- product_id (
HexBytes) – - accounts (
List[ChecksumAddress]) –
Returns:
ContractFunction– A contract function instance to be sent in a transaction.
afp.bindings.ClearingDiamond.is_admin_active
is_admin_active()Binding for isAdminActive on the ClearingFacet contract.
Returns:
bool–
afp.bindings.ClearingDiamond.is_liquidatable
is_liquidatable(margin_account_id, collateral_token)Binding for isLiquidatable on the AuctioneerFacet contract.
Parameters:
- margin_account_id (
ChecksumAddress) – - collateral_token (
ChecksumAddress) –
Returns:
bool–
afp.bindings.ClearingDiamond.is_liquidating
is_liquidating(margin_account_id, collateral_token)Binding for isLiquidating on the AuctioneerFacet contract.
Parameters:
- margin_account_id (
ChecksumAddress) – - collateral_token (
ChecksumAddress) –
Returns:
bool–
afp.bindings.ClearingDiamond.last_traded_timestamp
last_traded_timestamp(product_id, trader)Binding for lastTradedTimestamp on the BankruptcyFacet contract.
Parameters:
- product_id (
HexBytes) – - trader (
ChecksumAddress) –
Returns:
int–
afp.bindings.ClearingDiamond.mae_check_on_bid
mae_check_on_bid(liquidator_margin_account_id, liquidating_margin_account_id, collateral, bids)Binding for maeCheckOnBid on the AuctioneerFacet contract.
Parameters:
- liquidator_margin_account_id (
ChecksumAddress) – - liquidating_margin_account_id (
ChecksumAddress) – - collateral (
ChecksumAddress) – - bids (
List[BidData]) –
Returns:
afp.bindings.ClearingDiamond.max_mae_offered
max_mae_offered(margin_account_id, collateral, mmu_decreased)Binding for maxMaeOffered on the AuctioneerFacet contract.
Parameters:
- margin_account_id (
ChecksumAddress) – - collateral (
ChecksumAddress) – - mmu_decreased (
int) –
Returns:
int–
afp.bindings.ClearingDiamond.max_trading_fee_rate
max_trading_fee_rate()Binding for MAX_TRADING_FEE_RATE on the ClearingFacet contract.
Returns:
int–
afp.bindings.ClearingDiamond.mutualize_losses
mutualize_losses(bankrupt_account_id, collateral_token, product_ids, laas)Binding for mutualizeLosses on the BankruptcyFacet contract.
Parameters:
- bankrupt_account_id (
ChecksumAddress) – - collateral_token (
ChecksumAddress) – - product_ids (
List[HexBytes]) – - laas (
List[List[ChecksumAddress]]) –
Returns:
ContractFunction– A contract function instance to be sent in a transaction.
afp.bindings.ClearingDiamond.open_interest
open_interest(product_id)Binding for openInterest on the FinalSettlementFacet contract.
Parameters:
- product_id (
HexBytes) –
Returns:
int–
afp.bindings.ClearingDiamond.request_liquidation
request_liquidation(margin_account_id, collateral_token)Binding for requestLiquidation on the AuctioneerFacet contract.
Parameters:
- margin_account_id (
ChecksumAddress) – - collateral_token (
ChecksumAddress) –
Returns:
ContractFunction– A contract function instance to be sent in a transaction.
afp.bindings.ClearingDiamond.set_active
set_active(active)Binding for setActive on the ClearingFacet contract.
Parameters:
- active (
bool) –
Returns:
ContractFunction– A contract function instance to be sent in a transaction.
afp.bindings.ClearingDiamond.set_admin
set_admin(new_admin)Binding for setAdmin on the ClearingFacet contract.
Parameters:
- new_admin (
ChecksumAddress) –
Returns:
ContractFunction– A contract function instance to be sent in a transaction.
afp.bindings.ClearingDiamond.set_config
set_config(_config)Binding for setConfig on the ClearingFacet contract.
Parameters:
- _config (
Config) –
Returns:
ContractFunction– A contract function instance to be sent in a transaction.
afp.bindings.ClearingDiamond.set_treasury
set_treasury(new_treasury)Binding for setTreasury on the ClearingFacet contract.
Parameters:
- new_treasury (
ChecksumAddress) –
Returns:
ContractFunction– A contract function instance to be sent in a transaction.
afp.bindings.ClearingDiamond.terminate_auctions
terminate_auctions(margin_account_id, collateral)Binding for terminateAuctions on the AuctioneerFacet contract.
Parameters:
- margin_account_id (
ChecksumAddress) – - collateral (
ChecksumAddress) –
Returns:
ContractFunction– A contract function instance to be sent in a transaction.
afp.bindings.ClearingDiamond.unique_trader_count
unique_trader_count(product_id)Binding for uniqueTraderCount on the BankruptcyFacet contract.
Parameters:
- product_id (
HexBytes) –
Returns:
int–
afp.bindings.ClearingDiamond.validate_auctions
validate_auctions(margin_account_id, collateral_token, bids)Binding for validateAuctions on the AuctioneerFacet contract.
Parameters:
- margin_account_id (
ChecksumAddress) – - collateral_token (
ChecksumAddress) – - bids (
List[BidData]) –
Returns:
bool–
afp.bindings.ClearingDiamond.validate_la_as
validate_la_as(margin_account, bankrupt_account, product_id, product_owners)Binding for validateLAAs on the BankruptcyFacet contract.
Parameters:
- margin_account (
ChecksumAddress) – - bankrupt_account (
ChecksumAddress) – - product_id (
HexBytes) – - product_owners (
List[ChecksumAddress]) –
Returns:
afp.bindings.ClearingDiamond.valuation
valuation(product_id)Binding for valuation on the MarkPriceTrackerFacet contract.
Parameters:
- product_id (
HexBytes) –
Returns:
int–
afp.bindings.ClearingDiamond.valuation_after_trade
valuation_after_trade(product_id, price, quantity)Binding for valuationAfterTrade on the MarkPriceTrackerFacet contract.
Parameters:
Returns:
int–
afp.bindings.ClearingDiamond.version
version()Binding for version on the ClearingFacet contract.
Returns:
str–
afp.bindings.Config
Config(auction_config, clearing_config)Port of struct Config on the IClearing contract.
Attributes:
afp.bindings.Config.auction_config
auction_config: AuctionConfigafp.bindings.Config.clearing_config
clearing_config: ClearingConfigafp.bindings.Intent
Intent(margin_account_id, intent_account_id, hash, data, signature)Port of struct Intent on the IClearing contract.
Attributes:
- data (
IntentData) – - hash (
HexBytes) – - intent_account_id (
ChecksumAddress) – - margin_account_id (
ChecksumAddress) – - signature (
HexBytes) –
afp.bindings.Intent.data
data: IntentDataafp.bindings.Intent.hash
hash: hexbytes.HexBytesafp.bindings.Intent.intent_account_id
intent_account_id: eth_typing.ChecksumAddressafp.bindings.Intent.margin_account_id
margin_account_id: eth_typing.ChecksumAddressafp.bindings.Intent.signature
signature: hexbytes.HexBytesafp.bindings.IntentData
IntentData(nonce, trading_protocol_id, product_id, limit_price, quantity, max_trading_fee_rate, good_until, side)Port of struct IntentData on the IClearing contract.
Attributes:
- good_until (
int) – - limit_price (
int) – - max_trading_fee_rate (
int) – - nonce (
int) – - product_id (
HexBytes) – - quantity (
int) – - side (
Side) – - trading_protocol_id (
ChecksumAddress) –
afp.bindings.IntentData.good_until
good_until: intafp.bindings.IntentData.limit_price
limit_price: intafp.bindings.IntentData.max_trading_fee_rate
max_trading_fee_rate: intafp.bindings.IntentData.nonce
nonce: intafp.bindings.IntentData.product_id
product_id: hexbytes.HexBytesafp.bindings.IntentData.quantity
quantity: intafp.bindings.IntentData.side
side: Sideafp.bindings.IntentData.trading_protocol_id
trading_protocol_id: eth_typing.ChecksumAddressafp.bindings.LAAData
LAAData(owner, quantity, last_traded_timestamp, position_age)Port of struct LAAData on the IBankruptcy contract.
Attributes:
- last_traded_timestamp (
int) – - owner (
ChecksumAddress) – - position_age (
int) – - quantity (
int) –
afp.bindings.LAAData.last_traded_timestamp
last_traded_timestamp: intafp.bindings.LAAData.owner
owner: eth_typing.ChecksumAddressafp.bindings.LAAData.position_age
position_age: intafp.bindings.LAAData.quantity
quantity: intafp.bindings.MarginAccount
MarginAccount(w3, address)MarginAccount contract binding.
Parameters:
- w3 (
Web3) – - address (
ChecksumAddress) – The address of a deployed MarginAccount contract.
Functions:
- authorize – Binding for
authorizeon the MarginAccount contract. - authorized – Binding for
authorizedon the MarginAccount contract. - batch_mae_check – Binding for
batchMaeCheckon the MarginAccount contract. - batch_settle – Binding for
batchSettleon the MarginAccount contract. - capital – Binding for
capitalon the MarginAccount contract. - clearing – Binding for
clearingon the MarginAccount contract. - collateral_asset – Binding for
collateralAsseton the MarginAccount contract. - collateral_token – Binding for
collateralTokenon the MarginAccount contract. - collect_fee – Binding for
collectFeeon the MarginAccount contract. - deposit – Binding for
depositon the MarginAccount contract. - disperse_fees – Binding for
disperseFeeson the MarginAccount contract. - estimate_liquidation_price – Binding for
estimateLiquidationPriceon the MarginAccount contract. - estimate_liquidation_price_for_position – Binding for
estimateLiquidationPriceForPositionon the MarginAccount contract. - initialize – Binding for
initializeon the MarginAccount contract. - mae – Binding for
maeon the MarginAccount contract. - mae_and_mmu_after_batch_trade – Binding for
maeAndMmuAfterBatchTradeon the MarginAccount contract. - mae_check – Binding for
maeCheckon the MarginAccount contract. - mma – Binding for
mmaon the MarginAccount contract. - mmu – Binding for
mmuon the MarginAccount contract. - pnl – Binding for
pnlon the MarginAccount contract. - position_age – Binding for
positionAgeon the MarginAccount contract. - position_count – Binding for
positionCounton the MarginAccount contract. - position_data – Binding for
positionDataon the MarginAccount contract. - position_pn_l – Binding for
positionPnLon the MarginAccount contract. - position_quantity – Binding for
positionQuantityon the MarginAccount contract. - positions – Binding for
positionson the MarginAccount contract. - product_registry – Binding for
productRegistryon the MarginAccount contract. - revoke_authorization – Binding for
revokeAuthorizationon the MarginAccount contract. - settle – Binding for
settleon the MarginAccount contract. - valuation – Binding for
valuationon the MarginAccount contract. - withdraw – Binding for
withdrawon the MarginAccount contract. - withdrawable – Binding for
withdrawableon the MarginAccount contract.
Attributes:
- Deposit (
ContractEvent) – Binding forevent Depositon the MarginAccount contract. - FeeCollected (
ContractEvent) – Binding forevent FeeCollectedon the MarginAccount contract. - FeeDispersed (
ContractEvent) – Binding forevent FeeDispersedon the MarginAccount contract. - Initialized (
ContractEvent) – Binding forevent Initializedon the MarginAccount contract. - IntentAuthorized (
ContractEvent) – Binding forevent IntentAuthorizedon the MarginAccount contract. - IntentRevoked (
ContractEvent) – Binding forevent IntentRevokedon the MarginAccount contract. - PositionUpdated (
ContractEvent) – Binding forevent PositionUpdatedon the MarginAccount contract. - Withdraw (
ContractEvent) – Binding forevent Withdrawon the MarginAccount contract.
afp.bindings.MarginAccount.Deposit
Deposit: contract.ContractEventBinding for event Deposit on the MarginAccount contract.
afp.bindings.MarginAccount.FeeCollected
FeeCollected: contract.ContractEventBinding for event FeeCollected on the MarginAccount contract.
afp.bindings.MarginAccount.FeeDispersed
FeeDispersed: contract.ContractEventBinding for event FeeDispersed on the MarginAccount contract.
afp.bindings.MarginAccount.Initialized
Initialized: contract.ContractEventBinding for event Initialized on the MarginAccount contract.
afp.bindings.MarginAccount.IntentRevoked
IntentRevoked: contract.ContractEventBinding for event IntentRevoked on the MarginAccount contract.
afp.bindings.MarginAccount.PositionUpdated
PositionUpdated: contract.ContractEventBinding for event PositionUpdated on the MarginAccount contract.
afp.bindings.MarginAccount.Withdraw
Withdraw: contract.ContractEventBinding for event Withdraw on the MarginAccount contract.
afp.bindings.MarginAccount.batch_mae_check
batch_mae_check(margin_account, settlements, mark_price_if_settled)Binding for batchMaeCheck on the MarginAccount contract.
Parameters:
- margin_account (
ChecksumAddress) – - settlements (
List[Settlement]) – - mark_price_if_settled (
List[int]) –
Returns:
afp.bindings.MarginAccount.batch_settle
batch_settle(margin_account_id, settlements)Binding for batchSettle on the MarginAccount contract.
Parameters:
- margin_account_id (
ChecksumAddress) – - settlements (
List[Settlement]) –
Returns:
ContractFunction– A contract function instance to be sent in a transaction.
afp.bindings.MarginAccount.capital
capital(margin_account)Binding for capital on the MarginAccount contract.
Parameters:
- margin_account (
ChecksumAddress) –
Returns:
int–
afp.bindings.MarginAccount.clearing
clearing()Binding for clearing on the MarginAccount contract.
Returns:
afp.bindings.MarginAccount.collateral_asset
collateral_asset()Binding for collateralAsset on the MarginAccount contract.
Returns:
afp.bindings.MarginAccount.collateral_token
collateral_token()Binding for collateralToken on the MarginAccount contract.
Returns:
afp.bindings.MarginAccount.collect_fee
collect_fee(margin_account, capital_amount)Binding for collectFee on the MarginAccount contract.
Parameters:
- margin_account (
ChecksumAddress) – - capital_amount (
int) –
Returns:
ContractFunction– A contract function instance to be sent in a transaction.
afp.bindings.MarginAccount.deposit
deposit(amount)Binding for deposit on the MarginAccount contract.
Parameters:
- amount (
int) –
Returns:
ContractFunction– A contract function instance to be sent in a transaction.
afp.bindings.MarginAccount.disperse_fees
disperse_fees(recipients, capital_amounts)Binding for disperseFees on the MarginAccount contract.
Parameters:
- recipients (
List[ChecksumAddress]) – - capital_amounts (
List[int]) –
Returns:
ContractFunction– A contract function instance to be sent in a transaction.
afp.bindings.MarginAccount.estimate_liquidation_price
estimate_liquidation_price(margin_account_id, product_id, price, quantity)Binding for estimateLiquidationPrice on the MarginAccount contract.
Parameters:
- margin_account_id (
ChecksumAddress) – - product_id (
HexBytes) – - price (
int) – - quantity (
int) –
Returns:
int–
afp.bindings.MarginAccount.estimate_liquidation_price_for_position
estimate_liquidation_price_for_position(margin_account_id, position_id)Binding for estimateLiquidationPriceForPosition on the MarginAccount contract.
Parameters:
- margin_account_id (
ChecksumAddress) – - position_id (
HexBytes) –
Returns:
int–
afp.bindings.MarginAccount.initialize
initialize(_collateral_token, _valuation, _product_registry, _clearing)Binding for initialize on the MarginAccount contract.
Parameters:
- _collateral_token (
ChecksumAddress) – - _valuation (
ChecksumAddress) – - _product_registry (
ChecksumAddress) – - _clearing (
ChecksumAddress) –
Returns:
ContractFunction– A contract function instance to be sent in a transaction.
afp.bindings.MarginAccount.mae
mae(margin_account)Binding for mae on the MarginAccount contract.
Parameters:
- margin_account (
ChecksumAddress) –
Returns:
int–
afp.bindings.MarginAccount.mae_and_mmu_after_batch_trade
mae_and_mmu_after_batch_trade(margin_account, settlements, mark_price_if_settled)Binding for maeAndMmuAfterBatchTrade on the MarginAccount contract.
Parameters:
- margin_account (
ChecksumAddress) – - settlements (
List[Settlement]) – - mark_price_if_settled (
List[int]) –
Returns:
afp.bindings.MarginAccount.mae_check
mae_check(margin_account, settlement, mark_price_if_settled)Binding for maeCheck on the MarginAccount contract.
Parameters:
- margin_account (
ChecksumAddress) – - settlement (
Settlement) – - mark_price_if_settled (
int) –
Returns:
afp.bindings.MarginAccount.mma
mma(margin_account)Binding for mma on the MarginAccount contract.
Parameters:
- margin_account (
ChecksumAddress) –
Returns:
int–
afp.bindings.MarginAccount.mmu
mmu(margin_account)Binding for mmu on the MarginAccount contract.
Parameters:
- margin_account (
ChecksumAddress) –
Returns:
int–
afp.bindings.MarginAccount.pnl
pnl(margin_account)Binding for pnl on the MarginAccount contract.
Parameters:
- margin_account (
ChecksumAddress) –
Returns:
int–
afp.bindings.MarginAccount.position_age
position_age(margin_account_id, position_id)Binding for positionAge on the MarginAccount contract.
Parameters:
- margin_account_id (
ChecksumAddress) – - position_id (
HexBytes) –
Returns:
int–
afp.bindings.MarginAccount.position_count
position_count(margin_account)Binding for positionCount on the MarginAccount contract.
Parameters:
- margin_account (
ChecksumAddress) –
Returns:
int–
afp.bindings.MarginAccount.position_data
position_data(margin_account, position_id)Binding for positionData on the MarginAccount contract.
Parameters:
- margin_account (
ChecksumAddress) – - position_id (
HexBytes) –
Returns:
afp.bindings.MarginAccount.position_pn_l
position_pn_l(margin_account, position_id)Binding for positionPnL on the MarginAccount contract.
Parameters:
- margin_account (
ChecksumAddress) – - position_id (
HexBytes) –
Returns:
int–
afp.bindings.MarginAccount.position_quantity
position_quantity(margin_account, position_id)Binding for positionQuantity on the MarginAccount contract.
Parameters:
- margin_account (
ChecksumAddress) – - position_id (
HexBytes) –
Returns:
int–
afp.bindings.MarginAccount.positions
positions(margin_account)Binding for positions on the MarginAccount contract.
Parameters:
- margin_account (
ChecksumAddress) –
Returns:
afp.bindings.MarginAccount.product_registry
product_registry()Binding for productRegistry on the MarginAccount contract.
Returns:
afp.bindings.MarginAccount.settle
settle(margin_account, intent_account, settlement)Binding for settle on the MarginAccount contract.
Parameters:
- margin_account (
ChecksumAddress) – - intent_account (
ChecksumAddress) – - settlement (
Settlement) –
Returns:
ContractFunction– A contract function instance to be sent in a transaction.
afp.bindings.MarginAccount.valuation
valuation()Binding for valuation on the MarginAccount contract.
Returns:
afp.bindings.MarginAccount.withdraw
withdraw(amount)Binding for withdraw on the MarginAccount contract.
Parameters:
- amount (
int) –
Returns:
ContractFunction– A contract function instance to be sent in a transaction.
afp.bindings.MarginAccount.withdrawable
withdrawable(margin_account)Binding for withdrawable on the MarginAccount contract.
Parameters:
- margin_account (
ChecksumAddress) –
Returns:
int–
afp.bindings.MarginAccountRegistry
MarginAccountRegistry(w3, address=defaults.MARGIN_ACCOUNT_REGISTRY_ADDRESS)Bases: MarginAccountRegistry
MarginAccountRegistry contract binding.
Parameters:
- w3 (
Web3) –
Functions:
- clearing – Binding for
clearingon the MarginAccountRegistry contract. - get_admin – Binding for
getAdminon the MarginAccountRegistry contract. - get_margin_account – Binding for
getMarginAccounton the MarginAccountRegistry contract. - initialize – Binding for
initializeon the MarginAccountRegistry contract. - initialize_margin_account – Binding for
initializeMarginAccounton the MarginAccountRegistry contract. - is_admin_active – Binding for
isAdminActiveon the MarginAccountRegistry contract. - margin_accounts – Binding for
marginAccountson the MarginAccountRegistry contract. - owner – Binding for
owneron the MarginAccountRegistry contract. - product_registry – Binding for
productRegistryon the MarginAccountRegistry contract. - proxiable_uuid – Binding for
proxiableUUIDon the MarginAccountRegistry contract. - renounce_ownership – Binding for
renounceOwnershipon the MarginAccountRegistry contract. - set_active – Binding for
setActiveon the MarginAccountRegistry contract. - set_admin – Binding for
setAdminon the MarginAccountRegistry contract. - transfer_ownership – Binding for
transferOwnershipon the MarginAccountRegistry contract. - upgrade_interface_version – Binding for
UPGRADE_INTERFACE_VERSIONon the MarginAccountRegistry contract. - upgrade_to_and_call – Binding for
upgradeToAndCallon the MarginAccountRegistry contract. - valuation – Binding for
valuationon the MarginAccountRegistry contract.
Attributes:
- Initialized (
ContractEvent) – Binding forevent Initializedon the MarginAccountRegistry contract. - MarginAccountCreated (
ContractEvent) – Binding forevent MarginAccountCreatedon the MarginAccountRegistry contract. - OwnershipTransferred (
ContractEvent) – Binding forevent OwnershipTransferredon the MarginAccountRegistry contract. - Upgraded (
ContractEvent) – Binding forevent Upgradedon the MarginAccountRegistry contract.
afp.bindings.MarginAccountRegistry.Initialized
Initialized: contract.ContractEventBinding for event Initialized on the MarginAccountRegistry contract.
afp.bindings.MarginAccountRegistry.MarginAccountCreated
MarginAccountCreated: contract.ContractEventBinding for event MarginAccountCreated on the MarginAccountRegistry contract.
afp.bindings.MarginAccountRegistry.OwnershipTransferred
OwnershipTransferred: contract.ContractEventBinding for event OwnershipTransferred on the MarginAccountRegistry contract.
afp.bindings.MarginAccountRegistry.Upgraded
Upgraded: contract.ContractEventBinding for event Upgraded on the MarginAccountRegistry contract.
afp.bindings.MarginAccountRegistry.clearing
clearing()Binding for clearing on the MarginAccountRegistry contract.
Returns:
afp.bindings.MarginAccountRegistry.get_admin
get_admin()Binding for getAdmin on the MarginAccountRegistry contract.
Returns:
afp.bindings.MarginAccountRegistry.get_margin_account
get_margin_account(collateral_asset)Binding for getMarginAccount on the MarginAccountRegistry contract.
Parameters:
- collateral_asset (
ChecksumAddress) –
Returns:
afp.bindings.MarginAccountRegistry.initialize
initialize(_clearing, _valuation, _product_registry, beacon_)Binding for initialize on the MarginAccountRegistry contract.
Parameters:
- _clearing (
ChecksumAddress) – - _valuation (
ChecksumAddress) – - _product_registry (
ChecksumAddress) – - beacon_ (
ChecksumAddress) –
Returns:
ContractFunction– A contract function instance to be sent in a transaction.
afp.bindings.MarginAccountRegistry.initialize_margin_account
initialize_margin_account(collateral_asset)Binding for initializeMarginAccount on the MarginAccountRegistry contract.
Parameters:
- collateral_asset (
ChecksumAddress) –
Returns:
ContractFunction– A contract function instance to be sent in a transaction.
afp.bindings.MarginAccountRegistry.is_admin_active
is_admin_active()Binding for isAdminActive on the MarginAccountRegistry contract.
Returns:
bool–
afp.bindings.MarginAccountRegistry.margin_accounts
margin_accounts(key0)Binding for marginAccounts on the MarginAccountRegistry contract.
Parameters:
- key0 (
ChecksumAddress) –
Returns:
afp.bindings.MarginAccountRegistry.owner
owner()Binding for owner on the MarginAccountRegistry contract.
Returns:
afp.bindings.MarginAccountRegistry.product_registry
product_registry()Binding for productRegistry on the MarginAccountRegistry contract.
Returns:
afp.bindings.MarginAccountRegistry.proxiable_uuid
proxiable_uuid()Binding for proxiableUUID on the MarginAccountRegistry contract.
Returns:
HexBytes–
afp.bindings.MarginAccountRegistry.renounce_ownership
renounce_ownership()Binding for renounceOwnership on the MarginAccountRegistry contract.
Returns:
ContractFunction– A contract function instance to be sent in a transaction.
afp.bindings.MarginAccountRegistry.set_active
set_active(active)Binding for setActive on the MarginAccountRegistry contract.
Parameters:
- active (
bool) –
Returns:
ContractFunction– A contract function instance to be sent in a transaction.
afp.bindings.MarginAccountRegistry.set_admin
set_admin(new_admin)Binding for setAdmin on the MarginAccountRegistry contract.
Parameters:
- new_admin (
ChecksumAddress) –
Returns:
ContractFunction– A contract function instance to be sent in a transaction.
afp.bindings.MarginAccountRegistry.transfer_ownership
transfer_ownership(new_owner)Binding for transferOwnership on the MarginAccountRegistry contract.
Parameters:
- new_owner (
ChecksumAddress) –
Returns:
ContractFunction– A contract function instance to be sent in a transaction.
afp.bindings.MarginAccountRegistry.upgrade_interface_version
upgrade_interface_version()Binding for UPGRADE_INTERFACE_VERSION on the MarginAccountRegistry contract.
Returns:
str–
afp.bindings.MarginAccountRegistry.upgrade_to_and_call
upgrade_to_and_call(new_implementation, data)Binding for upgradeToAndCall on the MarginAccountRegistry contract.
Parameters:
- new_implementation (
ChecksumAddress) – - data (
HexBytes) –
Returns:
ContractFunction– A contract function instance to be sent in a transaction.
afp.bindings.MarginAccountRegistry.valuation
valuation()Binding for valuation on the MarginAccountRegistry contract.
Returns:
afp.bindings.OracleProvider
OracleProvider(w3, address=defaults.ORACLE_PROVIDER_ADDRESS)Bases: OracleProvider
OracleProvider contract binding.
Parameters:
- w3 (
Web3) –
Functions:
- get_admin – Binding for
getAdminon the OracleProvider contract. - initialize – Binding for
initializeon the OracleProvider contract. - is_admin_active – Binding for
isAdminActiveon the OracleProvider contract. - owner – Binding for
owneron the OracleProvider contract. - product_registry – Binding for
productRegistryon the OracleProvider contract. - proxiable_uuid – Binding for
proxiableUUIDon the OracleProvider contract. - renounce_ownership – Binding for
renounceOwnershipon the OracleProvider contract. - resolve – Binding for
resolveon the OracleProvider contract. - set_active – Binding for
setActiveon the OracleProvider contract. - set_admin – Binding for
setAdminon the OracleProvider contract. - submit – Binding for
submiton the OracleProvider contract. - transfer_ownership – Binding for
transferOwnershipon the OracleProvider contract. - upgrade_interface_version – Binding for
UPGRADE_INTERFACE_VERSIONon the OracleProvider contract. - upgrade_to_and_call – Binding for
upgradeToAndCallon the OracleProvider contract.
Attributes:
- Initialized (
ContractEvent) – Binding forevent Initializedon the OracleProvider contract. - OwnershipTransferred (
ContractEvent) – Binding forevent OwnershipTransferredon the OracleProvider contract. - PriceSubmitted (
ContractEvent) – Binding forevent PriceSubmittedon the OracleProvider contract. - Upgraded (
ContractEvent) – Binding forevent Upgradedon the OracleProvider contract.
afp.bindings.OracleProvider.Initialized
Initialized: contract.ContractEventBinding for event Initialized on the OracleProvider contract.
afp.bindings.OracleProvider.OwnershipTransferred
OwnershipTransferred: contract.ContractEventBinding for event OwnershipTransferred on the OracleProvider contract.
afp.bindings.OracleProvider.PriceSubmitted
PriceSubmitted: contract.ContractEventBinding for event PriceSubmitted on the OracleProvider contract.
afp.bindings.OracleProvider.Upgraded
Upgraded: contract.ContractEventBinding for event Upgraded on the OracleProvider contract.
afp.bindings.OracleProvider.get_admin
get_admin()Binding for getAdmin on the OracleProvider contract.
Returns:
afp.bindings.OracleProvider.initialize
initialize(_product_registry)Binding for initialize on the OracleProvider contract.
Parameters:
- _product_registry (
ChecksumAddress) –
Returns:
ContractFunction– A contract function instance to be sent in a transaction.
afp.bindings.OracleProvider.is_admin_active
is_admin_active()Binding for isAdminActive on the OracleProvider contract.
Returns:
bool–
afp.bindings.OracleProvider.owner
owner()Binding for owner on the OracleProvider contract.
Returns:
afp.bindings.OracleProvider.product_registry
product_registry()Binding for productRegistry on the OracleProvider contract.
Returns:
afp.bindings.OracleProvider.proxiable_uuid
proxiable_uuid()Binding for proxiableUUID on the OracleProvider contract.
Returns:
HexBytes–
afp.bindings.OracleProvider.renounce_ownership
renounce_ownership()Binding for renounceOwnership on the OracleProvider contract.
Returns:
ContractFunction– A contract function instance to be sent in a transaction.
afp.bindings.OracleProvider.resolve
resolve(product_id, key1)Binding for resolve on the OracleProvider contract.
Parameters:
Returns:
int–
afp.bindings.OracleProvider.set_active
set_active(active)Binding for setActive on the OracleProvider contract.
Parameters:
- active (
bool) –
Returns:
ContractFunction– A contract function instance to be sent in a transaction.
afp.bindings.OracleProvider.set_admin
set_admin(admin)Binding for setAdmin on the OracleProvider contract.
Parameters:
- admin (
ChecksumAddress) –
Returns:
ContractFunction– A contract function instance to be sent in a transaction.
afp.bindings.OracleProvider.submit
submit(key, fsp)Binding for submit on the OracleProvider contract.
Parameters:
Returns:
ContractFunction– A contract function instance to be sent in a transaction.
afp.bindings.OracleProvider.transfer_ownership
transfer_ownership(new_owner)Binding for transferOwnership on the OracleProvider contract.
Parameters:
- new_owner (
ChecksumAddress) –
Returns:
ContractFunction– A contract function instance to be sent in a transaction.
afp.bindings.OracleProvider.upgrade_interface_version
upgrade_interface_version()Binding for UPGRADE_INTERFACE_VERSION on the OracleProvider contract.
Returns:
str–
afp.bindings.OracleProvider.upgrade_to_and_call
upgrade_to_and_call(new_implementation, data)Binding for upgradeToAndCall on the OracleProvider contract.
Parameters:
- new_implementation (
ChecksumAddress) – - data (
HexBytes) –
Returns:
ContractFunction– A contract function instance to be sent in a transaction.
afp.bindings.OracleSpecification
OracleSpecification(oracle_address, fsv_decimals, fsp_alpha, fsp_beta, fsv_calldata)Port of struct OracleSpecification on the IProductRegistry contract.
Attributes:
- fsp_alpha (
int) – - fsp_beta (
int) – - fsv_calldata (
HexBytes) – - fsv_decimals (
int) – - oracle_address (
ChecksumAddress) –
afp.bindings.OracleSpecification.fsp_alpha
fsp_alpha: intafp.bindings.OracleSpecification.fsp_beta
fsp_beta: intafp.bindings.OracleSpecification.fsv_calldata
fsv_calldata: hexbytes.HexBytesafp.bindings.OracleSpecification.fsv_decimals
fsv_decimals: intafp.bindings.OracleSpecification.oracle_address
oracle_address: eth_typing.ChecksumAddressafp.bindings.PositionData
PositionData(position_id, quantity, cost_basis, maintenance_margin, pnl)Port of struct PositionData on the IMarginAccount contract.
Attributes:
- cost_basis (
int) – - maintenance_margin (
int) – - pnl (
int) – - position_id (
HexBytes) – - quantity (
int) –
afp.bindings.PositionData.cost_basis
cost_basis: intafp.bindings.PositionData.maintenance_margin
maintenance_margin: intafp.bindings.PositionData.pnl
pnl: intafp.bindings.PositionData.position_id
position_id: hexbytes.HexBytesafp.bindings.PositionData.quantity
quantity: intafp.bindings.PositionLossData
PositionLossData(position_id, bankrupt_account_u_pn_l, bankrupt_account_quantity, mark_price, point_value, tick_size, laa_data)Port of struct PositionLossData on the IBankruptcy contract.
Attributes:
- bankrupt_account_quantity (
int) – - bankrupt_account_u_pn_l (
int) – - laa_data (
List[LAAData]) – - mark_price (
int) – - point_value (
int) – - position_id (
HexBytes) – - tick_size (
int) –
afp.bindings.PositionLossData.bankrupt_account_quantity
bankrupt_account_quantity: intafp.bindings.PositionLossData.bankrupt_account_u_pn_l
bankrupt_account_u_pn_l: intafp.bindings.PositionLossData.laa_data
laa_data: typing.List[LAAData]afp.bindings.PositionLossData.mark_price
mark_price: intafp.bindings.PositionLossData.point_value
point_value: intafp.bindings.PositionLossData.position_id
position_id: hexbytes.HexBytesafp.bindings.PositionLossData.tick_size
tick_size: intafp.bindings.Product
Product(metadata, oracle_spec, price_quotation, collateral_asset, start_time, earliest_fsp_submission_time, unit_value, initial_margin_requirement, maintenance_margin_requirement, auction_bounty, tradeout_interval, tick_size, extended_metadata)Port of struct Product on the IProductRegistry contract.
Attributes:
- auction_bounty (
int) – - collateral_asset (
ChecksumAddress) – - earliest_fsp_submission_time (
int) – - extended_metadata (
str) – - initial_margin_requirement (
int) – - maintenance_margin_requirement (
int) – - metadata (
ProductMetadata) – - oracle_spec (
OracleSpecification) – - price_quotation (
str) – - start_time (
int) – - tick_size (
int) – - tradeout_interval (
int) – - unit_value (
int) –
afp.bindings.Product.auction_bounty
auction_bounty: intafp.bindings.Product.collateral_asset
collateral_asset: eth_typing.ChecksumAddressafp.bindings.Product.earliest_fsp_submission_time
earliest_fsp_submission_time: intafp.bindings.Product.extended_metadata
extended_metadata: strafp.bindings.Product.initial_margin_requirement
initial_margin_requirement: intafp.bindings.Product.maintenance_margin_requirement
maintenance_margin_requirement: intafp.bindings.Product.metadata
metadata: ProductMetadataafp.bindings.Product.oracle_spec
oracle_spec: OracleSpecificationafp.bindings.Product.price_quotation
price_quotation: strafp.bindings.Product.start_time
start_time: intafp.bindings.Product.tick_size
tick_size: intafp.bindings.Product.tradeout_interval
tradeout_interval: intafp.bindings.Product.unit_value
unit_value: intafp.bindings.ProductMetadata
ProductMetadata(builder, symbol, description)Port of struct ProductMetadata on the IProductRegistry contract.
Attributes:
- builder (
ChecksumAddress) – - description (
str) – - symbol (
str) –
afp.bindings.ProductMetadata.builder
builder: eth_typing.ChecksumAddressafp.bindings.ProductMetadata.description
description: strafp.bindings.ProductMetadata.symbol
symbol: strafp.bindings.ProductRegistry
ProductRegistry(w3, address=defaults.PRODUCT_REGISTRY_ADDRESS)Bases: ProductRegistry
ProductRegistry contract binding.
Parameters:
- w3 (
Web3) –
Functions:
- auction_bounty – Binding for
auctionBountyon the ProductRegistry contract. - clearing – Binding for
clearingon the ProductRegistry contract. - collateral_asset – Binding for
collateralAsseton the ProductRegistry contract. - earliest_fsp_submission_time – Binding for
earliestFSPSubmissionTimeon the ProductRegistry contract. - id – Binding for
idon the ProductRegistry contract. - imr – Binding for
imron the ProductRegistry contract. - initialize – Binding for
initializeon the ProductRegistry contract. - mmr – Binding for
mmron the ProductRegistry contract. - oracle_specification – Binding for
oracleSpecificationon the ProductRegistry contract. - owner – Binding for
owneron the ProductRegistry contract. - point_value – Binding for
pointValueon the ProductRegistry contract. - products – Binding for
productson the ProductRegistry contract. - proxiable_uuid – Binding for
proxiableUUIDon the ProductRegistry contract. - register – Binding for
registeron the ProductRegistry contract. - renounce_ownership – Binding for
renounceOwnershipon the ProductRegistry contract. - set_clearing – Binding for
setClearingon the ProductRegistry contract. - state – Binding for
stateon the ProductRegistry contract. - tick_size – Binding for
tickSizeon the ProductRegistry contract. - transfer_ownership – Binding for
transferOwnershipon the ProductRegistry contract. - upgrade_interface_version – Binding for
UPGRADE_INTERFACE_VERSIONon the ProductRegistry contract. - upgrade_to_and_call – Binding for
upgradeToAndCallon the ProductRegistry contract.
Attributes:
- Initialized (
ContractEvent) – Binding forevent Initializedon the ProductRegistry contract. - OwnershipTransferred (
ContractEvent) – Binding forevent OwnershipTransferredon the ProductRegistry contract. - ProductRegistered (
ContractEvent) – Binding forevent ProductRegisteredon the ProductRegistry contract. - Upgraded (
ContractEvent) – Binding forevent Upgradedon the ProductRegistry contract.
afp.bindings.ProductRegistry.Initialized
Initialized: contract.ContractEventBinding for event Initialized on the ProductRegistry contract.
afp.bindings.ProductRegistry.OwnershipTransferred
OwnershipTransferred: contract.ContractEventBinding for event OwnershipTransferred on the ProductRegistry contract.
afp.bindings.ProductRegistry.ProductRegistered
ProductRegistered: contract.ContractEventBinding for event ProductRegistered on the ProductRegistry contract.
afp.bindings.ProductRegistry.Upgraded
Upgraded: contract.ContractEventBinding for event Upgraded on the ProductRegistry contract.
afp.bindings.ProductRegistry.auction_bounty
auction_bounty(product_id)Binding for auctionBounty on the ProductRegistry contract.
Parameters:
- product_id (
HexBytes) –
Returns:
int–
afp.bindings.ProductRegistry.clearing
clearing()Binding for clearing on the ProductRegistry contract.
Returns:
afp.bindings.ProductRegistry.collateral_asset
collateral_asset(product_id)Binding for collateralAsset on the ProductRegistry contract.
Parameters:
- product_id (
HexBytes) –
Returns:
afp.bindings.ProductRegistry.earliest_fsp_submission_time
earliest_fsp_submission_time(product_id)Binding for earliestFSPSubmissionTime on the ProductRegistry contract.
Parameters:
- product_id (
HexBytes) –
Returns:
int–
afp.bindings.ProductRegistry.id
id(product)Binding for id on the ProductRegistry contract.
Parameters:
- product (
Product) –
Returns:
HexBytes–
afp.bindings.ProductRegistry.imr
imr(product_id)Binding for imr on the ProductRegistry contract.
Parameters:
- product_id (
HexBytes) –
Returns:
int–
afp.bindings.ProductRegistry.initialize
initialize()Binding for initialize on the ProductRegistry contract.
Returns:
ContractFunction– A contract function instance to be sent in a transaction.
afp.bindings.ProductRegistry.mmr
mmr(product_id)Binding for mmr on the ProductRegistry contract.
Parameters:
- product_id (
HexBytes) –
Returns:
int–
afp.bindings.ProductRegistry.oracle_specification
oracle_specification(product_id)Binding for oracleSpecification on the ProductRegistry contract.
Parameters:
- product_id (
HexBytes) –
Returns:
afp.bindings.ProductRegistry.owner
owner()Binding for owner on the ProductRegistry contract.
Returns:
afp.bindings.ProductRegistry.point_value
point_value(product_id)Binding for pointValue on the ProductRegistry contract.
Parameters:
- product_id (
HexBytes) –
Returns:
int–
afp.bindings.ProductRegistry.products
products(product_id)Binding for products on the ProductRegistry contract.
Parameters:
- product_id (
HexBytes) –
Returns:
Product–
afp.bindings.ProductRegistry.proxiable_uuid
proxiable_uuid()Binding for proxiableUUID on the ProductRegistry contract.
Returns:
HexBytes–
afp.bindings.ProductRegistry.register
register(product)Binding for register on the ProductRegistry contract.
Parameters:
- product (
Product) –
Returns:
ContractFunction– A contract function instance to be sent in a transaction.
afp.bindings.ProductRegistry.renounce_ownership
renounce_ownership()Binding for renounceOwnership on the ProductRegistry contract.
Returns:
ContractFunction– A contract function instance to be sent in a transaction.
afp.bindings.ProductRegistry.set_clearing
set_clearing(clearing_)Binding for setClearing on the ProductRegistry contract.
Parameters:
- clearing_ (
ChecksumAddress) –
Returns:
ContractFunction– A contract function instance to be sent in a transaction.
afp.bindings.ProductRegistry.state
state(product_id)Binding for state on the ProductRegistry contract.
Parameters:
- product_id (
HexBytes) –
Returns:
afp.bindings.ProductRegistry.tick_size
tick_size(product_id)Binding for tickSize on the ProductRegistry contract.
Parameters:
- product_id (
HexBytes) –
Returns:
int–
afp.bindings.ProductRegistry.transfer_ownership
transfer_ownership(new_owner)Binding for transferOwnership on the ProductRegistry contract.
Parameters:
- new_owner (
ChecksumAddress) –
Returns:
ContractFunction– A contract function instance to be sent in a transaction.
afp.bindings.ProductRegistry.upgrade_interface_version
upgrade_interface_version()Binding for UPGRADE_INTERFACE_VERSION on the ProductRegistry contract.
Returns:
str–
afp.bindings.ProductRegistry.upgrade_to_and_call
upgrade_to_and_call(new_implementation, data)Binding for upgradeToAndCall on the ProductRegistry contract.
Parameters:
- new_implementation (
ChecksumAddress) – - data (
HexBytes) –
Returns:
ContractFunction– A contract function instance to be sent in a transaction.
afp.bindings.ProductState
Bases: IntEnum
Port of enum ProductState on the ProductRegistry contract.
Attributes:
afp.bindings.ProductState.EXPIRED
EXPIRED = 5afp.bindings.ProductState.FINAL_SETTLEMENT
FINAL_SETTLEMENT = 4afp.bindings.ProductState.LIVE
LIVE = 2afp.bindings.ProductState.NOT_EXIST
NOT_EXIST = 0afp.bindings.ProductState.PENDING
PENDING = 1afp.bindings.ProductState.TRADEOUT
TRADEOUT = 3afp.bindings.Settlement
Settlement(position_id, quantity, price)Port of struct Settlement on the IMarginAccount contract.
Attributes:
afp.bindings.Settlement.position_id
position_id: hexbytes.HexBytesafp.bindings.Settlement.price
price: intafp.bindings.Settlement.quantity
quantity: intafp.bindings.Side
Bases: IntEnum
Port of enum Side on the ClearingFacet contract.
Attributes:
afp.bindings.Side.ASK
ASK = 1afp.bindings.Side.BID
BID = 0afp.bindings.SystemViewer
SystemViewer(w3, address=defaults.SYSTEM_VIEWER_ADDRESS)Bases: SystemViewer
SystemViewer contract binding.
Parameters:
- w3 (
Web3) –
Functions:
- clearing – Binding for
clearingon the SystemViewer contract. - initialize – Binding for
initializeon the SystemViewer contract. - mae_by_collateral_asset – Binding for
maeByCollateralAsseton the SystemViewer contract. - mae_by_collateral_assets – Binding for
maeByCollateralAssetson the SystemViewer contract. - mae_checks_by_collateral_asset – Binding for
maeChecksByCollateralAsseton the SystemViewer contract. - margin_account_registry – Binding for
marginAccountRegistryon the SystemViewer contract. - owner – Binding for
owneron the SystemViewer contract. - positions_by_collateral_asset – Binding for
positionsByCollateralAsseton the SystemViewer contract. - positions_by_collateral_assets – Binding for
positionsByCollateralAssetson the SystemViewer contract. - product_details – Binding for
productDetailson the SystemViewer contract. - product_registry – Binding for
productRegistryon the SystemViewer contract. - product_states – Binding for
productStateson the SystemViewer contract. - proxiable_uuid – Binding for
proxiableUUIDon the SystemViewer contract. - renounce_ownership – Binding for
renounceOwnershipon the SystemViewer contract. - transfer_ownership – Binding for
transferOwnershipon the SystemViewer contract. - upgrade_interface_version – Binding for
UPGRADE_INTERFACE_VERSIONon the SystemViewer contract. - upgrade_to_and_call – Binding for
upgradeToAndCallon the SystemViewer contract. - user_margin_data_by_collateral_asset – Binding for
userMarginDataByCollateralAsseton the SystemViewer contract. - user_margin_data_by_collateral_assets – Binding for
userMarginDataByCollateralAssetson the SystemViewer contract. - valuations – Binding for
valuationson the SystemViewer contract.
Attributes:
- Initialized (
ContractEvent) – Binding forevent Initializedon the SystemViewer contract. - OwnershipTransferred (
ContractEvent) – Binding forevent OwnershipTransferredon the SystemViewer contract. - Upgraded (
ContractEvent) – Binding forevent Upgradedon the SystemViewer contract.
afp.bindings.SystemViewer.Initialized
Initialized: contract.ContractEventBinding for event Initialized on the SystemViewer contract.
afp.bindings.SystemViewer.OwnershipTransferred
OwnershipTransferred: contract.ContractEventBinding for event OwnershipTransferred on the SystemViewer contract.
afp.bindings.SystemViewer.Upgraded
Upgraded: contract.ContractEventBinding for event Upgraded on the SystemViewer contract.
afp.bindings.SystemViewer.clearing
clearing()Binding for clearing on the SystemViewer contract.
Returns:
afp.bindings.SystemViewer.initialize
initialize(_clearing, _product_registry, _margin_account_registry)Binding for initialize on the SystemViewer contract.
Parameters:
- _clearing (
ChecksumAddress) – - _product_registry (
ChecksumAddress) – - _margin_account_registry (
ChecksumAddress) –
Returns:
ContractFunction– A contract function instance to be sent in a transaction.
afp.bindings.SystemViewer.mae_by_collateral_asset
mae_by_collateral_asset(collateral_asset, accounts)Binding for maeByCollateralAsset on the SystemViewer contract.
Parameters:
- collateral_asset (
ChecksumAddress) – - accounts (
List[ChecksumAddress]) –
Returns:
afp.bindings.SystemViewer.mae_by_collateral_assets
mae_by_collateral_assets(collateral_assets, accounts)Binding for maeByCollateralAssets on the SystemViewer contract.
Parameters:
- collateral_assets (
List[ChecksumAddress]) – - accounts (
List[ChecksumAddress]) –
Returns:
afp.bindings.SystemViewer.mae_checks_by_collateral_asset
mae_checks_by_collateral_asset(collateral_asset, accounts, settlements)Binding for maeChecksByCollateralAsset on the SystemViewer contract.
Parameters:
- collateral_asset (
ChecksumAddress) – - accounts (
List[ChecksumAddress]) – - settlements (
List[Settlement]) –
Returns:
afp.bindings.SystemViewer.margin_account_registry
margin_account_registry()Binding for marginAccountRegistry on the SystemViewer contract.
Returns:
afp.bindings.SystemViewer.owner
owner()Binding for owner on the SystemViewer contract.
Returns:
afp.bindings.SystemViewer.positions_by_collateral_asset
positions_by_collateral_asset(collateral_asset, accounts)Binding for positionsByCollateralAsset on the SystemViewer contract.
Parameters:
- collateral_asset (
ChecksumAddress) – - accounts (
List[ChecksumAddress]) –
Returns:
List[List[PositionData]]–
afp.bindings.SystemViewer.positions_by_collateral_assets
positions_by_collateral_assets(collateral_assets, accounts)Binding for positionsByCollateralAssets on the SystemViewer contract.
Parameters:
- collateral_assets (
List[ChecksumAddress]) – - accounts (
List[ChecksumAddress]) –
Returns:
List[List[PositionData]]–
afp.bindings.SystemViewer.product_details
product_details(product_ids)Binding for productDetails on the SystemViewer contract.
Parameters:
Returns:
afp.bindings.SystemViewer.product_registry
product_registry()Binding for productRegistry on the SystemViewer contract.
Returns:
afp.bindings.SystemViewer.product_states
product_states(product_ids)Binding for productStates on the SystemViewer contract.
Parameters:
Returns:
List[ProductState]–
afp.bindings.SystemViewer.proxiable_uuid
proxiable_uuid()Binding for proxiableUUID on the SystemViewer contract.
Returns:
HexBytes–
afp.bindings.SystemViewer.renounce_ownership
renounce_ownership()Binding for renounceOwnership on the SystemViewer contract.
Returns:
ContractFunction– A contract function instance to be sent in a transaction.
afp.bindings.SystemViewer.transfer_ownership
transfer_ownership(new_owner)Binding for transferOwnership on the SystemViewer contract.
Parameters:
- new_owner (
ChecksumAddress) –
Returns:
ContractFunction– A contract function instance to be sent in a transaction.
afp.bindings.SystemViewer.upgrade_interface_version
upgrade_interface_version()Binding for UPGRADE_INTERFACE_VERSION on the SystemViewer contract.
Returns:
str–
afp.bindings.SystemViewer.upgrade_to_and_call
upgrade_to_and_call(new_implementation, data)Binding for upgradeToAndCall on the SystemViewer contract.
Parameters:
- new_implementation (
ChecksumAddress) – - data (
HexBytes) –
Returns:
ContractFunction– A contract function instance to be sent in a transaction.
afp.bindings.SystemViewer.user_margin_data_by_collateral_asset
user_margin_data_by_collateral_asset(collateral_asset, accounts)Binding for userMarginDataByCollateralAsset on the SystemViewer contract.
Parameters:
- collateral_asset (
ChecksumAddress) – - accounts (
List[ChecksumAddress]) –
Returns:
afp.bindings.SystemViewer.user_margin_data_by_collateral_assets
user_margin_data_by_collateral_assets(collateral_assets, accounts)Binding for userMarginDataByCollateralAssets on the SystemViewer contract.
Parameters:
- collateral_assets (
List[ChecksumAddress]) – - accounts (
List[ChecksumAddress]) –
Returns:
afp.bindings.SystemViewer.valuations
valuations(product_ids)Binding for valuations on the SystemViewer contract.
Parameters:
Returns:
afp.bindings.Trade
Trade(product_id, protocol_id, trade_id, price, timestamp, accounts, quantities, fee_rates, intents)Port of struct Trade on the IClearing contract.
Attributes:
- accounts (
List[ChecksumAddress]) – - fee_rates (
List[int]) – - intents (
List[Intent]) – - price (
int) – - product_id (
HexBytes) – - protocol_id (
ChecksumAddress) – - quantities (
List[int]) – - timestamp (
int) – - trade_id (
int) –
afp.bindings.Trade.accounts
accounts: typing.List[eth_typing.ChecksumAddress]afp.bindings.Trade.fee_rates
fee_rates: typing.List[int]afp.bindings.Trade.intents
intents: typing.List[Intent]afp.bindings.Trade.price
price: intafp.bindings.Trade.product_id
product_id: hexbytes.HexBytesafp.bindings.Trade.protocol_id
protocol_id: eth_typing.ChecksumAddressafp.bindings.Trade.quantities
quantities: typing.List[int]afp.bindings.Trade.timestamp
timestamp: intafp.bindings.Trade.trade_id
trade_id: intafp.bindings.TradingProtocol
TradingProtocol(w3, address)TradingProtocol contract binding.
Parameters:
- w3 (
Web3) – - address (
ChecksumAddress) – The address of a deployed TradingProtocol contract.
Functions:
- add_trade_submitter – Binding for
addTradeSubmitteron the TradingProtocol contract. - change_owner – Binding for
changeOwneron the TradingProtocol contract. - default_admin_role – Binding for
DEFAULT_ADMIN_ROLEon the TradingProtocol contract. - deposit – Binding for
depositon the TradingProtocol contract. - execute – Binding for
executeon the TradingProtocol contract. - execute_sequence – Binding for
executeSequenceon the TradingProtocol contract. - get_role_admin – Binding for
getRoleAdminon the TradingProtocol contract. - get_role_member – Binding for
getRoleMemberon the TradingProtocol contract. - get_role_member_count – Binding for
getRoleMemberCounton the TradingProtocol contract. - get_role_members – Binding for
getRoleMemberson the TradingProtocol contract. - grant_role – Binding for
grantRoleon the TradingProtocol contract. - has_role – Binding for
hasRoleon the TradingProtocol contract. - initialize – Binding for
initializeon the TradingProtocol contract. - proxiable_uuid – Binding for
proxiableUUIDon the TradingProtocol contract. - remove_trade_submitter – Binding for
removeTradeSubmitteron the TradingProtocol contract. - renounce_role – Binding for
renounceRoleon the TradingProtocol contract. - revoke_role – Binding for
revokeRoleon the TradingProtocol contract. - supports_interface – Binding for
supportsInterfaceon the TradingProtocol contract. - trade_submitter_role – Binding for
TRADE_SUBMITTER_ROLEon the TradingProtocol contract. - upgrade_interface_version – Binding for
UPGRADE_INTERFACE_VERSIONon the TradingProtocol contract. - upgrade_to_and_call – Binding for
upgradeToAndCallon the TradingProtocol contract. - withdraw – Binding for
withdrawon the TradingProtocol contract.
Attributes:
- Initialized (
ContractEvent) – Binding forevent Initializedon the TradingProtocol contract. - RoleAdminChanged (
ContractEvent) – Binding forevent RoleAdminChangedon the TradingProtocol contract. - RoleGranted (
ContractEvent) – Binding forevent RoleGrantedon the TradingProtocol contract. - RoleRevoked (
ContractEvent) – Binding forevent RoleRevokedon the TradingProtocol contract. - SequenceExecuted (
ContractEvent) – Binding forevent SequenceExecutedon the TradingProtocol contract. - Upgraded (
ContractEvent) – Binding forevent Upgradedon the TradingProtocol contract.
afp.bindings.TradingProtocol.Initialized
Initialized: contract.ContractEventBinding for event Initialized on the TradingProtocol contract.
afp.bindings.TradingProtocol.RoleAdminChanged
RoleAdminChanged: contract.ContractEventBinding for event RoleAdminChanged on the TradingProtocol contract.
afp.bindings.TradingProtocol.RoleGranted
RoleGranted: contract.ContractEventBinding for event RoleGranted on the TradingProtocol contract.
afp.bindings.TradingProtocol.RoleRevoked
RoleRevoked: contract.ContractEventBinding for event RoleRevoked on the TradingProtocol contract.
afp.bindings.TradingProtocol.SequenceExecuted
SequenceExecuted: contract.ContractEventBinding for event SequenceExecuted on the TradingProtocol contract.
afp.bindings.TradingProtocol.Upgraded
Upgraded: contract.ContractEventBinding for event Upgraded on the TradingProtocol contract.
afp.bindings.TradingProtocol.add_trade_submitter
add_trade_submitter(submitter)Binding for addTradeSubmitter on the TradingProtocol contract.
Parameters:
- submitter (
ChecksumAddress) –
Returns:
ContractFunction– A contract function instance to be sent in a transaction.
afp.bindings.TradingProtocol.change_owner
change_owner(new_owner)Binding for changeOwner on the TradingProtocol contract.
Parameters:
- new_owner (
ChecksumAddress) –
Returns:
ContractFunction– A contract function instance to be sent in a transaction.
afp.bindings.TradingProtocol.default_admin_role
default_admin_role()Binding for DEFAULT_ADMIN_ROLE on the TradingProtocol contract.
Returns:
HexBytes–
afp.bindings.TradingProtocol.deposit
deposit(margin_account_contract, amount)Binding for deposit on the TradingProtocol contract.
Parameters:
- margin_account_contract (
ChecksumAddress) – - amount (
int) –
Returns:
ContractFunction– A contract function instance to be sent in a transaction.
afp.bindings.TradingProtocol.execute
execute(trade, fallback_on_failure)Binding for execute on the TradingProtocol contract.
Parameters:
Returns:
ContractFunction– A contract function instance to be sent in a transaction.
afp.bindings.TradingProtocol.execute_sequence
execute_sequence(trades, fallback_on_failure)Binding for executeSequence on the TradingProtocol contract.
Parameters:
Returns:
ContractFunction– A contract function instance to be sent in a transaction.
afp.bindings.TradingProtocol.get_role_admin
get_role_admin(role)Binding for getRoleAdmin on the TradingProtocol contract.
Parameters:
- role (
HexBytes) –
Returns:
HexBytes–
afp.bindings.TradingProtocol.get_role_member
get_role_member(role, index)Binding for getRoleMember on the TradingProtocol contract.
Parameters:
Returns:
afp.bindings.TradingProtocol.get_role_member_count
get_role_member_count(role)Binding for getRoleMemberCount on the TradingProtocol contract.
Parameters:
- role (
HexBytes) –
Returns:
int–
afp.bindings.TradingProtocol.get_role_members
get_role_members(role)Binding for getRoleMembers on the TradingProtocol contract.
Parameters:
- role (
HexBytes) –
Returns:
afp.bindings.TradingProtocol.grant_role
grant_role(role, account)Binding for grantRole on the TradingProtocol contract.
Parameters:
- role (
HexBytes) – - account (
ChecksumAddress) –
Returns:
ContractFunction– A contract function instance to be sent in a transaction.
afp.bindings.TradingProtocol.has_role
has_role(role, account)Binding for hasRole on the TradingProtocol contract.
Parameters:
- role (
HexBytes) – - account (
ChecksumAddress) –
Returns:
bool–
afp.bindings.TradingProtocol.initialize
initialize(clearing_address)Binding for initialize on the TradingProtocol contract.
Parameters:
- clearing_address (
ChecksumAddress) –
Returns:
ContractFunction– A contract function instance to be sent in a transaction.
afp.bindings.TradingProtocol.proxiable_uuid
proxiable_uuid()Binding for proxiableUUID on the TradingProtocol contract.
Returns:
HexBytes–
afp.bindings.TradingProtocol.remove_trade_submitter
remove_trade_submitter(submitter)Binding for removeTradeSubmitter on the TradingProtocol contract.
Parameters:
- submitter (
ChecksumAddress) –
Returns:
ContractFunction– A contract function instance to be sent in a transaction.
afp.bindings.TradingProtocol.renounce_role
renounce_role(role, caller_confirmation)Binding for renounceRole on the TradingProtocol contract.
Parameters:
- role (
HexBytes) – - caller_confirmation (
ChecksumAddress) –
Returns:
ContractFunction– A contract function instance to be sent in a transaction.
afp.bindings.TradingProtocol.revoke_role
revoke_role(role, account)Binding for revokeRole on the TradingProtocol contract.
Parameters:
- role (
HexBytes) – - account (
ChecksumAddress) –
Returns:
ContractFunction– A contract function instance to be sent in a transaction.
afp.bindings.TradingProtocol.supports_interface
supports_interface(interface_id)Binding for supportsInterface on the TradingProtocol contract.
Parameters:
- interface_id (
HexBytes) –
Returns:
bool–
afp.bindings.TradingProtocol.trade_submitter_role
trade_submitter_role()Binding for TRADE_SUBMITTER_ROLE on the TradingProtocol contract.
Returns:
HexBytes–
afp.bindings.TradingProtocol.upgrade_interface_version
upgrade_interface_version()Binding for UPGRADE_INTERFACE_VERSION on the TradingProtocol contract.
Returns:
str–
afp.bindings.TradingProtocol.upgrade_to_and_call
upgrade_to_and_call(new_implementation, data)Binding for upgradeToAndCall on the TradingProtocol contract.
Parameters:
- new_implementation (
ChecksumAddress) – - data (
HexBytes) –
Returns:
ContractFunction– A contract function instance to be sent in a transaction.
afp.bindings.TradingProtocol.withdraw
withdraw(margin_account_contract, amount)Binding for withdraw on the TradingProtocol contract.
Parameters:
- margin_account_contract (
ChecksumAddress) – - amount (
int) –
Returns:
ContractFunction– A contract function instance to be sent in a transaction.
afp.bindings.UserMarginAccountData
UserMarginAccountData(collateral_asset, margin_account_id, mae, mmu, positions)Port of struct UserMarginAccountData on the ISystemViewer contract.
Attributes:
- collateral_asset (
ChecksumAddress) – - mae (
int) – - margin_account_id (
ChecksumAddress) – - mmu (
int) – - positions (
List[PositionData]) –
afp.bindings.UserMarginAccountData.collateral_asset
collateral_asset: eth_typing.ChecksumAddressafp.bindings.UserMarginAccountData.mae
mae: intafp.bindings.UserMarginAccountData.margin_account_id
margin_account_id: eth_typing.ChecksumAddressafp.bindings.UserMarginAccountData.mmu
mmu: intafp.bindings.UserMarginAccountData.positions
positions: typing.List[PositionData]