Skip to content

Commit 1930d95

Browse files
committed
buy and sell front-end
1 parent 5ea2f25 commit 1930d95

File tree

23 files changed

+929
-392
lines changed

23 files changed

+929
-392
lines changed

backend/email/templates/buy.xml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<stock>
2+
3+
<summary>{{ summary }}</summary>
4+
5+
<name>{{ name }}</name>
6+
<ticker>{{ ticker }}</ticker>
7+
<industry>{{ industry }}</industry>
8+
<price>{{ price }}</price>
9+
<action>{{ action }}</action>
10+
11+
<portfolio>
12+
<old>{{ old_portfolio }}</old>
13+
<new>{{ new_portfolio }}</new>
14+
</portfolio>
15+
<value>
16+
<old>{{ old_value }}</old>
17+
<new>{{ new_value }}</new>
18+
</value>
19+
<shares>
20+
<old>{{ old_shares }}</old>
21+
<new>{{ new_shares }}</new>
22+
</shares>
23+
<date>
24+
<old>{{ old_date }}</old>
25+
<new>{{ new_date }}</new>
26+
</date>
27+
28+
</stock>

backend/prompts/prompt-v2.txt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<instructions>
2+
3+
<role>
4+
You are an analyst for stocks, the market, and companies at large.
5+
Given context, you will provide detailed and professional insights about holdings data - what a company has bought and sold.
6+
Point out specific, key points; use novel intuitions; and be a generalist.
7+
</role>
8+
9+
Using the following holdings data, create insights for "Berkshire Hathaway."
10+
11+
Highlight potential strategy, what they could be basing their trades off of, and their general market thinking.
12+
13+
Then, add in your (as) objective (as possible) opinion on what they could be doing right or wrong - and general insights on what should be happening.
14+
15+
<data>
16+
<stock>
17+
<name>Apple Inc<name/>
18+
<
19+
</stock>
20+
</data>
21+
22+
</instructions>

backend/routers/filer.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ def create_historical(cik, company, stamp):
234234
database.add_log(
235235
cik, "Failed to Update Filer Historical Stocks", company_name, cik
236236
)
237-
database.edit_status(cik, 0)
237+
database.edit_status(cik, 5)
238238

239239
allocation_list = analysis.analyze_allocation(cik)
240240
aum_list = analysis.analyze_aum(cik)
@@ -252,9 +252,11 @@ def create_historical(cik, company, stamp):
252252

253253
except Exception as e:
254254
report_error(cik, e)
255+
database.edit_status(5)
255256
database.add_log(
256257
cik, "Failed to Query Filer Historical Stocks", company_name, cik
257258
)
259+
return
258260

259261
start = stamp["start"]
260262
stamp = {"time.elapsed": datetime.now().timestamp() - start, "logs": []}
@@ -307,7 +309,7 @@ def update_filer(company, background: BackgroundTasks = BackgroundTasks):
307309
302, detail="Filer is partially building."
308310
)
309311
elif operation["status"] >= 2:
310-
raise HTTPException(409, detail="Filer still building.")
312+
raise HTTPException(409, detail="Filer still building.") # @IgnoreException
311313

312314
update, last_report = web.check_new(cik)
313315
if not update:
@@ -506,7 +508,7 @@ async def logs(cik: str, start: int = 0):
506508
raise HTTPException(404, detail="CIK not found.")
507509
except Exception as e:
508510
logging.error(e)
509-
raise HTTPException(500, detail="Error fetching logs.")
511+
raise HTTPException(500, detail="Error fetching logs.") # @IgnoreException
510512

511513

512514
@router.get("/estimate", status_code=202)
@@ -538,7 +540,9 @@ async def estimate(cik: str):
538540
raise HTTPException(404, detail="CIK not found.")
539541
except Exception as e:
540542
logging.error(e)
541-
raise HTTPException(500, detail="Error fetching time estimation.")
543+
raise HTTPException(
544+
500, detail="Error fetching time estimation." # @IgnoreException
545+
) # @IgnoreException
542546

543547

544548
@router.get("/info", tags=["filers"], status_code=200)
@@ -951,7 +955,7 @@ async def top_ciks():
951955
report_error("Top CIKs", e)
952956
raise HTTPException(500, detail="Error fetching filers.")
953957

954-
return {"filers": filers_sorted}
958+
return BrowserCachedResponse(content={"filers": filers_sorted}, cache_hours=1)
955959

956960

957961
popular_ciks_path = f"{cwd}/static/popular.json"
@@ -968,7 +972,7 @@ async def popular_ciks():
968972
report_error("Popular CIKs", e)
969973
raise HTTPException(500, detail="Error fetching filers.")
970974

971-
return {"filers": filers_sorted}
975+
return BrowserCachedResponse(content={"filers": filers_sorted}, cache_hours=1)
972976

973977

974978
def create_filer_try(cik):

0 commit comments

Comments
 (0)