def test_summarize(): c_dir = os.path.dirname(os.path.abspath(__file__)) base_dir = os.path.join(c_dir, '..') stock_list = os.path.join(base_dir, 'data', 'stocks.txt') data_dir = os.path.join(base_dir, 'test') aggregator = Aggregator(stock_list, data_dir) result = aggregator.summarize() eq_('stocks.txt', os.path.basename(aggregator.stock_list)) eq_('test', os.path.basename(aggregator.data_dir)) eq_(True, result.empty) return result
def start_aggregator(): bc = Dash() user, password = None, None with open("dash.txt", 'r') as f: for line in f: l = line.split("=") if len(l) > 1: if l[0] == 'rpcuser': user = l[1].replace("\n", "") elif l[0] == 'rpcpassword': password = l[1].replace("\n", "") bc.rpc_connect(user, password) agg = Aggregator(bc, "dash_daily.csv", "dash_24h.csv", update_rate=600) agg.synchronize()
''' sets = ['scaled', 'fixed'] loads = [ '001', '010', '020', '030', '040', '050', '060', '070', '080', '090', '100' ] test_location = {} tm = Template(config_file_template) for test_set in sets: for test_load in loads: config = tm.render(set=test_set, load=test_load) test_key = f'todolist-{test_set}-{test_load}' dir_name = os.path.join('/tmp', test_key) test_location[test_key] = dir_name os.makedirs(dir_name, exist_ok=True) with open(os.path.join(dir_name, 'configuration.ini'), 'w') as conf_out: conf_out.writelines(config) source_file = 'sample_results.jtl' target_file = 'result_stats.csv' zip_dir = '/tmp/todolist' for key, value in test_location.items(): with ZipFile(os.path.join(zip_dir, f'{key}.zip'), 'r') as zipObj: zipObj.extractall(value) source_path = os.path.join(value, source_file) target_path = os.path.join(value, target_file) # Cutoff Aggregator(source_path).write_file(target_path)
def __init__(self, filename='stocks.txt', **kwargs): self.c_dir = os.path.dirname(os.path.abspath(__file__)) self.base_dir = os.path.join(self.c_dir, '..') self.data_dir = os.path.join(self.base_dir, 'data') self.stock_list = os.path.join(self.data_dir, filename) self.aggregator = Aggregator(self.stock_list, self.data_dir)