-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathget_user_open_orders.py
More file actions
48 lines (39 loc) · 1.79 KB
/
Copy pathget_user_open_orders.py
File metadata and controls
48 lines (39 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import asyncio
import os
from decibel import TESTNET_CONFIG
from decibel.read import DecibelReadDex
SUB_ADDR = "0x456..."
async def main() -> None:
read = DecibelReadDex(TESTNET_CONFIG, api_key=os.environ.get("APTOS_NODE_API_KEY"))
response = await read.user_open_orders.get_by_addr(sub_addr=SUB_ADDR, limit=10)
if not response.items:
print(f"No open orders for {SUB_ADDR}")
return
print(f"Open Orders for {SUB_ADDR}:\n")
for order in response.items:
print(f" Order ID: {order.order_id}")
print(f" Parent: {order.parent}")
print(f" Market: {order.market}")
print(f" Client Order ID: {order.client_order_id}")
print(f" Orig Size: {order.orig_size}")
print(f" Remaining Size: {order.remaining_size}")
print(f" Size Delta: {order.size_delta}")
print(f" Price: {order.price}")
print(f" Is Buy: {order.is_buy}")
print(f" Details: {order.details}")
print(f" Transaction Version: {order.transaction_version}")
print(f" Unix MS: {order.unix_ms}")
print(f" Is TPSL: {order.is_tpsl}")
print(f" TP Order ID: {order.tp_order_id}")
print(f" TP Trigger Price: {order.tp_trigger_price}")
print(f" TP Limit Price: {order.tp_limit_price}")
print(f" SL Order ID: {order.sl_order_id}")
print(f" SL Trigger Price: {order.sl_trigger_price}")
print(f" SL Limit Price: {order.sl_limit_price}")
print(f" Order Type: {order.order_type}")
print(f" Trigger Condition: {order.trigger_condition}")
print(f" Order Direction: {order.order_direction}")
print(f" Is Reduce Only: {order.is_reduce_only}")
print()
if __name__ == "__main__":
asyncio.run(main())