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.

    26th November 12:00
    C: 9.0100
    O: 8.9800
    H: 9.0200
    L: 8.9100
    V: 30262639
    27th November 12:00
    C: 9.1000
    O: 9.0300
    H: 9.1500
    L: 9.0200
    V: 37395958
    29th November 12:00
    C: 9.0600
    O: 9.0400
    H: 9.1000
    L: 9.0300
    V: 13096150
    2nd December 12:00
    C: 9.0100
    O: 9.0800
    H: 9.1400
    L: 9.0000
    V: 37232621
    3rd December 12:00
    C: 8.8900
    O: 8.9500
    H: 8.9500
    L: 8.8000
    V: 41107429
    4th December 12:00
    C: 8.9500
    O: 8.9500
    H: 9.0300
    L: 8.9400
    V: 29982853
    5th December 12:00
    C: 8.9300
    O: 8.9700
    H: 9.0000
    L: 8.8800
    V: 25766900
    6th December 12:00
    C: 9.0200
    O: 8.9600
    H: 9.0700
    L: 8.9450
    V: 31084884
    9th December 12:00
    C: 9.0100
    O: 8.9700
    H: 9.0700
    L: 8.9600
    V: 21772922
    10th December 12:00
    C: 9.0300
    O: 9.0200
    H: 9.0300
    L: 8.9600
    V: 3181829

    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.

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