mirror of
https://github.com/aljazceru/bitfinex-api-py.git
synced 2025-12-19 14:54:21 +01:00
Rewrite, edit and organize examples/rest demos.
This commit is contained in:
28
examples/rest/public/rest_calculation_endpoints.py
Normal file
28
examples/rest/public/rest_calculation_endpoints.py
Normal file
@@ -0,0 +1,28 @@
|
||||
# python -c "import examples.rest.public.rest_calculation_endpoints"
|
||||
|
||||
from bfxapi import Client, PUB_REST_HOST
|
||||
|
||||
from bfxapi.rest.types import TradingMarketAveragePrice, FundingMarketAveragePrice, FxRate
|
||||
|
||||
bfx = Client(REST_HOST=PUB_REST_HOST)
|
||||
|
||||
trading_market_average_price: TradingMarketAveragePrice = bfx.rest.public.get_trading_market_average_price(
|
||||
symbol="tBTCUSD",
|
||||
amount=-100,
|
||||
price_limit=20000.5
|
||||
)
|
||||
|
||||
print("Average execution price for tBTCUSD:", trading_market_average_price.price_avg)
|
||||
|
||||
funding_market_average_price: FundingMarketAveragePrice = bfx.rest.public.get_funding_market_average_price(
|
||||
symbol="fUSD",
|
||||
amount=100,
|
||||
period=2,
|
||||
rate_limit=0.00015
|
||||
)
|
||||
|
||||
print("Average execution rate for fUSD:", funding_market_average_price.rate_avg)
|
||||
|
||||
fx_rate: FxRate = bfx.rest.public.get_fx_rate(ccy1="USD", ccy2="EUR")
|
||||
|
||||
print("Exchange rate between USD and EUR:", fx_rate.current_rate)
|
||||
Reference in New Issue
Block a user