fix: local ticker search for screener (Sectors companies/ 401s on sub)
- q= now searches universe table locally (ticker + company_name LIKE, order by close) instead of calling the Sectors companies/ endpoint, which returns SUBSCRIPTION_DOES_NOT_ALLOW on the current subscription and silently fell back to the full 780-ticker universe - removes the broken name-fill cmd + scheduler/one-shot Screen() name enrichment (wasted credits, empty names) - Screener UI: search card says 'kode saham', results still show company name when present
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
@@ -55,22 +54,9 @@ func main() {
|
||||
}
|
||||
raw, _ := json.Marshal(all)
|
||||
_ = db.SaveSnapshot("IDX", date, "close", string(raw))
|
||||
// Best-effort company-name enrichment (one screener call) so the screener
|
||||
// search can display "PT Bank Central Asia Tbk" instead of only "BBCA".
|
||||
names := map[string]string{}
|
||||
if rows, err := c.Screen(ctx, "", "", 1000, 0); err == nil {
|
||||
for _, row := range rows {
|
||||
if row.CompanyName != "" {
|
||||
names[strings.ToUpper(strings.TrimSuffix(row.Symbol, ".JK"))] = row.CompanyName
|
||||
}
|
||||
}
|
||||
} else {
|
||||
log.Printf("name enrichment skipped: %v", err)
|
||||
}
|
||||
uni := make([]store.UniverseRow, 0, len(all))
|
||||
for _, r := range all {
|
||||
tk := strings.ToUpper(strings.TrimSuffix(r.Symbol, ".JK"))
|
||||
uni = append(uni, store.UniverseRow{Symbol: tk, Close: r.Close, Date: r.Date, CompanyName: names[tk]})
|
||||
uni = append(uni, store.UniverseRow{Symbol: r.Symbol, Close: r.Close, Date: r.Date})
|
||||
}
|
||||
if err := db.SaveUniverse(uni); err != nil {
|
||||
log.Fatal(err)
|
||||
|
||||
Reference in New Issue
Block a user