import time


def period_aligned_now(period_seconds: int) -> str:
  """Return a MQL date string for the current timestamp aligned to the given period.

  This will return "now - now%period" in a MQL-parseable date string and is useful
  to get stable results. See also: (internal)
  """

  now = time.time()
  now -= now % period_seconds
  return time.strftime('%Y/%m/%d-%H:%M:%S+00:00', time.gmtime(now))