# alphai-tui [![CI](https://github.com/makeev/alphai-tui/actions/workflows/ci.yml/badge.svg)](https://github.com/makeev/alphai-tui/actions/workflows/ci.yml) [![crates.io](https://img.shields.io/crates/v/alphai-tui.svg)](https://crates.io/crates/alphai-tui) [![license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/makeev/alphai-tui/blob/main/LICENSE) [![alphai-tui on The Terminal Index](https://cli.masoko.net/badge/alphai-tui.svg)](https://cli.masoko.net/tools/alphai-tui/) An open-source, Bloomberg-style stock dashboard for the terminal that also answers why the price moved. Live quotes and candlestick charts on one side; on the other, for the same ticker, AI-scored news with a full analysis of each story, the SEC Form 4 insider filings and a structured read of the last earnings report. A watchlist calendar brings upcoming company reports and US macro releases into the same workspace. One Rust binary built on [ratatui](https://ratatui.rs), no browser tab, and no account needed for the prices. Coming from tickrs or ticker? See [how it compares](#how-it-compares). ![alphai-tui demo: the split dashboard with the quote rail, the news view with the chart over the list and the full AI analysis card beside it, the story read in place under the chart, the ticker's corporate events and the market-wide scope, a year of SEC Form 4 insider filings labelled by why each sale happened, the earnings read, the summary cards and heat map, the portfolio and the candlestick chart with moving averages, volume and RSI](https://raw.githubusercontent.com/makeev/alphai-tui/main/assets/demo.gif) ```sh brew install makeev/tap/alphai-tui # also cargo, apt, AUR, x-cmd, or a prebuilt binary alphai-tui NVDA AVGO AAPL MSFT META TSLA AMZN GOOGL BTC-USD ``` Quotes and charts run keyless on Yahoo, or on Finnhub, Alpaca or Tiingo with their own keys. The News, Insider, Earnings and Calendar views run on a free [AlphAI](https://alphai.io?utm_source=alphai-tui&utm_medium=referral) key that you paste once in the settings screen. The first run walks you through both, and after that a bare `alphai-tui` reopens your watchlist. ## The screens Nine views, one keystroke apart (`1` to `9`, or Tab). Some follow the selected ticker; Summary, Portfolio and Calendar cover several names. One line under the tabs carries the selected ticker's price into all of them. The screenshots use the `dracula` preset. ### The quote rail, in every view ![alphai-tui quote rail: the symbol and price, the day's change, the after-hours print with its time, what the holding has made, the session badge with a countdown to the opening bell, each part between thin rules](https://raw.githubusercontent.com/makeev/alphai-tui/main/assets/rail.png) Price, the change on the day, the extended-hours print measured against the regular close, what you are up or down on the ticker if you hold any of it, what the US market is doing right now (pre, live, post or closed) and how long until the next bell, whether the feed is delayed, where the price sits between the day's low and high, and, where the source reports them and the terminal is wide enough, the year's range and the day's volume. The rest of the watchlist follows as percentages. Each part sits between thin rules (`NBIS 115.88 USD │ ▼ -12.76 -9.92% │ AH 112.80 -2.66% · 19:59 │ ○ closed · opens in 55h`), and only the numbers that say which way a price went carry its color; times and sources stay in the faint tier. When the provider supplies a trade timestamp and feed, they follow the session badge (`Tiingo 13 Nov 16:00`, the time of the trade, not of the last refresh). A trade more than 20 minutes old during the session moves ahead of the extended print in the warning color, since the price beside it is then not the market's. With borderless panels the parts are spaced apart instead of ruled. The header keeps navigation and connection status. The flag prioritizes a filing that landed today, then the focused ticker's next report within today and the following six ET dates, then the next high-importance macro event. Portfolio, Calendar and Earnings use the ticker in focus. The flag reads the shared fresh calendar cache. Estimated macro dates keep an `est.` label, and postponed or cancelled events do not flag. So the News, Insider and Earnings views are never a ticker name with no price attached, and moving between tickers with the arrow keys is not a blind jump. Parts drop one at a time as the terminal narrows, the symbol and the price surviving to the last; `[ui] quote_rail = false` turns the line off, and a terminal under 12 rows gives the row back to the view. ### 1 Split: the default view ![alphai-tui split view: a full-width candlestick chart with moving averages, news marks, the presets and the pre and post market switch in its title, its switches along the bottom and a key to the marks and shades in the corner, the watchlist and the scored news feed side by side underneath](https://raw.githubusercontent.com/makeev/alphai-tui/main/assets/split.png) The chart across the top 70%, the watchlist and the news feed side by side in the bottom 30%. One screen that says what you follow, what it is doing and what is being said about it; the chart gets the full width, so it shows twice the candles a half-width one could. On very small terminals the feed steps aside and the watchlist and the chart share the row. `a` adds a ticker without leaving the app (type the symbol, Enter), `d` drops the selected one. Both write that ticker to the config's watchlist straight away, the way a holding is saved. A session started on tickers from the command line (`alphai-tui TSLA`) does the same without replacing the saved list: `a NVDA` adds NVDA to it and TSLA stays out. Save in the settings screen writes such a session's whole list on purpose. `/` finds a ticker in your watchlist from any view. Type part of its symbol or company name, use `↑`/`↓` to choose a result, then `Enter` to switch; `Esc` cancels without losing your place. Exact symbols come first. The results show regular-session prices and daily changes, with cached or stale quotes labelled. Names are available once a Yahoo quote has loaded (including from the cache); other sources support symbol search. Searching is local, does not change the watchlist order and requests no additional data until you select a ticker. `Ctrl-U` clears the query; `PgUp`/`PgDn` and `Home`/`End` move through a long list. In Portfolio, selecting a held ticker focuses its row; an unheld ticker opens in Chart. Enter ticker symbols rather than company or index names. Names containing spaces are rejected locally, including in command-line arguments and the saved watchlist, before any data request. Ticker punctuation such as `^`, `.` and `-` is preserved; support still depends on the selected data source. If a saved watchlist contains a name, startup identifies the invalid entry. Correct it in the config file, or pass ticker symbols on the command line to use a different list for that session. ### 2 News: the story and what it means ![alphai-tui news view: the ticker's chart over the article list with the selected story marked on it, the scopes, the score and the layouts as pills in the list's title, and the full AI analysis card on the right](https://raw.githubusercontent.com/makeev/alphai-tui/main/assets/news.png) Every article carries a per-ticker analysis: the expected price impact and the confidence behind it, relevance and novelty scores, how actionable it is, the background context, the entities involved and a contrarian view. A seven-day bullish/bearish rollup tops the ticker scope. The card starts with the selected ticker's AI impact and explanation, followed by the general summary and other companies. The selected ticker keeps its place even when it appears later in the provider's analysis. The feed shows articles scoring 5 and up by default. `+` and `-` move that bar live, the server does the filtering, so nothing you filtered out eats a slot on the page. The list's title shows the bar between those two keys (`- score 5+ +`), and a click on either key moves it too. Every row names its category: earnings, corporate, m&a, movers, tech, macro, other and so on. `C` opens a checklist of all fourteen with their full names: `space` ticks one on or off, `o` keeps only the one under the cursor, `a` brings them all back, and `Enter` applies the choice with a single refetch. The server filters here too, and the panel title says what is left behind the `C` key (`without movers, other`, or `earnings, m&a`). The choice covers the ticker and market scopes; trending is a curated top ten and stays as it is. To start every session with a choice, set `news_categories` or `news_exclude_categories` in the config. Filings and press releases that report a corporate event name the event in that column instead: `offering`, `debt`, `M&A`, `exec`, `buyback`, `dividend ↑` for a raised dividend, `guide ↓` for a lowered outlook. An earnings filing reads `8-K guide↑` when the release also raised its guidance. The SEC's generic headings, such as "Entry into a Material Definitive Agreement", give way to the event's figures, for example `$3.7B · priced · upsized · 2.875% convertible senior notes due 2033`. The same summary stands in for a headline the list is too narrow to show, and follows the headline when there is room for both. The card lists the facts as the document words them, names the company that reported the event and its role in it, and says when AlphAI withheld a fact it could not find in the text. The values are quoted from the document, while the type and the role are read by AI, so check the filing before acting on them. Most 8-K filings score 5 or 6, so a bar raised past 5 with `+` hides them. With reprints collapsed, a filing that joined a story an outlet started sits under that story's row; the events scope below never groups. Articles fresher than 15 minutes light up their age, and rows that arrived since you last looked carry a `●` that goes out once the cursor rests on them. New arrivals are placed at the top of the list even when the rows below them are newer: a story reaches the feed a while after it was published, and at its publish position it would land below the fold and never be seen. The ticker's chart sits over the list and the card beside them. The article you are reading is the highlighted mark on the chart and the chart's bottom line names it, so the story and the move it came with are on one screen. That needs a terminal at least 120 columns wide and the ticker or events scope; elsewhere the list and the card stand side by side. `x` cycles to list over card and to list beside card without the chart (the three layouts are pills at the right end of the list's title), and the News layout row in the settings screen saves the choice. `v` opens the article for reading: under the chart in that layout, over the whole screen in the others. `Enter` opens the article in the browser, and down on the last row loads the next page. ![alphai-tui news view in the market-wide scope: filings marked 8-K and 6-K, insider rows, reprints collapsed with an outlet count, and an earnings read available for the selected filing](https://raw.githubusercontent.com/makeev/alphai-tui/main/assets/market.png) `f` cycles the scope: the selected ticker, its corporate events, the whole market, or the 48-hour trending top ten. The list's title shows all four as pills behind the key, the current one lit. The events scope is the company's ledger: only its filings and press releases that report an event, newest first, from offerings and debt to deals, executive changes, dividends, buybacks and guidance, going back to June 2026 within your plan's archive. ![alphai-tui events scope: NVIDIA's corporate events, an executive change, a contract, results and a deal, with the selected filing's facts quoted in the card beside the list](https://raw.githubusercontent.com/makeev/alphai-tui/main/assets/events.png) It ignores the score and category filters, refreshes once per cache window like trending, and once loaded its events also mark the price chart, so an offering months ago shows on the candle it moved. Ticker and market news collapse reprints into one row by default and say how many outlets carry the story (`×4`). In `s` settings, turn **Collapse news** off and Save to see every article, or set `collapse_news = false` under `[ui]` in the config file. Save refreshes the news feed without restarting. Grouping uses the story's representative article; turn it off to include matching articles whose representative does not match the selected ticker or filters. Trending always stays grouped. The market-wide feed marks an earnings filing as `8-K` or `6-K` rather than as coverage of one, and mixes in the insider rows. ### 3 Table: the watchlist, full width The watchlist alone, full width: price, change in dollars and percent, the extended-hours change, the day's range and a sparkline of the session. The extended column appears only when some row actually has a print outside the session, so it costs no width during the trading day. ### 4 Chart: candles, averages, volume, RSI ![alphai-tui chart view: NVDA 15-minute candles across the pre-market, regular and after-hours sessions, each shaded apart, with SMA20 and SMA100, news marks, a key to the marks and shades in the corner, the chart's switches along the bottom, matching volume bars and RSI underneath](https://raw.githubusercontent.com/makeev/alphai-tui/main/assets/chart.png) Candlesticks at half-block resolution with a previous-close reference line, 20 and 100 period moving average overlays threaded through them as thin braille lines, a volume panel whose bars sit in their candles' own columns and take their color, and an RSI(14) panel. `c` switches to a Braille line chart, `m`, `i` and `b` toggle the overlays and the panels, `e` averages simple or exponential, `t` cycles interval presets, and `E` draws the pre and post market candles too (Yahoo, Alpaca and Tiingo), enabled by default. The chart title keeps the switch beside the source: `⇧E ext Yahoo`, the `ext` pill lit while the extended sessions show. The keys follow custom keybindings. Where there is nothing to draw, `E` says why in the footer: daily candles, crypto that trades around the clock, a listing outside the US, or Finnhub, which has no candle history (its chart title reads `ext n/a`). The chart's bottom edge names its own switches, `c candles m MA e SMA i RSI b vol n news`, each lit while on, where the latest headline leaves room for them. Charts start with five days of `15m` candles; set the top-level `range` and `interval` in the config to choose another window or size. The chart title lists the presets behind `t` (`1d 5d/15m 1mo 6mo 1y`, the current one lit with its candle size), because `t` and `T` cycle forward and backward through presets that change the window as well as the candle size. The `Last bar` line shows the newest candle's close, feed and start time. The price marker is labelled `quote`, `PRE`, `AH` or `bar` to distinguish a trade from a candle close. While the newest candle is still forming, the label also counts down to its close (`quote 2:41`). With the quote rail hidden, the chart title also carries the quote, currency and daily change. The ticker's news is marked on the candles it was published in: `▲` and `▼` for the AI sentiment call, `◆` when it is neutral, drawn in outline (`△ ▽ ◇`) for a filing or release reporting the company's own corporate event, brighter for a higher relevance score, and the freshest of them named on the bottom border. An event that can move a stock on its own, such as an offering, a deal or a dividend cut, counts two points higher than the coverage it shares a candle with. So the move and its reason share a column instead of living in different views. `n` turns the marks off. They are drawn from the news the app already holds for that ticker, which the Split and News views keep fresh, so they never cost an API request and they are simply absent until one of those views has loaded that ticker's feed. The chart's top right corner keeps a key to what is on screen: the kinds of mark it draws (`▲ bullish ▼ bearish ◆ neutral △ event`, or `• news` in line mode) and a swatch for each session shade it shows (`pre`, `post`). The client fetches extra history for indicator warm-up. Pre-market has a quiet warm background, after-hours a cool one, and regular trading keeps the panel background, up to the last bar: the right margin stays clear. Price, volume and RSI share the same session columns and vertical grid in both candle and line mode; under the price, volume and RSI carry the session as a band along their bottom row rather than a full background. Aggregation never combines different sessions or feeds into one candle. These session rules apply to US stocks on intraday intervals, including scheduled 13:00 closes and 17:00 after-hours closes on half days; crypto remains 24/7. A bar is its interval at every width. When the plot is too narrow for every bar of the window, the newest bars that fit are drawn and the title counts the rest: `last 70 of 192 bars`. Bars are never merged into larger candles, so the half-width chart in the split view draws the same bars as the chart view, fewer of them, and the price axis follows the bars on screen. To see more of the window, widen the terminal or pick a coarser interval with `t`. The time axis adapts its label spacing to the terminal width, gives the opening and closing bells priority, and puts dates on a second row. US stocks use New York time (`ET`) by default; `[chart] timezone = "local"` or `"utc"` changes the labels. Other instruments use local time under the `"exchange"` default. Future labels in the right margin skip closed US sessions, weekends and holidays, including daylight-saving changes. `session_shading = false` and `time_grid = false` disable those layers. The right margin carries the latest relevant price. A timestamped quote only updates a candle from the same source, interval and session: the regular close cannot overwrite a pre-market candle, and an IEX quote cannot rewrite a delayed SIP bar. Extended quotes at 0% still appear. The rail shows their source, timestamp and age; a new premarket retires the previous after-hours quote even if the first new trade has not arrived yet. ### 5 Insider: what the people inside the company did ![alphai-tui insider view: a year of Broadcom Form 4 events on a log scale, each sale marked by why the insider sold, over weekly dollar bars split the same way, the year's discretionary and routine sales above, the filing list with the reason for each sale and the selected filing's card beside it](https://raw.githubusercontent.com/makeev/alphai-tui/main/assets/insider.png) SEC Form 4 activity for the selected ticker: what its own officers and directors did with their shares. AlphAI labels every sale by what the filing says about it: discretionary when the insider chose to sell, routine when it followed from a 10b5-1 plan or from paperwork such as shares sold to pay the tax due on vesting, and unclear when the filing does not let it tell. A tax sale outside a plan therefore no longer reads as a choice. The top of the view counts the last 12 months in dollars by label: what was sold, a bar of the share the insiders chose to sell, the discretionary and routine totals with the routine reasons, purchases, and on the next line who chose to sell and who sold routinely, largest first. On a terminal at least 120 columns wide and 47 rows tall (45 with `z` bare) the same numbers become three tiles in big figures: discretionary sales, routine sales and purchases. The filing list is a ledger: transaction date, value, the stake share the event moved, reporting owner (first name first), role, and why: `▼ discretionary` (with its reason, such as open market), `▾ 10b5-1 plan`, `▾ tax on vesting`, `? unclear`, `▲ buy`, `◇ to issuer`. Unknown transaction dates show `?`; legacy rows keep their headline when the owner's name is unavailable. `f` cycles the list between all filings, discretionary sales and routine sales; the server filters, so a filtered page is a full one. The list's title shows the filter and the switch to the people mode (`x filings people`) as pills with their keys, and a click on a pill works like its key. The card leads with the company and owner, side and value, the label and its reason in full ("tax on vesting: Shares sold to pay the tax due when stock vested."), stake change and tranche count, followed by trade details and the separately labelled AI impact. Every event in the window is a mark placed by date on a log dollar scale: `▼` a discretionary sale, `▾` a routine one, `?` unclear, `▲` a buy and `◇` shares handed back to the issuer, with weekly dollar bars underneath (the discretionary part solid, the routine part shaded). A legend in the chart's top right corner names each kind of mark on screen in its own color (on a narrow terminal it moves to the bottom edge). The mark of the filing selected in the list renders inverted, so the list and the chart always point at each other. `v` hides the card for a full-width list and brings it back. `g` cycles the window between 3 months, 12 months and off. The list shows every filing by default, as the chart does; `+` and `-` filter it by trade size, the title then shows the bar between those keys where it has room, and the list says how many of the chart's filings it hides. `x` turns the list into people: everyone who traded in the last 12 months, with what they chose to sell, what they sold routinely, what they bought, a bar of their share of the dollars sold and their last trade. The selected person's filings sit beside the table, and on the chart their marks keep their color while everyone else's fade. `f` narrows the people the same way, `Enter` opens the AlphAI page of their latest filing that has one, and `x` goes back to the filings. The labels, the totals, the tiles and the people all come from the data the view already loads, so none of it costs a request; changing the filter costs one. ### 6 Earnings: the filing, read ![alphai-tui earnings view: NVIDIA's second quarter fiscal 2027 read with the verdict, the summary and a metric table carrying the prior quarter, the prior year and both changes](https://raw.githubusercontent.com/makeev/alphai-tui/main/assets/earnings.png) AlphAI's structured read of the ticker's own earnings filing, the way the company reported it: the verdict and why, the metric table with the prior quarter, the prior year and both changes, segments, the outlook, concerns, what to watch and several paragraphs of analysis. Every figure was checked against the filing text before it was published, and it prints exactly as the filing wrote it, units shortened and nothing rounded into a new number. American and foreign filings both (an 8-K item 2.02, or a foreign private issuer's 6-K with its half years and its own currency). When the release also announced something else, a buyback, a dividend or a change to the outlook, the read lists it under **Also in this release**, taken from the filing's row in the news or events feed already loaded. `←` `→` walk the watchlist, older quarters continue below the newest read. When a company has not reported since AlphAI began reading filings, the view says so and gives the next date available from the calendar, based on the source's confirmation marker. The bottom line carries the next couple of US macro releases (CPI, the jobs report, an FOMC decision), which is the other half of what moves a price you are about to read about. ### 7 Summary: the whole watchlist at once ![alphai-tui summary view: the day's line over eleven watchlist cards, each with its path through the window, the previous close dashed, the extended sessions as a band along the bottom, the news marks and a line of facts under it](https://raw.githubusercontent.com/makeev/alphai-tui/main/assets/summary.png) The whole watchlist on one screen, in one of three layouts, under a line that sums up the day: the session and its countdown, how many tickers are up and down and the average move, the portfolio's day, the next macro release and the watchlist's reports due within the week. - **Cards** (the default): a card per ticker filling the screen. Its path through the chart's window with the previous close dashed, the pre and post market as a band along its bottom row, the news marks and the alert's level; the window's high and low beside it; under it the window's move, the position, the alert and the day's range with the price in it. The extended print sits in the top border, the latest story and a report due within two weeks in the bottom one. A watchlist longer than the cards that fit gets one line per ticker with a sparkline instead. - **Heatmap**: a tile per ticker tinted toward the day's direction, harder for a bigger move (full at 5%), the move in big figures and the price under it. - **Compare**: every ticker on one chart in percent of the window's start, each line its own color and labelled at its end, best on top. ![alphai-tui summary heat map: a tile per ticker tinted red or green by the day's move, the move in big figures and the price under it](https://raw.githubusercontent.com/makeev/alphai-tui/main/assets/heatmap.png) ![alphai-tui summary comparison: every watchlist ticker on one chart in percent of the window's start, each line labelled at its end, best on top](https://raw.githubusercontent.com/makeev/alphai-tui/main/assets/compare.png) `x` cycles the layouts and `f` orders the tickers as the watchlist does or by the day's move, biggest gain first; both are pills on the right of the day's line, a click away. `↑` `↓` walk the tickers in the order on screen. Everything here comes from what the app already holds, so the view costs no request; a report date shows once the Calendar has looked it up. ### 8 Portfolio: what you hold and what it did ![alphai-tui portfolio view: three holdings with quantity, average price, last price, value, the day's move in money, profit and loss with its percentage and the share of the portfolio, and a total row underneath](https://raw.githubusercontent.com/makeev/alphai-tui/main/assets/portfolio.png) What the watchlist cannot answer: the price times what you own of it. One row per holding with its quantity, average price, value, the day's move in money, the profit or loss since you bought and the share of the portfolio it carries, and a total underneath. `p` opens a one-line prompt on the ticker under the cursor, prefilled with what is held, so a correction is two keystrokes and an emptied line drops the holding; the quantity and the price are written to the config file right away rather than waiting for Save. A holding that is not on the watchlist is polled all the same, so every row has a price, and a row still waiting for its first one says so instead of counting as zero. The same numbers turn up as two extra columns in the Table view and as a zone in the quote rail, but only for the tickers you actually hold. Holdings use the premarket or after-hours price when the source reports one, falling back to the regular quote otherwise. This applies to `Last`, value, P&L, totals and the holding figures in the table and quote rail, independently of the `E` candle toggle. An extended `Last` carries a `*`. During premarket, `Day` starts at the latest regular close; after hours, it includes both the regular session and the extended move. There is no currency conversion here and there is not going to be one: if the holdings quote in more than one currency, the total says `mixed currencies` rather than pretending the sum means something. #### Import positions from CSV Preview the changes, then run the same command without `--dry-run` to save them. Use `--config PATH` with either command to choose the portfolio. ```sh alphai-tui --import-positions holdings.csv --dry-run alphai-tui --import-positions holdings.csv ``` - **Interactive Brokers Activity Statement**. Export an Activity Statement as CSV. The importer reads the USD stock summaries in Open Positions. - **Interactive Brokers Flex Query**. Export Open Positions for a single date, with Summary detail, symbol, quantity, cost basis price or money, asset class and currency. Select one position basis (trade date or settlement date) when including section codes. Include Listing Exchange for international stocks. For example, `700` on SEHK becomes `0700.HK`. Check the units of London cost prices against the quoted price before saving. - **Other brokers**. A UTF-8 file needs a ticker, quantity and either a per-share cost or total cost basis. For example, `Symbol,Shares,Avg Cost` or `Ticker,Quantity,Cost Basis Total`. The importer also reads tab-separated files and semicolon-separated files with decimal commas or points. Use one decimal convention throughout and omit ambiguous thousands separators. Rows for the same ticker across accounts are combined at their quantity-weighted average cost. A ticker with both long and short positions is skipped. The preview lists each added, changed, unchanged and retained holding, plus the reasons for skipped rows. Existing holdings absent from the export stay in the portfolio. Restart open panels to see the saved positions. Each additional holding joins the quote polling cycle. ### 9 Calendar: reports and macro releases ![alphai-tui calendar: scheduled reports, filings with reads pending, published earnings reads and US macro releases](https://raw.githubusercontent.com/makeev/alphai-tui/main/assets/calendar.png) Calendar data from November 7, 2026, with an example watchlist and holdings. The past seven days and next 45 days of US macro releases and company reports from your watchlist and portfolio. AlphAI includes dates the source marks as confirmed, with partial coverage; a missing company may still report. Past company rows come from published earnings reads. A passed date alone never becomes a reported event, and an old schedule without a read disappears. `○` is scheduled, `◐` is reported with a read pending, and `●` has a linked read. The Time column shows `BMO` (before open), `AMC` (after close), or `—` for schedules; reported rows show the filing time in ET. Company dates and filings always use ET; macro timestamps use `[chart] timezone`. Pending means no linked read is available yet, without a processing or publication promise. `Today (ET)` and `Next 7d (ET)` count upcoming events over today and the next six ET dates. Wide panes also count filings that landed today. Cancelled, postponed, undated and unknown-status events do not count as upcoming. `known` qualifies partial or cached counts; unloaded or failed windows show loading or unavailable. Dates stay on every row. Within a day, scheduled reports appear BMO first, then unknown sessions, timed macro events and AMC. `↑` / `↓` select, `PgUp` / `PgDn` move ten events, and `f` cycles All, Reports and Macro locally (pills in the title). The selected event's compact panel includes the previous period, verdict, guidance and first watch item. `v` opens its full, scrollable snapshot without a request; `v` or `Esc` closes it. `Enter` opens a macro source or Earnings. A linked read opens its exact UID, even if newer reads exist. A scheduled or pending event shows available history with a banner identifying the context and displayed period. If a pending event gains a read in the background, the banner offers `r` to open it; the document stays in place until then. Portfolio-only tickers open without changing the watchlist. Shared issuer listings appear once and flag every matching watched or held symbol. The API can group common shares, preferred shares, warrants and notes under one issuer; other securities are never added to your watchlist or portfolio. Ordinary entry to `6 Earnings` returns to the latest read. Company events use two batched windows, the past seven through next seven ET days and days 7 through 44 ahead, with up to 50 tickers per request. The near window refreshes in every view, at most every six hours by default, and every hour while Calendar or a pending Earnings event is visible. Far dates refresh only in Calendar, every six hours. Requests start at least four seconds apart. The status line shows coverage and age separately for near and far groups. `r` refreshes macro and both report windows once per group, preserving cached rows while requests run. Failed groups wait for a manual retry; 401, 403 and 429 pause all corporate groups. A bad group is never split into extra requests. The calendar does not fetch each company's full earnings history. ### Price alerts `A` sets a one-shot price alert for the selected ticker, or the selected holding in Portfolio. Every view's footer shows `A alert` beside the selection keys; it follows your keybindings if you remap the action. Enter `>= 150` to catch a move up to 150, or `<= 140` for a move down to 140; `>` and `<` work too. `Enter` arms the rule, `Esc` cancels, and an empty line followed by `Enter` removes it (`Ctrl-U` clears the input). There is one level per ticker, for this running session only. Enter on an existing rule arms it again. The chart marks the level with a dotted line when it is in range, and keeps the exact level above the chart without changing the scale. The watchlist and Portfolio mark armed rules with `↑` or `↓`, waiting or paused rules with `?`, and fired rules with `!`. The quote rail carries the rule's status. A crossing shows a banner over the bottom row in any view, including bare mode, and sends one terminal bell. Several events queue for 12 seconds each; close arrivals share a bell. Sound or a visual flash is controlled by your terminal and tmux's `bell-action` and `visual-bell` settings. Opening `A` shows the fired price, feed, provider time and detection time after the banner has gone. Alerts use the newest valid timestamped regular or pre/post-market price already arriving from your provider, even with `E` off. They add no requests. Cached prices cannot arm a rule; the first valid answer becomes its starting price. If the condition is already met when you arm it, the price must move back across the level and reach it again before it fires. The rule stays armed through an outage or a source change. Older prints are ignored; a change between two known currencies pauses the rule until the original currency returns or you arm it again. Missing currency is compatible with a known one, as on Finnhub. A crossing and return between polls can be missed, and a delayed feed delivers a delayed alert. Provider timestamps can name the start of a bar used for an extended price. Tiingo's daytime reference price is calculated, and its timestamp here is the poll time. These are observed price updates, not a record of every trade. Removing a ticker clears its rule unless a holding keeps that ticker polled. Exiting the app clears all rules. ### Everywhere: help, settings, themes ![alphai-tui help overlay: the full key table with the config name of every action next to it, drawn over the calendar](https://raw.githubusercontent.com/makeev/alphai-tui/main/assets/help.png) `?` lists every action with the keys currently bound to it and the name to use in the config to rebind it. `s` opens the settings, grouped into prices (the source, where pre and after hours come from, the poll interval), API keys, news and look. Each key row says what the current choices use it for, and the bottom of the box explains the row under the cursor: what it covers, what each choice means and what it costs. Save writes all of it, plus the watchlist on screen, to the config file. `}` and `{` walk the color presets live, `z` hides the header and the footer for a tmux pane that carries its own status bar, and `r` refreshes prices and the visible data. The mouse works in every view. A click on a header pill switches the view; a click on a ticker in the rail, in the watchlist, on a Summary card or on a Portfolio row selects it; a click on a feed row selects the article, and a second click on the same row opens its card; a click on a row of the Split news strip opens the News view on that article. Keys are drawn on plates, in the footer and in the panel titles beside the choices they cycle, and a click on a plate or on a choice works like the key: a preset, the news scope or layout, the Insider filter, mode and chart window, the Calendar filter, a score's `-` and `+`. Two keys are never a click: quit, and `d`, which drops a saved ticker. The header's right end carries `s settings` and `? help` the same way. A key a title already shows is left out of the footer. The wheel moves the cursor in lists and scrolls the article card, the earnings read, the help and the settings. It never loads another page of a feed and never changes the chart preset, so a trackpad flick costs no requests. While the app has the mouse the terminal cannot select text with it: `M` hands the mouse back and takes it again (most terminals also select with Shift held), the Mouse row in settings does the same and Save remembers it as `[ui] mouse = false`. Price changes fade back over 900 ms without changing the text's weight or decoration. The ASCII spinner beside the source runs only while requests are in progress. The Animations row in settings switches these effects off live; Save remembers it as `[ui] animations = false`. With animations off, a steady `*` still indicates requests in progress. The renderer wakes on input and data, with up to 30 frames per second for short effects and a one-second clock for ages and scheduled work when idle. RGB themes fade between their explicit colors; the default ANSI theme uses a brief color highlight and keeps the terminal's palette. On Unix, a valid `Sync` terminfo capability enables synchronized frames. Other terminals, including Windows without that detection, keep ordinary frame output. `[ui] synchronized_output = false` disables the extension altogether. ## How it compares There are good terminal stock tools already. The two you are most likely to be choosing between are [tickrs](https://github.com/tarkah/tickrs), which is the closest in shape (Rust, ratatui, charts per ticker), and [ticker](https://github.com/achannarasappa/ticker), which is the most widely used and is built around tracking what you own. The short version: both are built around the price. This one puts the filings and the scored news next to it, and pays for that with no options chain and a simpler idea of a position. | | alphai-tui | tickrs | ticker | |---|---|---|---| | Price charts | candles, line, SMA/EMA, RSI, volume | line, candle, kagi, volume | none | | Whole watchlist at once | summary grid, table with sparklines | summary pane | quote table | | News with per-article analysis | yes, and marked on the price chart | no | no | | SEC Form 4 insider activity | chart and filing stream | no | no | | Earnings filing reads | yes | no | no | | Extended hours | price and candles | candles | price | | Options chain | no | yes | no | | Positions and P&L | quantity and average price, in a view of its own | quantity and average price | cost-basis lots, groups, currencies | | Export for scripts | `--once` text, `--json` | no | CSV and JSON | | Price sources | Yahoo, Finnhub, Alpaca, Tiingo | Yahoo | Yahoo, Coinbase | | A source that stops answering | cached start, automatic switch | no | no | | Add or remove a ticker in the app | yes | yes | no | | Rebindable keys | any action, in the config | vim keys | no | **What they do better.** tickrs has an options chain with calls and puts by expiry, which this has nothing to answer with, and a kagi chart if that is how you read price. ticker still has the most complete position tracking of the three: several cost-basis lots per holding, named groups and currency conversion, where this one keeps a single average price per ticker and sums in whatever currency the quotes come back in. If you track lots across currencies, ticker is the one to reach for. **One thing worth knowing.** Yahoo rate-limits by IP, and every tool here depends on it, this one included. Four price sources is the hedge: if Yahoo starts refusing, `s` switches to Finnhub, Alpaca or Tiingo without leaving the app. ## Install Homebrew (macOS and Linux): ```sh brew install makeev/tap/alphai-tui ``` Arch Linux, from the AUR: ```sh paru -S alphai-tui-bin ``` Debian and Ubuntu, from the apt repository (amd64 and arm64, Ubuntu 22.04 and Debian 12 or newer): ```sh sudo install -d -m 0755 /etc/apt/keyrings sudo curl -fsSL https://makeev.github.io/alphai-tui-apt/alphai-tui.gpg \ -o /etc/apt/keyrings/alphai-tui.gpg echo "deb [signed-by=/etc/apt/keyrings/alphai-tui.gpg] https://makeev.github.io/alphai-tui-apt stable main" \ | sudo tee /etc/apt/sources.list.d/alphai-tui.list sudo apt update && sudo apt install alphai-tui ``` Single `.deb` files, for an install without the repository, are linked from [the repository landing page](https://makeev.github.io/alphai-tui-apt/). Through [x-cmd](https://www.x-cmd.com/install/alphai-tui/), which picks whichever of the methods above your system already has: ```sh x install alphai-tui ``` Prebuilt binaries for macOS, Linux and Windows, no Rust needed: ```sh curl -LsSf https://github.com/makeev/alphai-tui/releases/latest/download/alphai-tui-installer.sh | sh ``` ```powershell # Windows powershell -ExecutionPolicy Bypass -c "irm https://github.com/makeev/alphai-tui/releases/latest/download/alphai-tui-installer.ps1 | iex" ``` Archives for every platform, with checksums, live on the [releases page](https://github.com/makeev/alphai-tui/releases). With a Rust toolchain (1.89+): ```sh cargo install alphai-tui ``` Or straight from the repository: ```sh cargo install --git https://github.com/makeev/alphai-tui ``` Or from a clone: ```sh git clone https://github.com/makeev/alphai-tui cd alphai-tui cargo run --release -- AAPL MSFT NVDA BTC-USD ``` ## Quick start ```sh alphai-tui NVDA AVGO AAPL MSFT META TSLA AMZN GOOGL BTC-USD ``` The first run opens the settings screen: pick a price source and paste your AlphAI key (get one free at [alphai.io](https://alphai.io?utm_source=alphai-tui&utm_medium=referral), Account > API keys). Leave it empty if you only want quotes and charts. Your watchlist and options persist in the config file, so next time plain `alphai-tui` works. ```sh alphai-tui --once AAPL # print quotes to stdout and exit (for scripts) alphai-tui --json AAPL # the same run as JSON, for a status bar alphai-tui -s finnhub NVDA # explicit source for one run alphai-tui --doctor # check the config, keys and sources, then exit ``` ## Options | Flag | Default | Meaning | |------|---------|---------| | `-s, --source` | `yahoo` | Price source: `yahoo`, `finnhub`, `alpaca` or `tiingo` | | `-e, --every` | `15` | Poll interval, seconds (also a settings row, applied live) | | `-r, --range` | `5d` | History window: `1d 5d 1mo 3mo 6mo 1y 2y` | | `-i, --interval` | `15m` | Candle size: `1m 2m 5m 15m 30m 60m 1d` | | `--theme` | `default` | Color preset, e.g. `catppuccin-mocha` (also a key and a settings row) | | `--bare` | off | Start without the header and footer, for a tmux pane (`z` toggles it live) | | `--hide-source` | off | Leave the price source's name off the header, the quote rail and the chart, for screenshots (also `ALPHAI_TUI_HIDE_SOURCE=1`); the settings screen still shows it | | `--once` | | Print quotes to stdout and exit | | `--json` | | Print those quotes as JSON instead of a text table (implies `--once`) | | `--earnings TICKER` | | Print the latest earnings read to stdout and exit (needs an AlphAI key; one request) | | `--import-positions FILE` | | Import holdings from a broker CSV and print the changes | | `--dry-run` | | Preview a position import | | `--events TICKER` | | Print the ticker's corporate events to stdout and exit (needs an AlphAI key; one request) | | `--doctor` | | Check the config, keys, price sources, AlphAI and the terminal, print a report that is safe to paste into an issue, and exit | | `--config` | | Use an alternate config file (Save writes back to it) | `-r` and `-i` set the startup window; the `t` key cycles the preset combinations (configurable as `[chart] presets`) for the session without persisting them. ### Health check ```sh alphai-tui --doctor # check everything and exit alphai-tui --doctor TSLA # ask the price sources for TSLA instead of AAPL ``` `--doctor` prints one line per finding, marked `ok`, `warn`, `fail`, `info` or `--` (not configured): ``` Prices (AAPL, one fetch per source) ok yahoo 354.07 USD 252 ms, timing varies ok alpaca 354.24 USD 1061 ms, key budget 3 of 200 this minute warn alpaca: 3 of 200 requests left this minute after this check: something else is spending the key (another app, or another alphai-tui pane) ok tiingo 354.07 USD 793 ms in use info tiingo polls 6 tickers every 15s ``` It looks at: - the config file: whether it loads, whether other users can read it (it holds keys), every value the app would ignore, and the watchlist; - each key, masked to its first two and last four characters, and whether it came from an env var or the config; - every price source whose keys are set, plus Yahoo: one fetch each, the price, how long it took, and on Alpaca and Finnhub what the key has left of its minute. A key that is nearly spent right after the check is being used by something else, another app or another alphai-tui pane; - what polling costs against the source's per-minute limit, where one is published (Alpaca, Finnhub), where pre and after hours come from, and whether the fallback is on; - the AlphAI key: its plan and what is left of the day; - the quote cache, the terminal (`NO_COLOR`, a 24-bit theme without truecolor, a window under 80x24), the market session, and whether a newer release is on crates.io. The exit code is 1 when a line says `fail`: the source in use or the AlphAI key refused, a config that does not load, half of an Alpaca key pair. Warnings do not fail it, and nothing is written. A run costs one request to each source it checks (two on Alpaca, two or three on Tiingo, which is a few of the 50 an hour its free plan allows; a refused request is retried), one of the day's AlphAI requests and one request to crates.io. Yahoo is always asked once, which only matters right after it blocked your IP. The report is meant for bug reports: keys are masked everywhere, error messages included, and your home directory shows as `~`. When something looks wrong, run it and paste the output into an issue. ### Quotes as JSON `--json` prints one object per symbol, in the order they were asked for, so a status bar or a cron job can read the numbers instead of parsing a table: ```sh alphai-tui --json AAPL NVDA alphai-tui --json AAPL | jq -r '.[0] | "\(.symbol) \(.price) \(.change_pct)%"' ``` ```json [ { "candles": 79, "change": 11.23, "change_pct": 3.5612, "currency": "USD", "day_range": { "high": 326.68, "low": 316.57 }, "extended": { "change": -1.07, "change_pct": -0.3276, "price": 325.5 }, "fetched": "2026-09-11T09:31:38Z", "fifty_two_week": { "high": 344.57, "low": 226.65 }, "prev_close": 315.34, "price": 326.57, "source": "yahoo", "symbol": "AAPL", "volume": 69820744.0 } ] ``` A ticker you hold also carries a `position` object with `qty`, `avg_price`, `cost`, `price` (the price used to value the holding, including extended trading), `value`, `pnl`, and `pnl_pct` and `day_pnl` when those can be worked out, so a status bar can show the money rather than the price: ```sh alphai-tui --json AAPL | jq -r '.[0].position | "\(.pnl) (\(.pnl_pct)%)"' ``` `symbol` and `price` are always there; the rest depends on what the source answers, and a figure it does not answer is left out rather than sent as null. `change` and `change_pct` count from the previous close, while the `extended` object measures its own move from the regular session's close, the way a broker screen does. A symbol that failed still gets a row, as `{"symbol": "…", "error": "…"}`, so a watchlist of four always prints four. Warnings go to stderr, so stdout stays a valid JSON document. Without symbols it prints the watchlist you saved in the app, and `-s`, `-r` and `-i` work the same as for a normal run: ```sh alphai-tui --json # whatever the config file holds alphai-tui --json -s alpaca AAPL # another source for this one run # a row per ticker for awk, a spreadsheet or a database alphai-tui --json | jq -r '.[] | [.symbol, .price, .change_pct] | @tsv' # append a snapshot to a log you can chart later; every row carries `fetched` alphai-tui --json | jq -c '.[]' >> quotes.jsonl # report only what broke, since the exit code is 0 either way alphai-tui --json | jq -r '.[] | select(.error) | "\(.symbol): \(.error)"' # watch a level from cron, printing nothing until it breaks alphai-tui --json NVDA | jq -e '.[0].price > 200' >/dev/null && echo 'NVDA above 200' ``` For a status bar, call a small wrapper instead of inlining the pipeline, because a jq filter quoted inside `tmux.conf` or an i3blocks config turns unreadable fast: ```sh #!/bin/sh # ~/bin/quote-bar alphai-tui --json AAPL NVDA | jq -r 'map(select(.error | not) | "\(.symbol) \(.price) \(.change_pct * 100 | round / 100)%") | join(" ")' ``` ```tmux set -g status-interval 60 set -g status-right '#(~/bin/quote-bar)' ``` Dropping the error rows there keeps a dead symbol from writing `null` into the bar, and the rounding trims `-6.1302` to the two decimals a bar has room for. One run costs one request per symbol (two on alpaca; on tiingo one or two for the whole list plus up to three per ticker), so give the loop an interval rather than letting the bar refresh as fast as it likes. Yahoo throttles by IP address and answers a burst with 429s for several minutes afterwards, which is long enough to lose the pane you built. A minute between runs is plenty for a status bar; below that, use a keyed source. CLI arguments win over the config file; the config file wins over built-in defaults. API keys can also come from env vars, which win over the config: `ALPHAI_API_KEY`, `FINNHUB_API_KEY`, `APCA_API_KEY_ID`, `APCA_API_SECRET_KEY`, `TIINGO_API_KEY`. ## Keys | Key | Where | Action | |-----|-------|--------| | `Tab` / `1`..`9` | everywhere | switch view | | `↑` `↓` / `j` `k` | table, chart, split | select ticker | | `a` | everywhere | add a ticker: type the symbol, `Enter` adds it, `Esc` cancels | | `/` | everywhere | find a watchlist ticker by symbol or loaded company name; `↑`/`↓` choose, `Enter` selects, `Esc` cancels | | `d` | everywhere | remove the selected ticker (the last one stays) | | `p` | everywhere | set what you hold of the ticker: `qty avg`, `Enter` saves it to the config, an empty line clears it | | `A` | everywhere | set or rearm a session price alert: `>= 150` or `<= 140`; empty clears, `Esc` cancels | | `↑` `↓` / `j` `k` | news, insider | scroll articles | | `↑` `↓` / `j` `k` | earnings | scroll the read | | `↑` `↓` / `j` `k` | calendar | select event | | `←` `→` / `h` `l` | news, insider, earnings | switch ticker | | `Enter` / `o` | news, insider | open article in browser | | `Enter` / `o` | earnings | open the read on alphai.io | | `Enter` / `o` | calendar | open macro source or the exact linked earnings read | | `v` | calendar | full event details; `Esc` / `v` closes | | `f` | calendar | filter All / Reports / Macro | | `f` | insider | filter the sales: all, discretionary, routine | | `f` | summary | order the tickers: as listed, or by the day's move | | `v` | news, insider | fullscreen article card; scroll with `↑` `↓`, `Esc` closes | | `E` | everywhere | draw pre and post market candles too (Yahoo, Alpaca and Tiingo); says why when there are none | | `x` | news | cycle the layout: chart over the list, stacked, or side-by-side | | `x` | insider | switch between the filings and the people | | `x` | summary | cycle the layout: cards, heatmap, compare | | `PgUp` `PgDn` | news | scroll the article card pane | | `PgUp` `PgDn` | earnings | page through the read | | `PgUp` `PgDn` | calendar | move ten events | | `↓` / `j` on the last row | news, insider | load the next page of the feed | | `f` | news, split | cycle news scope: selected ticker, its events, whole market, trending | | `+` / `-` | news, insider, split | raise / lower the visible feed's score filter, with or without shift (`=` and `_` work too); news: relevance, starts at 5; insider: trade size, starts at 1, every filing | | `C` | news, split | pick the news categories to show: `space` toggles, `o` only this one, `a` all, `Enter` applies, `Esc` cancels | | `g` | insider | cycle the trades chart window: 3 months, 12 months, off | | `c` | chart, split | toggle candlestick / line chart | | `m` | chart, split | toggle the two moving average overlays | | `e` | chart, split | average them simple (SMA) or exponential (EMA) | | `i` | chart, split | toggle the RSI(14) panel | | `b` | chart, split | toggle the volume panel | | `n` | chart, split | mark the ticker's cached news on the candles | | `t` / `T` | everywhere | cycle candle interval presets forward / back (each interval with a matching history window; the list is configurable as `[chart] presets`) | | `r` | everywhere | refresh prices and visible data; Calendar refreshes macro and both corporate windows | | `z` | everywhere | bare mode: hide the header and footer, giving both rows to the view | | `M` | everywhere | mouse on or off: off hands the mouse back to the terminal, which then selects text as usual | | `}` / `{` | everywhere | next / previous color preset (session-only until Save) | | `s` | everywhere | settings | | `?` | everywhere | help overlay: every action with its current keys | | `q` / `Esc` / `Ctrl-C` | everywhere | quit | ## A tmux workspace alphai-tui is a single self-contained process, so a terminal multiplexer (tmux, zellij, screen, or your terminal's own splits) turns it into a custom trading workspace: run one instance per pane and switch each pane to the view you want with `1`..`9`. ```sh tmux new-session -d -s market 'alphai-tui --bare NVDA' tmux split-window -h -t market 'alphai-tui --bare AAPL' # news pane on the right tmux select-pane -t market -L tmux split-window -v -t market 'alphai-tui --bare AVGO' tmux split-window -v -t market 'alphai-tui --bare TSLA' tmux attach -t market ``` `--bare` drops the header and the key hints, which a pane with tmux's own status bar has little use for, and hands both rows to the view; `z` toggles it in a running instance and `[ui] bare = true` makes it the default. The quote rail stays, so a bare pane still names its ticker and its price. Tiled panes put frames next to frames, so the shot below also sets `[ui] borders = "none"`: each panel becomes a tinted surface with a narrow gutter and its title on a tab above it, and the panes read as one desk. The Panels row in the settings screen switches it live. Press `4` in the three chart panes and `2` in the tall one, and you get a wall of charts next to a live scored feed: ![four alphai-tui instances in tmux panes: three bare panes with candlestick charts and their own quote rails, next to a full-height pane showing the scored news feed](https://raw.githubusercontent.com/makeev/alphai-tui/main/assets/tmux.png) Two things the instances share. The config file is one: the last pane to save settings wins, so set things up once and let the other panes just read it. Your AlphAI key's rate budget is the other: every pane showing news or insider data spends requests from the same per-key allowance, so on a free key keep an eye on how many such panes you open. The same trick turns the terminal into a full trading desk with an AI analyst on staff. Run an agent such as [Claude Code](https://claude.com/claude-code) in the pane next to alphai-tui and connect it to the [AlphAI MCP server](https://alphai.io/mcp?utm_source=alphai-tui&utm_medium=referral), which serves the same news, sentiment and insider data as the dashboard. You watch the tape on one side while the agent digs through whatever the tape surfaces: ask it for the last insider sells and the news that moved the stock this week, and get a sourced brief without leaving the terminal. ![Claude Code next to alphai-tui in tmux: the agent summarizes CRWV insider selling and the week's dominant story while the dashboard shows the candlestick chart and the scored news feed](https://raw.githubusercontent.com/makeev/alphai-tui/main/assets/agent.png) ## Data sources **Prices** - `yahoo`: no API key, intraday quote and history in one request. Timing varies by exchange; extended quotes use the source's timestamps, never the time a response was fetched. Crypto and FX tickers work as `BTC-USD`, `EURUSD=X`. Includes extended hours, 52-week range and full market volume. A daily chart may make an additional cached intraday request to timestamp its extended quote. `E` controls which candles are drawn. - `finnhub`: needs a key (free at [finnhub.io](https://finnhub.io)). Real-time-ish quotes; historical candles are premium-only there, so charts build up from quotes collected during the session and reset on restart. Range/interval switching with `t` does not apply to that synthetic history, and candles degrade to flat marks. Free tier is 60 req/min, one request per ticker per poll; the app warns on startup and in the settings screen when the watchlist and the poll interval together go over that. Crypto needs exchange-prefixed symbols (`BINANCE:BTCUSDT`). Its quote endpoint covers the regular session only, so no 52 week range or volume, and the extended-hours price is borrowed (see "Pre and after hours" below). - `alpaca`: needs a key id and secret (free at [alpaca.markets](https://alpaca.markets)). Realtime quotes from the IEX feed plus real historical bars, so charts are complete right after start instead of growing over the session. Crypto works in the usual `BTC-USD` form. IEX covers one exchange, with sparse pre-market trading from 08:00 ET and after-hours until 17:00 ET on normal days, so by default the extended quote and candles come from consolidated SIP data delayed 15 minutes, then Yahoo if SIP is unavailable or missing the relevant session (see "Pre and after hours" below). Regular candles and the headline quote remain IEX. The chart labels the extended feed, and the rail labels the quote's own source and age. Volume bars from different feeds are not consolidated into a single session; IEX's total is not presented as whole-market volume. Once extended candles are on the chart, regular IEX candles take their volume from the same consolidated bars, so both sessions share one scale. The newest 15 minutes have no volume bar until the delayed feed covers them. An intraday chart with extended hours off shows IEX's own counts and labels them `IEX only`. Daily charts take the consolidated daily bars whole, so the price range and the volume are the whole market's, while the current day keeps its live IEX close. That costs one request per ticker a minute, on top of the two per poll. If it is refused, the chart keeps IEX's daily bars and labels them `IEX only`. `ALPACA_FEED=delayed_sip` uses consolidated data for both regular and extended sessions with a 15-minute delay. `ALPACA_FEED=sip` uses realtime SIP and requires a paid subscription. The delayed mode uses `feed=delayed_sip` for snapshots and `feed=sip` for historical bars; the client sets the historical end to 15 minutes ago on every subscription. During that lag after the opening bell, today's delayed pre-market quote remains visible until regular data arrives, with its PRE label and age. Getting free keys: 1. Sign up at [alpaca.markets](https://alpaca.markets). Email is enough; market data and paper trading need no KYC. 2. The free Basic data plan is enabled by default. 3. In the dashboard switch the environment to Paper (fine for data), then Home > API Keys > Generate. Copy the Key ID and the Secret; the secret is shown only once. 4. Paste both in the settings screen (`s`) or export `APCA_API_KEY_ID` and `APCA_API_SECRET_KEY`. Free plan notes: the IEX feed is realtime but thin (roughly 2 to 3 percent of market volume, so charts of illiquid names can be sparse), and the API allows 200 requests/min. The app makes 2 requests per ticker per poll, plus up to 2 per minute for the SIP extended hours when those come from Alpaca. The startup and settings warnings include that allowance when suggesting a polling interval. Changing candle presets can trigger a fresh cache fill. Alpaca sizes a bars page by the minute bars behind it, roughly two weeks of a liquid name's extended hours, so the first fill of a chart window follows up to three more pages to reach the start of the IEX series; later refreshes take the newest page only. - `tiingo`: needs a key from [tiingo.com](https://www.tiingo.com), free or paid. Quotes and intraday bars come from IEX in real time, pre and post market included from 08:00 to 17:30 ET. Daily charts use Tiingo's consolidated end-of-day history, split adjusted, with the whole market's volume. Crypto works in the usual `BTC-USD` form. Coverage is US stocks, ETFs and mutual funds (funds have daily bars only); listings outside the US, indices and FX are not available here. During the session the price is Tiingo's IEX reference price: since February 2025 IEX's own last trade needs an exchange agreement, and the reference price stays within a few cents of it. IEX's volume is one venue's, so the quote carries none during the day and an intraday chart labels its volume `IEX only`. After the close Tiingo publishes the official close and the consolidated volume, and the rail switches to them; with an intraday chart open, the last after-hours price stays beside the close overnight. Before the open and after the bell IEX barely trades, so by default the extended quote comes from the whole market (see "Pre and after hours" below). With `extended_source = "same"` it is the IEX price beside the last close, dated by the bar that traded it rather than by the request. One request per poll quotes the whole watchlist, two when crypto is on it. Bars are refreshed once a minute per ticker and daily history every 15 minutes; in between, the live price moves the last candle, and a new candle has no volume bar until the next refresh. The free plan allows 50 requests an hour and 1,000 a day. That covers a couple of tickers polled every few minutes, not a live dashboard: the quote request alone is 240 an hour at the default 15 seconds. The paid Power plan allows 10,000 an hour. A key does not say which plan it is on, so the app does not warn about the budget ahead of time. When an allowance runs out, the error names it, and the automatic switch below moves to another source. **Pre and after hours** IEX, the feed behind `alpaca` on its free plan and behind `tiingo`, is one exchange, and before the open it barely trades: on 30 September 2026 by 08:52 ET Tiingo had one CoreWeave trade of 11 shares at 85.63, while the whole market had traded 581,000 shares and stood at 87.09. `finnhub` has no extended prices at all. So where the premarket and after-hours price comes from is a setting of its own, `extended_source` in the config and the Pre/after hours row in the settings screen: - `auto`, the default: when the price source sees one exchange or none, the extended quote and candles come from Alpaca's consolidated SIP feed, 15 minutes behind, if Alpaca keys are set, with Yahoo as the backup. Without Alpaca keys they come from Yahoo. `yahoo`, and `alpaca` on a SIP feed, keep their own. - `same`: only what the price source reports itself, no extra requests. - `alpaca`: always the consolidated SIP feed, with no Yahoo backup. It needs the Alpaca keys, whatever the price source is. - `yahoo`: always Yahoo, keyless and closer to real time, but subject to its IP blocks. A borrowed print replaces the source's own whenever it has one for the session under way, and the rail and the chart title name its feed (`SIP · delayed 15m`, `Yahoo`) and its age. Regular-session prices always stay the price source's. Borrowing costs about two Alpaca requests or one Yahoo request per ticker a minute: results are cached for 60 seconds per ticker and chart window, and an empty or failed refresh keeps the session already on screen without failing the price poll. A Yahoo IP block pauses the borrowed Yahoo requests across the watchlist for 30 minutes. Extended quotes stay available with `E` off, independently of the candle setting. **When a source stops answering** Every keyless quote feed throttles by IP sooner or later, and Yahoo's blocks are long: measured from one address, the first arrived after about ten requests and held for 19 minutes, the second came after eight and held for over an hour. No client-side retry shortens that, which is why the usual report about tools in this category is that they just stop working. Three things happen here instead: - Startup is never empty. The last good quotes and candles of every ticker are kept in `/alphai-tui/quotes.json` (`~/.cache` on Linux, `~/Library/Caches` on macOS), written at most once a minute, and put on screen while the first poll is in flight. The quote rail labels them (`cached 2h ago`) until live data replaces them, so old prices are never passed off as current. Entries older than a week, or taken with a different range and interval, are ignored rather than drawn. - A `429` from Yahoo says what it actually is: an IP block that lasts tens of minutes, with the advice to switch source. It is also the one refusal the client does not retry, since another request only feeds the counter holding the block open. - If every ticker keeps failing for 45 seconds, the app switches to another source that has its credentials and says so in the footer. It keeps the rows already on screen, never switches back on its own (probing a throttled feed is how a block gets extended) and never returns to a source that failed this session. The header always names the source in use, `s` picks another by hand, and `source_fallback = false` in the config turns the whole thing off. **News, sentiment, insider** - [AlphAI](https://alphai.io?utm_source=alphai-tui&utm_medium=referral): AI-enriched financial news feed. Every article carries validated tickers, a category, a deterministic 1 to 10 relevance score and a full per-ticker AI analysis (sentiment, price impact, confidence, novelty, actionability); insider rows are generated from SEC EDGAR Form 4 filings, one row per economic event; 8-K filings and press releases carry the corporate event they report, with facts quoted from the document, in the same response. The free tier (no card) allows 20 requests/min and 100/day. The app is careful with that budget: news and insider feeds fetch only what the visible view needs (the trending and events scopes are one extra request each), and cache each response for 5 minutes (`[ui] alphai_ttl_secs` in the config changes that), loads further pages only when you ask for them, and the article card reuses data already fetched with the list. The refresh at the end of that cache window asks the server what has arrived since the previous check rather than re-reading the newest page, which costs the same single request, keeps the pages you loaded and the row you are on, and is the only way to see an article that entered the feed behind its own publish time. The relevance and category filters are applied by the server, so filtered-out articles never occupy page slots; moving the score with `+`/`-` refetches the visible feed, one request per press at most, and a new choice of categories refetches it once, when it is applied. The Insider view's rollup and trades chart arrive as one bundle alongside the feed's first page and live in the same cache, so the chart costs no extra requests and the `g` window switch is free. The Earnings view fetches full history only for the ticker on screen, ordinarily cached for `alphai_ttl_secs * 12` (one hour by default). Opening a calendar UID absent from that cache makes one owner request; a successful response missing it permits one canonical-listing fallback. Errors do not trigger that fallback. The News card uses already loaded full reads, so opening the card still costs nothing. Macro is shared by every view and refreshes at `alphai_ttl_secs * 72`. The corporate near window uses `max(6h, ttl * 72)` in the background and `max(1h, ttl * 12)` while Calendar or a pending Earnings target is visible; far dates use `max(6h, ttl * 72)` only in Calendar. These are separate schedule caches, with no per-company history sweep. With B groups of at most 50 watchlist/portfolio tickers, a cold Calendar needs `2B + 1` calendar requests, including macro. Over 24 hours continuously in Calendar, the default budget is about `28B + 4`: 32 requests for up to 50 names, 60 for 51–100, before other activity. Background calendar polling costs `4B + 4`. At the minimum TTL of 30 seconds, corporate floors hold but macro runs every 36 minutes: `28B + 40`, or 68/96 for those group sizes. Manual refresh adds a macro request and both corporate windows per group. Errors wait for a manual retry; successful cached rows remain visible. There is no daily quota limiter, and restarting loses these caches. Feeds page 20 articles at a time, the most every plan allows (50 on Pro keys, detected automatically). Paging back past your plan's archive horizon (30 days on Free, 90 on Basic) shows an upgrade hint instead of older articles. Full API reference: [alphai.io/developers](https://alphai.io/developers?utm_source=alphai-tui&utm_medium=referral). Ticker forms follow the US/Yahoo convention (`AAPL`, `BTC-USD`, `VOD.L`), which is also what AlphAI uses. Finnhub-specific symbols like `BINANCE:BTCUSDT` will not have news attached. ## Configuration `~/.config/alphai-tui/config.toml` on Linux and macOS (`%APPDATA%` on Windows), created by the settings screen with mode 0600 since it can hold keys; `--config PATH` points at a different file. Saving the settings also persists the watchlist on screen, and `a` and `d` write it straight away. `a`, `d` and `p` apply their one change to the file as it is on disk, under a lock file beside it, so several tmux panes on one config do not undo each other. Every key is optional. A misspelled value in the `[ui]`, `[chart]`, `[theme]` or `[keybindings]` sections prints a warning on startup and keeps that entry's default, and a broken `[[positions]]` entry is skipped on its own. A file that does not parse at all, say after a TOML syntax error, runs the session on the defaults, says so in the footer and is not written to until it loads again; Save in the settings screen keeps a copy as `config.toml.broken` before replacing it. Fixed while the app runs, it is picked up by a restart. The `[ui]` and `[chart]` sections set startup defaults; the session keys (`x`, `f`, `g`, `+`, `-`, `C`, `c`, `m`, `i`, `b`, `e`, `n`, `t`) still change everything live without persisting it: ```toml source = "yahoo" watchlist = ["AAPL", "MSFT", "NVDA", "BTC-USD"] every = 15 range = "5d" # startup history window interval = "15m" # startup candle size; t cycles the chart presets live news_open = "alphai" # where enter opens news: "alphai" or "original" source_fallback = true # switch source when this one stops answering extended_source = "auto" # pre and after hours: auto | same | alpaca | yahoo (also a settings row) [keys] alphai = "ak_live_..." finnhub = "" alpaca_key_id = "" alpaca_secret = "" tiingo = "" [ui] default_view = "split" # split | news | table | chart | insider | earnings | summary | portfolio | calendar quote_rail = true # the price line under the tabs bare = false # start with no header and no footer (--bare, z) animations = true # price color fades and refresh spinner; also in settings mouse = true # clicks and the wheel; false leaves the mouse to the terminal (M toggles) synchronized_output = true # use synchronized frames only when terminfo advertises support news_layout = "chart" # chart | stacked | side (also a row in the settings screen) news_scope = "ticker" # ticker | events | market | trending collapse_news = true # one row per story in ticker and market news; settings can toggle it borders = "rounded" # frame lines: rounded | plain, or none for tinted panels (also a settings row) news_min_score = 5 # minimum relevance score in news feeds, 1 to 10 news_categories = [] # only these categories, e.g. ["earnings", "m&a"]; empty means all news_exclude_categories = [] # or all but these, e.g. ["crypto", "other"] insider_min_score = 1 # insider feed filter, 1 shows every filing; the score tracks trade size insider_chart = "3m" # insider trades chart window at start: 3m | 12m | off insider_decision = "all" # insider sales at start: all | discretionary | routine (f cycles) summary_layout = "cards" # summary view at start: cards | heatmap | compare (x cycles) alphai_ttl_secs = 300 # news/sentiment/insider cache lifetime, 30 to 86400 [chart] style = "candles" # candles | line sma = true # moving average overlays visible at start ma_type = "sma" # sma | ema, both using the periods below rsi = true # RSI panel visible at start volume = true # volume panel visible at start extended_hours = true # draw pre and post market candles; Shift+E toggles live timezone = "exchange" # exchange (ET for US stocks), local, utc session_shading = true # warm pre-market / cool after-hours backgrounds time_grid = true # vertical grid shared by price, volume and RSI news_markers = true # mark the ticker's cached news on the candles sma_fast = 20 # 2 to 250 sma_slow = 100 # 2 to 250; also sizes the history warm-up rsi_period = 14 # 2 to 100 right_margin_pct = 20 # free space right of the newest candle, 0 to 50 presets = [ # the combos the t and T keys cycle ["1d", "5m"], ["5d", "15m"], ["1mo", "60m"], ["6mo", "1d"], ["1y", "1d"], ] # What you hold, one entry per ticker. The p key writes these for you and # saves them here immediately; editing them by hand works just as well. # A ticker listed here is polled even when it is not on the watchlist. [[positions]] symbol = "AAPL" qty = 12 avg_price = 182.31 [[positions]] symbol = "BTC-USD" qty = 0.25 avg_price = 58200 ``` A quantity may be fractional, for crypto or for a broker that sells slices, and negative for a short, in which case a falling price is a profit. `avg_price` is what one unit cost on average: this is not a ledger and it does not keep lots, so a second buy means updating the average yourself (or letting `p` overwrite the line). ### Colors `[theme] preset` swaps in a ready-made palette: ```toml [theme] preset = "catppuccin-mocha" ``` Each preset supplies its own background and text colors. `default` takes the terminal's own colors and is shown here on a plain dark terminal:
alphai-tui split view in the default preset
default
alphai-tui split view in the dracula preset
dracula
alphai-tui split view in the catppuccin-mocha preset
catppuccin-mocha
alphai-tui split view in the catppuccin-macchiato preset
catppuccin-macchiato
alphai-tui split view in the catppuccin-frappe preset
catppuccin-frappe
alphai-tui split view in the gruvbox-dark preset
gruvbox-dark
alphai-tui split view in the nord preset
nord
alphai-tui split view in the aardvark-ink preset
aardvark-ink
alphai-tui split view in the aardvark-blue preset
aardvark-blue
alphai-tui split view in the catppuccin-latte preset
catppuccin-latte
alphai-tui split view in the gruvbox-light preset
gruvbox-light
The panel look is a separate choice. Frame lines are the default (`rounded`, or `plain`); `[ui] borders = "none"`, or the Panels row in the settings screen, draws tinted panels with a gutter instead. Either way, the panel the arrow keys move in (the watchlist, a feed, the agenda) has its frame in the accent color: ![alphai-tui split view in the dracula preset with borders = "none": tinted panels separated by a narrow gutter, each titled on a tab, the watchlist edged in the accent, in place of frame lines](https://raw.githubusercontent.com/makeev/alphai-tui/main/assets/borderless.png) `}` and `{` walk the presets live, `--theme catppuccin-mocha` picks one for a single run, and the Theme row in the settings screen (`s`) does both: `←` `→` cycle it with a live preview, Save writes it here. Available: `default`, `catppuccin-mocha`, `catppuccin-macchiato`, `catppuccin-frappe`, `catppuccin-latte`, `dracula`, `gruvbox-dark`, `gruvbox-light`, `nord`, `aardvark-ink`, `aardvark-blue` (the last two follow the Aardvark Ink and Aardvark Blue terminal palettes). Presets are written in hex, so they want a terminal with 24-bit color. Their background and body text cover the whole app, including menus and empty space, independently of the terminal theme. For a light app, choose `catppuccin-latte` or `gruvbox-light`; changing only the terminal background does not switch the app's preset. With `borders = "none"` they tint the panels one step off the palette's background, the regular session sits on that tint, and the pre-market and after-hours bands are drawn from it, so the three stay apart. `default` uses ANSI foregrounds, no panel tint and subtle RGB session backgrounds; `session_shading = false` preserves a fully transparent chart background with `default`. To keep the terminal's background with a named preset, set `background = "reset"` under `[theme]` and choose a preset suited to that background. `text = "reset"` also keeps the terminal's body text color. `pre_market_bg` and `post_market_bg` are the session background slots; each accepts the same color formats as the foreground slots. Setting either to `"reset"` uses the terminal background for that session. Every color the views draw comes from a named slot, and the optional `[theme]` table recolors any of them, over the preset when there is one. Values are ANSI color names (case-insensitive, `light-blue`, `grey`), `#RRGGBB` hex, or an ANSI-256 index written as a string like `"245"`. A bad color, a misspelled slot or an unknown preset prints a warning on startup and keeps the default; it never breaks the config file. The defaults are the values shown: ```toml [theme] accent = "cyan" # header title, active tab, overlay borders, headings accent_text = "black" # text on the active tab up = "green" # price up: candles, deltas, sparklines down = "red" # price down flat = "gray" # unchanged / no data pos = "green" # bullish sentiment, insider buys neg = "red" # bearish sentiment, insider sells error = "red" # error messages warn = "yellow" # notices and the editing highlight score_high = "yellow" # relevance score 8 to 10 sma_fast = "yellow" # fast moving average overlay sma_slow = "magenta" # slow moving average overlay rsi_line = "cyan" # RSI line ref_line = "darkgray" # previous close and RSI 30/70 reference lines border = "reset" # panel frames; reset keeps the terminal's foreground background = "reset" # whole-app background; reset keeps the terminal's background text = "reset" # body text throughout the app; reset keeps the terminal's foreground subtle = "reset" # sources, ages, axis labels, key hints; reset means the terminal's dim faint = "reset" # separators and inactive text; reset means the terminal's dim selection = "reset" # background of the cursor row; reset means reverse video surface = "reset" # panel background (borders = "none"); reset paints none ``` The presets fill these slots from their own palettes: matching background and body text, secondary text in the family's subtext shade, a cursor row that keeps each column's color, and a panel tint one step off the background. With `default`, these slots continue to use the terminal's colors. ### Custom keybindings The optional `[keybindings]` table rebinds any action. An action you list replaces its default keys entirely; actions you leave out keep theirs. The value is one key or a list of keys: ```toml [keybindings] quit = "ctrl-q" open = ["enter", "w"] next_preset = "]" prev_preset = "[" ``` A key is written as `[ctrl-][alt-][shift-]`, where base is a single character or one of the named keys: `esc`, `enter`, `tab`, `backtab`, `space`, `up`, `down`, `left`, `right`, `home`, `end`, `pgup`, `pgdn`, `backspace`, `delete`, `insert`, `f1` to `f12`. `shift-` plus a letter means the uppercase letter (`shift-t` equals `T`), and `shift-tab` equals `backtab`. The actions: `quit`, `next_view`, `prev_view`, `settings`, `help`, `refresh`, `up`, `down`, `left`, `right`, `page_up`, `page_down`, `open`, `card`, `cycle_scope`, `cycle_layout`, `score_up`, `score_down`, `insider_chart`, `chart_style`, `toggle_sma`, `toggle_rsi`, `toggle_volume`, `news_markers`, `ma_type`, `next_preset`, `prev_preset`, `next_theme`, `prev_theme`, `toggle_bare`, `add_ticker`, `remove_ticker`, `position`, `extended_hours`, `categories`, `find_ticker`, `toggle_mouse`, `price_alert`. The `?` help overlay shows this list with the current keys next to it. Reserved and never remappable: `ctrl-c` (force quit), `esc`, the digits `1` to `9` (view hotkeys), the keys inside the settings form, and `space`, `o`, `a` and `enter` inside the category picker. The ticker search uses fixed arrow, paging and text-editing keys while open; letters always type the query. A bad or reserved key, an unknown action, or a key claimed by two actions prints a warning on startup and falls back safely; the footer always shows the keys that are actually bound. ### Not configurable on purpose The AlphAI response cache (5 minutes), the feed page sizes, the 2 second poll floor and the chart warm-up factors are fixed. They keep the app a fair citizen of the free API tiers, and a config knob for them would turn an innocent-looking file into an abuse vector. `ALPACA_FEED`, `ALPHAI_API_URL`, `ALPACA_DATA_URL`, `YAHOO_CHART_URL` and `TIINGO_API_URL` stay env-only debug overrides for the same reason. ## Architecture ``` src/ domain.rs Quote, Candle, TickerData, Range/Interval config.rs config file load/save (CLI > env > file > defaults) source/ DataSource trait + implementations registry.rs the one place a new source registers; CLI, settings and keys derive from it http.rs shared client builder, JSON fetching and error helpers yahoo.rs Yahoo v8 chart endpoint (quote + history in one call) finnhub.rs Finnhub /quote with synthetic session history alpaca.rs snapshot + real historical bars (IEX/SIP feeds, crypto) tiingo.rs one IEX quote request per poll, cached IEX bars and daily history, crypto alphai.rs AlphAI API client + demand-driven fetch task (TTL cache) keymap.rs semantic actions + the key table (footer hints derive from it) theme.rs semantic color palette ([theme] overrides) indicators.rs SMA, EMA and RSI (Wilder smoothing) poller.rs fetches all symbols concurrently on a timer -> mpsc channel app.rs App state, event loop, key handling app/feeds.rs feed cache and every AlphAI request-budget guard app/settings.rs settings overlay state, rows derived from the registry ui/ View trait + implementations table.rs watchlist table chart.rs candlestick + line chart, SMA overlays, volume and RSI panels split.rs table + chart news.rs article list + sentiment rollup + detail pane insider.rs Form 4 rollup + filing list insider_chart.rs log-scale trades scatter + weekly dollar bars earnings.rs structured earnings read + the schedule line calendar.rs watchlist/portfolio agenda, report states, details and flags article.rs modal full-article card (AI analysis, context) settings.rs modal settings overlay ``` Data flows one way: background tasks (price poller, AlphAI fetcher) push events over an mpsc channel into `App::apply`; views are stateless renderers over `&mut App`. The UI never blocks on the network, and every AlphAI request-budget guard lives in one file (`app/feeds.rs`). ### Adding a price source 1. Implement `source::DataSource` (one async `fetch` returning quote plus candles) in a new module under `src/source/`. The helpers in `source/http.rs` cover the client, JSON fetching and error plumbing. A provider that quotes many tickers in one request can also implement `begin_cycle`, which hears the poll's whole symbol list before its `fetch` calls start, and answer all of them from one response (see `source/tiingo.rs`). 2. Append one `SourceInfo` entry to `source/registry.rs`: id, aliases, a settings hint, the key fields it needs and a constructor. The `--source` help and error list, the settings screen rows and picker cycle, config `[keys]` persistence and env-var overrides all derive from that entry, and the registry tests check it. 3. Describe the source in this README. ### Adding a view 1. Implement `ui::View` as a unit struct in a new module under `src/ui/`: a stateless `render` over `&mut App`, a new `ViewId` variant, a footer hint line, and the capability methods (`feed_shown`, `navigates_articles`, `has_chart_panel`, `shows_earnings`, `shows_calendar`) that opt into shared key handling and demand-driven AlphAI fetching. Views never fetch anything themselves. 2. Add it to `ui::VIEWS`. Order in that array defines the tab cycle and the `1`..`9` hotkeys; the header pills and the footer hints derive from it. ## Development ```sh cargo test # unit + TestBackend rendering tests cargo clippy --all-targets cargo fmt --all -- --check cargo run -- --once AAPL # network smoke test without a TTY ALPHAI_API_KEY=ak_live_... cargo test live_calendar_smoke -- --ignored # 1 request ALPHAI_API_KEY=ak_live_... cargo test live_api -- --ignored # 14 requests ``` CI runs the first three on every push and pull request, on Linux, macOS and Windows. What changed in each release is in [CHANGELOG.md](CHANGELOG.md). Issues and PRs are welcome. ## License MIT. Not investment advice; data comes from third-party sources and can be delayed or wrong. Respect the terms of the data providers you enable.