Get desktop application:
View/edit binary Protocol Buffers messages
* The Account API retrieves information for various accounts which have interacted with Compound. You can use this API to pull data about a specific account by address, or alternatively, pull data for a list of unhealthy accounts (that is, accounts which are approaching under-collateralization). <code>// Retreives list of accounts and related supply and borrow balances. fetch("API_BASE_URL/api/v2/account"); // Returns details for given account fetch("API_BASE_URL/api/v2/account?addresses[]=0x00..");</code>
* <p><i>Note: This service is experimental (alpha) and subject to change.</i></p> The CToken API retrieves information for all cTokens. You can use this API to pull data about all cTokens: <code>// Retreives list all cTokens fetch("API_BASE_URL/api/v2/ctoken"); // or return details for a single cToken fetch("API_BASE_URL/api/v2/ctoken?addresses[]=0x00..");</code>
* Custom data types that are shared between services.
(no methods)
* This includes a list of cTokens contextualized to each account. <code>{ "address": "0xbac065be2e8ca097e9ac924e94af000dd3a5663" "health": { "value": "1.07264275673050348990755599431194797431802239523113293682619605751591901" } "tokens": [ { "address": "0xf5dce57282a584d2746faf1593d3121fcac444dc" "borrow_balance_underlying": {"value": "131.4682716123015"} "lifetime_borrow_interest_accrued": {"value": "0.44430505829286"} "lifetime_supply_interest_accrued": {"value": "0.0000021671829864899976"} "supply_balance_underlying": {"value": "0.0"} } ], "total_borrow_value_in_eth": {"value": "0.5100157047140227313856015174794473200000000000000000000000000000" } "total_collateral_value_in_eth": {"value": "0.54706465148029978664135447293587201124121731200000000000000000000000000" } }</code>
Used in:
The public Ethereum address of the account
The value of all collateral supplied by the account. Calculated as <em>cTokens held • exchange rate • collateral factor</em>. Note: assets can be supplied and gain interest without being counted as collateral.
The value of all outstanding borrows with accumulated interest.
<pre>total_collateral_value_in_eth / total_borrow_value_in_eth</pre>. If this value is less than 1.0, the account is subject to liquidation.
doc-false
A list of tokens held by this account, see <ref>AccountCToken</ref> below for details.
* An account's supply, borrow, and interest information for a particular cToken. <code>{ "address": "0xf5dce57282a584d2746faf1593d3121fcac444dc" "borrow_balance_underlying": {"value": "131.4682716123015"} "lifetime_borrow_interest_accrued": {"value": "0.44430505829286"} "lifetime_supply_interest_accrued": {"value": "0.0000021671829864899976"} "supply_balance_underlying": {"value": "0.0"} }</code>
Used in:
The address of the cToken
The symbol of the cToken
The cToken balance converted to underlying tokens <pre>cTokens held • exchange rate</pre>
The borrow balance (this is denominated in the underlying token, not in cTokens)
The amount of supply interest accrued for the lifetime of this account-cToken pair.
The amount of borrow interest accrued for the lifetime of this account-cToken pair.
* The request to the account API can specify a number filters, such as which addresses to retrieve information about or general health requirements. The following shows an example set of request parameters in JSON: <code>{ "addresses": [] // returns all accounts if empty or not included "block_number": 0 // returns latest if given 0 "max_health": { "value": "10.0" } "min_borrow_value_in_eth": { "value": "0.002" } "page_number": 1 "page_size": 10 }</code>
Used as request type in: AccountService.account, AccountService.post_account
Used as field type in:
List of account addresses to filter on, e.g.: ["0x...", ,"0x..."] [Optional]
Filter for accounts which total outstanding borrows exceeding given amount. [Optional]
Filter for accounts where outstanding borrows divided by collateral value is less than the provided amount. If returned value is less than 1.0, for instance, the account is subject to liquidation. If provided, should be given as `{ "value": "...string formatted number..." }` [Optional]
If provided, API returns data for given block number from our historical data. Otherwise, API defaults to returning the latest information. [Optional]
If provided, API returns data for given timestamp from our historical data. Otherwise, API defaults to returning the latest information. [Optional]
Number of accounts to include in the response, default is 10 e.g. page_size=10 [Optional]
Pagination number for accounts in the response, default is 1 e.g. page_number=1 [Optional]
The account API returns an overall picture of accounts matching the filters on Compound.
Used as response type in: AccountService.account, AccountService.post_account
If set and non-zero, indicates an error returning data. <pre>NO_ERROR = 0 INTERNAL_ERROR = 1 INVALID_PAGE_NUMBER = 2 INVALID_PAGE_SIZE = 3</pre>
The request parameters are echoed in the response.
For example <pre>{ "page_number": 1, "page_size": 100, "total_entries": 83, "total_pages": 1, }</pre>
The portion of an outstanding borrow that can be closed in a liquidation, which is a percentage of the total underlying borrow balance. For example if the close factor is 0.1, then an account in liqudation is liable to have 10% of its borrows liquidated.
The amount of extra collateral that will be seized to incentivize liquidation. For example, an incentive of 1.05 implies that a liquidator will receive a 5% bonus on the exchange of collateral during a liquidation
The list of accounts (see <ref>Account</ref> below) matching the requested filter, with the associated account and cToken data.
doc-false
* This includes a list of cTokens contextualized to the full market. <code>{ "cToken": [{ "borrow_rate": {"value": "0.051453109785093843"}, "cash": {"value": "514.078443"}, "collateral_factor": {"value": "0.80000000000000000"}, "exchange_rate": {"value": "0.020024242770802729"}, "interest_rate_model_address": "0x1a43bfd39b15dcf444e17ab408c4b5be32deb7f5", "name": "Compound USD Coin", "number_of_borrowers": 3, "number_of_suppliers": 34, "reserves": {"value": "0"}, "supply_rate": {"value": "0.013237112532748109"}, "symbol": "cUSDC", "token_address": "0x5b281a6dda0b271e91ae35de655ad301c976edb1", "total_borrows": {"value": "178.064546"}, "total_supply": {"value": "34565.25157651"}, "underlying_address": "0x4dbcdf9b62e891a7cec5a2568c3f4faf9e8abe2b", "underlying_name": "USD Coin", "underlying_price": {"value": "0.0041368287055953530000000000"}, "underlying_symbol":"USDC" }], "error": null, "request": { "addresses": ["0x5b281a6dda0b271e91ae35de655ad301c976edb1"], "block_number": 4515576, "block_timestamp": 0 } }</code>
Used in:
The public Ethereum address of the cToken
The number of cTokens in existence
The amount of underlying tokens borrowed from the cToken
The amount of underylying tokens held by reserves
The current liquidity of the cToken
The cToken / underlying exchange rate. This rate increases over time as supply interest accrues.
The floating supply interest rate
The floating borrow interest rate
The amount of the value of the underlying token that will count as collateral. eg. cEth with collataral factor 0.75 means 1 eth of supply allows 0.75 eth of borrowing.
The number of accounts holding this cToken
The number of accounts with oustanding borrows
The price of the underlying token in eth
The address of the underlying token
The symbol of the ctoken
The name of the ctoken
The symbol of the underlying token
The name of the underlying token
The address of the interest rate model
* The request to the cToken API can specify a number filters, such as which tokens to retrieve information about or moment in time. The following shows an example set of request parameters in JSON: <code>{ "addresses": [] // returns all tokens if empty or not included "block_timestamp": 0 // returns latest information if given 0 }</code>
Used as request type in: CTokenService.ctoken, CTokenService.post_ctoken
Used as field type in:
List of token addresses to filter on, e.g.: ["0x...", ,"0x..."] [Optional]
Only one of block_number or block timestamp should be provided. If provided, API returns data for given block number from our historical data. Otherwise, API defaults to returning the latest information. [Optional]
Only one of block_number or block timestamp should be provided. If provided, API returns data for given block timestamp from our historical data. Otherwise, API defaults to returning the latest information. [Optional]
The cToken API returns an overall picture of cTokens matching the filter.
Used as response type in: CTokenService.ctoken, CTokenService.post_ctoken
If set and non-zero, indicates an error returning data. <pre>NO_ERROR = 0 INTERNAL_ERROR = 1
The request parameters are echoed in the response.
The list of cToken (see <ref>CToken</ref> below) matching the requested filter.
doc-false
doc-false
Used in: ,
Used for paginating results.
Used in:
The current page number
The number of entries to show per page.
The number of items matching the request across all pages.
The number of pages need to show total_entries at the given page_size.
For non-negative numbers only.
Used in: , , , ,
The full UNSIGNED number in string form. max value is 2^257 - 1, aka 231584178474632390847141970017375815706539969331281128078915168015826259279871
doc-false
The full SIGNED number in string form.