I've been playing around with fundamental analysis in Python like many people here do. The problem is that I can only find modules that have access to limited fundamentals.
For instance, I can't access things like payout ratios and debt. I'd attempt it manually with Yahoo Finance, but the tags people use to access that stuff don't even exist for payout ratios and debt. The last option seems to be to manually parse some finance/screener site for these additional values, which seems pretty annoying given how these sites change every so often.
I should mention I'm Australian so I'm interested in the ASX. I have a nabtrade account but that seems like a dead as far as downloading fundamentals go. I feel like calling them and telling them their screener is shit and I want the data to do with it what I want.
Is there a better or easier way? I'm now even considering subscribing to some service that will give me what I want. pls halp
I was looking and Quandl earlier. It looked interesting but I couldn't quite ascertain whether or not it could access all that data. Can it?
Thanks for reply, btw.
I just made an account and will trawl through it. It does look pretty comprehensive.
I thought something as obvious as debt would be easy to access.
While I'm trawling, let this be a Python thread. I fucking love Python now.
if you're just looking at basic metrics finviz . com has a pretty good screener. not sure if asx is covered and not going to check.
i also hope you don't have a fantasy of letting your python program do all the hard work for you, you're still going to have to read 10-q's and k's or whatever australia's equivalent is, the screener will just help you with some of the needle and the haystack. even then it still might be better to just pick a core group and keep on top of the financial reports, the way all these companies report and what it all means varies far too wildly for simply metric analysis to really be fruitful.
I am pretty much looking to build my own customisable scanner. I would like to be able to take any function I want, compute it for the set of all stocks on the ASX, order that set then the top of that list can spur more research.
Python isn't doing the hard work, just the boring work. The hard work is choosing the function and deciding whether or not it's meaningful, then doing the second round of research.
I'm sick of using stock screeners, widdling down to a manageable bunch of stocks based on simple (and in my opinion often naive) functions, then doing the rest of the numerical research manually by entering numbers and doing my own computations elsewhere.
i wish i could motivate myself to learn python more
but i just starting something new is always a struggle for me. like, what do i do first? where do i learn all of the different libraries and whatever else stuff is called.
I'd suggest Code Academy for the basic syntax,
and the Python site for the standard library
Then if you want to do something, assume you can then look up how to do it. It's worked for me so far, there are that many elegant modules for all sorts of stuff.
Python is really easy to use, in fact I can see it ruining me for other more burdensome languages.
Then depending on what you do you might use numpy, scipy etc for numerical analysis. That's what I do. I am basically replacing everything I used to do in Matlab by doing it in Python. If you download Anaconda it includes an IDE called Spyder which is decent, and all the usual mathsy modules.
There are a lot of good and easy to use modules that do what I wanted to do in the original post, but minus things like calling debt and payout ratio numbers.
for instance. Also, check out this page for .whl files which make it easy to install packages: http://www.lfd.uci.edu/~gohlke/pythonlibs/
Then you can go to the file location in the command prompt and use the command pip install package_name.whl and bam it's done. I got into Python to solve certain convex optimisation problems and I installed the cvxpy package and implemented it in a few lines of code. It was a beautiful moment in my life.
I think I'm starting to get something happening with this, too. I'm still testing and debugging.
Anyone else automate any aspect of their financial research? I'd like to hear about it.
It's not quite there atm, I've been learning on on the job cause I only picked up Python like a few weeks ago to do some unrelated shit and immediately got this idea cause I hate typical stock screeners. Is there any particular part you wanna see?
The meat of it atm is a simple formula for intrinsic value using ROE, book value and dividend payout ratio, as well as a required return.
I use the module yahoo-finance to get values, and I compute ROE and payout ratio manually. Shares are represented as objects (which is probably unnecessary, but I want to do other things in the future so it might come in handy then).
I am using the csv module to output the data to a spreadsheet type thing.
Currently I'm getting a few weird values peppered throughout (like that ABT being $0.0, that shouldn't be there), I'm trying to figure out how much is the code and how much is Yahoo not having it.
Also, I can't yet find a way to grab debt figures from the internet, which sucks because too high debt is a deal breaker for me so I'd like to filter it out.
When I get something that's consistently doing what I want I'll stick it on dropbox or something and link it here. I wouldn't mind getting some people who are good with Python talking cause I wanna learn what can be done in the way of automating financial research, and also machine learning interests me a lot.
Also, my internet keeps crapping out (th-thanks Telstra) so I need to add code to let it read the existing csv file and start where it left off. I haven't gotten past the letter E yet when running it before I lose my connection.
This is what the csv looks like atm. Clearly many of those figures don't belong there, especially when a company has negative earnings and negative equity, I got to set those to ROE = 0.
Python is so beautifully easy if you have any programming experience at all.
The hard part seems to be getting good data, as discussed above. I'm still working on it because I really want to get a slab of data to work with. I'm trying to follow where stock screening sites get their data from, I think it's all like big contracts and they don't dole it out for personal use.
Like I said, my end game goal with this stuff is a fully customisable stock screener where you can basically search and sort for basically formula or set of conditions you can imagine. Sort of like an SQL thing, but I guess more specialised for finance and stocks. I know people already have things like that, but it's all premium sort of shit, very inaccessible, although I'm starting to think it's because of the data getting problem.
Given the data, any half decent Python programmer could churn out some good shit, and a good programmer could make something quite beautiful. I'm still not sure what's out there already, but I haven't see anything, especially for the ASX.
do you know what 10 q's are? maybe it's 10 k... but it's the quarterly report, usually. you can get monthly and annuals, but each company has an investor section on their site to grab their latest reports.
im pretty sure you'd be able to use that?
Yeah, it's not so much getting the data, it's the doing it 2000 times, or getting it in a standardised way.
I'm not so hip to grabbing data of random pages like that, but I'm willing to learn if it comes down to it.
I looked into that, couldn't see any obvious way. I might actually call them and see how one could do it, but I'd suspect they'd not approve. You'd think they'd make it available but.
That's what I figure. Clearly they already have a database of exactly what I want, including all the debt numbers, both long term and short term.
I feel like a solution is out there, it's probably easier than I'm making it. Once I get access to nice data I'm gonna go to town with it.
Even more interesting would be historical data of things like debt, earnings and cashflow. I have a hunch that those things can indicate a lot. For instance, if I found something like for a certain company if their earnings/cashflow decline a certain amount in consecutive quarters then there's a whatever% chance of whatever.