Home Add Stock Quote Date Table to WordPress With Shortcode (Alpha Vantage API)

    Add Stock Quote Date Table to WordPress With Shortcode (Alpha Vantage API)

    0

    In early October we provided a shortcode that would query Alpha Vantage for stock data. One of the comments asked about how one would include the data in tables rather than a graph. This is a very crude example (I spend no more than a couple of minutes modifying it). If you’re going to use it you’ll want to style it and copy the inline CSS to the appropriate location.

    ■ ■ ■

    Shortcode of [stocktable number="10"] returns the following. It’s kind-of mobile responsive… so if you were to use it you would certainly need to make improvements. We’re caching the data for three hours.

    7th March 12:00
    C: 8.4800
    O: 8.5600
    H: 8.5700
    L: 8.3450
    V: 54285995
    8th March 12:00
    C: 8.4200
    O: 8.4000
    H: 8.4700
    L: 8.3400
    V: 43766799
    11th March 12:00
    C: 8.6100
    O: 8.4600
    H: 8.6300
    L: 8.4500
    V: 36875290
    12th March 12:00
    C: 8.5700
    O: 8.6500
    H: 8.7000
    L: 8.5500
    V: 37805025
    13th March 12:00
    C: 8.5300
    O: 8.5900
    H: 8.6500
    L: 8.5000
    V: 49018694
    14th March 12:00
    C: 8.4100
    O: 8.5200
    H: 8.5500
    L: 8.4000
    V: 36307868
    15th March 12:00
    C: 8.4300
    O: 8.4200
    H: 8.4700
    L: 8.3700
    V: 66555519
    18th March 12:00
    C: 8.5700
    O: 8.4500
    H: 8.5700
    L: 8.4200
    V: 37198328
    19th March 12:00
    C: 8.7000
    O: 8.6100
    H: 8.8700
    L: 8.6100
    V: 57278015
    20th March 12:00
    C: 8.5250
    O: 8.6700
    H: 8.6600
    L: 8.4800
    V: 31733266

    Original post published here.

    WordPress Shortcode

    Copy and paste the WordPress function into your theme's functions.php file or, if you sensibly have one installed, your custom functions plugin.

    If you require shortcode to work in a sidebar widget, you'll have to enable the functionality with a filter. If you're using our custom functions plugin, you'll have that feature enabled by default.

    Shortt URL for this post: http://shor.tt/1XVc