BitShares-Core  7.0.2
BitShares blockchain node software and command-line wallet software
Public Member Functions | Public Attributes | List of all members
graphene::chain::call_order_object Class Reference

tracks debt and call price information More...

#include <market_object.hpp>

Inheritance diagram for graphene::chain::call_order_object:
graphene::db::abstract_object< call_order_object, protocol_ids, call_order_object_type > graphene::db::base_abstract_object< call_order_object > graphene::db::object

Public Member Functions

asset get_collateral () const
 
asset get_debt () const
 
asset amount_to_receive () const
 
asset_id_type debt_type () const
 
asset_id_type collateral_type () const
 
price collateralization () const
 
pair< asset_id_type, asset_id_type > get_market () const
 
share_type get_max_debt_to_cover (price match_price, price feed_price, const uint16_t maintenance_collateral_ratio, const optional< price > &maintenance_collateralization=optional< price >()) const
 
- Public Member Functions inherited from graphene::db::abstract_object< call_order_object, protocol_ids, call_order_object_type >
 abstract_object ()
 
object_id< SpaceID, TypeID > get_id () const
 
- Public Member Functions inherited from graphene::db::base_abstract_object< call_order_object >
std::unique_ptr< objectclone () const override
 
void move_from (object &obj) override
 
fc::variant to_variant () const override
 
std::vector< char > pack () const override
 
 object ()=default
 
 object (uint8_t space_id, uint8_t type_id)
 
- Public Member Functions inherited from graphene::db::object
 object ()=default
 
 object (uint8_t space_id, uint8_t type_id)
 
virtual ~object ()=default
 
virtual std::unique_ptr< objectclone () const =0
 
virtual fc::variant to_variant () const =0
 
virtual std::vector< char > pack () const =0
 

Public Attributes

account_id_type borrower
 
share_type collateral
 call_price.base.asset_id, access via get_collateral More...
 
share_type debt
 call_price.quote.asset_id, access via get_debt More...
 
price call_price
 Collateral / Debt. More...
 
optional< uint16_t > target_collateral_ratio
 maximum CR to maintain when selling collateral on margin call More...
 
- Public Attributes inherited from graphene::db::object
object_id_type id
 

Additional Inherited Members

- Static Public Attributes inherited from graphene::db::abstract_object< call_order_object, protocol_ids, call_order_object_type >
static constexpr uint8_t space_id
 
static constexpr uint8_t type_id
 

Detailed Description

tracks debt and call price information

There should only be one call_order_object per asset pair per account and they will all have the same call price.

Definition at line 140 of file market_object.hpp.

Member Function Documentation

◆ amount_to_receive()

asset graphene::chain::call_order_object::amount_to_receive ( ) const
inline

Definition at line 145 of file market_object.hpp.

◆ collateral_type()

asset_id_type graphene::chain::call_order_object::collateral_type ( ) const
inline

Definition at line 147 of file market_object.hpp.

◆ collateralization()

price graphene::chain::call_order_object::collateralization ( ) const
inline

Definition at line 148 of file market_object.hpp.

◆ debt_type()

asset_id_type graphene::chain::call_order_object::debt_type ( ) const
inline

Definition at line 146 of file market_object.hpp.

◆ get_collateral()

asset graphene::chain::call_order_object::get_collateral ( ) const
inline

Definition at line 143 of file market_object.hpp.

◆ get_debt()

asset graphene::chain::call_order_object::get_debt ( ) const
inline

Definition at line 144 of file market_object.hpp.

◆ get_market()

pair<asset_id_type,asset_id_type> graphene::chain::call_order_object::get_market ( ) const
inline

Definition at line 157 of file market_object.hpp.

◆ get_max_debt_to_cover()

share_type call_order_object::get_max_debt_to_cover ( price  match_price,
price  feed_price,
const uint16_t  maintenance_collateral_ratio,
const optional< price > &  maintenance_collateralization = optional<price>() 
) const

Calculate maximum quantity of debt to cover to satisfy target_collateral_ratio.

Parameters
match_pricethe matching price if this call order is margin called
feed_pricemedian settlement price of debt asset
maintenance_collateral_ratiomedian maintenance collateral ratio of debt asset
maintenance_collateralizationmaintenance collateralization of debt asset, should only be valid after core-1270 hard fork
Returns
maximum amount of debt that can be called

Definition at line 61 of file market_object.cpp.

Member Data Documentation

◆ borrower

account_id_type graphene::chain::call_order_object::borrower

Definition at line 150 of file market_object.hpp.

◆ call_price

price graphene::chain::call_order_object::call_price

Collateral / Debt.

Definition at line 153 of file market_object.hpp.

◆ collateral

share_type graphene::chain::call_order_object::collateral

call_price.base.asset_id, access via get_collateral

Definition at line 151 of file market_object.hpp.

◆ debt

share_type graphene::chain::call_order_object::debt

call_price.quote.asset_id, access via get_debt

Definition at line 152 of file market_object.hpp.

◆ target_collateral_ratio

optional<uint16_t> graphene::chain::call_order_object::target_collateral_ratio

maximum CR to maintain when selling collateral on margin call

Definition at line 155 of file market_object.hpp.


The documentation for this class was generated from the following files: