Sjord / get-rich-slowly

Automatisch beleggen in beleggingsfondsen
7 stars 3 forks source link

How I run graph.php to get my portfolio in a graph? #8

Open mediax24 opened 5 years ago

mediax24 commented 5 years ago

Hello Thanks a lot for your python script It Works pretty well (I juste made some tweeks to make it works on python 2) But I try to figured out how to use graph.php but not a chance

Have you a procedure ? I'm on MAcOs

Thanks

Sjord commented 5 years ago

Hi @mediax24. Graph.php reads data/portfolio_history.json and data/money_history.json and plots a graph with the value of your stocks and money. To run PHP, you need a webserver with PHP on it. However, it uses very little PHP functionality, so I think it is quite easy to modify the script to run without any PHP.

Sjord commented 5 years ago

You still need a webserver, but you don't need PHP.

Update: I made these changes to the code which you can find in the no-php-graph branch. Checkout that branch and continue at step 4.

  1. Rename graph.php to graph.html.
  2. Remove the PHP block from graph.html, everything from <?php to ?>, including.
  3. In js/graph.js, change the calls to $.getJSON:
var funds = $.getJSON('../data/portfolio_history.json');
var money = $.getJSON('../data/money_history.json');
  1. Start a webserver in the get-rich-slowly directory. Note that this will expose your credentials, so this will be a security risk if you expose it to the local network.
python3 -m http.server 8000 --bind 127.0.0.1 
  1. Browse to http://localhost:8000/www/graph.html

It should look something like this:

image

mediax24 commented 5 years ago

thx i will try

Envoyé de mon iPhone

Le 23 janv. 2019 à 16:46, Sjoerd Langkemper notifications@github.com a écrit :

You still need a webserver, but you don't need PHP.

Rename graph.php to graph.html. Remove the PHP block from graph.html, everything from <?php to ?>, including. In js/graph.js, change the calls to $.getJSON: var funds = $.getJSON('../data/portfolio_history.json'); var money = $.getJSON('../data/money_history.json'); Start a webserver in the get-rich-slowly directory. Note that this will expose your credentials, so this will be a security risk if you expose it to the local network. python3 -m http.server 8000 --bind 127.0.0.1 Browse to http://localhost:8000/www/graph.html It should look something like this:

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.