open_orders prefiltered before hitting the orders
This commit is contained in:
parent
e888ee0c78
commit
9391f18051
|
|
@ -6,6 +6,7 @@
|
|||
. Decorator for api endpoints error handling
|
||||
. Input validation in api parameters
|
||||
. credentials.py import fallback
|
||||
. open_orders prefiltered before hitting the traders
|
||||
|
||||
2026.06.03:
|
||||
. Fixed tp mode 2 non-functional
|
||||
|
|
|
|||
5
main.py
5
main.py
|
|
@ -336,9 +336,12 @@ def main_routine():
|
|||
pairs_to_fetch.append(instance.status.get_pair())
|
||||
|
||||
open_orders = broker.fetch_open_orders(pairs_to_fetch)
|
||||
open_orders_by_pair = {}
|
||||
for order in open_orders:
|
||||
open_orders_by_pair.setdefault(order["symbol"], []).append(order)
|
||||
with traders_lock:
|
||||
for instance in running_traders:
|
||||
future = executor.submit(instance.check_status, open_orders)
|
||||
future = executor.submit(instance.check_status, open_orders_by_pair)
|
||||
futures.append(future)
|
||||
online_pairs.append(f"{instance.base}{instance.quote}")
|
||||
|
||||
|
|
|
|||
|
|
@ -1099,7 +1099,7 @@ class trader:
|
|||
return (base_left*price)+self.status.get_quote_spent()>=old_target
|
||||
|
||||
|
||||
def check_status(self,open_orders: list) -> int: #Should I change the order? Check the SO first?
|
||||
def check_status(self,open_orders: dict) -> int: #Should I change the order? Check the SO first?
|
||||
'''
|
||||
Main routine. It checks for closed orders and proceeds accordingly.
|
||||
'''
|
||||
|
|
@ -1128,7 +1128,8 @@ class trader:
|
|||
|
||||
#Extract ids from order list
|
||||
self.status.set_pause_reason("filtering open orders")
|
||||
open_orders_list = [order for order in open_orders if order["symbol"]==self.status.get_pair()]
|
||||
#open_orders_list = [order for order in open_orders if order["symbol"]==self.status.get_pair()]
|
||||
open_orders_list = open_orders.get(self.status.get_pair(),[])
|
||||
open_orders_ids = [order["id"] for order in open_orders_list]
|
||||
|
||||
self.status.set_pause_reason("check if tp_order is valid")
|
||||
|
|
|
|||
Loading…
Reference in New Issue