mirror of
https://github.com/aljazceru/bitfinex-api-py.git
synced 2025-12-19 06:44:22 +01:00
Add funding related rest endpoints, refactor pre-existent rest endpoints to use get_ prefix. Add function to calculate flags easily. Add example test to create a funding offer.
This commit is contained in:
26
examples/rest/create_funding_offer.py
Normal file
26
examples/rest/create_funding_offer.py
Normal file
@@ -0,0 +1,26 @@
|
||||
import os
|
||||
|
||||
from bfxapi.client import Client, Constants
|
||||
from bfxapi.utils.flags import calculate_offer_flags
|
||||
from bfxapi.rest.typings import List, FundingOffer, Notification
|
||||
|
||||
bfx = Client(
|
||||
REST_HOST=Constants.REST_HOST,
|
||||
API_KEY=os.getenv("BFX_API_KEY"),
|
||||
API_SECRET=os.getenv("BFX_API_SECRET")
|
||||
)
|
||||
|
||||
notification: Notification = bfx.rest.auth.submit_funding_offer(
|
||||
type="LIMIT",
|
||||
symbol="fUSD",
|
||||
amount="123.45",
|
||||
rate="0.001",
|
||||
period=2,
|
||||
flags=calculate_offer_flags(hidden=True)
|
||||
)
|
||||
|
||||
print("Offer notification:", notification)
|
||||
|
||||
offers: List[FundingOffer] = bfx.rest.auth.get_active_funding_offers()
|
||||
|
||||
print("Offers:", offers)
|
||||
Reference in New Issue
Block a user