Stocks Bar
VSCode Extension | A-shares | Hong Kong Stocks | Futures | Real-time Stock Data | Status Bar Updates
Stocks Bar
automatically refreshes stock data during trading hours and displays basic stock information in the VSCode status bar, allowing you to keep track of your stocks while using VSCode.
Stocks Bar
displays only pure numbers like stock prices and percentage changes by default. When you hover over them, you can view detailed information. You can also customize the display to show stock names for better identification.

The plugin is open source, available at: Github. Welcome to star ⭐️, submit issues or pull requests!
Commands
Open command palette with Ctrl/Cmd + Shift + P
:
Stocks Bar: Show
- Display Stocks Bar
Stocks Bar: Hide
- Hide Stocks Bar (stops background data update requests)
Stocks Bar: Search Stock
- Add Stocks Bar configuration
Plugin Configuration
Modify user settings to add the stock codes you want to monitor:
// Stock configuration: array
"stocksbar.stocks": [
"sh000001", // You can directly add stock code strings
{
"code": "sz000001", // Or add detailed configuration
"alias": "Ping An",
"hold_price": 0,
"hold_number": 0
}
],
// Futures configuration: array
"stocksbar.futures": [
{
"code": "cu2409",
"alias": "Copper",
"hold_price": 0,
"hold_number": -1
}
],
// Data update interval in milliseconds
"stocksbar.updateInterval": 10000
// Color for rising stocks, defaults to system theme
"stocksbar.riseColor": ""
// Color for falling stocks, defaults to system theme
"stocksbar.fallColor": ""
// Enable qos.hk API for real-time HK/US stock quotes (requires token configuration)
"stocksbar.useQosForHkUs": false
// Token for qos.hk API to get real-time HK/US stock quotes
"stocksbar.qosHkToken": "",
// Enable simple display mode, showing only stock name and percentage change
"stocksbar.simpleMode": false
Display Modes
Normal Display Mode
By default, Stocks Bar displays stock information in the following format:
[Stock Name/Alias] [Stock Price] [Percentage Change]%
Example: 平安 12.35 2.15%
Simple Display Mode
When simple mode is enabled, Stocks Bar displays only the stock name and percentage change:
[Stock Name/Alias] [Percentage Change]%
Example: 平安 2.15%
To enable simple mode, set the following configuration:
"stocksbar.simpleMode": true
Stock Configuration
Stock configuration can be either a stock code string or a detailed configuration object:
- code:
string
, stock code with market prefix (see prefix explanation below)
- alias:
string
, alias name, defaults to empty
- hold_price:
number
, holding price, optional, defaults to 0
- hold_number:
number
, holding quantity, optional, defaults to 0
When using stock code string like ["sz000001"]
, it's equivalent to [{"code": "sz000001", "alias": "", "hold_price": 0, "hold_number": 0}]
Futures Configuration
- code:
string
, futures code, e.g., cu2409
, sa2409
- alias:
string
, futures alias
- hold_price:
number
, holding price for long/short positions
- hold_number:
number
, position size, positive for long positions, negative for short positions
Prefix Explanation
- sh: Shanghai Stock Exchange, codes starting with
6
default to sh
prefix (Shanghai Composite Index: sh000001
)
- sz: Shenzhen Stock Exchange, codes not starting with
6
default to sz
prefix
- hk: Hong Kong stocks, e.g., Alibaba HK
hk09988
- US_: US stocks, e.g., Apple
US_AAPL
- hkHSC: Hang Seng Commerce & Industry Index (HK Index)
- hkHSCEI: Hang Seng China Enterprises Index (HK Index)
- hkHSI: Hang Seng Index (HK Index)
- hkHSCCI: Hang Seng China-Affiliated Corporations Index (HK Index)
- hkHSF: Hang Seng Finance Sub-index (HK Index)
- hkHSP: Hang Seng Properties Sub-index (HK Index)
- hkHSU: Hang Seng Utilities Sub-index (HK Index)
- hkGEM: S&P/HKEx GEM Index (HK Index)
- US_DOWJONES: Dow Jones Industrial Average (US Index)
- US_NASDAQ: NASDAQ Composite (US Index)
- US_SP500: S&P 500 (US Index)
Changelog
CHANGELOG
Contributors
Thanks to these lovely contributors for participating in the development and maintenance of Stocks Bar, making Stocks Bar
even better!
License
This project is open source under the MIT
license. For the complete license agreement, please refer to the LICENSE file.
Source
Plugin Source: Stocks Bar
was originally forked from stock-watch and has since undergone significant refactoring.
Stock Data Sources:
- Sina Finance
- Tonghuashun (iFinD)