<gh_stars>0
from vanga_me_core import get_coins_predictions_for_last_x_hours_or_days, get_coin_predictions_history_accuracy
from vanga_me_file_handling import get_search_term_google_and_yf_ticker_names_from_file, create_vanga_me_db_file
from vanga_me_dates_support import get_dates_between_dates
from datetime import datetime


__DETAILED_PRINTING__ = True
use_future_prediction_func = False
get_coins_from_file = False
coin_names_file = "coins.txt"


def main(google_terms_and_yahoo_tickers, _days_to_subtract=None, _check_x_last_hours=None):

    if not create_vanga_me_db_file():
        print('DB CONNECTION ERROR')
        return

    if use_future_prediction_func is True:
        coin_names = []
        for term in google_terms_and_yahoo_tickers:
            coin_names.append(term[0])

        predictions = get_coins_predictions_for_last_x_hours_or_days(coin_names, _days_to_subtract, _check_x_last_hours)

        print("\n\n\n\n\n")
        for prediction in predictions.items():
            print(prediction)

    else:
        # _dates = get_dates_between_dates('2021-11-25', datetime.now().strftime("%Y-%m-%d"))
        # _dates = get_dates_between_dates('2021-01-01', '2022-01-01')
        # _dates = None
        # if not create_vanga_me_db_file():
        #     print(f'could not create db file')

        prediction_accuracy = get_coin_predictions_history_accuracy(google_terms_and_yahoo_tickers,
                                                                    start_date="2014-01-01",
                                                                    end_date=datetime.now().strftime("%Y-%m-%d"),
                                                                    multiprocess_enabled=True)

        print("\n\n\n\n\n")
        for prediction in prediction_accuracy.items():
            print(prediction)


if __name__ == '__main__':

    basic_search_term_google_and_yf_ticker_name = [['Bitcoin', 'BTC-USD'], ['Ethereum', 'ETH-USD'],
                                                   ['BinanceCoin', 'BNB-USD'],
                                                   ['Tether', 'USDT-USD'], ['Cardano ', 'ADA-USD'],
                                                   ['Solana', 'SOL1-USD'],
                                                   ['XRP', 'XRP-USD'], ['Polkadot', 'DOT1-USD'],
                                                   ['USDCoin', 'USDC-USD'],
                                                   ['"hex coin"', 'HEX-USD'], ['Dogecoin', 'DOGE-USD'],
                                                   ['Avalanche', 'AVAX-USD']
                                                   ]

    if get_coins_from_file:
        search_term_google_and_yf_ticker_name = get_search_term_google_and_yf_ticker_names_from_file(coin_names_file)
        if len(search_term_google_and_yf_ticker_name) > 0:
            print('got search terms from file')
        else:
            print('check if file do not exist or empty dude/t')

            search_term_google_and_yf_ticker_name = basic_search_term_google_and_yf_ticker_name
    else:
        search_term_google_and_yf_ticker_name = basic_search_term_google_and_yf_ticker_name

    # search_term_google_and_yf_ticker_name = search_term_google_and_yf_ticker_name[:5]

    main(search_term_google_and_yf_ticker_name, _check_x_last_hours=1)

# def main():

#    directory_name = datetime.now().strftime("%Y-%m-%d_(%H-%M-%S)")

#    if not create_data_collecting_directory(directory_name):
#       return

#   return_dict = manager.dict()
#   print(f'\nnumber of coins to search: {len(search_term_google_and_yf_ticker_name)}\n')

#   for coin_name in search_term_google_and_yf_ticker_name:
#       coin_filename = directory_name + '\\' + coin_name[0].strip('"') + "_prediction_accuracy_" + \
#                       datetime.now().strftime("%y-%m-%d_%H-%M-%S") + ".txt"

#       dates_str = None
#       # dates = get_dates_between_dates('2021-11-01', '2021-11-28')
#       # dates_str = get_str_dates_from_dates(dates)


#       thread = threading.Thread(target=output_crypto_prediction_accuracy_to_file_between_dates,
#                           args=[dates_str, coin_name[0], coin_filename, coin_name[1]])

#       thread.name = coin_name[0]
#       thread.start()
#       print(f'{thread.name} has started')
#       jobs.append(thread)

#   for thread in jobs:
#       thread.join()
#       print(f'{thread.name} has joined')

#   output_final_data_to_summary_file(directory_name, return_dict)

#   # for thread in threads:
#   #    thread.join()

#   print("\nAll Set And Done!\n")

from vanga_me_core import get_coins_predictions_for_last_x_hours_or_days, get_coin_predictions_history_accuracy
from vanga_me_file_handling import get_search_term_google_and_yf_ticker_names_from_file, create_vanga_me_db_file
from vanga_me_dates_support import get_dates_between_dates
from datetime import datetime


__DETAILED_PRINTING__ = True
use_future_prediction_func = False
get_coins_from_file = False
coin_names_file = "coins.txt"


def main(google_terms_and_yahoo_tickers, _days_to_subtract=None, _check_x_last_hours=None):

    if not create_vanga_me_db_file():
        print('DB CONNECTION ERROR')
        return

    if use_future_prediction_func is True:
        coin_names = []
        for term in google_terms_and_yahoo_tickers:
            coin_names.append(term[0])

        predictions = get_coins_predictions_for_last_x_hours_or_days(coin_names, _days_to_subtract, _check_x_last_hours)

        print("\n\n\n\n\n")
        for prediction in predictions.items():
            print(prediction)

    else:
        # _dates = get_dates_between_dates('2021-11-25', datetime.now().strftime("%Y-%m-%d"))
        # _dates = get_dates_between_dates('2021-01-01', '2022-01-01')
        # _dates = None
        # if not create_vanga_me_db_file():
        #     print(f'could not create db file')

        prediction_accuracy = get_coin_predictions_history_accuracy(google_terms_and_yahoo_tickers,
                                                                    start_date="2014-01-01",
                                                                    end_date=datetime.now().strftime("%Y-%m-%d"),
                                                                    multiprocess_enabled=True)

        print("\n\n\n\n\n")
        for prediction in prediction_accuracy.items():
            print(prediction)


if __name__ == '__main__':

    basic_search_term_google_and_yf_ticker_name = [['Bitcoin', 'BTC-USD'], ['Ethereum', 'ETH-USD'],
                                                   ['BinanceCoin', 'BNB-USD'],
                                                   ['Tether', 'USDT-USD'], ['Cardano ', 'ADA-USD'],
                                                   ['Solana', 'SOL1-USD'],
                                                   ['XRP', 'XRP-USD'], ['Polkadot', 'DOT1-USD'],
                                                   ['USDCoin', 'USDC-USD'],
                                                   ['"hex coin"', 'HEX-USD'], ['Dogecoin', 'DOGE-USD'],
                                                   ['Avalanche', 'AVAX-USD']
                                                   ]

    if get_coins_from_file:
        search_term_google_and_yf_ticker_name = get_search_term_google_and_yf_ticker_names_from_file(coin_names_file)
        if len(search_term_google_and_yf_ticker_name) > 0:
            print('got search terms from file')
        else:
            print('check if file do not exist or empty dude/t')

            search_term_google_and_yf_ticker_name = basic_search_term_google_and_yf_ticker_name
    else:
        search_term_google_and_yf_ticker_name = basic_search_term_google_and_yf_ticker_name

    # search_term_google_and_yf_ticker_name = search_term_google_and_yf_ticker_name[:5]

    main(search_term_google_and_yf_ticker_name, _check_x_last_hours=1)

# def main():

#    directory_name = datetime.now().strftime("%Y-%m-%d_(%H-%M-%S)")

#    if not create_data_collecting_directory(directory_name):
#       return

#   return_dict = manager.dict()
#   print(f'\nnumber of coins to search: {len(search_term_google_and_yf_ticker_name)}\n')

#   for coin_name in search_term_google_and_yf_ticker_name:
#       coin_filename = directory_name + '\\' + coin_name[0].strip('"') + "_prediction_accuracy_" + \
#                       datetime.now().strftime("%y-%m-%d_%H-%M-%S") + ".txt"

#       dates_str = None
#       # dates = get_dates_between_dates('2021-11-01', '2021-11-28')
#       # dates_str = get_str_dates_from_dates(dates)


#       thread = threading.Thread(target=output_crypto_prediction_accuracy_to_file_between_dates,
#                           args=[dates_str, coin_name[0], coin_filename, coin_name[1]])

#       thread.name = coin_name[0]
#       thread.start()
#       print(f'{thread.name} has started')
#       jobs.append(thread)

#   for thread in jobs:
#       thread.join()
#       print(f'{thread.name} has joined')

#   output_final_data_to_summary_file(directory_name, return_dict)

#   # for thread in threads:
#   #    thread.join()

#   print("\nAll Set And Done!\n")
# _dates = get_dates_between_dates('2021-11-25', datetime.now().strftime("%Y-%m-%d")) # _dates = get_dates_between_dates('2021-01-01', '2022-01-01') # _dates = None # if not create_vanga_me_db_file(): #     print(f'could not create db file') # search_term_google_and_yf_ticker_name = search_term_google_and_yf_ticker_name[:5] # def main(): #    directory_name = datetime.now().strftime("%Y-%m-%d_(%H-%M-%S)") #    if not create_data_collecting_directory(directory_name): #       return #   return_dict = manager.dict() #   print(f'\nnumber of coins to search: {len(search_term_google_and_yf_ticker_name)}\n') #   for coin_name in search_term_google_and_yf_ticker_name: #       coin_filename = directory_name + '\\' + coin_name[0].strip('"') + "_prediction_accuracy_" + \ #                       datetime.now().strftime("%y-%m-%d_%H-%M-%S") + ".txt" #       dates_str = None #       # dates = get_dates_between_dates('2021-11-01', '2021-11-28') #       # dates_str = get_str_dates_from_dates(dates) #       thread = threading.Thread(target=output_crypto_prediction_accuracy_to_file_between_dates, #                           args=[dates_str, coin_name[0], coin_filename, coin_name[1]]) #       thread.name = coin_name[0] #       thread.start() #       print(f'{thread.name} has started') #       jobs.append(thread) #   for thread in jobs: #       thread.join() #       print(f'{thread.name} has joined') #   output_final_data_to_summary_file(directory_name, return_dict) #   # for thread in threads: #   #    thread.join() #   print("\nAll Set And Done!\n")