QuantumLearner commited on
Commit
cb57a13
·
verified ·
1 Parent(s): 2bc2c9f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -13
app.py CHANGED
@@ -7,10 +7,9 @@ import os
7
  # Global Variables
8
  # ---------------------------
9
  API_KEY = os.getenv("FMP_API_KEY")
10
- DEFAULT_RSS_PAGE = 0
11
  DEFAULT_SEARCH_NAME = "enotap"
12
  DEFAULT_CIK = "0001916078"
13
- NUM_PAGES = 10
14
 
15
  # ---------------------------
16
  # Initialize Session State
@@ -35,7 +34,7 @@ if "cik_value" not in st.session_state:
35
  @st.cache_data(show_spinner=False)
36
  def fetch_crowdfunding_rss(page: int) -> pd.DataFrame:
37
  """
38
- Fetch the crowdfunding live feed data for a specific page.
39
  """
40
  url = f"https://financialmodelingprep.com/api/v4/crowdfunding-offerings-rss-feed?page={page}&apikey={API_KEY}"
41
  try:
@@ -105,19 +104,13 @@ def main():
105
  )
106
 
107
  if page == "Crowdfunding Live Feed":
108
- rss_page = st.number_input(
109
- "Live Feed Page",
110
- min_value=0,
111
- value=DEFAULT_RSS_PAGE,
112
- help="Enter the page number to fetch from the crowdfunding live feed."
113
- )
114
- st.session_state.rss_page = rss_page
115
  if st.button("Run Crowdfunding Live Feed"):
116
  st.session_state.run_rss = True
117
  elif page == "Crowdfunding Search":
118
  search_name = st.text_input(
119
  "Campaign/Company Name",
120
- value=DEFAULT_SEARCH_NAME,
121
  help="Enter the name to search for crowdfunding campaigns (e.g., enotap)."
122
  )
123
  st.session_state.search_name = search_name
@@ -126,7 +119,7 @@ def main():
126
  else: # Crowdfunding By CIK
127
  cik_value = st.text_input(
128
  "Company CIK",
129
- value=DEFAULT_CIK,
130
  help="Enter the CIK of the company to fetch its crowdfunding campaigns."
131
  )
132
  st.session_state.cik_value = cik_value
@@ -141,13 +134,14 @@ def main():
141
  "Includes details such as company name, form type, offering amount, and more."
142
  )
143
  if st.session_state.run_rss:
 
144
  df_rss = fetch_crowdfunding_rss(st.session_state.rss_page)
145
  if df_rss.empty:
146
  st.error("No data found for that feed page.")
147
  else:
148
  st.dataframe(df_rss, use_container_width=True)
149
  else:
150
- st.info("Enter the page number in the sidebar and click 'Run Crowdfunding Live Feed'.")
151
 
152
  elif page == "Crowdfunding Search":
153
  st.header("Crowdfunding Search")
 
7
  # Global Variables
8
  # ---------------------------
9
  API_KEY = os.getenv("FMP_API_KEY")
10
+ DEFAULT_RSS_PAGE = 5 # User no longer sees this. We fetch page=5 by default.
11
  DEFAULT_SEARCH_NAME = "enotap"
12
  DEFAULT_CIK = "0001916078"
 
13
 
14
  # ---------------------------
15
  # Initialize Session State
 
34
  @st.cache_data(show_spinner=False)
35
  def fetch_crowdfunding_rss(page: int) -> pd.DataFrame:
36
  """
37
+ Fetch the crowdfunding live feed data for the given page.
38
  """
39
  url = f"https://financialmodelingprep.com/api/v4/crowdfunding-offerings-rss-feed?page={page}&apikey={API_KEY}"
40
  try:
 
104
  )
105
 
106
  if page == "Crowdfunding Live Feed":
107
+ # Removed the page input from the user.
 
 
 
 
 
 
108
  if st.button("Run Crowdfunding Live Feed"):
109
  st.session_state.run_rss = True
110
  elif page == "Crowdfunding Search":
111
  search_name = st.text_input(
112
  "Campaign/Company Name",
113
+ value=st.session_state.search_name,
114
  help="Enter the name to search for crowdfunding campaigns (e.g., enotap)."
115
  )
116
  st.session_state.search_name = search_name
 
119
  else: # Crowdfunding By CIK
120
  cik_value = st.text_input(
121
  "Company CIK",
122
+ value=st.session_state.cik_value,
123
  help="Enter the CIK of the company to fetch its crowdfunding campaigns."
124
  )
125
  st.session_state.cik_value = cik_value
 
134
  "Includes details such as company name, form type, offering amount, and more."
135
  )
136
  if st.session_state.run_rss:
137
+ # The default is set to page=5 in the code. The user cannot change it.
138
  df_rss = fetch_crowdfunding_rss(st.session_state.rss_page)
139
  if df_rss.empty:
140
  st.error("No data found for that feed page.")
141
  else:
142
  st.dataframe(df_rss, use_container_width=True)
143
  else:
144
+ st.info("Click 'Run Crowdfunding Live Feed' to fetch the live feed.")
145
 
146
  elif page == "Crowdfunding Search":
147
  st.header("Crowdfunding Search")