-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmain.py
51 lines (41 loc) · 2.86 KB
/
main.py
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
from import_ticks import import_ticks_for_indicator
from analyze_data import read_triggers, load_news_pip_data_at_timedeltas, calc_news_pip_metrics, news_pip_metrics_to_dfs, read_news_data
from utils import get_indicator_info, get_higher_dev_expected_direction
from scrape import update_indicator_history
from generate_report import render_pdf_report, render_markdown
from scheduler import get_triggers_vars, get_day, render_event_html
import datetime
def analyze_indicator(trading_symbol, haawks_id_str):
# Perform analysis on the selected indicator and trading symbol
indicator_info = get_indicator_info(haawks_id_str) # Gets indicator info (dict) by reading from haawks shortlist
underlying_currency = indicator_info['inv_currency']
underlying_currency_higher_dev = indicator_info['higher_dev']
symbol_higher_dev = get_higher_dev_expected_direction(trading_symbol, underlying_currency, underlying_currency_higher_dev)
if input("Check investing.com for updated news data? (Y/n)").upper() in ['Y', ""]:
news_data = update_indicator_history(haawks_id_str)
else:
news_data = read_news_data(haawks_id_str)
import_ticks_for_indicator(haawks_id_str, trading_symbol)
triggers = read_triggers(haawks_id_str)
news_pip_data = load_news_pip_data_at_timedeltas(haawks_id_str, news_data, trading_symbol)
news_pip_metrics = calc_news_pip_metrics(haawks_id_str, news_pip_data, triggers, symbol_higher_dev)
news_pip_metrics_dfs = news_pip_metrics_to_dfs(news_pip_metrics)
render_pdf_report(haawks_id_str, trading_symbol, news_data, news_pip_metrics_dfs, triggers, symbol_higher_dev, indicator_info)
def generate_report(trading_symbol, haawks_id_str):
# Perform analysis on the selected indicator and trading symbol
indicator_info = get_indicator_info(haawks_id_str) # Gets indicator info (dict) by reading from haawks shortlist
underlying_currency = indicator_info['inv_currency']
underlying_currency_higher_dev = indicator_info['higher_dev']
symbol_higher_dev = get_higher_dev_expected_direction(trading_symbol, underlying_currency, underlying_currency_higher_dev)
if input("Check investing.com for updated news data? (Y/n)").upper() in ['Y', ""]:
news_data = update_indicator_history(haawks_id_str)
else:
news_data = read_news_data(haawks_id_str)
import_ticks_for_indicator(haawks_id_str, trading_symbol)
triggers = read_triggers(haawks_id_str)
news_pip_data = load_news_pip_data_at_timedeltas(haawks_id_str, news_data, trading_symbol)
news_pip_metrics = calc_news_pip_metrics(haawks_id_str, news_pip_data, triggers, symbol_higher_dev)
news_pip_metrics_dfs = news_pip_metrics_to_dfs(news_pip_metrics)
render_pdf_report(haawks_id_str, trading_symbol, news_data, news_pip_metrics_dfs, triggers, symbol_higher_dev, indicator_info)
if __name__ == "__main__":
generate_report("USDJPY", "10000")