derivatives

This commit is contained in:
itsdeka
2023-01-26 16:44:32 +01:00
committed by Davide Casale
parent ca91588067
commit 48433fbb01
5 changed files with 56 additions and 1 deletions

View File

@@ -0,0 +1,31 @@
# python -c "import examples.rest.derivatives"
import os
from bfxapi.client import Client, Constants
bfx = Client(
REST_HOST=Constants.REST_HOST,
API_KEY=os.getenv("BFX_API_KEY"),
API_SECRET=os.getenv("BFX_API_SECRET")
)
# Create a new order
submitted_order = bfx.rest.auth.submit_order(
symbol="tBTCF0:USTF0",
amount="0.015",
price="16700",
lev=10,
type="LIMIT"
)
print("Submit Order Notification:", submitted_order)
# Get position collateral limits
limits = bfx.rest.auth.get_derivative_position_collateral_limits(symbol="tBTCF0:USTF0")
print(f"Limits {limits}")
# Update position collateral
response = bfx.rest.auth.set_derivative_position_collateral(symbol="tBTCF0:USTF0", collateral=50)
print(response.STATUS)