File size: 880 Bytes
c49b21b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import importlib.util
import os

def run_module(module_path, module_name):
    spec = importlib.util.spec_from_file_location(module_name, module_path)
    mod = importlib.util.module_from_spec(spec)
    spec.loader.exec_module(mod)
    if hasattr(mod, 'main'):
        mod.main()
    else:
        print(f"[WARN] {module_name} has no main() function.")

def main():
    this_dir = os.path.dirname(os.path.abspath(__file__))
    finhub_dir = os.path.join(this_dir, 'finhub')
    modules = [
        ('company_info.py', 'company_info'),
        ('sentiment.py', 'sentiment'),
        ('ratings.py', 'ratings'),
        ('quote.py', 'quote'),
    ]
    for fname, mname in modules:
        print(f"[INFO] Merging {mname.replace('_', ' ')}...")
        run_module(os.path.join(finhub_dir, fname), mname)
    print("[INFO] All merges complete.")

if __name__ == "__main__":
    main()