Add example to submit, cancel, edit order and adjust issue in labeler.py

This commit is contained in:
itsdeka
2023-01-06 18:22:39 +01:00
committed by Davide Casale
parent ef836bbe1a
commit 22f6fe01fd
4 changed files with 48 additions and 8 deletions

View File

@@ -0,0 +1,36 @@
import os
from bfxapi.client import Client, Constants
from bfxapi.enums import OrderType
from bfxapi.utils.flags import calculate_order_flags
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(
type=OrderType.EXCHANGE_LIMIT,
symbol="tBTCUST",
amount="0.015",
price="10000",
flags=calculate_order_flags(hidden=False)
)
print("Submit Order Notification:", submitted_order)
# Update it
updated_order = bfx.rest.auth.update_order(
id=submitted_order["NOTIFY_INFO"]["ID"],
amount="0.020",
price="10100"
)
print("Update Order Notification:", updated_order)
# Delete it
canceled_order = bfx.rest.auth.cancel_order(id=submitted_order["NOTIFY_INFO"]["ID"])
print("Cancel Order Notification:", canceled_order)