feat(watchlist): add company identity catalog

Embed a pinned FinanceDatabase equity snapshot, add authenticated company search and identity-based follows, preserve legacy assets, and map selected Yahoo symbols for collection.

Refs #19

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-11-22 15:08:22 +01:00
parent 1123360914
commit d65222169a
50 changed files with 49897 additions and 193 deletions

View File

@ -0,0 +1,32 @@
package generation
import (
"github.com/tradarr/backend/internal/models"
"regexp"
"strings"
)
var yahooTicker = regexp.MustCompile(`^[A-Za-z0-9^][A-Za-z0-9.^=\-]{0,31}$`)
var figiIdentity = regexp.MustCompile(`^BBG[A-Z0-9]{9}$`)
// Only the Yahoo source gets the catalogue's Yahoo listing hint. Other feeds
// retain the exact historical Symbol input. No guesses or Bloomberg conversion.
func yahooSymbols(assets []models.UserAsset) []string {
out := []string{}
seen := map[string]bool{}
for _, a := range assets {
symbol := a.Symbol
if a.CompanyID != nil {
if a.YahooSymbol == nil {
continue
}
symbol = *a.YahooSymbol
}
if !yahooTicker.MatchString(symbol) || figiIdentity.MatchString(strings.ToUpper(symbol)) || seen[symbol] {
continue
}
seen[symbol] = true
out = append(out, symbol)
}
return out
}