BitShares-Core  6.1.0
BitShares blockchain implementation and command-line interface software
Classes | Public Member Functions | List of all members
graphene::app::history_api Class Reference

The history_api class implements the RPC API for account history. More...

#include <api.hpp>

Classes

struct  history_operation_detail
 

Public Member Functions

 history_api (application &app)
 
vector< operation_history_objectget_account_history (const std::string &account_name_or_id, operation_history_id_type stop=operation_history_id_type(), uint32_t limit=application_options::get_default().api_limit_get_account_history, operation_history_id_type start=operation_history_id_type()) const
 Get the history of operations related to the specified account. More...
 
vector< operation_history_objectget_account_history_by_time (const std::string &account_name_or_id, const optional< uint32_t > &limit=optional< uint32_t >(), const optional< fc::time_point_sec > &start=optional< fc::time_point_sec >()) const
 Get the history of operations related to the specified account no later than the specified time. More...
 
history_operation_detail get_account_history_by_operations (const std::string &account_name_or_id, const flat_set< uint16_t > &operation_types, uint32_t start, uint32_t limit) const
 Get the history of operations related to the specified account filtering by operation types. More...
 
vector< operation_history_objectget_account_history_operations (const std::string &account_name_or_id, int64_t operation_type, operation_history_id_type start=operation_history_id_type(), operation_history_id_type stop=operation_history_id_type(), uint32_t limit=application_options::get_default().api_limit_get_account_history_operations) const
 Get the history of operations related to the specified account filtering by operation type. More...
 
vector< operation_history_objectget_relative_account_history (const std::string &account_name_or_id, uint64_t stop=0, uint32_t limit=application_options::get_default().api_limit_get_relative_account_history, uint64_t start=0) const
 Get the history of operations related to the specified account referenced by an event numbering specific to the account. The current number of operations for the account can be found in the account statistics (or use 0 for start). More...
 
vector< operation_history_objectget_block_operation_history (uint32_t block_num, const optional< uint16_t > &trx_in_block={}) const
 Get all operations within a block or a transaction, including virtual operations. More...
 
vector< operation_history_objectget_block_operations_by_time (const optional< fc::time_point_sec > &start=optional< fc::time_point_sec >()) const
 Get all operations, including virtual operations, within the most recent block (no later than the specified time) containing at least one operation. More...
 
vector< order_history_objectget_fill_order_history (const std::string &a, const std::string &b, uint32_t limit) const
 Get details of order executions occurred most recently in a trading pair. More...
 
vector< bucket_objectget_market_history (const std::string &a, const std::string &b, uint32_t bucket_seconds, const fc::time_point_sec &start, const fc::time_point_sec &end) const
 Get OHLCV data of a trading pair in a time range. More...
 
flat_set< uint32_t > get_market_history_buckets () const
 Get OHLCV time bucket lengths supported (configured) by this API server. More...
 
vector< liquidity_pool_history_objectget_liquidity_pool_history (liquidity_pool_id_type pool_id, const optional< fc::time_point_sec > &start=optional< fc::time_point_sec >(), const optional< fc::time_point_sec > &stop=optional< fc::time_point_sec >(), const optional< uint32_t > &limit=optional< uint32_t >(), const optional< int64_t > &operation_type=optional< int64_t >()) const
 Get history of a liquidity pool. More...
 
vector< liquidity_pool_history_objectget_liquidity_pool_history_by_sequence (liquidity_pool_id_type pool_id, const optional< uint64_t > &start=optional< uint64_t >(), const optional< fc::time_point_sec > &stop=optional< fc::time_point_sec >(), const optional< uint32_t > &limit=optional< uint32_t >(), const optional< int64_t > &operation_type=optional< int64_t >()) const
 Get history of a liquidity pool. More...
 

Detailed Description

The history_api class implements the RPC API for account history.

This API contains methods to access account histories

Definition at line 69 of file api.hpp.

Constructor & Destructor Documentation

◆ history_api()

graphene::app::history_api::history_api ( application app)
explicit

Definition at line 371 of file api.cpp.

Member Function Documentation

◆ get_account_history()

vector< operation_history_object > graphene::app::history_api::get_account_history ( const std::string &  account_name_or_id,
operation_history_id_type  stop = operation_history_id_type(),
uint32_t  limit = application_options::get_default().api_limit_get_account_history,
operation_history_id_type  start = operation_history_id_type() 
) const

Get the history of operations related to the specified account.

Parameters
account_name_or_idThe account name or ID whose history should be queried
stopID of the earliest operation to retrieve
limitMaximum number of operations to retrieve, must not exceed the configured value of api_limit_get_account_history
startID of the most recent operation to retrieve
Returns
A list of operations related to the specified account, ordered from most recent to oldest.

Definition at line 406 of file api.cpp.

◆ get_account_history_by_operations()

