mirror of
https://github.com/aljazceru/bitfinex-api-py.git
synced 2025-12-19 06:44:22 +01:00
add seed candles
This commit is contained in:
@@ -176,20 +176,20 @@ class _RestPublicEndpoints(_Requests):
|
||||
|
||||
def get_candles_hist(
|
||||
self,
|
||||
resource: str,
|
||||
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/{resource}/hist", params=params)
|
||||
data = self._GET(f"candles/trade:{tf}:{symbol}/hist", params=params)
|
||||
return [ serializers.Candle.parse(*subdata) for subdata in data ]
|
||||
|
||||
def get_candles_last(
|
||||
self,
|
||||
resource: str,
|
||||
symbol: str, tf: str = "1m",
|
||||
sort: Optional[Sort] = None, start: Optional[str] = None, end: Optional[str] = None, limit: Optional[int] = None
|
||||
) -> Candle:
|
||||
params = { "sort": sort, "start": start, "end": end, "limit": limit }
|
||||
data = self._GET(f"candles/{resource}/last", params=params)
|
||||
data = self._GET(f"candles/trade:{tf}:{symbol}/last", params=params)
|
||||
return serializers.Candle.parse(*data)
|
||||
|
||||
def get_derivatives_status(self, symbols: Union[List[str], Literal["ALL"]]) -> List[DerivativesStatus]:
|
||||
|
||||
13
examples/rest/get_candles_hist.py
Normal file
13
examples/rest/get_candles_hist.py
Normal file
@@ -0,0 +1,13 @@
|
||||
# python -c "from examples.rest.get_candles_hist import *"
|
||||
|
||||
from bfxapi.client import Client, Constants
|
||||
|
||||
bfx = Client(
|
||||
REST_HOST=Constants.REST_HOST
|
||||
)
|
||||
|
||||
print(f"Candles: {bfx.rest.public.get_candles_hist(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_candles_hist(tf='15m', symbol='fUSD:a30:p2:p30')}")
|
||||
Reference in New Issue
Block a user