GithubHelp home page GithubHelp logo

cointree's Introduction

Cointree

A cryptocurrency treemap visualization built with Meteor using the pup boilerplate, react, and D3js.

This application demonstrates several useful patterns in Meteor including:

  • polling a 3rd party HTTP endpoint for data coinmarketcap
  • doing bulk mongodb inserts to avoid excessive refreshes on the client as cryptocurrency data is updated one currency at a time
  • using D3 in combination with react

This project was inspired by one of the early financial industry examples of the treemap, the map of the market from smartmoney.com which regrettably isn't live anymore.

Note that I haven't removed all the parts of the pup boilerplate that I didn't use. Notably pup includes authentication, social logins, and a documents collection, none of which are ued here.

This application polls every 3 minutes via a cron job defined in imports/modules/server/cron-poll-coinmarketcap.js. The cron job does a bulk insert into the Prices and LatestPrices collections. The former tracks each price change in each cryptocurrency while the latter only maintains the most recent price change for faster publishing to the client. There's no point in polling any faster than 3 minutes as the API being called unfortunately doesn't update prices much faster than that. The current code also limits the data being stored and displayed to those cryptocurrencies with a market cap over $50M USD.

The percolate:synced-cron package is used to define cron jobs. If you're curious as to why there's no import for it - it's a Meteor classic style Atmosphere package that defines an object in the global scope.

The Treemap is defined as a page here. As you might know, react and D3 don't really get along very well since React doesn't want anyone touching the DOM directly. My react D3 code came from the rd3 project which unfortunately isn't maintained anymore. I had to make a number of corrections and adaptations to make it work for this use case, particularly to color code each currency based on price changes.

Run the app locally

  1. Make sure Meteor and npm are installed
  2. clone this repo
  3. npm install
  4. npm start
  5. Open localhost:3000 in your browser

You may have to wait up to 3 minutes for the first data to be available.

Screenshot

cointreemap screenshot

License

MIT

Copyright (c) 2018 Cloak Security

cointree's People

Contributors

cleverbeagle avatar ninjapixel avatar pilararr avatar rglover avatar zodern avatar

Stargazers

 avatar  avatar  avatar

Watchers

 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.