Insert static inline stock ticker for known exchange symbols by customizable shortcode.
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
Stock Quote is simplified, static inline variation of 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.
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.
For feature requests or help send feedback or use support forum on WordPress.
Cache Timeout
period has expired, plugin will pick first symbol from All Stock Symbols
field. Each time it will pick next symbol.You can add Stock Quote to posts, pages or widgets by 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 feedsdecimals
– 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,00template
– 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 to customize date output, separate by pipe character, eg. |l, jS \of F Yraw
– 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[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:
Not supported:
* MCX – Moscow Exchange (since December 2018) – eg. MCX:GAZP
* ASX – Australian Securities Exchange (since since May 2020) – eg. ASX:MSB
* SGX – Singapore Exchange (since July 13th 2020) – eg. C29.SI
* NSE – National Stock Exchange of India (since July 2020) – eg. NSE:VB
Easy install Stock Quote as any other ordinary WordPress plugin
Plugins
-> Add New
Stock Quote
pluginStock Quote
Settings
-> Stock Quote
AlphaVantage.co API Key
Alpha Vantage API Key you received in previous stepAll 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.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.[stock_quote]
to page or post as usual.For start you can try with AAPL (Apple). If you need some specific symbol, check you’ll need to figure out by your self.
To get quote for this exchange, simply add symbol .DJI
or ^DJI
.
Use Currency symbols like EURGBP
to get rate of 1 Euro
= ? British Pounds
Add to Custom Names
legend currency exchange symbol w/o =X
part, like:
EURGBP;Euro (€) ⇨ British Pound Sterling (£)
Enter symbol in format EXCHANGE:SYMBOL
like LON:AVST
Add this to your template file (you also can add custom parameters for shortcode):
<?php echo do_shortcode('[stock_ticker]'); ?>
You’ll need to set company name to Custom Names field on plugin settings page.
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 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/
%ltrade%
with optional modifier for customized date format like %ltrade|l, jS \of F Y%
show
is set as symbol
, if definition exists in custom legend.EURGBP
instead of old EURGBP=X
get_symbol_to_fetch()
data_to_db()
get_stock_from_db()
public so user can access Stock data in DB from custom functionssanitize_symbols()
to main class and make it public static so user can access it from custom functionsSTO:ERIC-B
) (thanks to @iarwain)stuck quote
questionNetagive
spelling error (thanks to @eigood)raw
%raw_price%
, %raw_change%
, %raw_changep%
and %raw_volume%
last_open
instead of proper last_close
add_to_all_symbols
)decimals
, number_format
and template
as shortcode parametersWPAU_STOCK_QUOTE_CACHE_TIMEOUT
sq_transient_id
to transient_id
)stockquote_purge_cache
in page URL