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:
32
backend/internal/generation/company_symbols.go
Normal file
32
backend/internal/generation/company_symbols.go
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user