Skip to content

Commit

Permalink
buy and sell front-end
Browse files Browse the repository at this point in the history
  • Loading branch information
leftmove committed Feb 9, 2025
1 parent 5ea2f25 commit 1930d95
Show file tree
Hide file tree
Showing 23 changed files with 929 additions and 392 deletions.
28 changes: 28 additions & 0 deletions backend/email/templates/buy.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<stock>

<summary>{{ summary }}</summary>

<name>{{ name }}</name>
<ticker>{{ ticker }}</ticker>
<industry>{{ industry }}</industry>
<price>{{ price }}</price>
<action>{{ action }}</action>

<portfolio>
<old>{{ old_portfolio }}</old>
<new>{{ new_portfolio }}</new>
</portfolio>
<value>
<old>{{ old_value }}</old>
<new>{{ new_value }}</new>
</value>
<shares>
<old>{{ old_shares }}</old>
<new>{{ new_shares }}</new>
</shares>
<date>
<old>{{ old_date }}</old>
<new>{{ new_date }}</new>
</date>

</stock>
22 changes: 22 additions & 0 deletions backend/prompts/prompt-v2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<instructions>

<role>
You are an analyst for stocks, the market, and companies at large.
Given context, you will provide detailed and professional insights about holdings data - what a company has bought and sold.
Point out specific, key points; use novel intuitions; and be a generalist.
</role>

Using the following holdings data, create insights for "Berkshire Hathaway."

Highlight potential strategy, what they could be basing their trades off of, and their general market thinking.

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.

<data>
<stock>
<name>Apple Inc<name/>
<
</stock>
</data>

</instructions>
16 changes: 10 additions & 6 deletions backend/routers/filer.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ def create_historical(cik, company, stamp):
database.add_log(
cik, "Failed to Update Filer Historical Stocks", company_name, cik
)
database.edit_status(cik, 0)
database.edit_status(cik, 5)

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

except Exception as e:
report_error(cik, e)
database.edit_status(5)
database.add_log(
cik, "Failed to Query Filer Historical Stocks", company_name, cik
)
return

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

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


@router.get("/estimate", status_code=202)
Expand Down Expand Up @@ -538,7 +540,9 @@ async def estimate(cik: str):
raise HTTPException(404, detail="CIK not found.")
except Exception as e:
logging.error(e)
raise HTTPException(500, detail="Error fetching time estimation.")
raise HTTPException(
500, detail="Error fetching time estimation." # @IgnoreException
) # @IgnoreException


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

return {"filers": filers_sorted}
return BrowserCachedResponse(content={"filers": filers_sorted}, cache_hours=1)


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

return {"filers": filers_sorted}
return BrowserCachedResponse(content={"filers": filers_sorted}, cache_hours=1)


def create_filer_try(cik):
Expand Down
Loading

0 comments on commit 1930d95

Please sign in to comment.