blippy
Posts: 11
Joined: Fri Nov 03, 2017 3:07 pm

Portfolio

Fri Nov 03, 2017 3:14 pm

Yahoo Finance had a good service that allowed you to download share prices. Unfortunately, it seems to have been acting up lately, and is going the way of all things Yahoo, namely downhill.

The good news is that Mathematica can download share prices. If anyone is interested in learning how Mathematica can be used as a portfolio tracker, then let me know, and I'll do a write-up on it.

I'm very happy that Mathematica is included in the Raspberry Pi distro. I hope it continues!

Daveawalker
Posts: 20
Joined: Fri Apr 26, 2013 3:26 pm

Re: Portfolio

Wed Mar 14, 2018 12:10 pm

Yes I would be interested. What stockmarkets can it download from?

blippy
Posts: 11
Joined: Fri Nov 03, 2017 3:07 pm

Re: Portfolio

Fri Mar 16, 2018 12:32 pm

Daveawalker wrote:
Wed Mar 14, 2018 12:10 pm
Yes I would be interested. What stockmarkets can it download from?
I am new to Mathematica, so I can give very little in the way of advice. It uses Mathematica's Financial Entity, so I assume that its coverage is extensive.

Yahoo Finance is effectively defunct, but Mathematica still works. It's not 100%, though. Opening prices seems quite stable, but latest trades don't seem to work particularly well. Closing prices are 99% OK, but seem to fail on some stocks for whatever reason. L:IAG (International Airline Group) is a large company quoted on the London Stock Exchange, but its closing price always seems to be unavailable.

You'll probably need to experiment.

Here is a script that values your portfolio:

https://gist.github.com/blippy/0ebbdeab ... 7817b5c7eb

What you need to do is create the file ~/tmp/port.tsv. Each line in the file should contain a record of the stocks you hold. Each record should contain:
* the ticker symbol
* a tab separator
* the quantity of stock held
in that order.

Ticker symbols should be qualified with the relevant exchange. For example, Vodafone is listed on the LSE (London Stock Exchange), so it would have the symbol L:VOD . On the NYSE or NASDAQ you can possibly avoid qualifying the exchange. Try it and see.

You can make things fancier, if you like, by, for example, trying to calculate the gain for the day. You'd have to adjust the output by taking the latest trade from the opening price, and multiplying by the number of share shares held.

Hope that helps.

Let me know how you get on.

Return to “Mathematica”

Who is online

Users browsing this forum: No registered users and 0 guests