diff --git a/changelog.txt b/changelog.txt index 439ba31..587adc1 100755 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,7 @@ +2025.09.25: +. Added a pause after getting filled orders in check_status. +. Added an extra logging line in take_profit_routine. + 2025.09.24: . Added a new config option: wait_after_initial_market_order. If specifies in seconds the amount of wait time after sending the initial market order. It should help the exchanges to report correctly the recently filled market order. diff --git a/main.py b/main.py index ea4e754..911eba8 100644 --- a/main.py +++ b/main.py @@ -18,7 +18,7 @@ import exchange_wrapper import trader -version = "2025.09.24" +version = "2025.09.25" ''' Color definitions. If you want to change them, check the reference at https://en.wikipedia.org/wiki/ANSI_escape_code#Colors diff --git a/trader.py b/trader.py index 50a8fcc..3dc1e1a 100755 --- a/trader.py +++ b/trader.py @@ -197,6 +197,10 @@ class trader: #Sending initial order + # + # Here, if the amount of the initial order is already available in the account, don't send a market order; just pull the current price and simulate that the order was sent and filled. + # Cleanup probably would have to be disabled for this to make sense. + # self.status.set_pause_reason("start_trader - sending first order") self.broker.logger.log_this("Sending first order...",2,self.status.get_pair()) action = "sell" if self.config.get_is_short() else "buy" @@ -789,6 +793,7 @@ class trader: partial_profit = market_order["cost"]-(avg_buy_price*partial_filled_amount)-self.parse_fees(market_order)[1] self.status.set_partial_profit(self.status.get_partial_profit()+partial_profit) break + self.broker.logger.log_this("Waiting for partial fill sell order to fill.",1,self.status.get_pair()) tries-=1 time.sleep(self.broker.get_wait_time()) if tries==0: @@ -1186,6 +1191,7 @@ class trader: filled_orders = [] for id in filled_ids: order = self.broker.get_order(id, self.status.get_pair()) + time.sleep(self.broker.get_wait_time()) if order["status"]=="closed": filled_orders.append(order) if len(filled_orders)>0: #To make sure that the safety orders are actually filled (Kucoin sometimes sends incomplete order lists)