[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Home]
4Archive logo
Accessing fundamentals with Python
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /biz/ - Business & Finance

Thread replies: 32
Thread images: 4
File: python.jpg (52 KB, 460x288) Image search: [iqdb] [SauceNao] [Google]
52 KB, 460x288
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
Have you tried Quandl?
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.
Should. It's pretty great.

Maybe try asking them what specifically you need?
File: pythonlogo.jpg (46 KB, 680x459) Image search: [iqdb] [SauceNao] [Google]
46 KB, 680x459
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.
I'd program that little snake to slither up my asshole if I could.
I think there's a module for that.
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.
Plus, I could schedule a script to run daily and provide alerts based on any arbitrary condition I want. I don't think that's asking too much.
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.
good old import anuspython as snek
Since we're talking about python, out of curiosity how do I install numpy/scipy without using distributions?
Not quite sure what you mean, but you can install them from wheel files on this page: http://www.lfd.uci.edu/~gohlke/pythonlibs/
that seems to be the simplest.
Ayyy Lmao. You a UCI student?
I am not. You?
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.

Can you post one of your basic analysis scripts for some basic stuff as an example?
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.
File: spreadsheet.png (43 KB, 390x891) Image search: [iqdb] [SauceNao] [Google]
43 KB, 390x891
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.
something i want to try is creating a floating market cap index of a portfolio
im making a lot of progress as of learning python now, so eventually, i should be able to do that
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.
unless you can get it from your broker?
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.
The easier I can access bulk data, the more likely I am to make a trade, so that's fees to them.
they do get paid (by you) to answer such questions. anyhow, im sure they'd rather you at least be a potential customer and should be extremely professional towards you.
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.
Thread replies: 32
Thread images: 4
Thread DB ID: 482298

[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Search | Home]

[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Search | Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the shown content originated from that site. This means that 4Archive shows their content, archived. If you need information for a Poster - contact them.
If a post contains personal/copyrighted/illegal content, then use the post's [Report] link! If a post is not removed within 24h contact me at wtabusse@gmail.com with the post's information.