2025-04-09 19:25:15 -05:00
@ use ( 'App\Models\Currency' )
2025-09-26 17:41:28 -05:00
< x - layouts . app >
2024-08-27 21:17:54 -05:00
< div x - data >
2025-09-26 17:41:28 -05:00
< x - ui . modal
2024-10-18 14:59:10 -05:00
key = " create-transaction "
2024-10-22 12:41:18 -05:00
title = " { { __('Create Transaction') }} "
2024-08-27 21:17:54 -05:00
>
@ livewire ( 'manage-transaction-form' , [
'portfolio' => $portfolio ,
2024-08-28 22:06:47 -05:00
'symbol' => $holding -> market_data -> symbol ,
2024-08-27 21:17:54 -05:00
])
2025-09-26 17:41:28 -05:00
</ x - ui . modal >
2024-08-26 19:52:46 -05:00
2025-09-26 17:41:28 -05:00
< x - ui . modal
2024-10-20 20:00:06 -05:00
key = " holding-options "
2024-10-22 12:41:18 -05:00
title = " { { __('Holding Options') }} "
2024-10-20 20:00:06 -05:00
>
@ livewire ( 'holding-options-form' , [
'holding' => $holding
])
2025-09-26 17:41:28 -05:00
</ x - ui . modal >
2024-10-20 20:00:06 -05:00
2025-09-26 17:41:28 -05:00
< x - ui . toolbar >
2024-08-26 21:34:13 -05:00
< x - slot : title >
< a href = " { { route('portfolio.show', ['portfolio' => $portfolio->id ]) }} " title = " { { __('Portfolio') }} " >
{{ $portfolio -> title }}
2024-08-28 22:06:47 -05:00
</ a > » < span title = " { { __('Holding') }} " > {{ $holding -> market_data -> symbol }} </ span >
2024-10-20 20:00:06 -05:00
2024-08-26 21:34:13 -05:00
</ x - slot : title >
2024-08-27 21:17:54 -05:00
2024-10-21 22:23:20 -05:00
@ can ( 'fullAccess' , $portfolio )
2025-09-26 17:41:28 -05:00
< x - ui . button
2024-10-20 20:00:06 -05:00
title = " { { __('Holding options') }} "
icon = " o-pencil "
class = " btn-circle btn-ghost btn-sm text-secondary "
@ click = " $dispatch ('toggle-holding-options') "
/>
2025-01-28 21:15:29 -06:00
@ else
2025-09-26 17:41:28 -05:00
< x - ui . icon name = " o-eye " class = " text-secondary w-4 " title = " { { __('Read only') }} " />
2024-10-21 22:23:20 -05:00
@ endcan
2024-10-20 20:00:06 -05:00
2025-09-26 17:41:28 -05:00
< x - ui . flex - spacer />
2024-08-27 21:17:54 -05:00
2024-10-21 22:23:20 -05:00
@ can ( 'fullAccess' , $portfolio )
2025-09-26 17:41:28 -05:00
< x - ui . button
2024-10-22 12:36:43 -05:00
label = " { { __('Create transaction') }} "
2024-10-21 22:23:20 -05:00
class = " btn-sm btn-primary whitespace-nowrap "
@ click = " $dispatch ('toggle-create-transaction') "
/>
@ endcan
2025-09-26 17:41:28 -05:00
</ x - ui . toolbar >
2024-08-26 19:52:46 -05:00
2024-08-26 21:34:13 -05:00
< div class = " mt-6 grid md:grid-cols-9 gap-5 " >
2025-09-26 17:41:28 -05:00
< x - ui . card class = " md:col-span-5 " >
2024-10-18 20:46:22 -05:00
< x - slot : title >
2024-08-26 21:34:13 -05:00
2024-08-28 22:06:47 -05:00
{{ $holding -> market_data -> symbol }}
2024-10-18 20:46:22 -05:00
< span class = " text-sm ml-2 " > {{ $holding -> market_data -> name }} </ span >
2024-08-26 21:34:13 -05:00
</ x - slot : title >
2024-08-30 20:58:00 -05:00
@ livewire ( 'holding-market-data' , [ 'holding' => $holding ])
2024-08-27 22:41:13 -05:00
2025-09-26 17:41:28 -05:00
</ x - ui . card >
2024-08-27 22:41:13 -05:00
2025-09-26 17:41:28 -05:00
< x - ui . card title = " { { __('Fundamentals') }} " class = " md:col-span-4 " >
2024-08-27 22:41:13 -05:00
2025-04-09 19:25:15 -05:00
@ if ( ! empty ( $holding -> market_data -> market_cap ))
2024-09-01 16:06:29 -05:00
< p >
< span class = " font-bold " > {{ __ ( 'Market Cap' ) }} : </ span >
2025-04-09 19:25:15 -05:00
{{ Currency :: forHumans ( $holding -> market_data -> market_cap , $holding -> market_data -> currency ) }}
2024-09-01 16:06:29 -05:00
</ p >
2025-04-09 19:25:15 -05:00
@ endif
2024-09-01 16:06:29 -05:00
2025-04-09 19:25:15 -05:00
@ if ( ! empty ( $holding -> market_data -> forward_pe ))
2024-08-27 18:12:51 -05:00
< p >
< span class = " font-bold " > {{ __ ( 'Forward PE' ) }} : </ span >
2024-08-28 22:06:47 -05:00
{{ $holding -> market_data -> forward_pe }}
2024-08-27 18:12:51 -05:00
</ p >
2025-04-09 19:25:15 -05:00
@ endif
2024-08-27 18:12:51 -05:00
2025-04-09 19:25:15 -05:00
@ if ( ! empty ( $holding -> market_data -> trailing_pe ))
2024-08-27 18:12:51 -05:00
< p >
< span class = " font-bold " > {{ __ ( 'Trailing PE' ) }} : </ span >
2024-08-28 22:06:47 -05:00
{{ $holding -> market_data -> trailing_pe }}
2024-08-27 18:12:51 -05:00
</ p >
2025-04-09 19:25:15 -05:00
@ endif
2024-08-27 18:12:51 -05:00
2025-04-09 19:25:15 -05:00
@ if ( ! empty ( $holding -> market_data -> book_value ))
< p >
< span class = " font-bold " > {{ __ ( 'Book Value' ) }} : </ span >
{{ Number :: currency ( $holding -> market_data -> book_value , $holding -> market_data -> currency ) }}
</ p >
@ endif
2024-08-26 21:34:13 -05:00
2024-08-27 22:49:01 -05:00
< p >
< span class = " font-bold " > {{ __ ( '52 week' ) }} : </ span >
2025-09-26 17:41:28 -05:00
< x - ui . fifty - two - week - range : market - data = " $holding->market_data " />
2024-09-01 16:06:29 -05:00
</ p >
2025-04-09 19:25:15 -05:00
@ if ( ! empty ( $holding -> market_data -> dividend_yield ))
2024-09-01 16:06:29 -05:00
< p >
< span class = " font-bold " > {{ __ ( 'Dividend Yield' ) }} : </ span >
2024-09-05 20:23:41 -05:00
{{ Number :: percentage (
2025-04-09 19:25:15 -05:00
$holding -> market_data -> dividend_yield ,
2024-09-05 20:23:41 -05:00
$holding -> market_data -> dividend_yield < 1 ? 2 : 0
) }}
2024-09-01 16:06:29 -05:00
</ p >
2025-04-09 19:25:15 -05:00
@ endif
2024-09-01 16:06:29 -05:00
2025-04-09 19:25:15 -05:00
@ if ( ! empty ( $holding -> market_data -> last_dividend_date ))
2024-09-01 16:06:29 -05:00
< p >
2024-09-05 20:41:07 -05:00
< span class = " font-bold " > {{ __ ( 'Last Dividend Paid' ) }} : </ span >
2025-04-09 19:25:15 -05:00
{{ $holding -> market_data -> last_dividend_date -> format ( 'F d, Y' ) }}
2024-08-27 22:49:01 -05:00
</ p >
2025-04-09 19:25:15 -05:00
@ endif
2024-08-27 22:49:01 -05:00
2025-09-26 17:41:28 -05:00
</ x - ui . card >
2024-08-26 21:34:13 -05:00
2025-09-26 17:41:28 -05:00
< x - ui . card title = " { { __('Recent activity') }} " class = " md:col-span-3 " >
2024-08-27 18:12:51 -05:00
@ livewire ( 'transactions-list' , [
'portfolio' => $holding -> portfolio ,
2024-08-29 18:46:21 -05:00
'transactions' => $holding -> transactions ,
2024-08-27 21:17:54 -05:00
'shouldGoToHolding' => false
2024-08-27 18:12:51 -05:00
])
2024-08-26 21:34:13 -05:00
2025-09-26 17:41:28 -05:00
</ x - ui . card >
2024-08-26 21:34:13 -05:00
2025-09-26 17:41:28 -05:00
< x - ui . card title = " { { __('Dividends') }} " class = " md:col-span-3 " >
2024-10-18 14:59:10 -05:00
2024-09-06 23:15:43 -05:00
@ if ( $holding -> dividends -> isEmpty ())
< div class = " flex justify-center items-center h-full pb-10 text-secondary " >
{{ __ ( 'No dividends for :symbol yet' , [ 'symbol' => $holding -> symbol ]) }}
</ div >
@ endif
2024-08-30 20:58:00 -05:00
@ livewire ( 'holding-dividends-list' , [ 'holding' => $holding ])
2024-08-26 21:34:13 -05:00
2025-09-26 17:41:28 -05:00
</ x - ui . card >
2024-08-26 21:34:13 -05:00
2025-09-26 17:41:28 -05:00
< x - ui . card title = " { { __('Splits') }} " class = " md:col-span-3 " >
2024-08-26 21:34:13 -05:00
2024-09-06 23:15:43 -05:00
@ if ( $holding -> splits -> isEmpty ())
< div class = " flex justify-center items-center h-full pb-10 text-secondary " >
{{ __ ( 'No splits for :symbol yet' , [ 'symbol' => $holding -> symbol ]) }}
</ div >
@ endif
2024-08-27 18:12:51 -05:00
@ foreach ( $holding -> splits -> take ( 5 ) as $split )
2025-09-26 17:41:28 -05:00
< x - ui . list - item : item = " $split " no - separator >
2024-08-27 18:12:51 -05:00
< x - slot : value >
2024-09-06 23:15:43 -05:00
1 : {{ $split -> split_amount }}
2024-08-27 18:12:51 -05:00
</ x - slot : value >
< x - slot : sub - value >
2024-09-05 20:41:07 -05:00
< span title = " { { __('Distribution Date') }} " > {{ $split -> date -> format ( 'F d, Y' ) }} </ span >
2024-08-27 18:12:51 -05:00
</ x - slot : sub - value >
2025-09-26 17:41:28 -05:00
</ x - ui . list - item >
2024-08-26 21:34:13 -05:00
2024-08-27 18:12:51 -05:00
@ endforeach
2024-08-26 21:34:13 -05:00
2025-09-26 17:41:28 -05:00
</ x - ui . card >
2024-08-26 21:34:13 -05:00
2024-10-31 17:33:48 -05:00
@ if ( config ( 'services.ai_chat_enabled' ))
2025-04-09 19:25:15 -05:00
{{ -- // todo: add to system prompt:
2024-10-31 12:09:06 -05:00
// Additionally, here is some recent news about {$this->holding->symbol}:
// And their latest SEC filings: --}}
2025-09-26 17:41:28 -05:00
@ livewire ( 'ui.ai-chat-window' , [
2024-10-31 12:09:06 -05:00
'chatable' => $holding ,
'suggested_prompts' => [
[
'text' => 'What are the key risks?' ,
'value' => 'What are the key risks for the company?'
],
[
'text' => 'Should I invest more?' ,
'value' => 'Is it worthwhile to invest more?'
],
[
'text' => 'Should I sell?' ,
'value' => 'When is a good time for me to sell?'
],
[
'text' => 'What are the key strengths?' ,
'value' => 'What are the key strengths for this company?'
],
[
'text' => 'Is this a successful position?' ,
'value' => 'Is this a successful holding in my portfolio?'
]
],
'system_prompt' => "
2025-09-26 20:11:51 -05:00
Most recent training data: " . now () -> toDateString () . " .
You are an investment portfolio assistant providing advice to an investor. Use the following information to provide relevant recommendations. Use the words 'likely' or 'may' instead of concrete statements (except for obvious statements of fact or common sense). . Do not apologize. Be polite, but minimize gratuitous niceties. When referencing numbers, always round to the nearest 100th decimal place.
2024-10-31 12:09:06 -05:00
The investor owns " . ( $holding -> quantity > 0 ? 'a total of ' . $holding -> quantity : 'ZERO' ) . " shares of { $holding -> market_data -> name } (ticker: { $holding -> symbol } ) with an average cost basis of { $holding -> average_cost_basis } . Here are the relevant transactions - sales and purchases of { $holding -> symbol } :
{ $formattedTransactions }
This investor has earned $ { $holding -> dividends_earned } in dividends so far and earned { $holding -> realized_gains_dollars } in realized gains (sales) from { $holding -> symbol } in this portfolio.
The current market price for { $holding -> symbol } is { $holding -> market_data -> market_value } . Additionally, here's other critical fundamentals for { $holding -> market_data -> name } that might help:
* Market cap: { $holding -> market_data -> market_cap }
* Forward PE: { $holding -> market_data -> forward_pe }
* Trailing PE: { $holding -> market_data -> trailing_pe }
* Book value: { $holding -> market_data -> book_value }
* 52 week low: { $holding -> market_data -> fifty_two_week_low }
* 52 week high: { $holding -> market_data -> fifty_two_week_high }
* Dividend yield: { $holding -> market_data -> dividend_yield }
2025-09-26 20:11:51 -05:00
Based on this current market data, quantity owned, and average cost basis, you should determine if the { $holding -> symbol } holding is making or losing money.
2024-10-31 12:09:06 -05:00
2024-10-31 15:19:59 -05:00
Below is the question from the investor. Considering these facts, provide a concise response to the following question (give a direct response). Limit your response to no more than 75 words and consider using a common decision framework. Use github style markdown for any formatting: "
2024-10-31 12:09:06 -05:00
])
2024-10-31 17:33:48 -05:00
@ endif
2024-10-31 12:09:06 -05:00
2024-08-26 21:34:13 -05:00
</ div >
2024-08-26 19:52:46 -05:00
</ div >
2025-09-26 17:41:28 -05:00
</ x - layouts . app >