#74 Adding API call to get all call orders for a given account type
This commit is contained in:
parent
37cadb2be8
commit
e7ec05f545
2 changed files with 21 additions and 0 deletions
|
|
@ -533,5 +533,20 @@ namespace graphene { namespace app {
|
||||||
return result;
|
return result;
|
||||||
} FC_CAPTURE_AND_RETHROW( (a) ) }
|
} FC_CAPTURE_AND_RETHROW( (a) ) }
|
||||||
|
|
||||||
|
vector<call_order_object> database_api::get_margin_positions( const account_id_type& id )const
|
||||||
|
{ try {
|
||||||
|
const auto& idx = _db.get_index_type<call_order_index>();
|
||||||
|
const auto& aidx = idx.indices().get<by_account>();
|
||||||
|
auto start = aidx.lower_bound( boost::make_tuple( id, 0 ) );
|
||||||
|
auto end = aidx.lower_bound( boost::make_tuple( id+1, 0 ) );
|
||||||
|
vector<call_order_object> result;
|
||||||
|
while( start != end )
|
||||||
|
{
|
||||||
|
result.push_back(*start);
|
||||||
|
++start;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
} FC_CAPTURE_AND_RETHROW( (id) ) }
|
||||||
|
|
||||||
|
|
||||||
} } // graphene::app
|
} } // graphene::app
|
||||||
|
|
|
||||||
|
|
@ -247,6 +247,11 @@ namespace graphene { namespace app {
|
||||||
*/
|
*/
|
||||||
vector<key_id_type> get_keys_for_address( const address& a )const;
|
vector<key_id_type> get_keys_for_address( const address& a )const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return all open margin positions for a given account id.
|
||||||
|
*/
|
||||||
|
vector<call_order_object> get_margin_positions( const account_id_type& id )const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/** called every time a block is applied to report the objects that were changed */
|
/** called every time a block is applied to report the objects that were changed */
|
||||||
void on_objects_changed(const vector<object_id_type>& ids);
|
void on_objects_changed(const vector<object_id_type>& ids);
|
||||||
|
|
@ -389,6 +394,7 @@ FC_API(graphene::app::database_api,
|
||||||
(get_proposed_transactions)
|
(get_proposed_transactions)
|
||||||
(get_account_references)
|
(get_account_references)
|
||||||
(get_keys_for_address)
|
(get_keys_for_address)
|
||||||
|
(get_margin_positions)
|
||||||
)
|
)
|
||||||
FC_API(graphene::app::history_api, (get_account_history)(get_market_history)(get_market_history_buckets))
|
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))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue