mirror of
https://github.com/aljazceru/bitfinex-api-py.git
synced 2025-12-18 06:14:22 +01:00
Align code with new Bitfinex API documentation improvements.
This commit is contained in:
@@ -239,10 +239,10 @@ class RestPublicEndpoints(Middleware):
|
||||
data = self._get(f"funding/stats/{symbol}/hist", params=params)
|
||||
return [ serializers.FundingStatistic.parse(*sub_data) for sub_data in data ]
|
||||
|
||||
def get_pulse_profile(self, nickname: str) -> PulseProfile:
|
||||
def get_pulse_profile_details(self, nickname: str) -> PulseProfile:
|
||||
return serializers.PulseProfile.parse(*self._get(f"pulse/profile/{nickname}"))
|
||||
|
||||
def get_pulse_history(self, *, end: Optional[str] = None, limit: Optional[int] = None) -> List[PulseMessage]:
|
||||
def get_pulse_message_history(self, *, end: Optional[str] = None, limit: Optional[int] = None) -> List[PulseMessage]:
|
||||
messages = []
|
||||
|
||||
for subdata in self._get("pulse/hist", params={ "end": end, "limit": limit }):
|
||||
|
||||
@@ -199,7 +199,7 @@ DerivativesStatus = generate_labeler_serializer(
|
||||
"_PLACEHOLDER",
|
||||
"insurance_fund_balance",
|
||||
"_PLACEHOLDER",
|
||||
"next_funding_evt_timestamp_ms",
|
||||
"next_funding_evt_mts",
|
||||
"next_funding_accrued",
|
||||
"next_funding_step",
|
||||
"_PLACEHOLDER",
|
||||
@@ -258,7 +258,7 @@ FundingStatistic = generate_labeler_serializer(
|
||||
name="FundingStatistic",
|
||||
klass=types.FundingStatistic,
|
||||
labels=[
|
||||
"timestamp",
|
||||
"mts",
|
||||
"_PLACEHOLDER",
|
||||
"_PLACEHOLDER",
|
||||
"frr",
|
||||
|
||||
@@ -106,10 +106,10 @@ class Statistic(_Type):
|
||||
@dataclass
|
||||
class Candle(_Type):
|
||||
mts: int
|
||||
open: float
|
||||
close: float
|
||||
high: float
|
||||
low: float
|
||||
open: int
|
||||
close: int
|
||||
high: int
|
||||
low: int
|
||||
volume: float
|
||||
|
||||
@dataclass
|
||||
@@ -119,7 +119,7 @@ class DerivativesStatus(_Type):
|
||||
deriv_price: float
|
||||
spot_price: float
|
||||
insurance_fund_balance: float
|
||||
next_funding_evt_timestamp_ms: int
|
||||
next_funding_evt_mts: int
|
||||
next_funding_accrued: float
|
||||
next_funding_step: int
|
||||
current_funding: float
|
||||
@@ -149,7 +149,7 @@ class Leaderboard(_Type):
|
||||
|
||||
@dataclass
|
||||
class FundingStatistic(_Type):
|
||||
timestamp: int
|
||||
mts: int
|
||||
frr: float
|
||||
avg_period: float
|
||||
funding_amount: float
|
||||
|
||||
@@ -149,7 +149,7 @@ DerivativesStatus = generate_labeler_serializer(
|
||||
"_PLACEHOLDER",
|
||||
"insurance_fund_balance",
|
||||
"_PLACEHOLDER",
|
||||
"next_funding_evt_timestamp_ms",
|
||||
"next_funding_evt_mts",
|
||||
"next_funding_accrued",
|
||||
"next_funding_step",
|
||||
"_PLACEHOLDER",
|
||||
|
||||
@@ -88,10 +88,10 @@ class FundingCurrencyRawBook(_Type):
|
||||
@dataclass
|
||||
class Candle(_Type):
|
||||
mts: int
|
||||
open: float
|
||||
close: float
|
||||
high: float
|
||||
low: float
|
||||
open: int
|
||||
close: int
|
||||
high: int
|
||||
low: int
|
||||
volume: float
|
||||
|
||||
@dataclass
|
||||
@@ -100,7 +100,7 @@ class DerivativesStatus(_Type):
|
||||
deriv_price: float
|
||||
spot_price: float
|
||||
insurance_fund_balance: float
|
||||
next_funding_evt_timestamp_ms: int
|
||||
next_funding_evt_mts: int
|
||||
next_funding_accrued: float
|
||||
next_funding_step: int
|
||||
current_funding: float
|
||||
|
||||
@@ -12,13 +12,13 @@ bfx = Client(rest_host=PUB_REST_HOST)
|
||||
end = datetime.datetime(2020, 5, 2).timestamp() * 1000
|
||||
|
||||
# Retrieves 25 pulse messages up to 2020/05/02
|
||||
messages: List[PulseMessage] = bfx.rest.public.get_pulse_history(end=end, limit=25)
|
||||
messages: List[PulseMessage] = bfx.rest.public.get_pulse_message_history(end=end, limit=25)
|
||||
|
||||
for message in messages:
|
||||
print(f"Message author: {message.profile.nickname} ({message.profile.puid})")
|
||||
print(f"Title: <{message.title}>")
|
||||
print(f"Tags: {message.tags}\n")
|
||||
|
||||
profile: PulseProfile = bfx.rest.public.get_pulse_profile("News")
|
||||
profile: PulseProfile = bfx.rest.public.get_pulse_profile_details("News")
|
||||
URL = profile.picture.replace("size", "small")
|
||||
print(f"<{profile.nickname}>'s profile picture: https://s3-eu-west-1.amazonaws.com/bfx-pub/{URL}")
|
||||
|
||||
Reference in New Issue
Block a user