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.

    8th July 12:00
    C: 10.2000
    O: 10.2000
    H: 10.2600
    L: 10.1800
    V: 23244145
    9th July 12:00
    C: 10.1400
    O: 10.1700
    H: 10.1900
    L: 10.1000
    V: 25140615
    10th July 12:00
    C: 10.1100
    O: 10.1900
    H: 10.2600
    L: 10.1100
    V: 29082154
    11th July 12:00
    C: 10.1900
    O: 10.1500
    H: 10.2000
    L: 10.1100
    V: 27667547
    12th July 12:00
    C: 10.4900
    O: 10.2400
    H: 10.5000
    L: 10.2400
    V: 40761563
    15th July 12:00
    C: 10.4200
    O: 10.4900
    H: 10.5600
    L: 10.3400
    V: 33753508
    16th July 12:00
    C: 10.5100
    O: 10.3700
    H: 10.5100
    L: 10.2850
    V: 29530493
    17th July 12:00
    C: 10.3300
    O: 10.4800
    H: 10.5000
    L: 10.3100
    V: 25204389
    18th July 12:00
    C: 10.2600
    O: 10.3000
    H: 10.3100
    L: 10.1800
    V: 25828860
    19th July 12:00
    C: 10.2000
    O: 10.3000
    H: 10.3200
    L: 10.2000
    V: 38501425

    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