mirror of
https://github.com/aljazceru/bitfinex-api-py.git
synced 2025-12-19 06:44: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)
|
data = self._get(f"funding/stats/{symbol}/hist", params=params)
|
||||||
return [ serializers.FundingStatistic.parse(*sub_data) for sub_data in data ]
|
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}"))
|
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 = []
|
messages = []
|
||||||
|
|
||||||
for subdata in self._get("pulse/hist", params={ "end": end, "limit": limit }):
|
for subdata in self._get("pulse/hist", params={ "end": end, "limit": limit }):
|
||||||
|
|||||||
@@ -199,7 +199,7 @@ DerivativesStatus = generate_labeler_serializer(
|
|||||||
"_PLACEHOLDER",
|
"_PLACEHOLDER",
|
||||||
"insurance_fund_balance",
|
"insurance_fund_balance",
|
||||||
"_PLACEHOLDER",
|
"_PLACEHOLDER",
|
||||||
"next_funding_evt_timestamp_ms",
|
"next_funding_evt_mts",
|
||||||
"next_funding_accrued",
|
"next_funding_accrued",
|
||||||
"next_funding_step",
|
"next_funding_step",
|
||||||
"_PLACEHOLDER",
|
"_PLACEHOLDER",
|
||||||
@@ -258,7 +258,7 @@ FundingStatistic = generate_labeler_serializer(
|
|||||||
name="FundingStatistic",
|
name="FundingStatistic",
|
||||||
klass=types.FundingStatistic,
|
klass=types.FundingStatistic,
|
||||||
labels=[
|
labels=[
|
||||||
"timestamp",
|
"mts",
|
||||||
"_PLACEHOLDER",
|
"_PLACEHOLDER",
|
||||||
"_PLACEHOLDER",
|
"_PLACEHOLDER",
|
||||||
"frr",
|
"frr",
|
||||||
|
|||||||
@@ -106,10 +106,10 @@ class Statistic(_Type):
|
|||||||
@dataclass
|
@dataclass
|
||||||
class Candle(_Type):
|
class Candle(_Type):
|
||||||
mts: int
|
mts: int
|
||||||
open: float
|
open: int
|
||||||
close: float
|
close: int
|
||||||
high: float
|
high: int
|
||||||
low: float
|
low: int
|
||||||
volume: float
|
volume: float
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
@@ -119,7 +119,7 @@ class DerivativesStatus(_Type):
|
|||||||
deriv_price: float
|
deriv_price: float
|
||||||
spot_price: float
|
spot_price: float
|
||||||
insurance_fund_balance: float
|
insurance_fund_balance: float
|
||||||
next_funding_evt_timestamp_ms: int
|
next_funding_evt_mts: int
|
||||||
next_funding_accrued: float
|
next_funding_accrued: float
|
||||||
next_funding_step: int
|
next_funding_step: int
|
||||||
current_funding: float
|
current_funding: float
|
||||||
@@ -149,7 +149,7 @@ class Leaderboard(_Type):
|
|||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class FundingStatistic(_Type):
|
class FundingStatistic(_Type):
|
||||||
timestamp: int
|
mts: int
|
||||||
frr: float
|
frr: float
|
||||||
avg_period: float
|
avg_period: float
|
||||||
funding_amount: float
|
funding_amount: float
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ DerivativesStatus = generate_labeler_serializer(
|
|||||||
"_PLACEHOLDER",
|
"_PLACEHOLDER",
|
||||||
"insurance_fund_balance",
|
"insurance_fund_balance",
|
||||||
"_PLACEHOLDER",
|
"_PLACEHOLDER",
|
||||||
"next_funding_evt_timestamp_ms",
|
"next_funding_evt_mts",
|
||||||
"next_funding_accrued",
|
"next_funding_accrued",
|
||||||
"next_funding_step",
|
"next_funding_step",
|
||||||
"_PLACEHOLDER",
|
"_PLACEHOLDER",
|
||||||
|
|||||||
@@ -88,10 +88,10 @@ class FundingCurrencyRawBook(_Type):
|
|||||||
@dataclass
|
@dataclass
|
||||||
class Candle(_Type):
|
class Candle(_Type):
|
||||||
mts: int
|
mts: int
|
||||||
open: float
|
open: int
|
||||||
close: float
|
close: int
|
||||||
high: float
|
high: int
|
||||||
low: float
|
low: int
|
||||||
volume: float
|
volume: float
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
@@ -100,7 +100,7 @@ class DerivativesStatus(_Type):
|
|||||||
deriv_price: float
|
deriv_price: float
|
||||||
spot_price: float
|
spot_price: float
|
||||||
insurance_fund_balance: float
|
insurance_fund_balance: float
|
||||||
next_funding_evt_timestamp_ms: int
|
next_funding_evt_mts: int
|
||||||
next_funding_accrued: float
|
next_funding_accrued: float
|
||||||
next_funding_step: int
|
next_funding_step: int
|
||||||
current_funding: float
|
current_funding: float
|
||||||
|
|||||||
@@ -12,13 +12,13 @@ bfx = Client(rest_host=PUB_REST_HOST)
|
|||||||
end = datetime.datetime(2020, 5, 2).timestamp() * 1000
|
end = datetime.datetime(2020, 5, 2).timestamp() * 1000
|
||||||
|
|
||||||
# Retrieves 25 pulse messages up to 2020/05/02
|
# 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:
|
for message in messages:
|
||||||
print(f"Message author: {message.profile.nickname} ({message.profile.puid})")
|
print(f"Message author: {message.profile.nickname} ({message.profile.puid})")
|
||||||
print(f"Title: <{message.title}>")
|
print(f"Title: <{message.title}>")
|
||||||
print(f"Tags: {message.tags}\n")
|
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")
|
URL = profile.picture.replace("size", "small")
|
||||||
print(f"<{profile.nickname}>'s profile picture: https://s3-eu-west-1.amazonaws.com/bfx-pub/{URL}")
|
print(f"<{profile.nickname}>'s profile picture: https://s3-eu-west-1.amazonaws.com/bfx-pub/{URL}")
|
||||||
|
|||||||
Reference in New Issue
Block a user