timestamps fix

This commit is contained in:
Nicolás Sánchez 2024-11-13 09:24:09 -03:00
parent c3be184dbf
commit 9771f76dd4
4 changed files with 5 additions and 4 deletions

View File

@ -1,3 +1,5 @@
2024.11.13: Fixed bug handling timestamps.
2024.11.11: 2024.11.11:
. Refactored boost check to optimize CPU usage. . Refactored boost check to optimize CPU usage.

View File

@ -75,7 +75,7 @@ class broker:
try: try:
database_connection = sqlite3.connect("profits/profits_database.db") database_connection = sqlite3.connect("profits/profits_database.db")
database_cursor = database_connection.cursor() database_cursor = database_connection.cursor()
database_cursor.execute(f"SELECT * FROM profits_table WHERE timestamp >= {time.time()-timespan} ORDER BY timestamp DESC") database_cursor.execute(f"SELECT * FROM profits_table WHERE timestamp >= {time.time()-timespan} ORDER BY timestamp")
rows = database_cursor.fetchall() rows = database_cursor.fetchall()
return [item[0] for item in rows if item[1]==pair] return [item[0] for item in rows if item[1]==pair]
except Exception as e: except Exception as e:

View File

@ -22,7 +22,7 @@ In case the permissions of the certificate changes, reset them this way:
# ll /etc/letsencrypt/ # ll /etc/letsencrypt/
''' '''
version = "2024.11.11" version = "2024.11.13"
''' '''
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

View File

@ -1227,10 +1227,9 @@ class trader:
The last n deals must be within the last t seconds The last n deals must be within the last t seconds
''' '''
return len(self.deals_timestamps)>=self.boosted_deals_range and self.deals_timestamps[-1]-self.boosted_time_range<=self.deals_timestamps[-4] return len(self.deals_timestamps)>=self.boosted_deals_range and time.time()-self.boosted_time_range<=self.deals_timestamps[-self.boosted_deals_range]
def get_tp_level(self, order_index: int = 0) -> float: def get_tp_level(self, order_index: int = 0) -> float:
''' '''
Returns the correct take profit percentage, according to the strategy (config_dict["tp_mode"]): Returns the correct take profit percentage, according to the strategy (config_dict["tp_mode"]):