Skip to content

Kinneyzhang/stock

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

72 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stock.el - A-Share Real-time Stock Dashboard

Stock is an Emacs package for displaying A-share (Chinese stock market) real-time data based on Sina Finance API.

Features

  • 📊 Dashboard Buffer: Display stock indices and favorite stocks with auto-refresh
  • 📈 Mode-line Display: Quick glance at stock prices while working
  • 📉 Header-line Display: Alternative display in buffer header
  • 🔄 Auto Refresh: Data updates during trading hours (9:00-11:30, 13:00-15:00)
  • 🔍 Stock Search: Search any stock by code
  • Favorites Management: Add/remove favorite stocks with persistence
  • Incremental Updates: Uses tp.el for efficient text property updates

Screenshot

./imgs/stock.png

Requirements

  • Emacs 28.1+
  • tp.el - Text Properties manipulation library

Installation

Download stock.el and stock-utils.el to your Emacs load-path. Make sure tp.el is installed.

(use-package stock
  :load-path "~/.emacs.d/site-lisp/stock"
  :bind
  ("C-c s s" . stock)
  ("C-c s m" . stock-modeline-mode)
  :custom
  (stock-auto-refresh t)
  (stock-refresh-seconds 5)
  (stock-code-list '("sh600036" "sz000625")))

Quick Start

M-x stock          ; Open dashboard

In the dashboard:

  • + : Add favorite stocks
  • _ : Remove a stock
  • g : Refresh data
  • s : sort stocks
  • c : Toggle color (stealth mode)

Documentation

Configuration

VariableDefaultDescription
stock-index-list’(“sh000001” “sz399001” “sz399006”)Stock indices to display
stock-code-list’(“sh600036” “sz000625”)Default favorite stocks
stock-buffer-nameA ChiveDashboard buffer name
stock-auto-refreshtEnable auto-refresh
stock-refresh-seconds5Refresh interval (seconds)
stock-colouringtEnable colored display
stock-modeline-stocksnilStocks for mode-line display
stock-modeline-format”[%n:%p]”Mode-line format (%n=name, %p=percent)
stock-modeline-refresh-seconds1Mode-line refresh interval
stock-headerline-stocksnilStocks for header-line display
stock-headerline-format”[%n:%p]”Header-line format
stock-headerline-refresh-seconds1Header-line refresh interval

Commands

CommandDescription
stockOpen the main stock dashboard
stock-refreshManually refresh stock data
stock-searchSearch stocks by codes
stock-addAdd stocks to favorites
stock-removeRemove a stock from favorites
stock-switch-colouringToggle color display (stealth mode)
stock-modeline-modeToggle mode-line stock display
stock-modeline-addAdd stocks to mode-line
stock-modeline-removeRemove a stock from mode-line
stock-headerline-modeToggle header-line stock display
stock-headerline-addAdd stocks to header-line
stock-headerline-removeRemove a stock from header-line

Mode-line Display

Display real-time stock prices in your mode-line:

;; Configure stocks
(setq stock-modeline-stocks '("sh600036" "sz000625"))

;; Enable mode-line display
(stock-modeline-mode 1)

Header-line Display

Display stocks in the header-line:

;; Configure stocks
(setq stock-headerline-stocks '("sh600036" "sz000625"))

;; Enable header-line display
(stock-headerline-mode 1)

For Traders

Buy and forget. 买了就忘。

License

GNU General Public License v3.0

About

Real-time board for A shares.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Emacs Lisp 100.0%