mirror of
https://github.com/aljazceru/bitfinex-api-py.git
synced 2026-02-07 14:54:32 +01:00
add seed candles
This commit is contained in:
@@ -45,6 +45,8 @@ class _Requests(object):
|
||||
|
||||
def _GET(self, endpoint, params = None):
|
||||
response = requests.get(f"{self.host}/{endpoint}", params=params)
|
||||
|
||||
print(f"{self.host}/{endpoint}")
|
||||
|
||||
if response.status_code == HTTPStatus.NOT_FOUND:
|
||||
raise ResourceNotFound(f"No resources found at endpoint <{endpoint}>.")
|
||||
@@ -215,6 +217,14 @@ class _RestPublicEndpoints(_Requests):
|
||||
|
||||
return [ serializers.Liquidation.parse(*subdata[0]) for subdata in data ]
|
||||
|
||||
def get_seed_candles(self, symbol: str, tf: str = '1m', sort: Optional[Sort] = None, start: Optional[str] = None, end: Optional[str] = None, limit: Optional[int] = None) -> List[Candle]:
|
||||
|
||||
params = {"sort": sort, "start": start, "end": end, "limit": limit}
|
||||
|
||||
data = self._GET(f"candles/trade:{tf}:{symbol}/hist?limit={limit}&start={start}&end={end}&sort={sort}", params=params)
|
||||
|
||||
return [ serializers.Candle.parse(*subdata) for subdata in data ]
|
||||
|
||||
def get_leaderboards_hist(
|
||||
self,
|
||||
resource: str,
|
||||
|
||||
15
examples/rest/get_seed_candles.py
Normal file
15
examples/rest/get_seed_candles.py
Normal file
@@ -0,0 +1,15 @@
|
||||
# python -c "from examples.rest.get_seed_candles import *"
|
||||
|
||||
import time
|
||||
|
||||
from bfxapi.client import Client, Constants
|
||||
|
||||
bfx = Client(
|
||||
REST_HOST=Constants.REST_HOST
|
||||
)
|
||||
|
||||
print(f"Candles: {bfx.rest.public.get_seed_candles(symbol='tBTCUSD')}")
|
||||
|
||||
# Be sure to specify a period or aggregated period when retrieving funding candles.
|
||||
# If you wish to mimic the candles found in the UI, use the following setup to aggregate all funding candles: a30:p2:p30
|
||||
print(f"Candles: {bfx.rest.public.get_seed_candles(symbol='fUSD:a30:p2:p30', tf='15m')}")
|
||||
Reference in New Issue
Block a user