Artem Kalyta commited on
Commit
9409b88
·
1 Parent(s): 66e4785

minor fixes

Browse files
Files changed (4) hide show
  1. .gitignore +0 -1
  2. config.py +1 -1
  3. prompts.py +4 -2
  4. select_top_financials.py +1 -1
.gitignore CHANGED
@@ -6,5 +6,4 @@
6
  /etf-tech-env
7
  /extras
8
  /.idea
9
- /.idea
10
  __pycache__
 
6
  /etf-tech-env
7
  /extras
8
  /.idea
 
9
  __pycache__
config.py CHANGED
@@ -16,4 +16,4 @@ class Config:
16
  MAIN_SHEET_NAME = "Companies"
17
 
18
  SELECTED_BY_FINANCIALS = "Top Financials"
19
- TEMP_NUMBER_TO_SELECT = 5
 
16
  MAIN_SHEET_NAME = "Companies"
17
 
18
  SELECTED_BY_FINANCIALS = "Top Financials"
19
+ TEMP_NUMBER_TO_SELECT = 15
prompts.py CHANGED
@@ -21,8 +21,10 @@ class Prompts:
21
  "Do not nest values within the JSON."
22
  FINANCIAL_INFORMATION_PROMPT = ""
23
  SELECT_TOP_FINANCIALS_PROMPT = "Select the top {num_companies} companies with the best financials out of the " \
24
- "companies in the provided list based on the financial metrics provided. For each" \
25
- " company provide a short 2-3 bulletpoints justification why this company was " \
 
 
26
  "selected. Format your answer as the following JSON:\n" \
27
  "[{{ticker: company_ticker, justification: justification}}, ...]\n" \
28
  "List of companies with financials: {companies}"
 
21
  "Do not nest values within the JSON."
22
  FINANCIAL_INFORMATION_PROMPT = ""
23
  SELECT_TOP_FINANCIALS_PROMPT = "Select the top {num_companies} companies with the best financials out of the " \
24
+ "companies in the provided list based on the financial metrics provided." \
25
+ " The investment formula is too look for the lower pe ratio (if pe ratio is available), higher market cap," \
26
+ " lower beta (volatility), higher 5-year and 1-year returns, and closer to 1 analyst recommendation." \
27
+ " For each company provide a short 2-3 bulletpoints justification why this company was " \
28
  "selected. Format your answer as the following JSON:\n" \
29
  "[{{ticker: company_ticker, justification: justification}}, ...]\n" \
30
  "List of companies with financials: {companies}"
select_top_financials.py CHANGED
@@ -26,7 +26,7 @@ def get_selected_companies(data: pd.DataFrame) -> dict:
26
  company.update({"ticker": tickers[c]})
27
  prompt = Prompts.SELECT_TOP_FINANCIALS_PROMPT.format(num_companies=Config.TEMP_NUMBER_TO_SELECT,
28
  companies=financial_data)
29
- response = send_openai_request(prompt=prompt)
30
  selected_df = pd.DataFrame(response)
31
  selected_df["justification"] = selected_df["justification"].apply(lambda x: " ".join(x))
32
  selected_df = pd.merge(selected_df, data[financial_columns + ["ticker"]], on="ticker")
 
26
  company.update({"ticker": tickers[c]})
27
  prompt = Prompts.SELECT_TOP_FINANCIALS_PROMPT.format(num_companies=Config.TEMP_NUMBER_TO_SELECT,
28
  companies=financial_data)
29
+ response = send_openai_request(prompt=prompt, max_tokens=3000)
30
  selected_df = pd.DataFrame(response)
31
  selected_df["justification"] = selected_df["justification"].apply(lambda x: " ".join(x))
32
  selected_df = pd.merge(selected_df, data[financial_columns + ["ticker"]], on="ticker")