2025.09.20
This commit is contained in:
parent
451e1a63aa
commit
09f9aa313c
|
|
@ -1,3 +1,6 @@
|
|||
2025.09.20:
|
||||
. Fixed bug that caused short traders to initialize using the same workflow as a long one.
|
||||
|
||||
2025.09.19:
|
||||
. Added pageSize parameter to the open order requests when querying Kucoin.
|
||||
|
||||
|
|
|
|||
|
|
@ -503,28 +503,6 @@ class Broker:
|
|||
return []
|
||||
|
||||
|
||||
# def fetch_full_orders(self,pairs=None) -> list:
|
||||
# '''
|
||||
# Returns a list of all orders on the exchange
|
||||
|
||||
# :param pairs: list of pairs to get orders for
|
||||
# :return: list of orders
|
||||
# '''
|
||||
|
||||
# if pairs is None:
|
||||
# pairs = []
|
||||
# try:
|
||||
# orders = []
|
||||
# if self.get_exchange_name()=="binance":
|
||||
# orders = self.get_opened_orders_binance(pairs)
|
||||
# else:
|
||||
# orders = self.get_opened_orders()
|
||||
# return [] if orders is None else orders
|
||||
# except Exception as e:
|
||||
# self.logger.log_this(f"Exception in fetch_full_orders: {e}",2)
|
||||
# return []
|
||||
|
||||
|
||||
def fetch_open_orders(self,pairs=None) -> list:
|
||||
'''
|
||||
Returns a list of all open orders on the exchange
|
||||
|
|
@ -572,27 +550,6 @@ class Broker:
|
|||
return []
|
||||
|
||||
|
||||
# def get_opened_orders(self,no_retries=False): #It should return a list of all opened orders
|
||||
# '''
|
||||
# Returns a list of all the open orders on the exchange
|
||||
|
||||
# :param pairs: list of pairs
|
||||
# :return: list of all the open orders on the exchange
|
||||
# '''
|
||||
|
||||
# retries = self.retries
|
||||
# while retries>0:
|
||||
# try:
|
||||
# return self.exchange.fetch_open_orders()
|
||||
# except Exception as e:
|
||||
# self.logger.log_this(f"Exception in get_opened_orders: {e}",1)
|
||||
# if no_retries:
|
||||
# break
|
||||
# time.sleep(self.wait_time)
|
||||
# retries-=1
|
||||
# return []
|
||||
|
||||
|
||||
def get_closed_orders(self,pair=None,no_retries=False): #It should return a list of all opened orders
|
||||
'''
|
||||
Returns a list of all the open orders on the exchange
|
||||
|
|
@ -614,27 +571,6 @@ class Broker:
|
|||
return []
|
||||
|
||||
|
||||
# def get_opened_orders_binance(self,pairs):
|
||||
# '''
|
||||
# Returns a list of all the open orders on the exchange
|
||||
|
||||
# :param pairs: list of pairs
|
||||
# :return: list of all the open orders on the exchange
|
||||
# '''
|
||||
|
||||
# try:
|
||||
# if "unified_order_query" in self.broker_config and self.broker_config["unified_order_query"] is True:
|
||||
# return self.exchange.fetch_open_orders()
|
||||
# result = []
|
||||
# for pair in pairs:
|
||||
# a = self.exchange.fetch_open_orders(pair)
|
||||
# result.extend(iter(a))
|
||||
# return result
|
||||
# except Exception as e:
|
||||
# self.logger.log_this(f"Exception in get_opened_orders_binance: {e}",1)
|
||||
# return []
|
||||
|
||||
|
||||
def get_closed_orders_binance(self,pairs):
|
||||
'''
|
||||
Returns a list of all the closed orders on the exchange
|
||||
|
|
@ -1025,9 +961,9 @@ class Broker:
|
|||
if self.get_exchange_name() in ["okex","bybit"]:
|
||||
return float(market["limits"]["amount"]["min"])
|
||||
elif self.get_exchange_name() in ["kucoin"]:
|
||||
return (float(market["limits"]["cost"]["min"])+.1)/self.get_ticker_price(pair)
|
||||
elif self.get_exchange_name() in ["gateio"]:
|
||||
return (float(market["limits"]["cost"]["min"])+.25)/self.get_ticker_price(pair)
|
||||
elif self.get_exchange_name() in ["gateio"]:
|
||||
return (float(market["limits"]["cost"]["min"])+.1)/self.get_ticker_price(pair)
|
||||
elif self.get_exchange_name()=="binance":
|
||||
for line in market["info"]["filters"]:
|
||||
if line["filterType"] == "NOTIONAL":
|
||||
|
|
|
|||
2
main.py
2
main.py
|
|
@ -18,7 +18,7 @@ import exchange_wrapper
|
|||
import trader
|
||||
|
||||
|
||||
version = "2025.09.19"
|
||||
version = "2025.09.20"
|
||||
|
||||
'''
|
||||
Color definitions. If you want to change them, check the reference at https://en.wikipedia.org/wiki/ANSI_escape_code#Colors
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ class trader:
|
|||
|
||||
self.set_pause(True, "start_trader")
|
||||
|
||||
if self.status.get_is_short():
|
||||
if self.config.get_is_short():
|
||||
self.broker.logger.log_this("Calculating optimal order size...",2,self.status.get_pair())
|
||||
|
||||
#Get minimum order size from exchange
|
||||
|
|
@ -774,7 +774,7 @@ class trader:
|
|||
self.status.set_safety_orders([])
|
||||
|
||||
#Handle the partial fills
|
||||
if not self.status.get_is_short():
|
||||
if not self.config.get_is_short():
|
||||
#With short traders is just an accounting issue, since when the trader restarts it will be buying cheaper what it sold more expensive in the partially filled safety order(s)
|
||||
if partial_filled_amount!=0 and len(partial_filled_price)>0 and partial_filled_amount>self.broker.get_min_base_size(self.status.get_pair()):
|
||||
#send a market order and sum the profits and wait for it to be filled
|
||||
|
|
|
|||
Loading…
Reference in New Issue