mirror of
https://github.com/aljazceru/bitfinex-api-py.git
synced 2025-12-20 15:24:21 +01:00
Rewrite, edit and organize examples/rest demos.
This commit is contained in:
19
examples/rest/authenticated/claim_position.py
Normal file
19
examples/rest/authenticated/claim_position.py
Normal file
@@ -0,0 +1,19 @@
|
||||
# python -c "import examples.rest.authenticated.claim_position"
|
||||
|
||||
import os
|
||||
|
||||
from bfxapi import Client, REST_HOST
|
||||
|
||||
from bfxapi.rest.types import Notification, PositionClaim
|
||||
|
||||
bfx = Client(
|
||||
REST_HOST=REST_HOST,
|
||||
API_KEY=os.getenv("BFX_API_KEY"),
|
||||
API_SECRET=os.getenv("BFX_API_SECRET")
|
||||
)
|
||||
|
||||
# Claims all active positions
|
||||
for position in bfx.rest.auth.get_positions():
|
||||
notification: Notification[PositionClaim] = bfx.rest.auth.claim_position(position.position_id)
|
||||
claim: PositionClaim = notification.notify_info
|
||||
print(f"Position: {position} | PositionClaim: {claim}")
|
||||
Reference in New Issue
Block a user