#47 Adding API to get the available history buckets based upon the configuration
This commit is contained in:
parent
44313ac8a4
commit
af812a7b51
5 changed files with 34 additions and 23 deletions
2
docs
2
docs
|
|
@ -1 +1 @@
|
||||||
Subproject commit 94ec061b91edbe9d1ebae576e641f921998428c8
|
Subproject commit 71ed2984b71d57cab13cdf12074cff150edc1d3d
|
||||||
|
|
@ -445,7 +445,17 @@ namespace graphene { namespace app {
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
vector<bucket_object> history_api::get_market_history( asset_id_type a, asset_id_type b, uint32_t bucket_seconds, fc::time_point_sec start, fc::time_point_sec end )const
|
|
||||||
|
|
||||||
|
flat_set<uint32_t> history_api::get_market_history_buckets()const
|
||||||
|
{
|
||||||
|
auto hist = _app.get_plugin<market_history_plugin>( "market_history" );
|
||||||
|
FC_ASSERT( hist );
|
||||||
|
return hist->tracked_buckets();
|
||||||
|
}
|
||||||
|
|
||||||
|
vector<bucket_object> history_api::get_market_history( asset_id_type a, asset_id_type b,
|
||||||
|
uint32_t bucket_seconds, fc::time_point_sec start, fc::time_point_sec end )const
|
||||||
{ try {
|
{ try {
|
||||||
FC_ASSERT(_app.chain_database());
|
FC_ASSERT(_app.chain_database());
|
||||||
const auto& db = *_app.chain_database();
|
const auto& db = *_app.chain_database();
|
||||||
|
|
|
||||||
|
|
@ -258,25 +258,27 @@ namespace graphene { namespace app {
|
||||||
*/
|
*/
|
||||||
class history_api
|
class history_api
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
history_api(application& app):_app(app){}
|
history_api(application& app):_app(app){}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get operations relevant to the specificed account
|
* @brief Get operations relevant to the specificed account
|
||||||
* @param account The account whose history should be queried
|
* @param account The account whose history should be queried
|
||||||
* @param stop ID of the earliest operation to retrieve
|
* @param stop ID of the earliest operation to retrieve
|
||||||
* @param limit Maximum number of operations to retrieve (must not exceed 100)
|
* @param limit Maximum number of operations to retrieve (must not exceed 100)
|
||||||
* @param start ID of the most recent operation to retrieve
|
* @param start ID of the most recent operation to retrieve
|
||||||
* @return A list of operations performed by account, ordered from most recent to oldest.
|
* @return A list of operations performed by account, ordered from most recent to oldest.
|
||||||
*/
|
*/
|
||||||
vector<operation_history_object> get_account_history(account_id_type account,
|
vector<operation_history_object> get_account_history(account_id_type account,
|
||||||
operation_history_id_type stop = operation_history_id_type(),
|
operation_history_id_type stop = operation_history_id_type(),
|
||||||
int limit = 100,
|
int limit = 100,
|
||||||
operation_history_id_type start = operation_history_id_type())const;
|
operation_history_id_type start = operation_history_id_type())const;
|
||||||
|
|
||||||
vector<bucket_object> get_market_history( asset_id_type a, asset_id_type b, uint32_t bucket_seconds, fc::time_point_sec start, fc::time_point_sec end )const;
|
vector<bucket_object> get_market_history( asset_id_type a, asset_id_type b, uint32_t bucket_seconds,
|
||||||
private:
|
fc::time_point_sec start, fc::time_point_sec end )const;
|
||||||
application& _app;
|
flat_set<uint32_t> get_market_history_buckets()const;
|
||||||
|
private:
|
||||||
|
application& _app;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -377,7 +379,7 @@ FC_API(graphene::app::database_api,
|
||||||
(get_transaction_hex)
|
(get_transaction_hex)
|
||||||
(get_proposed_transactions)
|
(get_proposed_transactions)
|
||||||
)
|
)
|
||||||
FC_API(graphene::app::history_api, (get_account_history)(get_market_history))
|
FC_API(graphene::app::history_api, (get_account_history)(get_market_history)(get_market_history_buckets))
|
||||||
FC_API(graphene::app::network_api, (broadcast_transaction)(add_node)(get_connected_peers))
|
FC_API(graphene::app::network_api, (broadcast_transaction)(add_node)(get_connected_peers))
|
||||||
FC_API(graphene::app::login_api,
|
FC_API(graphene::app::login_api,
|
||||||
(login)
|
(login)
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
Subproject commit 701b9ac00c46234ee7cc6385027f5942590debc9
|
Subproject commit c09035dba0cdab7fcb2c11bf81aaeaffaa981f66
|
||||||
|
|
@ -117,8 +117,7 @@ class market_history_plugin : public graphene::app::plugin
|
||||||
const boost::program_options::variables_map& options) override;
|
const boost::program_options::variables_map& options) override;
|
||||||
virtual void plugin_startup() override;
|
virtual void plugin_startup() override;
|
||||||
|
|
||||||
vector<bucket_object> get_history( const bucket_key& start, const bucket_key& end )const;
|
const flat_set<uint32_t>& tracked_buckets()const;
|
||||||
const flat_set<uint32_t>& tracked_buckets()const;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class detail::market_history_plugin_impl;
|
friend class detail::market_history_plugin_impl;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue