Skip to main content

Liquidity Pools

Table Metadata

PropertyConfiguration
Natural Key(s)liquidity_pool_id, closed_at
Partition Field(s)batch_run_date (MONTH partition)
Clustered Field(s)liquidity_pool_id, asset_a_id, asset_b_id, last_modified_ledger
Documentationdbt docs

Column Details

NameDescriptionData TypeDomain ValuesRequired?Notes
liquidity_pool_idUnique identifier for a liquidity pool. There cannot be duplicate pools for the same asset pair. Once a pool has been created for the asset pair, another cannot be created.stringYesThere is a good primer on AMMs here
typeThe mechanism that calculates pricing and division of shares for the pool. With the initial AMM rollout, the only type of liquidity pool allowed to be created is a constant product poolstringconstant_productYesFor more information regarding pricing and deposit calculations, read Cap-38.
feeThe number of basis points charged as a percentage of the trade in order to complete the transaction. The fees earned on all trades are divided amongst pool shareholders and distributed as an incentive to keep money in the poolsinteger30YesFees are distributed immediately to accounts as the transaction completes. There is no schedule for fee distribution
trustline_countTotal number of accounts with trustlines authorized to the pool. To create a trustline, an account must trust both base assets before trusting a pool with the asset pairintegerYesIf the issuer of A or B revokes authorization on the trustline, the account will automatically withdraw from every liquidity pool containing that asset and those pool trustlines will be deleted.
pool_share_countParticipation in a liquidity pool is represented by a pool share. The total number of pool shares is calculated by a constant product formula and is an arbitrary number representing the amount of participation in the pool.floatYesShares are not transferable; the only way to increase the number of pool shares held is to deposit into a liquidity pool. Conversely, decreasing pools shares can only be accomplished through a withdraw operation. Shares cannot be sent in payments or sold using offers.
asset_a_typeThe identifier for type of asset code, can be an alphanumeric with 4 characters, 12 characters or the native asset to the network, XLM.string
  • credit_alphanum4
  • credit_alphanum12
  • native
Yes
asset_a_codeThe 4 or 12 character code representation of the asset of one of the two asset pairs in a liquidity poolstringNo
asset_a_issuerThe account address of the original asset issuer that created one of the two asset pairs in the liquidity poolstringNo
asset_a_amountThe raw number of tokens locked in the pool for one of the two asset pairs in the liquidity poolfloatYesThe amount is a better representation of liquidity in the pool over pool share counts.
asset_b_typeThe identifier for type of asset code, can be an alphanumeric with 4 characters, 12 characters or the native asset to the network, XLM.string
  • credit_alphanum4
  • credit_alphanum12
  • native
Yes
asset_b_codeThe 4 or 12 character code representation of the asset of one of the two asset pairs in a liquidity poolstringNo
asset_b_issuerThe account address of the original asset issuer that created one of the two asset pairs in the liquidity poolstringNo
asset_b_amountThe raw number of tokens locked in the pool for one of the two asset pairs in the liquidity poolfloatYesThe amount is a better representation of liquidity in the pool over pool share counts.
last_modified_ledgerThe ledger sequence number when the ledger entry (this unique signer for the account) was modified. Deletions do not count as a modification and will report the prior modification sequence numberintegerYes
ledger_entry_changeCode that describes the ledger entry change type that was applied to the ledger entry.integer
  • 0 - Ledger Entry Created
  • 1 - Ledger Entry Updated
  • 2 - Ledger Entry Deleted
  • 3 - Ledger Entry State (value of the entry)
YesValid entry change types are 0, 1, and 2 for ledger entries of type liquidity_pools.
deletedIndicates whether the ledger entry (liquidity pool) has been deleted or not. Once an entry is deleted, it cannot be recovered. Liquidity pools are deleted once all pool shares are withdrawn from the poolbooleanYes
batch_idString representation of the run id for a given DAG in Airflow. Takes the form of "scheduled__<batch_end_date>-<dag_alias>". Batch ids are unique to the batch and help with monitoring and rerun capabilitiesstringYes
batch_run_dateThe start date for the batch interval. When taken with the date in the batch_id, the date represents the interval of ledgers processed. The batch run date can be seen as a proxy of closed_at for a ledger.datetimeYesThe table is partitioned on batch_run_date. It is recommended to always include the batch_run_date in the filter if possible to help reduce query cost.
batch_insert_tsThe timestamp in UTC when a batch of records was inserted into the database. This field can help identify if a batch executed in real time or as part of a backfilltimestampYes
asset_a_idUnique identifier for asset_a_code, asset_a_issuerintegerNo
asset_b_idUnique identifier for asset_b_code, asset_b_issuerintegerNo
closed_atTimestamp in UTC when this ledger closed and committed to the network. Ledgers are expected to close ~every 5 secondstimestampYes
ledger_sequenceThe sequence number of this ledger. It represents the order of the ledger within the Stellar blockchain. Each ledger has a unique sequence number that increments with every new ledger, ensuring that ledgers are processed in the correct order.integerYes