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:
itsdeka
2023-01-06 15:18:57 +01:00
committed by Davide Casale
parent 72a3252e32
commit ef836bbe1a
7 changed files with 170 additions and 37 deletions

View 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)