complete order list
This commit is contained in:
parent
22f7dc292f
commit
c5415a7e8b
|
|
@ -1,3 +1,6 @@
|
|||
2024.11.17:
|
||||
. The trader is supplied with a complete open order list, instead of only the ids.
|
||||
|
||||
2024.11.13:
|
||||
. Fixed bug handling timestamps.
|
||||
. Added a couple of pauses for OKX.
|
||||
|
|
|
|||
|
|
@ -486,14 +486,15 @@ class broker:
|
|||
if pairs is None:
|
||||
pairs = []
|
||||
try:
|
||||
id_list = []
|
||||
#id_list = []
|
||||
if self.read_config["exchange"]=="binance":
|
||||
orders = self.get_opened_orders_binance(pairs)
|
||||
else:
|
||||
orders = self.get_opened_orders()
|
||||
if orders!=[]:
|
||||
id_list.extend(x["id"] for x in orders)
|
||||
return id_list
|
||||
return self.get_opened_orders_binance(pairs)
|
||||
return self.get_opened_orders()
|
||||
#else:
|
||||
# orders = self.get_opened_orders()
|
||||
#if orders!=[]:
|
||||
# id_list.extend(x["id"] for x in orders)
|
||||
#return id_list
|
||||
except Exception as e:
|
||||
self.logger.log_this(f"Exception in fetch_open_orders: {e}",2)
|
||||
return []
|
||||
|
|
|
|||
2
main.py
2
main.py
|
|
@ -22,7 +22,7 @@ In case the permissions of the certificate changes, reset them this way:
|
|||
# ll /etc/letsencrypt/
|
||||
'''
|
||||
|
||||
version = "2024.11.13"
|
||||
version = "2024.11.17"
|
||||
|
||||
'''
|
||||
Color definitions. If you want to change them, check the reference at https://en.wikipedia.org/wiki/ANSI_escape_code#Colors
|
||||
|
|
|
|||
11
todo.txt
11
todo.txt
|
|
@ -2,12 +2,11 @@ Mandatory:
|
|||
=========
|
||||
0. Mobile app.
|
||||
1. Stats webpage.
|
||||
2. Instead of providing a list of order_ids to each trader, provide a list of the open orders for easier future development, including partial order fills.
|
||||
3. Maintain local orderbooks for each trading pair, which enables:
|
||||
3a. Smart order pricing: Prioritization of fill speed over instant profit or vice versa
|
||||
4. Consolidate vocabulary (trader, pair and bot; instance & trader)
|
||||
5. Base add for short traders.
|
||||
6. Proper handling of order price too high/low in OKX (rare, it happens when under heavy volatility).
|
||||
2. Maintain local orderbooks for each trading pair, which enables:
|
||||
2a. Smart order pricing: Prioritization of fill speed over instant profit or vice versa
|
||||
3. Consolidate vocabulary (trader, pair and bot; instance & trader)
|
||||
4. Base add for short traders.
|
||||
5. Proper handling of order price too high/low in OKX (rare, it happens when under heavy volatility).
|
||||
|
||||
|
||||
Would be nice to have:
|
||||
|
|
|
|||
|
|
@ -1100,6 +1100,9 @@ class trader:
|
|||
self.update_status(False)
|
||||
return 0
|
||||
|
||||
#Extract ids from order list
|
||||
open_orders_ids = [order["id"] for order in open_orders if order["symbol"]==self.pair]
|
||||
|
||||
#Checks if the orders are valid
|
||||
if self.tp_order is None:
|
||||
self.broker.logger.log_this("Take profit order is None",1,self.pair)
|
||||
|
|
@ -1121,7 +1124,7 @@ class trader:
|
|||
return 1
|
||||
|
||||
#Checks if the take profit order is filled
|
||||
if self.tp_order["id"] not in open_orders:
|
||||
if self.tp_order["id"] not in open_orders_ids:
|
||||
tp_status = self.broker.get_order(self.tp_order["id"],self.pair)
|
||||
if tp_status["status"]=="closed":
|
||||
if tp_status["filled"]>0:
|
||||
|
|
@ -1150,7 +1153,7 @@ class trader:
|
|||
return 1
|
||||
|
||||
# Check if safety order is filled
|
||||
if self.so["id"] not in open_orders and self.safety_order_index<=self.config_dict["no_of_safety_orders"]:
|
||||
if self.so["id"] not in open_orders_ids and self.safety_order_index<=self.config_dict["no_of_safety_orders"]:
|
||||
#so_status = self.so
|
||||
#if self.so["id"]!="":
|
||||
so_status = self.broker.get_order(self.so["id"],self.pair)
|
||||
|
|
|
|||
Loading…
Reference in New Issue