INNER CODE UNIT · Python

MarketIsOpen

Mo-Khalifa96/Forex-Trading-Bot · TimeProcessing.py:6

def MarketIsOpen():
    '''This function adjusts the bot's working to the forex market working hours (UTC time).'''

    #Adjusting bot working hours according to UTC time
    date_now = datetime.now(tz=utc)
    time_now = date_now.time()
    open_time, close_time = time(hour=22, minute=00, second=00), time(hour=21, minute=59, second=00)
    if date_now.weekday() != 5:
        if date_now.weekday() == 6 and time_now < open_time:
            return False
        elif date_now.weekday() == 4 and time_now >= close_time:
            return False
        else:
            return True
    else:
        return False

def NewCandleUpdate(tframe: str, CandlesRetrieved: int):

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…