Skip to content

Commit fd22f65

Browse files
committed
add endpoints: offer_trades and metrics
1 parent fabf558 commit fd22f65

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

stellar_base/horizon.py

+29
Original file line numberDiff line numberDiff line change
@@ -665,6 +665,35 @@ def trade_aggregations(self, params=None):
665665
endpoint = '/trade_aggregations/'
666666
return self.query(endpoint, params)
667667

668+
def offer_trades(self, offer_id, params=None):
669+
"""This endpoint represents all trades for a given offer.
670+
671+
`GET /offers/{offer_id}/trades{?cursor,limit,order}
672+
<https://www.stellar.org/developers/horizon/reference/endpoints/trades-for-offer.html>`_
673+
674+
:param int offer_id: The offer ID to get trades on.
675+
:param dict params: The query parameters to pass to this request, such
676+
as cursor, order, and limit.
677+
:return: A list of effects on the given operation
678+
:rtype: dict
679+
680+
"""
681+
endpoint = '/offers/{offer_id}/trades'.format(offer_id=offer_id)
682+
return self.query(endpoint, params)
683+
684+
def metrics(self):
685+
"""The metrics endpoint returns a host of useful data points for monitoring the health
686+
of the underlying Horizon process.
687+
688+
`GET /metrics
689+
<https://www.stellar.org/developers/horizon/reference/endpoints/metrics.html>`_
690+
691+
:return: A host of useful data points for monitoring the health of the underlying Horizon process
692+
:rtype: dict
693+
"""
694+
695+
endpoint = '/metrics'
696+
return self.query(endpoint)
668697

669698
def check_horizon_reply(reply):
670699
if 'status' not in reply:

0 commit comments

Comments
 (0)