def synthetic_data7(): """ Reads configs and returns True if configs say that synthetic data should be used, and False otherwise """ config = launch_utils.read_configs() if config["data_source"] == "synthetic": res = True else: res = False return res
from helper_funcs import get_full_path, delete_logs, append_logs, list_to_file, exit7, synthetic_data7 from launch_utils import read_configs, launch_scripts import data_provider from dataset_preprocessing import cleanup_dataset, data_sanity_check time_between_fetches = 1.0 # how often should the data be fetched from the data provider, in seconds this_many_last_observations = 500 # to save them TO a separate file # Reset states delete_logs() # delete logs from the previous sessions with open(get_full_path("state_controls/summonAnomaly.txt"), "w") as f: f.write("0") with open(get_full_path("state_controls/exit7.txt"), "w") as f: f.write("0") data_channels = read_configs()["data_channels"] use_synthetic_data7 = synthetic_data7() append_logs("use_synthetic_data7 : " + str(use_synthetic_data7), "0launcher", "always", "print") append_logs("data_channels : " + str(data_channels), "0launcher", "always", "print") cleanup_dataset(use_synthetic_data7) data_sanity_check(use_synthetic_data7, data_channels) launch_scripts() if use_synthetic_data7: data_filename = "dataset/syntheticData.txt" last_n_filename = "dataset/lastNpoints_synthetic.txt"
""" Converts texts to datapoints, and the other way around. Will be made mostly obsolete after the planned transition to a database is done. """ import pandas as pd import helper_funcs import launch_utils channels = launch_utils.read_configs()["data_channels"] def find_all_positions_of_character(istr, character): return [pos for pos, char in enumerate(istr) if char == character] # a list def get_price_from_substr(istr, original_str): """Extracts the float value (e.g. 7.5) and the channel_name from a string like this: "channel_name; unit; 7.5". Args: istr (str): a string like this: "bitcoin; eur; 7.5" original_str (str): at the very first stage of parcing, before this func is called, we receive a string like: 1585474566.27; bitcoin; eur; 3.664121010741326 § ethereum; eur; 1.0710547987175814 ... We pass it here for debug purposes. """ positions_list = find_all_positions_of_character(istr, ';') if len(positions_list) > 0: temp_list = positions_list[ -1:] # get the position of last ";" as a list of 1 element else:
name4logs = "helper_funcs" def synthetic_data7(): """ Reads configs and returns True if configs say that synthetic data should be used, and False otherwise """ config = launch_utils.read_configs() if config["data_source"] == "synthetic": res = True else: res = False return res use_synthetic_data7 = synthetic_data7() cryptos = launch_utils.read_configs()["data_channels"] log_verbosity = launch_utils.read_configs()["log_verbosity"] def get_full_path(filename): """ Returns the full path of a file assuming that it's located in the same dir as this script. Args: filename (str): the name of the file, including the extension """ __location__ = os.path.realpath( os.path.join(os.getcwd(), os.path.dirname(__file__))) full_path = os.path.join(__location__, filename) return full_path