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 January 12:00
    C: 8.2900
    O: 8.1100
    H: 8.3650
    L: 8.0250
    V: 40729353
    8th January 12:00
    C: 8.3700
    O: 8.4200
    H: 8.5400
    L: 8.3500
    V: 45643969
    9th January 12:00
    C: 8.7200
    O: 8.4500
    H: 8.7700
    L: 8.3600
    V: 48404884
    10th January 12:00
    C: 8.6700
    O: 8.7100
    H: 8.7700
    L: 8.4500
    V: 39490422
    11th January 12:00
    C: 8.8200
    O: 8.7700
    H: 8.9300
    L: 8.7000
    V: 41559875
    14th January 12:00
    C: 8.9900
    O: 8.8000
    H: 9.0600
    L: 8.7600
    V: 44833842
    15th January 12:00
    C: 8.8400
    O: 9.0200
    H: 9.0300
    L: 8.7500
    V: 65311702
    16th January 12:00
    C: 8.2900
    O: 8.6800
    H: 8.7700
    L: 8.2600
    V: 73869859
    17th January 12:00
    C: 8.3600
    O: 8.2700
    H: 8.4400
    L: 8.2100
    V: 56722604
    18th January 12:00
    C: 8.5800
    O: 8.3900
    H: 8.6000
    L: 8.3300
    V: 51127860

    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