Edit demos in examples/ folder to use lowercase property identifiers.

This commit is contained in:
Davide Casale
2023-01-27 15:57:36 +01:00
parent d767e5dcfe
commit 6e96cda584
10 changed files with 20 additions and 21 deletions

View File

@@ -101,7 +101,7 @@ class _RestPublicEndpoints(_Requests):
def get_t_tickers(self, pairs: Union[List[str], Literal["ALL"]]) -> List[TradingPairTicker]:
if isinstance(pairs, str) and pairs == "ALL":
return [ cast(TradingPairTicker, sub_data) for sub_data in self.get_tickers([ "ALL" ]) if cast(str, sub_data.SYMBOL).startswith("t") ]
return [ cast(TradingPairTicker, sub_data) for sub_data in self.get_tickers([ "ALL" ]) if cast(str, sub_data.symbol).startswith("t") ]
data = self.get_tickers([ "t" + pair for pair in pairs ])
@@ -109,7 +109,7 @@ class _RestPublicEndpoints(_Requests):
def get_f_tickers(self, currencies: Union[List[str], Literal["ALL"]]) -> List[FundingCurrencyTicker]:
if isinstance(currencies, str) and currencies == "ALL":
return [ cast(FundingCurrencyTicker, sub_data) for sub_data in self.get_tickers([ "ALL" ]) if cast(str, sub_data.SYMBOL).startswith("f") ]
return [ cast(FundingCurrencyTicker, sub_data) for sub_data in self.get_tickers([ "ALL" ]) if cast(str, sub_data.symbol).startswith("f") ]
data = self.get_tickers([ "f" + currency for currency in currencies ])
@@ -218,7 +218,6 @@ class _RestPublicEndpoints(_Requests):
return [ serializers.Liquidation.parse(*sub_data[0]) for sub_data 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)

View File

@@ -15,5 +15,5 @@ open_margin_positions = bfx.rest.auth.get_positions()
# claim all positions
for position in open_margin_positions:
print(f"Position {position}")
claim = bfx.rest.auth.claim_position(position.POSITION_ID, amount=0.000001)
print(f"Claim {claim.NOTIFY_INFO}")
claim = bfx.rest.auth.claim_position(position.position_id, amount=0.000001)
print(f"Claim {claim.notify_info}")

View File

@@ -25,7 +25,7 @@ print("Submit Order Notification:", submitted_order)
# Update it
updated_order = bfx.rest.auth.update_order(
id=submitted_order.NOTIFY_INFO.ID,
id=submitted_order.notify_info.id,
amount="0.020",
price="10100"
)
@@ -33,6 +33,6 @@ updated_order = bfx.rest.auth.update_order(
print("Update Order Notification:", updated_order)
# Delete it
canceled_order = bfx.rest.auth.cancel_order(id=submitted_order.NOTIFY_INFO.ID)
canceled_order = bfx.rest.auth.cancel_order(id=submitted_order.notify_info.id)
print("Cancel Order Notification:", canceled_order)

View File

@@ -27,5 +27,5 @@ print(f"Limits {limits}")
# Update position collateral
response = bfx.rest.auth.set_derivative_position_collateral(symbol="tBTCF0:USTF0", collateral=50)
print(response.STATUS)
print(response.status)

View File

@@ -12,7 +12,7 @@ t_symbol_response = bfx.rest.public.get_trading_market_average_price(
price_limit="20000.5"
)
print(t_symbol_response.PRICE_AVG)
print(t_symbol_response.price_avg)
f_symbol_response = bfx.rest.public.get_funding_market_average_price(
symbol="fUSD",
@@ -21,8 +21,8 @@ f_symbol_response = bfx.rest.public.get_funding_market_average_price(
rate_limit="0.00015"
)
print(f_symbol_response.RATE_AVG)
print(f_symbol_response.rate_avg)
fx_rate = bfx.rest.public.get_fx_rate(ccy1="USD", ccy2="EUR")
print(fx_rate.CURRENT_RATE)
print(fx_rate.current_rate)

View File

@@ -14,9 +14,9 @@ messages = bfx.rest.public.get_pulse_history(end=now, limit=100)
for message in messages:
print(f"Message: {message}")
print(message.CONTENT)
print(message.PROFILE.PICTURE)
print(message.content)
print(message.profile.picture)
profile = bfx.rest.public.get_pulse_profile("News")
print(f"Profile: {profile}")
print(f"Profile picture: {profile.PICTURE}")
print(f"Profile picture: {profile.picture}")

View File

@@ -15,4 +15,4 @@ print(increase_info)
# increase a margin position
notification = bfx.rest.auth.increase_position(symbol="tBTCUSD", amount=0.0001)
print(notification.NOTIFY_INFO)
print(notification.notify_info)

View File

@@ -12,20 +12,20 @@ bfx = Client(
def transfer_wallet():
response = bfx.rest.auth.submit_wallet_transfer(from_wallet="exchange", to_wallet="funding", from_currency="ETH", to_currency="ETH", amount=0.001)
print("Transfer:", response.NOTIFY_INFO)
print("Transfer:", response.notify_info)
def get_existing_deposit_address():
response = bfx.rest.auth.get_deposit_address(wallet="exchange", method="bitcoin", renew=False)
print("Address:", response.NOTIFY_INFO)
print("Address:", response.notify_info)
def create_new_deposit_address():
response = bfx.rest.auth.get_deposit_address(wallet="exchange", method="bitcoin", renew=True)
print("Address:", response.NOTIFY_INFO)
print("Address:", response.notify_info)
def withdraw():
# tetheruse = Tether (ERC20)
response = bfx.rest.auth.submit_wallet_withdraw(wallet="exchange", method="tetheruse", amount=1, address="0x742d35Cc6634C0532925a3b844Bc454e4438f44e")
print("Address:", response.NOTIFY_INFO)
print("Address:", response.notify_info)
def create_lighting_network_deposit_address():
invoice = bfx.rest.auth.get_deposit_invoice(wallet="funding", currency="LNX", amount=0.001)

View File

@@ -19,7 +19,7 @@ class OrderBook(object):
}
def update(self, symbol: str, data: TradingPairBook) -> None:
price, count, amount = data.PRICE, data.COUNT, data.AMOUNT
price, count, amount = data.price, data.count, data.amount
kind = (amount > 0) and "bids" or "asks"

View File

@@ -19,7 +19,7 @@ class RawOrderBook(object):
}
def update(self, symbol: str, data: TradingPairRawBook) -> None:
order_id, price, amount = data.ORDER_ID, data.PRICE, data.AMOUNT
order_id, price, amount = data.order_id, data.price, data.amount
kind = (amount > 0) and "bids" or "asks"