Giter Club home page Giter Club logo

candlestick.js's Introduction

Candlestick.js

candlestick chart on canvas

This is a simple function to draw a candlestick chart using canvas. The only file you need from this project is Candlestick.js

Not compatible with old browsers! Tested on Chrome only!

alt tag

Live demo:

Assumptions

Data is in the same format as in finance.yahoo.com historical prices, see for example: http://finance.yahoo.com/q/hp?s=AAPL+Historical+Prices On this page in finance.yahoo.com you can inspect the link below the table titled: "Download to Spreadsheet"

Roadmap:

  • x coordinate labels for different ranges - daily charts
  • add more indicators to top of the screen - bollinger bands, keltner bands, EMA, ...
  • add bottom indicators - MACD, Volume, ...
  • cache data using indexedDB
  • add labels for each top indicator, SMA(C,20) + line color
  • interactivity - allow scrolling by dragging sideways
  • allow drawing of trendlines by clicking and dragging
  • add mini language to define indicators and how to draw them

Demo explanation

The minimal index.html file is really short, it contains in the HEAD section 3 javascript files,

  1. jQuery from a CDN
  2. the Candlestick.js file which is the main file for this project
  3. the demo index.js file

In the BODY section there is one canvas element with an id and dimensions.

The index.js file has one jQuery function which onLoad sets the indicators object and uses AJAX to get the data from a file on the same server as the rest of the project. when the get returns with data it calls the main function:

Candlestick(canvasID, data, options);

the parameters:

Data for the testing is for AAPL, MA and PRAA symbols. A live demo is at smallestbusiness.com/Candlestick.js.demo_page/

Questions? Comments? @amiheines

candlestick.js's People

Contributors

amih avatar

Watchers

James Cloos avatar  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.