history_api::history_operation_detail graphene::app::history_api::get_account_history_by_operations ( const std::string &  account_name_or_id,
const flat_set< uint16_t > &  operation_types,
uint32_t  start,
uint32_t  limit 
) const

Get the history of operations related to the specified account filtering by operation types.

Parameters
account_name_or_idThe account name or ID whose history should be queried
operation_typesThe IDs of the operation we want to get operations in the account ( 0 = transfer , 1 = limit order create, ...)
startthe sequence number where to start looping back through the history
limitthe max number of entries to return (from start number), must not exceed the configured value of api_limit_get_account_history_by_operations
Returns
history_operation_detail

Definition at line 635 of file api.cpp.

◆ get_account_history_by_time()

vector< operation_history_object > graphene::app::history_api::get_account_history_by_time ( const std::string &  account_name_or_id,
const optional< uint32_t > &  limit = optional<uint32_t>(),
const optional< fc::time_point_sec > &  start = optional<fc::time_point_sec>() 
) const

Get the history of operations related to the specified account no later than the specified time.

Parameters
account_name_or_idThe account name or ID whose history should be queried
limitMaximum number of operations to retrieve, must not exceed the configured value of api_limit_get_account_history
startthe time point to start looping back through history
Returns
A list of operations related to the specified account, ordered from most recent to oldest.
Note
  1. If account_name_or_id cannot be tied to an account, an empty list will be returned
  2. limit can be omitted or be null, if so the configured value of api_limit_get_account_history will be used
  3. start can be omitted or be null, if so the api will return the "first page" of the history
  4. One or more optional parameters can be omitted from the end of the parameter list, and the optional parameters in the middle cannot be omitted (but can be null).

Definition at line 464 of file api.cpp.

◆ get_account_history_operations()

vector< operation_history_object > graphene::app::history_api::get_account_history_operations ( const std::string &  account_name_or_id,
int64_t  operation_type,
operation_history_id_type  start = operation_history_id_type(),
operation_history_id_type  stop = operation_history_id_type(),
uint32_t  limit = application_options::get_default().api_limit_get_account_history_operations 
) const

Get the history of operations related to the specified account filtering by operation type.

Parameters
account_name_or_idThe account name or ID whose history should be queried
operation_typeThe type of the operation we want to get operations in the account ( 0 = transfer , 1 = limit order create, ...)
stopID of the earliest operation to retrieve
limitMaximum number of operations to retrieve, must not exceed the configured value of api_limit_get_account_history_operations
startID of the most recent operation to retrieve
Returns
A list of operations related to the specified account, ordered from most recent to oldest.

Definition at line 505 of file api.cpp.

◆ get_block_operation_history()

vector< operation_history_object > graphene::app::history_api::get_block_operation_history ( uint32_t  block_num,
const optional< uint16_t > &  trx_in_block = {} 
) const

Get all operations within a block or a transaction, including virtual operations.

Parameters
block_numthe number (height) of the block to fetch
trx_in_blockthe sequence of a transaction in the block, starts from 0, optional. If specified, will return only operations of that transaction. If omitted, will return all operations in the specified block.
Returns
a list of operation_history objects ordered by ID
Note
the data is fetched from the account_history plugin, so results may be incomplete due to the partial-operations option configured in the API node. To get complete data, it is recommended to query from ElasticSearch where the data is maintained by the elastic_search plugin.

Definition at line 595 of file api.cpp.

◆ get_block_operations_by_time()

vector< operation_history_object > graphene::app::history_api::get_block_operations_by_time ( const optional< fc::time_point_sec > &  start = optional<fc::time_point_sec>()) const

Get all operations, including virtual operations, within the most recent block (no later than the specified time) containing at least one operation.

Parameters
starttime point, optional, if omitted, the data of the latest block containing at least one operation will be returned
Returns
a list of operation_history objects ordered by ID in descending order
Note
the data is fetched from the account_history plugin, so results may be incomplete or incorrect due to the partial-operations option configured in the API node. To get complete data, it is recommended to query from ElasticSearch where the data is maintained by the elastic_search plugin.

Definition at line 609 of file api.cpp.

◆ get_fill_order_history()

vector< order_history_object > graphene::app::history_api::get_fill_order_history ( const std::string &  a,
const std::string &  b,
uint32_t  limit 
) const

Get details of order executions occurred most recently in a trading pair.

Parameters
aAsset symbol or ID in a trading pair
bThe other asset symbol or ID in the trading pair
limitMaximum records to return
Returns
a list of order_history objects, in "most recent first" order

Definition at line 376 of file api.cpp.

◆ get_liquidity_pool_history()

vector< liquidity_pool_history_object > graphene::app::history_api::get_liquidity_pool_history ( liquidity_pool_id_type  pool_id,
const optional< fc::time_point_sec > &  start = optional<fc::time_point_sec>(),
const optional< fc::time_point_sec > &  stop = optional<fc::time_point_sec>(),
const optional< uint32_t > &  limit = optional<uint32_t>(),
const optional< int64_t > &  operation_type = optional<int64_t>() 
) const

Get history of a liquidity pool.

Parameters
pool_idID of the liquidity pool to query
startA UNIX timestamp. Optional. If specified, only the operations occurred not later than this time will be returned.
stopA UNIX timestamp. Optional. If specified, only the operations occurred later than this time will be returned.
limitMaximum quantity of operations in the history to retrieve. Optional. If not specified, the configured value of api_limit_get_liquidity_pool_history will be used. If specified, it must not exceed the configured value of api_limit_get_liquidity_pool_history.
operation_typeOptional. If specified, only the operations whose type is the specified type will be returned. Otherwise all operations will be returned.
Returns
operation history of the liquidity pool, ordered by time, most recent first.
Note
  1. The time must be UTC. The range is (stop, start].
  2. In case when there are more operations than limit occurred in the same second, this API only returns the most recent records, the rest records can be retrieved with the get_liquidity_pool_history_by_sequence API.
  3. List of operation type code: 59-creation, 60-deletion, 61-deposit, 62-withdrawal, 63-exchange.
  4. One or more optional parameters can be omitted from the end of the parameter list, and the optional parameters in the middle cannot be omitted (but can be null).

Definition at line 716 of file api.cpp.

◆ get_liquidity_pool_history_by_sequence()

vector< liquidity_pool_history_object > graphene::app::history_api::get_liquidity_pool_history_by_sequence ( liquidity_pool_id_type  pool_id,
const optional< uint64_t > &  start = optional<uint64_t>(),
const optional< fc::time_point_sec > &  stop = optional<fc::time_point_sec>(),
const optional< uint32_t > &  limit = optional<uint32_t>(),
const optional< int64_t > &  operation_type = optional<int64_t>() 
) const

Get history of a liquidity pool.

Parameters
pool_idID of the liquidity pool to query
startAn Integer. Optional. If specified, only the operations whose sequences are not greater than this will be returned.
stopA UNIX timestamp. Optional. If specified, only operations occurred later than this time will be returned.
limitMaximum quantity of operations in the history to retrieve. Optional. If not specified, the configured value of api_limit_get_liquidity_pool_history will be used. If specified, it must not exceed the configured value of api_limit_get_liquidity_pool_history.
operation_typeOptional. If specified, only the operations whose type is the specified type will be returned. Otherwise all operations will be returned.
Returns
operation history of the liquidity pool, ordered by time, most recent first.
Note
  1. The time must be UTC. The range is (stop, start].
  2. List of operation type code: 59-creation, 60-deletion, 61-deposit, 62-withdrawal, 63-exchange.
  3. One or more optional parameters can be omitted from the end of the parameter list, and the optional parameters in the middle cannot be omitted (but can be null).

Definition at line 765 of file api.cpp.

◆ get_market_history()

vector< bucket_object > graphene::app::history_api::get_market_history ( const std::string &  a,
const std::string &  b,
uint32_t  bucket_seconds,
const fc::time_point_sec start,
const fc::time_point_sec end 
) const

Get OHLCV data of a trading pair in a time range.

Parameters
aAsset symbol or ID in a trading pair
bThe other asset symbol or ID in the trading pair
bucket_secondsLength of each time bucket in seconds. Note: it need to be within result of get_market_history_buckets() API, otherwise no data will be returned
startThe start of a time range, E.G. "2018-01-01T00:00:00"
endThe end of the time range
Returns
A list of OHLCV data, in "least recent first" order. If there are more records in the specified time range than the configured value of api_limit_get_market_history, only the first records will be returned.

Definition at line 665 of file api.cpp.

◆ get_market_history_buckets()

flat_set< uint32_t > graphene::app::history_api::get_market_history_buckets ( ) const

Get OHLCV time bucket lengths supported (configured) by this API server.

Returns
A list of time bucket lengths in seconds. E.G. if the result contains a number "300", it means this API server supports OHLCV data aggregated in 5-minute buckets.

Definition at line 628 of file api.cpp.

◆ get_relative_account_history()

vector< operation_history_object > graphene::app::history_api::get_relative_account_history ( const std::string &  account_name_or_id,
uint64_t  stop = 0,
uint32_t  limit = application_options::get_default().api_limit_get_relative_account_history,
uint64_t  start = 0 
) const

Get the history of operations related to the specified account referenced by an event numbering specific to the account. The current number of operations for the account can be found in the account statistics (or use 0 for start).

Parameters
account_name_or_idThe account name or ID whose history should be queried
stopSequence number of earliest operation. 0 is default and will query 'limit' number of operations.
limitMaximum number of operations to retrieve, must not exceed the configured value of api_limit_get_relative_account_history
startSequence number of the most recent operation to retrieve. 0 is default, which will start querying from the most recent operation.
Returns
A list of operations related to the specified account, ordered from most recent to oldest.

Definition at line 552 of file api.cpp.


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