mirror of
https://github.com/aljazceru/bitfinex-api-py.git
synced 2025-12-19 23:04:21 +01:00
Rewrite all rest examples according to v3.0.0b3's changes.
This commit is contained in:
@@ -2,23 +2,17 @@
|
||||
|
||||
import os
|
||||
|
||||
from bfxapi import Client, REST_HOST
|
||||
from bfxapi import Client
|
||||
from bfxapi.types import Notification, Order
|
||||
from bfxapi.enums import OrderType, Flag
|
||||
|
||||
bfx = Client(
|
||||
rest_host=REST_HOST,
|
||||
api_key=os.getenv("BFX_API_KEY"),
|
||||
api_secret=os.getenv("BFX_API_SECRET")
|
||||
)
|
||||
|
||||
# Submit a new order
|
||||
submit_order_notification: Notification[Order] = bfx.rest.auth.submit_order(
|
||||
type=OrderType.EXCHANGE_LIMIT,
|
||||
symbol="tBTCUST",
|
||||
amount=0.015,
|
||||
price=10000,
|
||||
flags=Flag.HIDDEN + Flag.OCO + Flag.CLOSE
|
||||
type="EXCHANGE LIMIT", symbol="tBTCUST", amount=0.015, price=10000
|
||||
)
|
||||
|
||||
print("Submit order notification:", submit_order_notification)
|
||||
@@ -27,16 +21,12 @@ order: Order = submit_order_notification.data
|
||||
|
||||
# Update its amount and its price
|
||||
update_order_notification: Notification[Order] = bfx.rest.auth.update_order(
|
||||
id=order.id,
|
||||
amount=0.020,
|
||||
price=10150
|
||||
id=order.id, amount=0.020, price=10150
|
||||
)
|
||||
|
||||
print("Update order notification:", update_order_notification)
|
||||
|
||||
# Cancel it by its ID
|
||||
cancel_order_notification: Notification[Order] = bfx.rest.auth.cancel_order(
|
||||
id=order.id
|
||||
)
|
||||
cancel_order_notification: Notification[Order] = bfx.rest.auth.cancel_order(id=order.id)
|
||||
|
||||
print("Cancel order notification:", cancel_order_notification)
|
||||
|
||||
Reference in New Issue
Block a user