开发者 |
urkekg
techwebux |
---|---|
更新时间 | 2021年2月27日 17:54 |
捐献地址: | 去捐款 |
PHP版本: | 5.6 及以上 |
WordPress版本: | 5.6 |
版权: | GPLv3 or later |
版权网址: | 版权信息 |
[stock_quote]
shortcode inline to Paragraph Block or Common Block to insert Stock Quote within the post/page content.
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:
All Stock Symbols
field. Solution: We are working on cron
driven updates, but we do not have ETA for that release.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.Cache Timeout
value so plugin skip fetching of updated quotes. Solution: decrease Cache Timeout
value below 600 (that means below 10 minutes).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.%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