Giter VIP home page Giter VIP logo

craft-stockquote's Introduction

Stock Quote plugin for Craft CMS

Simple real-time stock quotes from Yahoo Finance.

Installation

To install Stock Quote, follow these steps:

  1. Download & unzip the file and place the stockquote directory into your craft/plugins directory
  2. -OR- do a git clone https://github.com/surprisehighway/craft-stockquote.git directly into your craft/plugins folder. You can then update it with git pull
  3. -OR- install with Composer via composer require surprisehighway/craft-stockquote
  4. Install plugin in the Craft Control Panel under Settings > Plugins
  5. The plugin folder should be named stockquote for Craft to see it. GitHub recently started appending -master (the branch name) to the name of the folder for zip file downloads.

Stock Quote works on Craft 2.4.x and Craft 2.5.x.

Usage

Single Quote

{% set quote = craft.stockQuote.getQuote('GOOG') %}

{{ quote.symbol }}
{{ quote.name }}
{{ quote.last }}
{{ quote.date }}
{{ quote.time }}
{{ quote.change }}
{{ quote.open }}
{{ quote.high }}
{{ quote.low }}
{{ quote.volume }}
{{ quote.previous }}

Multiple Symbols

{% set quotes = craft.stockQuote.getQuotes('GOOG,MSFT') %}

{% for quote in quotes %}
	{{ quote.symbol }}
	{{ quote.date }}
	{{ quote.time }}
	{{ quote.change }}
{% endfor %}

Caching

Depending on your site traffic it might make sense to cache the results instead of querying Yahoo on every page load.

{% cache using key "stockquote" for 5 mins %}

	{% set quote = craft.stockQuote.getQuote('RLGT') %}

	{{ quote.symbol }}
	{{ quote.date }}
	{{ quote.time }}
	{{ quote.change }}

{% endcache %}

Brought to you by Surprise Highway

craft-stockquote's People

Contributors

imagehat avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.