Skip to content

Commit

Permalink
#210 - Added date/time into the results
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions committed Oct 12, 2024
1 parent 221a0f1 commit acf2b31
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions pkscreener/classes/ScreeningStatistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -3217,6 +3217,21 @@ def validateLTP(self, df, screenDict, saveDict, minLTP=None, maxLTP=None,minChan
ltpValid = float(str(pct_save).replace("%","")) >= minChange
saveDict["LTP"] = round(ltp, 2)
screenDict["LTP"] = (colorText.GREEN if ltpValid else colorText.FAIL) + ("%.2f" % ltp) + colorText.END
try:
dateTimePart = str(recent.index[0]).split(" ")
if len(dateTimePart) == 1:
indexDate = PKDateUtilities.dateFromYmdString(dateTimePart[0])
dayDate = f"{indexDate.day}/{indexDate.month}"
elif len(dateTimePart) == 2:
today = PKDateUtilities.currentDateTime()
indexDate = datetime.datetime.strptime(str(recent.index[0]),"%Y-%m-%d %H:%M:%S").replace(tzinfo=today.tzinfo)
dayDate = f"{indexDate.day}/{indexDate.month} {indexDate.hour}:{indexDate.minute}"
screenDict["Time"] = f"{colorText.FAIL}{dayDate}{colorText.END}"
saveDict["Time"] = str(dayDate)
except Exception as e:
self.default_logger.debug(e, exc_info=True)
pass

return ltpValid, verifyStageTwo
screenDict["LTP"] = colorText.FAIL + ("%.2f" % ltp) + colorText.END
saveDict["LTP"] = round(ltp, 2)
Expand Down

0 comments on commit acf2b31

Please sign in to comment.