martinberlin / cale-integrations

CALE configurator to add APIs to your epaper screens - PHP/Symfony 4.4
https://cale.es
MIT License
6 stars 0 forks source link

Add Crypto prices internal API #46

Closed martinberlin closed 3 years ago

martinberlin commented 3 years ago

This weekend adding PhpPlot charts for #crypto prices of

  1. BTC
  2. ETH
  3. Litecoin

No real time, just updated hourly.

Views: daily, hourly or minutes.

Time span: last week, last N days, last N hours

Candle type: Filled candles or hollow candles

Data source cryptodatadownload from provider Bitstamp: http://www.cryptodatadownload.com/data/bitstamp/

Example candlesticks generated with PHPPlot from this data:

candlesticks1

phpPlot output. Image should be returned using this

EncodeImage — Returns the plot image data

Synopsis

$plot->EncodeImage(‘raw’);

So we can output from a symfony controller . This didn't work fine, but there must be a way to use a Symfony response for this, check: https://stackoverflow.com/questions/19236592/output-jpgraph-in-symfony-2 (ob_start -> get_contents) Otherwise the image url gives an error when being opened in the browser directly and WKHTMLToimage will not work correctly.

martinberlin commented 3 years ago

Implemented and deployed live. Before closing, would be nice to add:

data/symbols.json

{
  "BTCEUR": "Bitcoin/Euro",
  "ETHEUR": "Ethereum/Euro",
  "LTCEUR": "Litecoin/Euro",
  "BTCUSD": "Bitcoin/Dollar",
  "ETHUSD": "Ethereum/Dollar",
  "LTCUSD": "Litecoin/Dollar"
}

As a feed for the dropdown so more coins can be added without modifying the FormType

martinberlin commented 3 years ago

Live since last week