This repository has been archived by the owner on Feb 1, 2024. It is now read-only.
Support CAP-0003: Account for the "liabilities" on an account #2
Labels
feature request
New feature or request
Milestone
Desired Behavior
The bot should incorporate the liabilities change from Stellar Core (CAP-0003)
This will prevent the bot from placing "phantom" orders on the orderbook, limiting the amounts of the order to the current balance of the asset minus the sum of the amounts in currently open orders.
Impact
The desired behavior will allow me to conform to the new protocol changes and will prevent the bot from being caught off guard when these changes do go into effect in stellar-core.
Feature Suggestion
We can achieve the desired behavior by first summing up the outstanding orders as an initial calculation for liabilities. Once horizon has full support for liabilities we can switchover to using those exposed fields.
References
This feature does not exist anywhere else, please see the specification section below for details.
Additional context
See the Reddit post announcing the liabilities change and the migration schedule to protocol 10, which includes the liabilities change.
Some alternatives that would achieve the same result are:
The feature suggested above was better than these alternatives because we are already fetching all the relevant order information from Horizon and summing up our liabilities for XLM, we just need to extend this logic to non-native assets.
Horizon does not fully support liabilities yet, it has a
0
value for all liabilities, so this solution will allow us to be compliant in the mean time.Specification
CAP-0003: https://github.com/stellar/stellar-protocol/blob/master/core/cap-0003.md
This section of the specification is particularly important:
account.sellingLiabilities
A
: the amount of native asset offered to be sold, aggregated over all offers owned byA
account.buyingLiabilities
A
: the amount of native asset offered to be bought, aggregated over all offers owned byA
trustline.sellingLiabilities
A
and non-native assetX
: the amount ofX
offered to be sold, aggregated over all offers owned byA
trustline.buyingLiabilities
A
and non-native assetX
: the amount ofX
offered to be bought, aggregated over all offers owned byA
Horizon will only show a valid value for liabilities if the latest ledger (
/ledger
) is using protocol version 10 (which depends on voting by the network). This should be taken into consideration if using the liabilities values from horizon.The text was updated successfully, but these errors were encountered: