Title: Stock Quote
Author: Aleksandar Urošević
Published: <strong>2015 年 4 月 14 日</strong>
Last modified: 2021 年 2 月 27 日

---

搜尋外掛

![](https://ps.w.org/stock-quote/assets/banner-772x250.png?rev=1661848)

這個外掛**並未在最新的 3 個 WordPress 主要版本上進行測試**。開發者可能不再對這個
外掛進行維護或提供技術支援，並可能會與更新版本的 WordPress 產生使用上的相容性問題。

![](https://ps.w.org/stock-quote/assets/icon.svg?rev=2482613)

# Stock Quote

 由 [Aleksandar Urošević](https://profiles.wordpress.org/urkekg/) 開發

[下載](https://downloads.wordpress.org/plugin/stock-quote.0.2.3.zip)

 * [詳細資料](https://tw.wordpress.org/plugins/stock-quote/#description)
 * [使用者評論](https://tw.wordpress.org/plugins/stock-quote/#reviews)
 *  [安裝方式](https://tw.wordpress.org/plugins/stock-quote/#installation)
 * [開發資訊](https://tw.wordpress.org/plugins/stock-quote/#developers)

 [技術支援](https://wordpress.org/support/plugin/stock-quote/)

## 外掛說明

A simple and easy configurable plugin for WordPress which allows you to insert inline
stock quotes with stock price information to posts, pages, widgets or even to template
files. Insertion is mainly available by shortcode.

Please note, stock data has been provided by [Alpha Vantage](https://www.alphavantage.co/)

Stock Quote is simplified, static inline variation of [Stock Ticker](https://wordpress.org/plugins/stock-ticker/)
plugin.

**Multisite WordPress is not supported yet**

**IMPORTANT** Stock Quote does not have own Gutenberg Block, so you can add `[stock_quote]`
shortcode inline to Paragraph Block or Common Block to insert Stock Quote within
the post/page content.

### Disclaimer

All stock data used in **Stock Quote** is provided by **Alpha Vantage**, displayed
for informational and educational purposes only and should not be considered as 
investment advise.

Author of the **Stock Quote** plugin does not accept liability or responsibility
for your use of plugin, including but not limited to trading and investment results.
Along to that, author of **Stock Quote** plugin can not guarantee that stock prices
are always accurate as they are provided by 3rd party service for free.

### Features

 * Configure default stock symbol that will be displayed by shortcode if no symbol
   provided
 * Configure default presence of company as Company Name or as Stock Symbol
 * Configure global colours for unchanged quote, negative and positive changes
 * Tooltip for quote item display company name, exchange market and last trade date/
   time (if available)
 * Define custom names for companies to be used instead symbols
 * Plugin uses native WordPress function to get and cache data from AlphaVantage.
   co API for predefined duration of time

For feature requests or help [send feedback](https://urosevic.net/wordpress/plugins/stock-quote/)
or use support forum on WordPress.

### How It Works?

 1. When front-end is loaded in browser, plugin will render quote placeholder in place
    where you have inserted shortcode.
 2. Right after page is loaded, AJAX call will request quote content and inject it 
    inside quote placeholder. That quote is retrieved as a cached value in database.
 3. Couple seconds latter, second AJAX request will initiate background quote update
    from WordPress.
 4. If `Cache Timeout` period has expired, plugin will pick first symbol from `All 
    Stock Symbols` field. Each time it will pick next symbol.
 5. Without disturbing page rendering and speed to get quote from database, plugin 
    in background retrieve data from AlphaVantage.co for picked symbol.
 6. If quote is successfully retrieved, plugin will save value for that symbol in database.
 7. New fetched quote for symbol will be displayed on front-end only after page reload
    but not right after updated quote get fetched from AlphaVantage.co!

### How To Use

You can add Stock Quote to posts, pages or widgets by shortcode.

#### Shortcode

Use simple shortcode `[stock_quote]` without any parameter in post or page, to display
quote with default (global) settings.

**IMPORTANT** All shortcode parameters and values should be lowercase, except symbols
which must be uppercase!

You can tune single shortcode with parameters:

 * `symbol` – represent single stock symbol (if not provided then use default from
   settings page)
 * `show` – can be `name` to represent company with Company Name (default), or `
   symbol` to represent company with Stock Symbol. You must add preferred symbol
   to `Custom Names` textarea on Settings page because Google Finance does not provide
   nice company names in feeds
 * `decimals` – override default number of decimal places for values (default from
   settings page used if no custom set by shortcode). Valud values are: `1`, `2`,`
   3` and `4`
 * `number_format` – override default number format for values (default from this
   settings page used if no custom set by shortcode). Valid options are: `cd` for
   _0.000,00_; `dc` for _0,000.00_; `sd` for _0 000.00_ and `sc` for _0 000,00_
 * `template` – override default template string (default is: `%company% %price%%
   change% %changep%`). You can use following template keywords: `%company%`, `%
   company_name%`, `%exch_symbol%`, `%symbol%`, `%price%`, `%change%`, `%changep%`,`%
   volume%`, `%raw_price%`, `%raw_change%`, `%raw_changep%`, `%raw_volume%` and `%
   ltrade%` which stand for the last trade day (like _2020-09-25_), which can be
   followed by [the PHP date format](https://www.php.net/manual/en/datetime.format.php)
   to customize date output, separate by pipe character, eg. _|l, jS \of F Y_
 * `raw` – enable printing quote content without wrapping to SPAN with classes. 
   Default is disabled. Can be `1` or `true` for enabled, OR `0` or `false` for 
   disabled.
 * `class` – (optional) custom class name for quote item, if you wish some special
   styling

#### Example

    ```
    [stock_quote symbol="^DJI" show="symbol"]
    ```

or

    ```
    [stock_quote symbol="MSFT" decimals=3 number_format=cd template="%symbol% %price% %change% %changep%"]<h3>Supported Stock Exchange Markets</h3>
    ```

Alpha Vantage provide stock data for following stock exchange markets:

 * **BOM** – Bombay Stock Exchange
 * **BIT** – Borsa Italiana Milan Stock Exchange
 * **TSE** – Canadian/Toronto Securities Exchange
 * **FRA** – Deutsche Boerse Frankfurt Stock Exchange
 * **ETR** – Deutsche Boerse Frankfurt Stock Exchange
 * **AMS** – Euronext Amsterdam
 * **EBR** – Euronext Brussels
 * **ELI** – Euronext Lisbon
 * **EPA** – Euronext Paris
 * **LON** – London Stock Exchange
 * **NASDAQ** – NASDAQ Exchange
 * **CPH** – NASDAQ OMX Copenhagen
 * **HEL** – NASDAQ OMX Helsinki
 * **ICE** – NASDAQ OMX Iceland
 * **STO** – NASDAQ OMX Stockholm
 * **NYSE** – New York Stock Exchange
 * **SHA** – Shanghai Stock Exchange
 * **SHE** – Shenzhen Stock Exchange
 * **TPE** – Taiwan Stock Exchange
 * **TYO** – Tokyo Stock Exchange

Not supported:
 * **MCX** – Moscow Exchange (since December 2018) – eg. `MCX:GAZP`***
ASX** – Australian Securities Exchange ([since since May 2020](https://twitter.com/moinzaman/status/1262522914227712000))–
eg. `ASX:MSB` * **SGX** – Singapore Exchange ([since July 13th 2020](https://kpo-and-czm.blogspot.com/2017/11/bye-yahoo-finance-hi-alpha-vantage.html?showComment=1596075191464#c3946519402226422619))–
eg. `C29.SI` * **NSE** – National Stock Exchange of India ([since July 2020](https://twitter.com/sachinmankapure/status/1279794312210010114))–
eg. `NSE:VB`

## 螢幕擷圖

 * [[
 * Global plugin settings page
 * [[
 * Stock Quote in action

## 安裝方式

Easy install Stock Quote as any other ordinary WordPress plugin

 1.  Go to `Plugins` -> `Add New`
 2.  Search for `Stock Quote` plugin
 3.  Install and activate `Stock Quote`
 4.  Get a free API Key from [AlphaVantage.co](https://www.alphavantage.co/support/#api-key)
 5.  In WordPress Dashboard go to `Settings` -> `Stock Quote`
 6.  Enter to field `AlphaVantage.co API Key` Alpha Vantage API Key you received in
     previous step
 7.  Enter to field `All Stock Symbols` all stock symbols you’ll use on whole website
     in various shortcodes, separated by comma. This field is used to fetch stock data
     from AlphaVantage.co API by AJAX in background. Because AV have only API to get
     data for single symbol, that can take a while to get. Please note, for default
     shortcode symbol there is still field in Default Settings section of plugin.
 8.  Save settings and click button `Fetch Stock Data Now!` to initially fetch stock
     data to database and wait for a while until we get all symbols from AlphaVantage.
     co for the very first time.
 9.  Insert shortcode `[stock_quote]` to page or post as usual.

## 常見問題集

### How to know which stock symbols to use?

For start you can try with AAPL (Apple). If you need some specific symbol, check
you’ll need to figure out by your self.

### How to get Dow Jones Industrial Average?

To get quote for this exchange, simply add symbol `.DJI` or `^DJI`.

### How to get currency exchange rate?

Use Currency symbols like `EURGBP` to get rate of `1 Euro` = `? British Pounds`

### How to get descriptive title for currency exchange rates

Add to `Custom Names` legend currency exchange symbol w/o `=X` part, like:

    ```
    EURGBP;Euro (€) ⇨ British Pound Sterling (£)
    ```

### How to get proper stock price from proper stock exchange?

Enter symbol in format `EXCHANGE:SYMBOL` like `LON:AVST`

### How to add Stock Ticker to header theme file?

Add this to your template file (you also can add custom parameters for shortcode):

    ```
    <?php echo do_shortcode('[stock_ticker]'); ?>
    ```

### I set to show company name but symbol is displayed instead

You’ll need to set company name to Custom Names field on plugin settings page.

### My quote do not update or have large delay

There is couple possible causes for this issue:
 1. Your website do not have enough
visits to fetch each symbol from `All Stock Symbols` field. Solution: We are working
on `cron` driven updates, but we do not have ETA for that release. 1. You have set
too short `Cache Timeout` value so plugin do not have enough time to fetch updated
quote for each symbol in `All Stock Symbols`. Solution: Increase `Cache Timeout`
value. 1. You have too long `Cache Timeout` value so plugin skip fetching of updated
quotes. Solution: decrease `Cache Timeout` value below 600 (that means below 10 
minutes). 1. You have set too short `Fetch Timeout` so plugin do not have enough
time to successfully retrieve symbol from AlphaVantage.co. Solution: Increase `Fetch
Timeout` by 2-3 second than you have set already. If that still does not work, try
with another 2-3 seconds. 1. When you hover over quote on front-end, you should 
see last trade date. If date is older than expected (including last trade day), 
it’s possible that something stuck in plugin. Solution: Enable debugging in WordPress
as explained in official article [https://codex.wordpress.org/Debugging_in_WordPress#Example_wp-config.php_for_Debugging](https://codex.wordpress.org/Debugging_in_WordPress#Example_wp-config.php_for_Debugging)
and after couple of hours disable debugging, upload wp-content/stock-quote.log to
DropBox/Google Drive/etc and provide link to log in email sent throug our contact
form at [https://urosevic.net/c/](https://urosevic.net/c/)

## 使用者評論

![](https://secure.gravatar.com/avatar/f35f93ae052b2f5b87df05f5ec7de4d0d05c292007f9d8b57e4e2b45f0534bb4?
s=60&d=retro&r=g)

### 󠀁[Good and with important options.](https://wordpress.org/support/topic/good-and-with-important-options/)󠁿

 [Webprom Design](https://profiles.wordpress.org/webprom/) 2019 年 6 月 24 日

I like it, it provides all needed options. Tip for author: Help on selecting stock
exchange should be put on plugin’s page.

![](https://secure.gravatar.com/avatar/ae0b37521122b8db499adc370169a00ca3a30076dcf52e3d1c6011a15a37c0b8?
s=60&d=retro&r=g)

### 󠀁[Great plugin – multifunctional](https://wordpress.org/support/topic/great-plugin-multifunctional/)󠁿

 [travelnval](https://profiles.wordpress.org/travelnval/) 2018 年 2 月 20 日

Great plugin, able to get quotes from multiple exchanges and with the new feature
which was added for raw price able to do calculations. Great support and very responsive.
Thanks again

![](https://secure.gravatar.com/avatar/089099fd834cc95219726a2a41cf23d5c410e5da7616f3c75885970c842d77a1?
s=60&d=retro&r=g)

### 󠀁[Great plugin](https://wordpress.org/support/topic/great-plugin-13948/)󠁿

 [jsdixon](https://profiles.wordpress.org/jsdixon/) 2017 年 5 月 24 日

small, neat, and does what it says. developer provided a fix to a small problem 
quickly. great all round!

 [ 閱讀全部 3 則使用者評論 ](https://wordpress.org/support/plugin/stock-quote/reviews/)

## 參與者及開發者

以下人員參與了開源軟體〈Stock Quote〉的開發相關工作。

參與者

 *   [ Aleksandar Urošević ](https://profiles.wordpress.org/urkekg/)
 *   [ TechWebUX ](https://profiles.wordpress.org/techwebux/)

〈Stock Quote〉外掛目前已有 1 個本地化語言版本。 感謝[全部譯者](https://translate.wordpress.org/projects/wp-plugins/stock-quote/contributors)
為這個外掛做出的貢獻。

[將〈Stock Quote〉外掛本地化為台灣繁體中文版](https://translate.wordpress.org/projects/wp-plugins/stock-quote)

### 對開發相關資訊感興趣？

任何人均可[瀏覽程式碼](https://plugins.trac.wordpress.org/browser/stock-quote/)、
查看 [SVN 存放庫](https://plugins.svn.wordpress.org/stock-quote/)，或透過 [RSS](https://plugins.trac.wordpress.org/log/stock-quote/?limit=100&mode=stop_on_copy&format=rss)
訂閱[開發記錄](https://plugins.trac.wordpress.org/log/stock-quote/)。

## 變更記錄

#### 0.2.3 (20210227)

 * Tested: WordPress 5.6.2 and PHP 7.4.15
 * Add: new template keyword `%ltrade%` with optional modifier for customized date
   format like `%ltrade|l, jS \of F Y%`

#### 0.2.2 (20200811)

 * Tested: WordPress 5.5-RC2-48768 and PHP 7.4.1
 * Add: New template keyword %company_name% which show descriptive company name 
   even if `show` is set as `symbol`, if definition exists in custom legend.
 * Improve: Made all strings in plugin available for localization.
 * Improve: Retrieve single row of data from DB as Stock Quote has single symbol
   per shortcode or widget.
 * Improve: Help section on plugin settings page.
 * Simplify: Remove unused variables and improve conditionals for better DRY.
 * Change: FOREX symbol now should be used as `EURGBP` instead of old `EURGBP=X`
 * Change: Remove ASX, SGX and NSE from supported exchanges because AlphaVantage
   does not provide data for Australian Securities Exchange, Singapore Exchange 
   and National Stock Exchange of India

#### 0.2.1.1 (20200520)

 * Remove MCX from supported exchanges because AlphaVantage does not provide data
   for Moscow Stock Exchange
 * Add support for AlphaVantage.co empty response {} reported for Australian Exchange
   by @blockathon

#### 0.2.1 (20180923)

 * Improve: statuses and messages in fetch log
 * Improve: Make Force Fetch to wait between each symbol fetch regarding to the 
   API Tier
 * Improve: Remove duplicate symbols on settings update
 * Simplify: Merge 3 settings sections to single register_settings
 * Improve: Move routine to extract symbol to fetch to self method `get_symbol_to_fetch()`
 * Improve: Move stock data to DB to self method `data_to_db()`
 * Change: Make method `get_stock_from_db()` public so user can access Stock data
   in DB from custom functions
 * Change: Move method `sanitize_symbols()` to main class and make it public static
   so user can access it from custom functions
 * Add Alpha Vantage Tier option for better fetch timeout control
 * Add to settings page list of stock exchanges supported by AlphaVantage
 * Switch to GLOBAL_QUOTE API mode and eliminate requirement to calculate change
   amount from TIME_SERIES_DAILY and TIME_SERIES_INTRADAY
 * Fix: Allow dash character in symbols (eg. `STO:ERIC-B`) (thanks to @iarwain)
 * (20180609) Readme: add How It Works
 * Readme: Update FAQ with `stuck quote` question

#### 0.2.0.5 (20180901)

 * Fix: `Netagive` spelling error (thanks to @eigood)

#### 0.2.0.4 (20180604)

 * Fix: workaround for stuck skipping
 * Add: URL request to unlock fetch

#### 0.2.0.3 (20180219)

 * Add: shortcode parameter `raw`
 * Add: template keywords `%raw_price%`, `%raw_change%`, `%raw_changep%` and `%raw_volume%`

#### 0.2.0.2 (20180204)

 * Fix: price amount was taken from `last_open` instead of proper `last_close`

#### 0.2.0.1 (20171229)

 * Fix: on PHP 5.x – PHP Fatal error: Using $this when not in object context
 * Test: PHP 5.6.31 and 7.1.12

#### 0.2.0 (20171222)

 * (20171224)
    - Add: front-end updater AJAX call
 * (20171222)
 * Move: method sanitize_symbols to main plugin class
 * Add: on shortcode renderer part to check is current symbol already in All Symbols
   list and append if it’s not (method `add_to_all_symbols`)
 * Add: fetching system to settings page
 * Fix: Fatal exceptions caused by classes, methods and variables renaming
 * Fix: Settings page
 * Fix: Admin settings symbol
 * (20171217) Add: plugin update script with database creation and legacy settings
   migration
 * Add: All Symbols settings field
 * Add: AlphaVantage parser and DB updater
 * Add: get_stock_from_db
 * (20171212) Start AlphaVantage.co version based on v0.1.7.1

#### 0.1.7.1 (20170524)

 * Fix: when changep is empty – PHP Warning: number_format() expects parameter 1
   to be float, string given in wp-content/plugins/stock-quote/stock-quote.php on
   line 436

#### 0.1.7 (20170521)

 * Add: `decimals`, `number_format` and `template` as shortcode parameters
 * Add: Error check on fetching data from Google
 * Cleanup: Remove unused constant `WPAU_STOCK_QUOTE_CACHE_TIMEOUT`
 * Cleanup: Improve variable names (like `sq_transient_id` to `transient_id`)
 * Remove: unused Stock Quote element ID
 * Update: help for shortcode and parameters
 * Update: readme file

#### 0.1.6 (20170118)

 * Add: options to choose number format and amount of decimal places
 * Optimize: Remove enqueing stylesheet and move inline CSS from footer to HEAD.
   Converted images to single inline data:image to reduce HTTP requests.
 * Simplify: remove shortcode parameters zero, minus and plus, because webmaster
   can tweak colours by custom class
 * Simplify: convert main CSS to SASS and inject to HEAD instead link to small file
 * Change: improve settings page layout.

#### 0.1.5 (20160523)

 * Fix: Complete support for localization
 * Add: Localization to Serbian Cyrillic

#### 0.1.4 (20151016)

 * Fix: Quote stuck and never change
 * Change: Made name of transient cache key name human readable

#### 0.1.3 (20150809)

 * Change: Item ID length reduced fro 8 to 4 characters
 * Change: Move all core methods inside class
 * Make code fully compliant to WordPress Coding Standard
 * Update FAQ

#### 0.1.2 (20150723)

 * Add: Option to purge cache by providing parameter `stockquote_purge_cache` in
   page URL
 * Add: Option on plugin settings page to set fetch timeout in seconds (2 is default).
   Usefull for websites hosted on shared hosting.
 * Change: Timeout fields to HTML5 number

#### 0.1.1 (20150607)

 * Fix: Make available to work with our Stock Ticker plugin

#### 0.1.0 (20150408)

 * Initial release

## 中繼資料

 *  版本 **0.2.3**
 *  最後更新 **5 年前**
 *  啟用安裝數 **200+**
 *  WordPress 版本需求 ** 4.6 或更新版本 **
 *  已測試相容的 WordPress 版本 **5.6.17**
 *  PHP 版本需求 ** 5.6 或更新版本 **
 *  語言
 * [English (US)](https://wordpress.org/plugins/stock-quote/) 及 [Serbian](https://sr.wordpress.org/plugins/stock-quote/).
 *  [將這個外掛本地化為你的母語版本](https://translate.wordpress.org/projects/wp-plugins/stock-quote)
 * 標籤
 * [exchange](https://tw.wordpress.org/plugins/tags/exchange/)[finance](https://tw.wordpress.org/plugins/tags/finance/)
   [stock](https://tw.wordpress.org/plugins/tags/stock/)[trading](https://tw.wordpress.org/plugins/tags/trading/)
 *  [進階檢視](https://tw.wordpress.org/plugins/stock-quote/advanced/)

## 評分

 5 星，滿分為 5 星

 *  [  3 個 5 星使用者評論     ](https://wordpress.org/support/plugin/stock-quote/reviews/?filter=5)
 *  [  0 個 4 星使用者評論     ](https://wordpress.org/support/plugin/stock-quote/reviews/?filter=4)
 *  [  0 個 3 星使用者評論     ](https://wordpress.org/support/plugin/stock-quote/reviews/?filter=3)
 *  [  0 個 2 星使用者評論     ](https://wordpress.org/support/plugin/stock-quote/reviews/?filter=2)
 *  [  0 個 1 星使用者評論     ](https://wordpress.org/support/plugin/stock-quote/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/stock-quote/reviews/#new-post)

[查看全部使用者評論](https://wordpress.org/support/plugin/stock-quote/reviews/)

## 參與者

 *   [ Aleksandar Urošević ](https://profiles.wordpress.org/urkekg/)
 *   [ TechWebUX ](https://profiles.wordpress.org/techwebux/)

## 技術支援

使用者可在技術支援論壇提出意見反應或使用問題。

 [檢視技術支援論壇](https://wordpress.org/support/plugin/stock-quote/)

## 贊助

想要支援這個外掛的發展嗎？

 [ 贊助這個外掛 ](https://urosevic.net/wordpress/donate/?donate_for=stock-quote)