Giter Site home page Giter Site logo

yahoostockquotes's Introduction

#change for master

YahooStockQuotes

Yahoo Stock Quotes in PHP

MIT License Build Status Code Climate Test Coverage Issue Count Codacy Badge Codacy Badge

What it does

This library makes it simple to access any number of stock prices (and their changes) in your code. It limits itself to one update per day to save your server's (and Yahoo's) resources. It consists of one code file and one cache file. No database necessary.

Merely set the $stockSymbols array to your list of desired stocks' symbols, include the file, and use the three public functions where you need them.

Simple.

Requirements

There must be a stockQuotes.json file in the same directory as the stockQuotes.php file.

stockQuotes.json must be WRITABLE by the user who owns the PHP process (apache, www-data, nginx, hhvm, etc.).

If the file does not exist or is not writable, every page view will require a new request to Yahoo's servers, which will slow down all page views drastically and get your server blocked by Yahoo.

Example usage

<?php

include 'stockQuotes.php';

?><html>
	<head>
		<title>Stock Test</title>
	</head>
	<body>
		Price: <?php echo $stockQuotes->getPrice('YHOO'); ?>
		<br/>
		Change: <?php echo $stockQuotes->getChange('YHOO'); ?>
		<br/>
		Last updated: <?php echo $stockQuotes->getUpdatedDate(); ?>
	</body>
</html>

Supercharged by ZenHub.io

yahoostockquotes's People

Contributors

aensley avatar efueger 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.