This commit is contained in:
Nicolás Sánchez 2025-09-03 20:10:42 -03:00
parent bb3fb692df
commit 84bada9967
5 changed files with 24 additions and 17 deletions

View File

@ -37,6 +37,9 @@ class ConfigHandler:
"force_restart_if_retries_exhausted": False, "force_restart_if_retries_exhausted": False,
"check_old_long_price": False #switch_to_short should flip this to True unless stated "check_old_long_price": False #switch_to_short should flip this to True unless stated
} }
if self.broker.get_exchange_name()=="kucoin":
self.default_config_dictionary["concurrent_safety_orders"]=1
self.default_config_dictionary["boosted_concurrent_safety_orders"]=1
self.config_file_path = f"configs/{pair.split('/')[0]}{pair.split('/')[1]}.json" self.config_file_path = f"configs/{pair.split('/')[0]}{pair.split('/')[1]}.json"
self.config_dictionary = self.default_config_dictionary.copy() self.config_dictionary = self.default_config_dictionary.copy()

View File

@ -379,6 +379,11 @@ class Broker:
if self.get_exchange_name()=="binance": if self.get_exchange_name()=="binance":
a = self.exchange.fetch_last_prices(pair_list) a = self.exchange.fetch_last_prices(pair_list)
return {x: a[x]["price"] for x in a.keys()} return {x: a[x]["price"] for x in a.keys()}
elif self.get_exchange_name()=="kucoin":
a = self.exchange.fetch_tickers(pair_list)
if pair_list is None:
return {x: a[x]["close"] for x in a.keys()}
return {x: a[x]["close"] for x in a.keys() if x in pair_list}
else: else:
a = self.exchange.fetch_tickers() a = self.exchange.fetch_tickers()
if pair_list is None: if pair_list is None:

View File

@ -18,7 +18,7 @@ import exchange_wrapper
import trader import trader
version = "2025.09.02" version = "2025.09.03"
''' '''
Color definitions. If you want to change them, check the reference at https://en.wikipedia.org/wiki/ANSI_escape_code#Colors Color definitions. If you want to change them, check the reference at https://en.wikipedia.org/wiki/ANSI_escape_code#Colors
@ -277,7 +277,7 @@ def main_routine():
global reload_interval global reload_interval
global screen_buffer global screen_buffer
executor = ThreadPoolExecutor(max_workers=len(running_traders)+worker_threads_overprovisioning) executor = ThreadPoolExecutor(max_workers=len(broker.get_config()["pairs"])+worker_threads_overprovisioning)
is_testnet = "TESTNET " if broker.get_config()["is_sandbox"] else "" is_testnet = "TESTNET " if broker.get_config()["is_sandbox"] else ""
exchange_version_label = f"{bright_white}{broker.get_config()['exchange'].upper()} {is_testnet}{white}| DCAv2 {version} | CCXT v{ccxt.__version__}" exchange_version_label = f"{bright_white}{broker.get_config()['exchange'].upper()} {is_testnet}{white}| DCAv2 {version} | CCXT v{ccxt.__version__}"
separator_line = blue + "="*80 + white separator_line = blue + "="*80 + white
@ -325,7 +325,6 @@ def main_routine():
price_list = broker.get_prices(pairs_to_fetch) price_list = broker.get_prices(pairs_to_fetch)
#Here, assign the prices to the dusters (if any) #Here, assign the prices to the dusters (if any)
for future in as_completed(futures): for future in as_completed(futures):
try: try:
future.result() future.result()

View File

@ -7,8 +7,7 @@ Mandatory:
3. API documentation. 3. API documentation.
4. Implement api key hashing. 4. Implement api key hashing.
5. Dockerize. 5. Dockerize.
6. When autoswitching to long, instead of using a big market order, the last safety order should be a sell order of all the available funds. 6. Earn should be integrated into the instance, in order to be able to invest the idle funds from the short traders.
7. Earn should be integrated into the instance, in order to be able to invest the idle funds from the short traders.
Would be nice to have: Would be nice to have:
@ -16,7 +15,8 @@ Would be nice to have:
0. Trader order: alphabetical; by uptime; by safety orders, by percentage_to_completion. (Although this may be more suitable for the web and mobile apps) 0. Trader order: alphabetical; by uptime; by safety orders, by percentage_to_completion. (Although this may be more suitable for the web and mobile apps)
1. Local implementation of amount_to_precision, cost_to_precision and price_to_precision. (Unless the plan is to continue to use CCXT forever) 1. Local implementation of amount_to_precision, cost_to_precision and price_to_precision. (Unless the plan is to continue to use CCXT forever)
2. Instead of cancelling and resending the take profit order, edit it (Kucoin only supports editing on high frequency orders) 2. Instead of cancelling and resending the take profit order, edit it (Kucoin only supports editing on high frequency orders)
3. Round-robin trading pairs: Instead of a fixed list of trading pairs, after n closed deals the trader is terminated and a new one spawns, picking the trading pair 3. When autoswitching to long, instead of using a big market order, the last safety order should be a sell order of all the available funds.
4. Round-robin trading pairs: Instead of a fixed list of trading pairs, after n closed deals the trader is terminated and a new one spawns, picking the trading pair
from a pre-populated list (the trading pairs can be selected by using Yang-Zhang, Parkinson or another volatility indicator) from a pre-populated list (the trading pairs can be selected by using Yang-Zhang, Parkinson or another volatility indicator)
This could be very benefitial, since it limits the long time commitment to a small list of trading pairs, enabling the instance to react to market trends very This could be very benefitial, since it limits the long time commitment to a small list of trading pairs, enabling the instance to react to market trends very
rapidly. rapidly.

View File

@ -1150,14 +1150,14 @@ class trader:
self.broker.logger.log_this("Take profit order closed but not filled, trader restart disabled.",1,self.status.get_pair()) self.broker.logger.log_this("Take profit order closed but not filled, trader restart disabled.",1,self.status.get_pair())
return 1 return 1
elif tp_status["status"]=="canceled": elif tp_status["status"]=="canceled":
#TODO: Here, if the safety order is still open, we could resend the tp order. #TODO: Here, if the safety order is still open, we could resend the tp order.
if self.config.get_attempt_restart(): if self.config.get_attempt_restart():
self.broker.logger.log_this("Take profit order canceled. Restarting the trader.",1,self.status.get_pair()) self.broker.logger.log_this("Take profit order canceled. Restarting the trader.",1,self.status.get_pair())
self.status.save_to_file(is_backup=True) self.status.save_to_file(is_backup=True)
self.restart = True self.restart = True
else: else:
self.broker.logger.log_this("Take profit order canceled. Trader restart disabled.",1,self.status.get_pair()) self.broker.logger.log_this("Take profit order canceled. Trader restart disabled.",1,self.status.get_pair())
return 1 return 1
elif tp_status["status"]=="": elif tp_status["status"]=="":
self.broker.logger.log_this(f"Take profit order search returned empty order. Order ID: {tp_status['id']}",1,self.status.get_pair()) self.broker.logger.log_this(f"Take profit order search returned empty order. Order ID: {tp_status['id']}",1,self.status.get_pair())
return 1 return 1