Rewrite all rest examples according to v3.0.0b3's changes.

This commit is contained in:
Davide Casale
2023-10-26 17:46:38 +02:00
parent 9287723678
commit 1ec6c49428
15 changed files with 141 additions and 139 deletions

View File

@@ -1,15 +1,12 @@
# python -c "import examples.rest.auth.toggle_keep_funding"
import os
from typing import List
from bfxapi import Client, REST_HOST
from bfxapi import Client
from bfxapi.types import FundingLoan, Notification
bfx = Client(
rest_host=REST_HOST,
api_key=os.getenv("BFX_API_KEY"),
api_secret=os.getenv("BFX_API_SECRET")
)
@@ -18,9 +15,7 @@ loans: List[FundingLoan] = bfx.rest.auth.get_funding_loans(symbol="fUSD")
# Set every loan's keep funding status to <off> (1: <on>, 2: <off>)
notification: Notification[None] = bfx.rest.auth.toggle_keep_funding(
type="loan",
ids=[ loan.id for loan in loans ],
changes={ loan.id: 2 for loan in loans }
type="loan", ids=[loan.id for loan in loans], changes={loan.id: 2 for loan in loans}
)
print("Toggle keep funding notification:", notification)