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.

    3rd October 12:00
    C: 8.7100
    O: 8.5500
    H: 8.7100
    L: 8.4500
    V: 40827900
    4th October 12:00
    C: 8.7400
    O: 8.7200
    H: 8.7600
    L: 8.6600
    V: 27827400
    7th October 12:00
    C: 8.6800
    O: 8.7000
    H: 8.7900
    L: 8.6100
    V: 29340400
    8th October 12:00
    C: 8.5400
    O: 8.6500
    H: 8.6600
    L: 8.5000
    V: 31091200
    9th October 12:00
    C: 8.5600
    O: 8.6100
    H: 8.6400
    L: 8.5600
    V: 16898500
    10th October 12:00
    C: 8.6200
    O: 8.5800
    H: 8.6500
    L: 8.5200
    V: 28069600
    11th October 12:00
    C: 8.7800
    O: 8.7300
    H: 8.8700
    L: 8.7300
    V: 34175700
    14th October 12:00
    C: 8.8200
    O: 8.8200
    H: 8.8400
    L: 8.7600
    V: 24794500
    15th October 12:00
    C: 9.0700
    O: 8.8400
    H: 9.1000
    L: 8.7800
    V: 29771700
    16th October 12:00
    C: 9.0700
    O: 9.1100
    H: 9.1900
    L: 9.0600
    V: 23940585

    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