@gloom-sh/terminal 0.20.16 → 0.20.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/api-client/data.ts +13 -3
- package/src/api-client/types/econ.ts +3 -0
- package/src/cli/commands/fred-series.ts +3 -1
- package/src/cli/commands/overview.ts +65 -13
- package/src/cli/csv-export.ts +73 -0
- package/src/cli/desktop-pane-shot.ts +3 -2
- package/src/cli/help.ts +4 -2
- package/src/cli/pane-functions/headless.ts +7 -2
- package/src/cli/pane-functions/index.ts +2 -2
- package/src/cli/pane-functions/screenshot-bridge.ts +4 -2
- package/src/cli/report-tables.ts +17 -3
- package/src/cli/result.ts +3 -6
- package/src/components/chart/composite/legend.tsx +37 -7
- package/src/components/ui/data-table/display-columns.ts +4 -1
- package/src/components/ui/data-table/hooks.ts +2 -3
- package/src/components/ui/data-table/index.tsx +4 -1
- package/src/components/ui/data-table/types.ts +11 -4
- package/src/components/ui/data-table/visible-range.ts +11 -1
- package/src/plugins/builtin/awards/pane.tsx +6 -2
- package/src/plugins/builtin/chart-composer/pane.tsx +4 -1
- package/src/plugins/builtin/credit-conditions/series.ts +2 -2
- package/src/plugins/builtin/earnings/board-model.ts +12 -0
- package/src/plugins/builtin/earnings/board-table.ts +7 -4
- package/src/plugins/builtin/earnings/board.tsx +2 -2
- package/src/plugins/builtin/earnings/highlight.ts +1 -1
- package/src/plugins/builtin/econ/calendar-model.ts +2 -0
- package/src/plugins/builtin/econ/fred-catalog.ts +1 -256
- package/src/plugins/builtin/econ-statistics/cache.ts +1 -1
- package/src/plugins/builtin/econ-statistics/client.ts +11 -10
- package/src/plugins/builtin/econ-statistics/detail.tsx +1 -0
- package/src/plugins/builtin/econ-statistics/headless.ts +42 -6
- package/src/plugins/builtin/econ-statistics/index.tsx +1 -0
- package/src/plugins/builtin/econ-statistics/pane.tsx +7 -2
- package/src/plugins/builtin/econ-statistics/stats.ts +2 -1
- package/src/plugins/builtin/econ-statistics/view.ts +9 -3
- package/src/plugins/builtin/shared/fred-catalog.ts +256 -0
- package/src/plugins/builtin/shared/series-cache.ts +3 -0
- package/src/plugins/builtin/shared/series-detail-chart.tsx +3 -0
- package/src/plugins/builtin/short-interest/watch-pane.tsx +7 -7
- package/src/plugins/builtin/ticker-detail/adr-pair/model.ts +16 -0
- package/src/plugins/builtin/ticker-detail/adr-pair/tab.tsx +8 -4
- package/src/plugins/builtin/time-sales/headless.ts +4 -1
- package/src/plugins/builtin/time-sales/pane.tsx +2 -0
- package/src/plugins/builtin/time-sales/window.ts +12 -0
- package/src/plugins/builtin/treasury-auctions/client.ts +4 -0
- package/src/plugins/builtin/treasury-auctions/treasury-direct.ts +2 -0
- package/src/plugins/builtin/treasury-daily/client.ts +23 -11
- package/src/renderers/electrobun/view/cli-pane-shot-entry.tsx +2 -0
- package/src/sources/gloomberb-cloud/fred-publisher.ts +25 -0
- package/src/sources/gloomberb-cloud/fred-series.ts +1 -1
- package/src/time-series/base-series.ts +3 -0
- package/src/time-series/ice-credit.ts +1 -0
- package/src/time-series/types.ts +1 -0
- package/src/types/headless.ts +4 -2
- package/src/utils/throttled-fetch.ts +15 -1
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
import { fredSeriesUrl, seriesNotOnFred } from "../../../sources/gloomberb-cloud/fred-series";
|
|
2
|
+
import type { SeriesDefinition, SeriesFrequency } from "../../../series/types";
|
|
3
|
+
|
|
4
|
+
type FredRow = readonly [seriesId: string, name: string, unit: string, frequency: SeriesFrequency, publisher: string, tags?: readonly string[]];
|
|
5
|
+
|
|
6
|
+
/** What people call a Treasury bill: a t-bill, a tbill, cash parked in a money market. */
|
|
7
|
+
const BILL_TAGS = ["bill", "T-bill", "T-bills", "tbill", "tbills", "money markets", "money market"] as const;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The FRED series Gloom Cloud serves, by group, except the Treasury constant
|
|
11
|
+
* maturities (UST:2Y and so on, from the yield curve) and the credit spreads
|
|
12
|
+
* and yields (from the credit plugin). Ids follow the server's allowlist: a
|
|
13
|
+
* series added there is listed here to reach the catalog.
|
|
14
|
+
* Türkiye's CPI, Brazil's IPCA, MAS's SORA and NAHB's housing market index
|
|
15
|
+
* are served the same way but are not on FRED; their rows name TurkStat,
|
|
16
|
+
* IBGE, MAS and NAHB (`seriesNotOnFred`).
|
|
17
|
+
*/
|
|
18
|
+
const GROUPS: ReadonlyArray<{ group: string; rows: readonly FredRow[] }> = [
|
|
19
|
+
{
|
|
20
|
+
group: "Rates",
|
|
21
|
+
rows: [
|
|
22
|
+
["FEDFUNDS", "Fed funds effective rate (monthly)", "%", "monthly", "Federal Reserve Board", ["fed funds"]],
|
|
23
|
+
["DFF", "Fed funds effective rate", "%", "daily", "Federal Reserve Board", ["fed funds"]],
|
|
24
|
+
["EFFR", "Effective federal funds rate", "%", "daily", "Federal Reserve Bank of New York", ["EFFR", "money markets"]],
|
|
25
|
+
["IORB", "Interest on reserve balances", "%", "daily", "Federal Reserve Board", ["IORB", "money markets"]],
|
|
26
|
+
["DFEDTARU", "Fed funds target range, upper limit", "%", "daily", "Federal Reserve Board", ["fed funds", "policy rate"]],
|
|
27
|
+
["DFEDTARL", "Fed funds target range, lower limit", "%", "daily", "Federal Reserve Board", ["fed funds", "policy rate"]],
|
|
28
|
+
["ECBDFR", "ECB deposit facility rate", "%", "daily", "European Central Bank", ["ECB", "euro area", "policy rate"]],
|
|
29
|
+
["DPRIME", "Bank prime loan rate", "%", "daily", "Federal Reserve Board"],
|
|
30
|
+
["DFII5", "5Y TIPS real yield", "%", "daily", "Federal Reserve Board", ["treasury", "real yield"]],
|
|
31
|
+
["DFII10", "10Y TIPS real yield", "%", "daily", "Federal Reserve Board", ["treasury", "real yield"]],
|
|
32
|
+
["T10Y2Y", "10Y minus 2Y Treasury spread", "bp", "daily", "Federal Reserve Bank of St. Louis", ["treasury", "curve", "2s10s"]],
|
|
33
|
+
["T10Y3M", "10Y minus 3M Treasury spread", "bp", "daily", "Federal Reserve Bank of St. Louis", ["treasury", "curve"]],
|
|
34
|
+
// The Federal Reserve Board's Kim-Wright estimates, a week or so behind.
|
|
35
|
+
...Array.from({ length: 10 }, (_, index): FredRow =>
|
|
36
|
+
[`THREEFYTP${index + 1}`, `${index + 1}Y Treasury term premium (Kim-Wright)`, "%", "daily", "Federal Reserve Board", ["treasury", "term premium", "Kim-Wright"]]),
|
|
37
|
+
["SOFR", "SOFR", "%", "daily", "Federal Reserve Bank of New York", ["secured overnight financing rate", "money markets"]],
|
|
38
|
+
["SORA", "SORA (Singapore overnight rate average)", "%", "daily", "MAS", ["SGD", "Singapore", "MAS", "overnight", "money markets"]],
|
|
39
|
+
["OBFR", "Overnight bank funding rate", "%", "daily", "Federal Reserve Bank of New York", ["OBFR", "money markets"]],
|
|
40
|
+
["DTB4WK", "4-week Treasury bill rate", "%", "daily", "Federal Reserve Board", BILL_TAGS],
|
|
41
|
+
["DTB3", "3-month Treasury bill rate", "%", "daily", "Federal Reserve Board", BILL_TAGS],
|
|
42
|
+
["DTB6", "6-month Treasury bill rate", "%", "daily", "Federal Reserve Board", BILL_TAGS],
|
|
43
|
+
["DTB1YR", "1-year Treasury bill rate", "%", "daily", "Federal Reserve Board", BILL_TAGS],
|
|
44
|
+
["DCPF3M", "3-month AA financial commercial paper rate", "%", "daily", "Federal Reserve Board", ["commercial paper", "money markets"]],
|
|
45
|
+
["DCPN3M", "3-month AA nonfinancial commercial paper rate", "%", "daily", "Federal Reserve Board", ["commercial paper", "money markets"]],
|
|
46
|
+
["RRPONTSYD", "Overnight reverse repo at the Fed", "billion USD", "daily", "Federal Reserve Bank of New York", ["RRP", "liquidity", "money markets"]],
|
|
47
|
+
["WDTGAL", "Treasury General Account", "million USD", "weekly", "Federal Reserve Board", ["TGA", "liquidity", "money markets"]],
|
|
48
|
+
["WRESBAL", "Bank reserves at the Fed", "million USD", "weekly", "Federal Reserve Board", ["reserves", "liquidity", "money markets"]],
|
|
49
|
+
["WALCL", "Fed total assets", "million USD", "weekly", "Federal Reserve Board", ["balance sheet", "liquidity"]],
|
|
50
|
+
["M2SL", "M2 money stock", "billion USD", "monthly", "Federal Reserve Board", ["money supply", "liquidity"]],
|
|
51
|
+
],
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
group: "Volatility",
|
|
55
|
+
rows: [
|
|
56
|
+
["VIXCLS", "VIX", "index", "daily", "Cboe", ["volatility index", "30 day"]],
|
|
57
|
+
["VXVCLS", "VIX 3M", "index", "daily", "Cboe", ["volatility index", "3 month"]],
|
|
58
|
+
],
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
group: "Economy",
|
|
62
|
+
rows: [
|
|
63
|
+
["GDP", "Gross domestic product", "billion USD", "quarterly", "Bureau of Economic Analysis", ["GDP", "growth"]],
|
|
64
|
+
["GDPC1", "Real gross domestic product", "billion USD", "quarterly", "Bureau of Economic Analysis", ["GDP", "growth"]],
|
|
65
|
+
["UNRATE", "Unemployment rate", "%", "monthly", "Bureau of Labor Statistics", ["labor", "jobs"]],
|
|
66
|
+
["ICSA", "Initial jobless claims", "count", "weekly", "Department of Labor", ["labor", "claims"]],
|
|
67
|
+
["PAYEMS", "Nonfarm payrolls", "thousand people", "monthly", "Bureau of Labor Statistics", ["labor", "jobs", "employment"]],
|
|
68
|
+
["NPPTTL", "Private payroll employment (discontinued)", "thousand people", "monthly", "ADP Research Institute", ["labor", "jobs"]],
|
|
69
|
+
["JTSJOL", "Job openings", "thousand jobs", "monthly", "Bureau of Labor Statistics", ["labor", "JOLTS"]],
|
|
70
|
+
["OPHNFB", "Nonfarm labor productivity", "index", "quarterly", "Bureau of Labor Statistics", ["labor", "productivity"]],
|
|
71
|
+
["ULCNFB", "Unit labor costs", "index", "quarterly", "Bureau of Labor Statistics", ["labor", "wages"]],
|
|
72
|
+
["RSAFS", "Retail sales", "million USD", "monthly", "Census Bureau", ["consumer", "spending"]],
|
|
73
|
+
["RSFSXMV", "Retail sales excluding autos", "million USD", "monthly", "Census Bureau", ["consumer", "spending"]],
|
|
74
|
+
["UMCSENT", "University of Michigan consumer sentiment", "index", "monthly", "University of Michigan", ["consumer", "sentiment"]],
|
|
75
|
+
["CSCICP03USM665S", "Consumer confidence (OECD)", "index", "monthly", "OECD", ["consumer", "sentiment"]],
|
|
76
|
+
["HOUST", "Housing starts", "thousand units", "monthly", "Census Bureau", ["housing", "homebuilders"]],
|
|
77
|
+
["PERMIT", "Building permits", "thousand units", "monthly", "Census Bureau", ["housing", "homebuilders"]],
|
|
78
|
+
["EXHOSLUSM495S", "Existing home sales", "units", "monthly", "National Association of Realtors", ["housing", "homebuilders"]],
|
|
79
|
+
["HSN1F", "New home sales", "thousand units", "monthly", "Census Bureau", ["housing", "homebuilders"]],
|
|
80
|
+
["MORTGAGE30US", "30-year fixed mortgage rate (Freddie Mac PMMS)", "%", "weekly", "Freddie Mac", ["housing", "mortgage rate", "PMMS", "Freddie Mac", "homebuilders"]],
|
|
81
|
+
["MORTGAGE15US", "15-year fixed mortgage rate (Freddie Mac PMMS)", "%", "weekly", "Freddie Mac", ["housing", "mortgage rate", "PMMS", "Freddie Mac", "homebuilders"]],
|
|
82
|
+
// Computed by Gloom Cloud: MORTGAGE30US less DGS10 on each PMMS date.
|
|
83
|
+
["MORTGAGE30US10Y", "30-year mortgage rate minus 10Y Treasury, on the PMMS date", "bp", "weekly", "Freddie Mac and Federal Reserve Board", ["housing", "mortgage spread", "PMMS", "treasury", "homebuilders"]],
|
|
84
|
+
["NAHBHMI", "NAHB housing market index (builder sentiment)", "index", "monthly", "NAHB", ["housing", "NAHB", "HMI", "homebuilders", "sentiment"]],
|
|
85
|
+
["DGORDER", "Durable goods orders", "million USD", "monthly", "Census Bureau", ["manufacturing", "orders"]],
|
|
86
|
+
["ADXTNO", "Durable goods orders excluding transportation", "million USD", "monthly", "Census Bureau", ["manufacturing", "orders"]],
|
|
87
|
+
["AMTMNO", "Manufacturing new orders", "million USD", "monthly", "Census Bureau", ["manufacturing", "factory orders"]],
|
|
88
|
+
["BOPGSTB", "Trade balance", "million USD", "monthly", "Bureau of Economic Analysis and Census Bureau", ["trade"]],
|
|
89
|
+
["INDPRO", "Industrial production", "index", "monthly", "Federal Reserve Board", ["manufacturing", "output"]],
|
|
90
|
+
["TCU", "Capacity utilization", "%", "monthly", "Federal Reserve Board", ["manufacturing"]],
|
|
91
|
+
["PI", "Personal income", "billion USD", "monthly", "Bureau of Economic Analysis", ["consumer", "income"]],
|
|
92
|
+
["PCE", "Personal consumption expenditures", "billion USD", "monthly", "Bureau of Economic Analysis", ["consumer", "spending"]],
|
|
93
|
+
["NETFI", "Current account balance", "billion USD", "quarterly", "Bureau of Economic Analysis", ["trade", "external"]],
|
|
94
|
+
],
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
group: "Defense & fiscal",
|
|
98
|
+
rows: [
|
|
99
|
+
["FDEFX", "National defense spending (annual rate)", "billion USD", "quarterly", "Bureau of Economic Analysis", ["defense", "military", "DoD", "budget", "government spending", "GDP"]],
|
|
100
|
+
["ADEFNO", "New orders for defense capital goods", "million USD", "monthly", "Census Bureau", ["defense", "military", "DoD", "orders", "manufacturing"]],
|
|
101
|
+
["MTSO133FMS", "Federal outlays (Monthly Treasury Statement)", "million USD", "monthly", "U.S. Treasury", ["budget", "government spending", "fiscal", "deficit", "Treasury"]],
|
|
102
|
+
],
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
group: "Inflation",
|
|
106
|
+
rows: [
|
|
107
|
+
["CPIAUCSL", "CPI, all items", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "headline", "seasonally adjusted"]],
|
|
108
|
+
["CPIAUCNS", "CPI, all items (not seasonally adjusted)", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "headline"]],
|
|
109
|
+
["CPILFESL", "Core CPI", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "core", "ex food and energy"]],
|
|
110
|
+
["CPILFENS", "Core CPI (not seasonally adjusted)", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "core"]],
|
|
111
|
+
["CPIUFDSL", "CPI: Food", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "component"]],
|
|
112
|
+
["CUSR0000SAF11", "CPI: Food at home", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "component", "groceries"]],
|
|
113
|
+
["CUSR0000SEFV", "CPI: Food away from home", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "component", "restaurants"]],
|
|
114
|
+
["CPIENGSL", "CPI: Energy", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "component"]],
|
|
115
|
+
["CUSR0000SETB01", "CPI: Gasoline", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "component", "energy"]],
|
|
116
|
+
["CUSR0000SEHF01", "CPI: Electricity", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "component", "energy"]],
|
|
117
|
+
["CUSR0000SEHF02", "CPI: Utility gas service", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "component", "energy"]],
|
|
118
|
+
["CUSR0000SACL1E", "CPI: Core goods", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "component", "goods"]],
|
|
119
|
+
["CUSR0000SETA01", "CPI: New vehicles", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "component", "goods", "cars"]],
|
|
120
|
+
["CUSR0000SETA02", "CPI: Used cars and trucks", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "component", "goods", "cars"]],
|
|
121
|
+
["CPIAPPSL", "CPI: Apparel", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "component", "goods"]],
|
|
122
|
+
["CUSR0000SAM1", "CPI: Medical care goods", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "component", "goods", "health"]],
|
|
123
|
+
["CUSR0000SASLE", "CPI: Core services", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "component", "services"]],
|
|
124
|
+
["CUSR0000SAH1", "CPI: Shelter", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "component", "services", "housing"]],
|
|
125
|
+
["CUSR0000SEHA", "CPI: Rent", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "component", "services", "housing"]],
|
|
126
|
+
["CUSR0000SEHC", "CPI: Owners' equivalent rent", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "component", "services", "housing", "OER"]],
|
|
127
|
+
["CUSR0000SEHB", "CPI: Lodging away from home", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "component", "services", "hotels"]],
|
|
128
|
+
["CUSR0000SAM2", "CPI: Medical care services", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "component", "services", "health"]],
|
|
129
|
+
["CUSR0000SAS4", "CPI: Transportation services", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "component", "services"]],
|
|
130
|
+
["CUSR0000SETG01", "CPI: Airline fares", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "component", "services", "travel"]],
|
|
131
|
+
["PCEPI", "PCE price index", "index", "monthly", "Bureau of Economic Analysis", ["PCE", "headline"]],
|
|
132
|
+
["PCEPILFE", "Core PCE price index", "index", "monthly", "Bureau of Economic Analysis", ["PCE", "core"]],
|
|
133
|
+
["PPIACO", "Producer prices, all commodities", "index", "monthly", "Bureau of Labor Statistics", ["PPI"]],
|
|
134
|
+
["PPIFIS", "Producer prices, final demand", "index", "monthly", "Bureau of Labor Statistics", ["PPI"]],
|
|
135
|
+
["PPIFID", "Producer prices, final demand (not seasonally adjusted)", "index", "monthly", "Bureau of Labor Statistics", ["PPI"]],
|
|
136
|
+
["IR", "Import prices", "index", "monthly", "Bureau of Labor Statistics", ["trade"]],
|
|
137
|
+
["IQ", "Export prices", "index", "monthly", "Bureau of Labor Statistics", ["trade"]],
|
|
138
|
+
["T5YIE", "5Y breakeven inflation", "%", "daily", "Federal Reserve Bank of St. Louis", ["breakeven", "expectations", "TIPS"]],
|
|
139
|
+
["T10YIE", "10Y breakeven inflation", "%", "daily", "Federal Reserve Bank of St. Louis", ["breakeven", "expectations", "TIPS"]],
|
|
140
|
+
["T5YIFR", "5Y, 5Y forward inflation expectation", "%", "daily", "Federal Reserve Bank of St. Louis", ["breakeven", "expectations", "5y5y"]],
|
|
141
|
+
["TURCPIYOY", "Türkiye CPI, y/y", "%", "monthly", "TurkStat", ["CPI", "headline", "Turkey", "TR", "inflation", "lira"]],
|
|
142
|
+
["TURCPIMOM", "Türkiye CPI, m/m", "%", "monthly", "TurkStat", ["CPI", "headline", "Turkey", "TR", "inflation", "lira"]],
|
|
143
|
+
["BRAIPCAMOM", "Brazil IPCA, m/m", "%", "monthly", "IBGE", ["IPCA", "CPI", "headline", "Brazil", "BR", "Brazil inflation", "inflation", "real"]],
|
|
144
|
+
["BRAIPCA15MOM", "Brazil IPCA-15 mid-month, m/m", "%", "monthly", "IBGE",
|
|
145
|
+
["IPCA-15", "IPCA", "CPI", "mid-month", "Brazil", "BR", "Brazil inflation", "inflation", "real"]],
|
|
146
|
+
],
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
group: "FX",
|
|
150
|
+
rows: [
|
|
151
|
+
["DEXUSEU", "Euro (USD per EUR)", "USD", "daily", "Federal Reserve Board", ["EURUSD", "EUR", "euro"]],
|
|
152
|
+
["DEXUSUK", "British pound (USD per GBP)", "USD", "daily", "Federal Reserve Board", ["GBPUSD", "GBP", "sterling", "pound"]],
|
|
153
|
+
["DEXUSAL", "Australian dollar (USD per AUD)", "USD", "daily", "Federal Reserve Board", ["AUDUSD", "AUD"]],
|
|
154
|
+
["DEXUSNZ", "New Zealand dollar (USD per NZD)", "USD", "daily", "Federal Reserve Board", ["NZDUSD", "NZD"]],
|
|
155
|
+
["DEXJPUS", "Japanese yen (JPY per USD)", "JPY", "daily", "Federal Reserve Board", ["USDJPY", "JPY", "yen"]],
|
|
156
|
+
["DEXCHUS", "Chinese yuan (CNY per USD)", "CNY", "daily", "Federal Reserve Board", ["USDCNY", "CNY", "renminbi", "yuan"]],
|
|
157
|
+
["DEXINUS", "Indian rupee (INR per USD)", "INR", "daily", "Federal Reserve Board", ["USDINR", "INR"]],
|
|
158
|
+
["DEXBZUS", "Brazilian real (BRL per USD)", "BRL", "daily", "Federal Reserve Board", ["USDBRL", "BRL"]],
|
|
159
|
+
["DEXMXUS", "Mexican peso (MXN per USD)", "MXN", "daily", "Federal Reserve Board", ["USDMXN", "MXN"]],
|
|
160
|
+
["DEXKOUS", "South Korean won (KRW per USD)", "KRW", "daily", "Federal Reserve Board", ["USDKRW", "KRW"]],
|
|
161
|
+
["DEXCAUS", "Canadian dollar (CAD per USD)", "CAD", "daily", "Federal Reserve Board", ["USDCAD", "CAD"]],
|
|
162
|
+
["DEXSZUS", "Swiss franc (CHF per USD)", "CHF", "daily", "Federal Reserve Board", ["USDCHF", "CHF", "franc", "swiss franc"]],
|
|
163
|
+
["DEXTAUS", "Taiwan dollar (TWD per USD)", "TWD", "daily", "Federal Reserve Board", ["USDTWD", "TWD"]],
|
|
164
|
+
["DEXHKUS", "Hong Kong dollar (HKD per USD)", "HKD", "daily", "Federal Reserve Board", ["USDHKD", "HKD"]],
|
|
165
|
+
["DEXSIUS", "Singapore dollar (SGD per USD)", "SGD", "daily", "Federal Reserve Board", ["USDSGD", "SGD"]],
|
|
166
|
+
["DEXTHUS", "Thai baht (THB per USD)", "THB", "daily", "Federal Reserve Board", ["USDTHB", "THB"]],
|
|
167
|
+
["DEXMAUS", "Malaysian ringgit (MYR per USD)", "MYR", "daily", "Federal Reserve Board", ["USDMYR", "MYR"]],
|
|
168
|
+
["DEXNOUS", "Norwegian krone (NOK per USD)", "NOK", "daily", "Federal Reserve Board", ["USDNOK", "NOK"]],
|
|
169
|
+
["DEXSDUS", "Swedish krona (SEK per USD)", "SEK", "daily", "Federal Reserve Board", ["USDSEK", "SEK"]],
|
|
170
|
+
["DEXDNUS", "Danish krone (DKK per USD)", "DKK", "daily", "Federal Reserve Board", ["USDDKK", "DKK"]],
|
|
171
|
+
["DEXSLUS", "Sri Lankan rupee (LKR per USD)", "LKR", "daily", "Federal Reserve Board", ["USDLKR", "LKR"]],
|
|
172
|
+
["DEXSFUS", "South African rand (ZAR per USD)", "ZAR", "daily", "Federal Reserve Board", ["USDZAR", "ZAR"]],
|
|
173
|
+
["DEXVZUS", "Venezuelan bolivar (VES per USD)", "VES", "daily", "Federal Reserve Board", ["USDVES", "VES"]],
|
|
174
|
+
["DTWEXBGS", "Broad dollar index", "index", "daily", "Federal Reserve Board", ["dollar", "trade weighted"]],
|
|
175
|
+
["DTWEXAFEGS", "Dollar index against advanced economies", "index", "daily", "Federal Reserve Board", ["dollar", "trade weighted"]],
|
|
176
|
+
["DTWEXEMEGS", "Dollar index against emerging markets", "index", "daily", "Federal Reserve Board", ["dollar", "trade weighted"]],
|
|
177
|
+
["RTWEXBGS", "Real broad dollar index", "index", "monthly", "Federal Reserve Board", ["dollar", "trade weighted", "real"]],
|
|
178
|
+
["RTWEXAFEGS", "Real dollar index against advanced economies", "index", "monthly", "Federal Reserve Board", ["dollar", "trade weighted", "real"]],
|
|
179
|
+
["RTWEXEMEGS", "Real dollar index against emerging markets", "index", "monthly", "Federal Reserve Board", ["dollar", "trade weighted", "real"]],
|
|
180
|
+
],
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
group: "Energy",
|
|
184
|
+
rows: [
|
|
185
|
+
["DCOILWTICO", "WTI crude oil spot", "USD/barrel", "daily", "U.S. Energy Information Administration", ["oil", "crude"]],
|
|
186
|
+
["WCOILWTICO", "WTI crude oil spot (weekly)", "USD/barrel", "weekly", "U.S. Energy Information Administration", ["oil", "crude"]],
|
|
187
|
+
["DCOILBRENTEU", "Brent crude oil spot", "USD/barrel", "daily", "U.S. Energy Information Administration", ["oil", "crude"]],
|
|
188
|
+
["DHHNGSP", "Henry Hub natural gas spot", "USD/MMBtu", "daily", "U.S. Energy Information Administration", ["natural gas"]],
|
|
189
|
+
["NATURALGAS", "Natural gas consumption", "billion cubic feet", "monthly", "U.S. Energy Information Administration", ["natural gas"]],
|
|
190
|
+
],
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
// The IMF's monthly world prices: the closest public series to LME copper and aluminium, which FUT does not list,
|
|
194
|
+
// and to iron ore, whose futures are licensed.
|
|
195
|
+
group: "Commodities",
|
|
196
|
+
rows: [
|
|
197
|
+
["PCOPPUSDM", "Global price of copper", "USD/ton", "monthly", "International Monetary Fund", ["copper", "metals", "LME"]],
|
|
198
|
+
["PALUMUSDM", "Global price of aluminum", "USD/ton", "monthly", "International Monetary Fund", ["aluminum", "aluminium", "metals", "LME"]],
|
|
199
|
+
["PIORECRUSDM", "Global price of iron ore (dry metric ton)", "USD/ton", "monthly", "International Monetary Fund", ["iron ore", "iron", "steel", "metals"]],
|
|
200
|
+
],
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
group: "Valuation",
|
|
204
|
+
rows: [
|
|
205
|
+
["NCBEILQ027S", "Nonfinancial corporate equities (Z.1)", "million USD", "quarterly", "Federal Reserve Board", ["market cap", "Buffett"]],
|
|
206
|
+
["FBCELLQ027S", "Financial sector corporate equities (Z.1)", "million USD", "quarterly", "Federal Reserve Board", ["market cap"]],
|
|
207
|
+
["BOGZ1FL153064486Q", "Household corporate equity holdings (Z.1)", "million USD", "quarterly", "Federal Reserve Board", ["households", "equity allocation"]],
|
|
208
|
+
["BOGZ1FL663067003Q", "Broker-dealer customer receivables (Z.1)", "million USD", "quarterly", "Federal Reserve Board", ["margin debt"]],
|
|
209
|
+
["CPROFIT", "Corporate profits after tax", "billion USD", "quarterly", "Bureau of Economic Analysis", ["earnings", "profits"]],
|
|
210
|
+
["TNWMVBSNNCB", "Nonfinancial corporate net worth (Z.1)", "million USD", "quarterly", "Federal Reserve Board", ["Tobin's Q"]],
|
|
211
|
+
],
|
|
212
|
+
},
|
|
213
|
+
];
|
|
214
|
+
|
|
215
|
+
/** The FRED series the rates and macro panes chart, each listed once. */
|
|
216
|
+
export const FRED_CATALOG_SERIES: readonly SeriesDefinition[] = GROUPS.flatMap(({ group, rows }) => (
|
|
217
|
+
rows.map(([seriesId, name, unit, frequency, publisher, tags]): SeriesDefinition => ({
|
|
218
|
+
id: `fred:${seriesId}`,
|
|
219
|
+
name,
|
|
220
|
+
unit,
|
|
221
|
+
frequency,
|
|
222
|
+
group,
|
|
223
|
+
...(tags?.length ? { tags } : {}),
|
|
224
|
+
publisher,
|
|
225
|
+
// The licence a publisher's data comes under, which the catalog lists beside the series (SORA's).
|
|
226
|
+
...(seriesNotOnFred(seriesId)?.attribution ? { limitation: seriesNotOnFred(seriesId)!.attribution } : {}),
|
|
227
|
+
url: fredSeriesUrl(seriesId),
|
|
228
|
+
expression: `FRED:${seriesId}`,
|
|
229
|
+
}))
|
|
230
|
+
));
|
|
231
|
+
|
|
232
|
+
/** Spellings of a Treasury bill a person types, as the series names say it. */
|
|
233
|
+
const BILL_WORDS: ReadonlyArray<[RegExp, string]> = [
|
|
234
|
+
[/\bt-?bills?\b|\bt bills?\b|\btreasury bills?\b/g, "treasury bill"],
|
|
235
|
+
[/\b(\d+|three|six|one|four)[\s-]*(month|mo|m)\b/g, "$1-month"],
|
|
236
|
+
[/\bthree-month\b/g, "3-month"],
|
|
237
|
+
[/\bsix-month\b/g, "6-month"],
|
|
238
|
+
[/\b(\d+|four)[\s-]*(week|wk|w)\b/g, "$1-week"],
|
|
239
|
+
[/\bfour-week\b/g, "4-week"],
|
|
240
|
+
[/\b(1|one)[\s-]*(year|yr|y)\b/g, "1-year"],
|
|
241
|
+
];
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* The served FRED series a name asks for, when one alone fits every word: `3 month t-bill` is DTB3. Null for an id
|
|
245
|
+
* (DTB3), for words several series fit and for none.
|
|
246
|
+
*/
|
|
247
|
+
export function fredSeriesIdForName(text: string): string | null {
|
|
248
|
+
const normalized = BILL_WORDS.reduce((value, [pattern, replacement]) => value.replace(pattern, replacement), text.trim().toLowerCase());
|
|
249
|
+
const words = normalized.split(/\s+/).filter((word) => word && word !== "rate" && word !== "yield");
|
|
250
|
+
if (words.length < 2) return null;
|
|
251
|
+
const fits = FRED_CATALOG_SERIES.filter((series) => {
|
|
252
|
+
const name = `${series.name} ${(series.tags ?? []).join(" ")}`.toLowerCase();
|
|
253
|
+
return words.every((word) => name.includes(word));
|
|
254
|
+
});
|
|
255
|
+
return fits.length === 1 ? fits[0]!.id.replace(/^fred:/, "") : null;
|
|
256
|
+
}
|
|
@@ -6,6 +6,9 @@ export interface DatedObservation {
|
|
|
6
6
|
value: number | null;
|
|
7
7
|
/** The day the value was released, when the source says (FRED's newest monthly figure). */
|
|
8
8
|
releasedOn?: string;
|
|
9
|
+
firstReleased?: string;
|
|
10
|
+
revisedOn?: string;
|
|
11
|
+
firstReleaseValue?: number;
|
|
9
12
|
}
|
|
10
13
|
|
|
11
14
|
export interface SeriesCacheMetadata {
|
|
@@ -80,6 +80,7 @@ export function SeriesDetailChart({
|
|
|
80
80
|
reference,
|
|
81
81
|
resetKey,
|
|
82
82
|
formatValue,
|
|
83
|
+
formatAxisValue,
|
|
83
84
|
aboveChartRows = 0,
|
|
84
85
|
aboveChart,
|
|
85
86
|
belowChartRows = 0,
|
|
@@ -102,6 +103,7 @@ export function SeriesDetailChart({
|
|
|
102
103
|
/** A new key drops the user's zoom and pan. */
|
|
103
104
|
resetKey: string;
|
|
104
105
|
formatValue: (value: number) => string;
|
|
106
|
+
formatAxisValue?: (value: number) => string;
|
|
105
107
|
/** Rows kept for `aboveChart`, drawn between the figures and a drawable chart. */
|
|
106
108
|
aboveChartRows?: number;
|
|
107
109
|
aboveChart?: (chartWidth: number) => ReactNode;
|
|
@@ -159,6 +161,7 @@ export function SeriesDetailChart({
|
|
|
159
161
|
viewportResetKey={resetKey}
|
|
160
162
|
onViewportChange={setUserViewport}
|
|
161
163
|
formatValue={(value) => formatValue(value)}
|
|
164
|
+
formatAxisValue={formatAxisValue}
|
|
162
165
|
emptyMessage="Not enough chart data"
|
|
163
166
|
/>
|
|
164
167
|
</>
|
|
@@ -16,7 +16,7 @@ import { colors } from "../../../theme/colors";
|
|
|
16
16
|
import type { PaneProps } from "../../../types/plugin";
|
|
17
17
|
import { Box, TextAttributes } from "../../../ui";
|
|
18
18
|
import { formatShortDate } from "../../../utils/datetime-format";
|
|
19
|
-
import { MISSING_VALUE, formatCompact, formatNumber } from "../../../utils/format";
|
|
19
|
+
import { MISSING_VALUE, displayWidth, formatCompact, formatNumber } from "../../../utils/format";
|
|
20
20
|
import { nextHeaderSort, type SortDirection } from "../../../utils/sort-values";
|
|
21
21
|
import { shortInterestPublicationSegments } from "./schedule";
|
|
22
22
|
import { loadShortWatch } from "./watch-client";
|
|
@@ -55,6 +55,7 @@ const COLUMNS: WatchColumn[] = [
|
|
|
55
55
|
];
|
|
56
56
|
const DEFAULT_SORT = { columnId: "setup" as ShortWatchSortId, direction: "desc" as SortDirection };
|
|
57
57
|
const rowKey = (row: ShortWatchRow) => row.symbol;
|
|
58
|
+
const rowSetup = (row: ShortWatchRow) => row.error ?? (row.return1M == null ? "No month of daily closes" : setupLabel(row.setup));
|
|
58
59
|
|
|
59
60
|
const day = (iso: string | null) => iso ? formatShortDate(`${iso}T00:00:00Z`, { year: false, utc: true, fallback: MISSING_VALUE }) : MISSING_VALUE;
|
|
60
61
|
const signed = (value: number | null, digits = 1) => value == null ? MISSING_VALUE : `${value > 0 ? "+" : ""}${formatNumber(value, digits)}%`;
|
|
@@ -87,21 +88,19 @@ export function ShortWatchPane({ width, height, focused }: Pick<PaneProps, "widt
|
|
|
87
88
|
// A date every row shares moves to the query bar; a column no row fills is left out.
|
|
88
89
|
const settled = useMemo(() => sharedDate(rows, "settlementDate"), [rows]);
|
|
89
90
|
const closed = useMemo(() => sharedDate(rows, "closeDate"), [rows]);
|
|
90
|
-
const columns = useMemo(() => COLUMNS.
|
|
91
|
+
const columns = useMemo(() => COLUMNS.map((column) => column.id === "setup"
|
|
92
|
+
? { ...column, width: Math.max(column.width, ...rows.map((row) => Math.min(32, displayWidth(rowSetup(row))))) } : column)
|
|
93
|
+
.filter((column) => !(column.id === "settlementDate" && settled)
|
|
91
94
|
&& !(column.id === "closeDate" && closed)
|
|
92
95
|
&& !(column.id === "percentFloat" && rows.length > 0 && rows.every((row) => row.percentFloat == null))), [rows, settled, closed]);
|
|
93
96
|
const [selected, setSelected] = usePluginPaneState<string | null>("short-watch:selected", null);
|
|
94
97
|
|
|
95
|
-
const unreported = rows.filter((row) => !row.settlementDate).map((row) => row.symbol);
|
|
96
|
-
const unpriced = rows.filter((row) => row.settlementDate && row.return1M == null).map((row) => row.symbol);
|
|
97
98
|
usePaneNoticeFooter({
|
|
98
99
|
registrationId: "short-watch-notices",
|
|
99
100
|
focused,
|
|
100
101
|
notices: [
|
|
101
102
|
universe.symbols.length ? universe.notice : null,
|
|
102
103
|
resource.data ? resource.error : null,
|
|
103
|
-
unreported.length ? `No short interest settlement for ${unreported.join(", ")}.` : null,
|
|
104
|
-
unpriced.length ? `No month of daily closes for ${unpriced.join(", ")}.` : null,
|
|
105
104
|
].filter((value): value is string => !!value),
|
|
106
105
|
});
|
|
107
106
|
// When the newest settlement listed was published and the next is due, as `fn SIW` dates it.
|
|
@@ -119,7 +118,8 @@ export function ShortWatchPane({ width, height, focused }: Pick<PaneProps, "widt
|
|
|
119
118
|
const renderCell = useCallback((row: ShortWatchRow, column: WatchColumn): DataTableCell => {
|
|
120
119
|
switch (column.id) {
|
|
121
120
|
case "symbol": return { text: row.symbol, color: colors.textBright, attributes: TextAttributes.BOLD };
|
|
122
|
-
case "setup": return { text:
|
|
121
|
+
case "setup": return { text: rowSetup(row),
|
|
122
|
+
color: row.error || row.return1M == null || row.setup === "crowded-rising" ? colors.warning : colors.textDim };
|
|
123
123
|
case "percentFloat": return { text: row.percentFloat == null ? MISSING_VALUE : `${formatNumber(row.percentFloat, 1)}%`,
|
|
124
124
|
color: row.setup ? colors.textBright : colors.text, value: row.percentFloat ?? undefined };
|
|
125
125
|
case "daysToCover": return { text: row.daysToCover == null ? MISSING_VALUE : formatNumber(row.daysToCover, 1), value: row.daysToCover ?? undefined };
|
|
@@ -54,6 +54,22 @@ export function adrPairLegs(
|
|
|
54
54
|
return { pair, receiptSide, receiptKey: pair.receipt, homeKey: home, otherKey: pair.receipt };
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
/**
|
|
58
|
+
* Each leg's quote: the other line's from its own read, and the listing's own
|
|
59
|
+
* from its read or, while that has none (a read that failed), the quote its
|
|
60
|
+
* pane already shows. The pane heads with that price, so the tab never says
|
|
61
|
+
* it is unavailable beside it.
|
|
62
|
+
*/
|
|
63
|
+
export function adrPairQuotes(
|
|
64
|
+
legs: AdrPairLegs,
|
|
65
|
+
read: { own: Quote | null | undefined; other: Quote | null | undefined },
|
|
66
|
+
paneQuote: Quote | null | undefined,
|
|
67
|
+
): { receipt: Quote | null; home: Quote | null } {
|
|
68
|
+
const own = read.own ?? paneQuote ?? null;
|
|
69
|
+
const other = read.other ?? null;
|
|
70
|
+
return legs.receiptSide ? { receipt: own, home: other } : { receipt: other, home: own };
|
|
71
|
+
}
|
|
72
|
+
|
|
57
73
|
/** The comparison from the two quotes and the home currency's USD value (as exchange rates are served). */
|
|
58
74
|
export function adrPairComparison(
|
|
59
75
|
legs: AdrPairLegs,
|
|
@@ -10,7 +10,7 @@ import { heldCurrencyUnit } from "../../../../utils/currency-units";
|
|
|
10
10
|
import type { TickerResearchTabProps } from "../../../../types/plugin";
|
|
11
11
|
import { Box } from "../../../../ui";
|
|
12
12
|
import { useOpenDescription } from "../../shared/open-description";
|
|
13
|
-
import { adrPairComparison, adrPairFigures, adrPairInputRows, adrPairLegs, type AdrPairInputRow } from "./model";
|
|
13
|
+
import { adrPairComparison, adrPairFigures, adrPairInputRows, adrPairLegs, adrPairQuotes, type AdrPairInputRow } from "./model";
|
|
14
14
|
|
|
15
15
|
// The price and its time first: a narrow pane keeps them and drops the role.
|
|
16
16
|
const COLUMNS: DataTableColumn[] = [
|
|
@@ -37,9 +37,12 @@ export function AdrPairResearchTab({ width, height, focused }: TickerResearchTab
|
|
|
37
37
|
// Both legs through the quote path, so each is read alike whichever side the pane is on.
|
|
38
38
|
const ownEntry = useQuoteEntry(legs ? ticker?.metadata.ticker ?? symbol : null, ticker);
|
|
39
39
|
const otherEntry = useQuoteEntry(legs?.otherKey ?? null, null);
|
|
40
|
+
const quotes = legs
|
|
41
|
+
? adrPairQuotes(legs, { own: resolveEntryData(ownEntry), other: resolveEntryData(otherEntry) }, financials?.quote)
|
|
42
|
+
: { receipt: null, home: null };
|
|
43
|
+
const receiptQuote = quotes.receipt;
|
|
44
|
+
const homeQuote = quotes.home;
|
|
40
45
|
const [receiptEntry, homeEntry] = legs?.receiptSide ? [ownEntry, otherEntry] : [otherEntry, ownEntry];
|
|
41
|
-
const receiptQuote = resolveEntryData(receiptEntry);
|
|
42
|
-
const homeQuote = resolveEntryData(homeEntry);
|
|
43
46
|
// The home price's currency, a minor unit read as its own (GBp as GBP), as the comparison reads it.
|
|
44
47
|
const homeCurrency = homeQuote?.currency ? heldCurrencyUnit(homeQuote.currency).currency : "";
|
|
45
48
|
const observed = useFxRateObservations([homeCurrency]).get(homeCurrency);
|
|
@@ -53,7 +56,8 @@ export function AdrPairResearchTab({ width, height, focused }: TickerResearchTab
|
|
|
53
56
|
|
|
54
57
|
if (!legs) return <EmptyState title="No ADR pair for this listing." />;
|
|
55
58
|
const pending = (entry: typeof receiptEntry) => !entry || entry.phase === "loading" || entry.phase === "idle";
|
|
56
|
-
|
|
59
|
+
// A leg with a quote is not waiting on its read.
|
|
60
|
+
const loading = !comparison && ((!receiptQuote && pending(receiptEntry)) || (!homeQuote && pending(homeEntry)));
|
|
57
61
|
const error = !comparison && !loading
|
|
58
62
|
? `Prices unavailable for ${!receiptQuote ? legs.receiptKey : legs.homeKey}.`
|
|
59
63
|
: null;
|
|
@@ -5,7 +5,7 @@ import type { TapeRange, TapeSnapshot } from "../../../api-client/tape";
|
|
|
5
5
|
import { fetchTape } from "./client";
|
|
6
6
|
import { newestFirst, quoteSpread, tapePrice, tapePriceDigits, tapeStatistics, tapeTimeKey } from "./model";
|
|
7
7
|
import { REPORT_ROWS } from "../shared/headless-options";
|
|
8
|
-
import { inTapeRange, normalizeTapeClock, parseTapeClock, servedWindow, sessionDay, tapeMoment, tapeWindowRange } from "./window";
|
|
8
|
+
import { inTapeRange, lastSessionNote, normalizeTapeClock, parseTapeClock, servedWindow, sessionDay, tapeMoment, tapeWindowRange } from "./window";
|
|
9
9
|
|
|
10
10
|
type Format = NonNullable<HeadlessPaneColumn["format"]>;
|
|
11
11
|
const fixedPrice = (digits: number): Format => (value) => tapePrice(typeof value === "number" ? value : null, digits);
|
|
@@ -109,6 +109,9 @@ export const timeSalesHeadless: HeadlessPaneDefinition<"bundle"> = {
|
|
|
109
109
|
const price = fixedPrice(tapePriceDigits(data.trades.map((row) => row.price)));
|
|
110
110
|
const trades = ordered(data.trades).slice(0, limit).map((row) => ({ ...row, conditions: row.conditions.join(" ") }));
|
|
111
111
|
const notes = windowed ? [...windowed.notes, ...listedNote(windowed.range, data.trades.length, trades.length)] : [];
|
|
112
|
+
const lastSession = lastSessionNote(data);
|
|
113
|
+
if (!windowed && lastSession) notes.unshift(lastSession);
|
|
114
|
+
if (!windowed && trades.length < data.trades.length) notes.push(`Listing the first ${trades.length} of ${data.trades.length} observed trades, newest first; --limit takes up to 1000.`);
|
|
112
115
|
// SIP prints, real-time or fifteen minutes delayed by entitlement, dated by the newest print.
|
|
113
116
|
const freshness = data.feed === "sip"
|
|
114
117
|
? { status: "live" as const, cadence: "daily" as const }
|
|
@@ -15,6 +15,7 @@ import { isCloudSessionRequired, useResearchCloudSession } from "../shared/resea
|
|
|
15
15
|
import { newestFirst, quoteKey, quoteSpread, stickyTapePriceDigits, tapeClockNewYork, tapeConditionWords, tapePrice, tapeQuantity, tapeStampNewYork, tapeStatistics, tapeTicks, tapeTime, tapeAfter, tapeMomentKey, tapeRowAtOrBefore, tapeVenue, tradeKey, type TapeDigits } from "./model";
|
|
16
16
|
import { usePinnedMoment } from "../../../components/use-pinned-moment";
|
|
17
17
|
import { useTape } from "./use-tape";
|
|
18
|
+
import { lastSessionNote } from "./window";
|
|
18
19
|
|
|
19
20
|
const TABS = [{ value: "trades", label: "Trades" }, { value: "quotes", label: "NBBO" }];
|
|
20
21
|
const TRADES: DataTableColumn[] = [
|
|
@@ -121,6 +122,7 @@ function TimeSalesView({ width, height, focused, symbol, exchange }: PaneProps &
|
|
|
121
122
|
...(pinnedBeforeTape ? [`The pinned moment is before this tape's first ${tab === "quotes" ? "quote" : "print"}, ${tapeStampNewYork(rowTime(rows.at(-1)!))}.`] : [])] });
|
|
122
123
|
usePaneStatusFooter({ registrationId: "time-sales:status", loading: resource.loading, error: resource.error,
|
|
123
124
|
info: data ? [...splitDelayedStatus({ id: "feed", quoteStatus: true, parts: [{ text: `${data.feed === "sip" ? "real-time" : "15m delayed"} · ${tapeStampNewYork(data.asOf)}`, tone: "muted" }] }),
|
|
125
|
+
...(lastSessionNote(data) ? [{ id: "last-session", parts: [{ text: lastSessionNote(data)!, tone: "muted" as const }] }] : []),
|
|
124
126
|
...(frozen ? [{ id: "paused", parts: [{ text: "paused", tone: "warning" as const }] }] : []),
|
|
125
127
|
...(!data.connected || resource.snapshotOnly ? [{ id: "snapshot", parts: [{ text: "snapshot", tone: "warning" as const }] }] : [])] : [] });
|
|
126
128
|
const quoteColumns = useMemo(() => dropColumnsToFit(QUOTES, width - 1, QUOTE_DROP_ORDER), [width]);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { TapeRange, TapeSnapshot } from "../../../api-client/tape";
|
|
2
|
+
import { isVenueTradingDay } from "../../../market-data/market/freshness";
|
|
2
3
|
import { formatUtcDayTime } from "../../../utils/utc-time";
|
|
3
4
|
import { tapeTimeKey } from "./model";
|
|
4
5
|
|
|
@@ -96,6 +97,17 @@ export function servedWindow(snapshot: Pick<TapeSnapshot, "session" | "generated
|
|
|
96
97
|
return { date, from, to: Math.min(close, cutoff), cutoff: cutoff < close, delayMinutes: Math.round(snapshot.delaySeconds / 60) };
|
|
97
98
|
}
|
|
98
99
|
|
|
100
|
+
export function lastSessionNote(snapshot: Pick<TapeSnapshot, "session" | "generatedAt" | "delaySeconds" | "asOf">): string | null {
|
|
101
|
+
const served = servedWindow(snapshot);
|
|
102
|
+
if (!served) return null;
|
|
103
|
+
const now = newYorkParts(Date.parse(snapshot.generatedAt));
|
|
104
|
+
const observedDay = snapshot.asOf ? newYorkParts(Date.parse(snapshot.asOf)).date : served.date;
|
|
105
|
+
if (observedDay > served.date) return null;
|
|
106
|
+
if (now.date <= served.date && served.cutoff) return null;
|
|
107
|
+
const closed = !isVenueTradingDay("NYSE", now.date) || now.seconds < SIP_OPEN || now.seconds >= SIP_CLOSE;
|
|
108
|
+
return `${closed ? "Market closed; last session" : "Last available session"} ${sessionDay(served.date)}.`;
|
|
109
|
+
}
|
|
110
|
+
|
|
99
111
|
/** What TAS serves, for a window it cannot read: `Fri 16 Oct 2026, 04:00:00 ET (08:00:00 UTC) to ...`. */
|
|
100
112
|
function servedWindowText(served: ServedWindow): string {
|
|
101
113
|
const end = served.cutoff ? `${tapeMoment(served.to)}, the feed cutoff${served.delayMinutes ? ` (${served.delayMinutes} min delayed)` : ""}` : tapeMoment(served.to);
|
|
@@ -66,9 +66,13 @@ export interface AuctionQuery {
|
|
|
66
66
|
pageSize?: number;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
+
// A query that has not answered in 15 s does not answer the second time
|
|
70
|
+
// either: the source stalls for a minute at a time. The board then stands on
|
|
71
|
+
// TreasuryDirect and the saved copy (cache.ts) at once, not after 48 s of retries.
|
|
69
72
|
const TREASURY_FETCH = createThrottledFetch({
|
|
70
73
|
requestsPerMinute: 20,
|
|
71
74
|
maxRetries: 2,
|
|
75
|
+
retryTimeouts: false,
|
|
72
76
|
timeoutMs: 15_000,
|
|
73
77
|
backoffBaseMs: 800,
|
|
74
78
|
defaultHeaders: { Accept: "application/json" },
|
|
@@ -22,9 +22,11 @@ export const DIRECT_LOOKBACK_DAYS = 60;
|
|
|
22
22
|
/** Announced auctions are listed days to two weeks ahead; a month leaves none out. */
|
|
23
23
|
const DIRECT_LOOKAHEAD_DAYS = 30;
|
|
24
24
|
|
|
25
|
+
// As Fiscal Data's (client.ts): a stalled search is not waited out twice more.
|
|
25
26
|
const DIRECT_FETCH = createThrottledFetch({
|
|
26
27
|
requestsPerMinute: 20,
|
|
27
28
|
maxRetries: 2,
|
|
29
|
+
retryTimeouts: false,
|
|
28
30
|
timeoutMs: 20_000,
|
|
29
31
|
backoffBaseMs: 800,
|
|
30
32
|
defaultHeaders: { Accept: "application/json" },
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { signalWithTimeout } from "../../../utils/async-deadline";
|
|
1
2
|
import { httpFetch } from "../../../utils/http-transport";
|
|
2
3
|
import { numericOrNull, scalarTextOrNull } from "../../../utils/guards";
|
|
3
4
|
import { cashLineLabel, type CashAccount, type DebtDay, type OperatingCash, type TgaClose } from "./model";
|
|
@@ -100,13 +101,21 @@ function parseDebtToPenny(payload: unknown): DebtDay[] {
|
|
|
100
101
|
.slice(0, DEBT_DAYS);
|
|
101
102
|
}
|
|
102
103
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
104
|
+
/**
|
|
105
|
+
* One statement read, bounded whoever asks: a caller's signal (a command's)
|
|
106
|
+
* ends it sooner, never later, so a source that does not answer is an error
|
|
107
|
+
* in seconds rather than whenever its gateway gives up.
|
|
108
|
+
*/
|
|
109
|
+
async function readJson(url: string, label: string, signal: AbortSignal | undefined, timeoutMs: number): Promise<unknown> {
|
|
110
|
+
const deadline = signalWithTimeout(signal, timeoutMs);
|
|
111
|
+
try {
|
|
112
|
+
const response = await httpFetch(url, { headers: { Accept: "application/json" }, signal: deadline });
|
|
113
|
+
if (!response.ok) throw new Error(`${label} request failed (${response.status})`);
|
|
114
|
+
return await response.json() as unknown;
|
|
115
|
+
} catch (error) {
|
|
116
|
+
if (deadline.aborted && !signal?.aborted) throw new Error(`${label} request timed out after ${Math.round(timeoutMs / 1000)} s`);
|
|
117
|
+
throw error;
|
|
118
|
+
}
|
|
110
119
|
}
|
|
111
120
|
|
|
112
121
|
/**
|
|
@@ -114,11 +123,14 @@ async function readJson(url: string, label: string, signal?: AbortSignal): Promi
|
|
|
114
123
|
* closing balance history unless `history` is off (a report that does not draw it).
|
|
115
124
|
* A history that cannot be read leaves the figures as they are.
|
|
116
125
|
*/
|
|
117
|
-
export async function fetchTreasuryDaily(
|
|
126
|
+
export async function fetchTreasuryDaily(
|
|
127
|
+
signal?: AbortSignal,
|
|
128
|
+
{ history = true, timeoutMs = FETCH_TIMEOUT_MS }: { history?: boolean; timeoutMs?: number } = {},
|
|
129
|
+
): Promise<TreasuryDaily> {
|
|
118
130
|
const [cash, debt, tga] = await Promise.all([
|
|
119
|
-
readJson(CASH_URL, "Treasury cash", signal),
|
|
120
|
-
readJson(DEBT_URL, "Treasury debt", signal),
|
|
121
|
-
history ? readJson(TGA_HISTORY_URL, "Treasury account history", signal).then(parseTgaHistory).then(
|
|
131
|
+
readJson(CASH_URL, "Treasury cash", signal, timeoutMs),
|
|
132
|
+
readJson(DEBT_URL, "Treasury debt", signal, timeoutMs),
|
|
133
|
+
history ? readJson(TGA_HISTORY_URL, "Treasury account history", signal, timeoutMs).then(parseTgaHistory).then(
|
|
122
134
|
(closes) => ({ closes }),
|
|
123
135
|
(error: unknown) => ({ closes: [] as TgaClose[], error: error instanceof Error ? error.message : String(error) }),
|
|
124
136
|
) : { closes: [] as TgaClose[] },
|
|
@@ -201,6 +201,8 @@ function installShotHttpFetchTransport(): void {
|
|
|
201
201
|
method: "POST",
|
|
202
202
|
headers: { "Content-Type": "application/json" },
|
|
203
203
|
body: JSON.stringify(await toRequestEnvelope(url, init)),
|
|
204
|
+
// A pane's own deadline ends the read here as in the app, not when the Bun side gives up.
|
|
205
|
+
signal: init?.signal ?? null,
|
|
204
206
|
});
|
|
205
207
|
const result = await response.json() as { ok: boolean; error?: string; data?: HttpProxyResponseEnvelope };
|
|
206
208
|
if (!result.ok || !result.data) throw new Error(result.error ?? `Request failed: ${url}`);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { FRED_CATALOG_SERIES } from "../../plugins/builtin/shared/fred-catalog";
|
|
2
|
+
import { ICE_CREDIT_PUBLISHER, ICE_CREDIT_SERIES } from "../../time-series/ice-credit";
|
|
3
|
+
import { seriesNotOnFred } from "./fred-series";
|
|
4
|
+
|
|
5
|
+
const publishers = new Map([
|
|
6
|
+
...FRED_CATALOG_SERIES.map((series): [string, string] => [series.id.slice(5), series.publisher!]),
|
|
7
|
+
...ICE_CREDIT_SERIES.map((series): [string, string] => [series.seriesId, ICE_CREDIT_PUBLISHER]),
|
|
8
|
+
]);
|
|
9
|
+
const additional: Readonly<Record<string, string>> = {
|
|
10
|
+
GDPNOW: "Federal Reserve Bank of Atlanta",
|
|
11
|
+
NFCI: "Federal Reserve Bank of Chicago",
|
|
12
|
+
STLFSI4: "Federal Reserve Bank of St. Louis",
|
|
13
|
+
MEDCPIM158SFRBCLE: "Federal Reserve Bank of Cleveland",
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export function fredPublisher(seriesId: string, source?: string | null): string | null {
|
|
17
|
+
const normalized = seriesId.trim().toUpperCase();
|
|
18
|
+
return publishers.get(normalized) ?? additional[normalized]
|
|
19
|
+
?? (/^DGS\d|^DFII\d/.test(normalized) ? "Federal Reserve Board" : source?.trim() || null);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function fredCitation(seriesId: string, source?: string | null): string {
|
|
23
|
+
const publisher = fredPublisher(seriesId, source);
|
|
24
|
+
return seriesNotOnFred(seriesId) ? publisher ?? "Gloom Cloud" : publisher ? `${publisher} via FRED` : "Publisher not stated via FRED";
|
|
25
|
+
}
|
|
@@ -9,7 +9,7 @@ import type {
|
|
|
9
9
|
const CACHE_KIND = "fred-series";
|
|
10
10
|
const CACHE_SOURCE = "gloomberb-cloud";
|
|
11
11
|
// Refresh persisted metadata that predates FRED's source coverage dates.
|
|
12
|
-
const CACHE_SCHEMA_VERSION =
|
|
12
|
+
const CACHE_SCHEMA_VERSION = 3;
|
|
13
13
|
const CACHE_POLICY = {
|
|
14
14
|
staleMs: 24 * 60 * 60 * 1000,
|
|
15
15
|
expireMs: 30 * 24 * 60 * 60 * 1000,
|