Here is my github repo for doing technical analysis and backtesting in Python. Right now everything is in main.py which yes I know I need to separate all those classes out...
i think it would be cool to use some data mining techniques on a fundamental news like shareholder reports and news articles, tweets, etc ...not sure how you'd get any insights via text mining though since there would be some bias
I considered doing something like this with 10-k forms but they are extremely hard to parse correctly. Ideally, I would like to do some text analysis on the MD&A section.
Yeah that would be next to impossible to get any useful info out of. It would require a massive dictionary of words and internet slang, and then have to have some kind of artificial intelligence to put the stuff it finds together into meaningful interpretations. I'm not how that would work.
Lol if you go to their site now it forwards to a shady cayman islands-based investment "management" company. I have seen several of those in my time as a trader...they almost always work overseas so they don't have to follow SEC regulations because they are doing something super sketchy. This one makes you click to agree that you are either a "sophisticated person," a high net worth individual or a company before you enter the site. Definitely shady.
Hedge funds aren't allowed to advertise themselves, and you can only invest in them if you are an "accredited investor" so for a hedge fund website that alone isn't too sketchy. I built a website for a hedge fund and I'm just glad I didn't have to do that though haha
You can represent each word with a unique identifier, have a group of people label a set of tweets (not sure how many would be needed, maybe thousands) as "bullish" or "bearish" and then use those as training data samples for a model. It's a simple\naive technique called bag-of-words but could still be useful.
I just assume anyone who knows how to code at the level of developing artificial intelligence engines that can interpret the level of retardation normally found on Twitter probably has a neckbeard. shrug
Ok, updated the OP w/ the source. Now... let's make it do cool shit! What kinds of fundamental factors might be useful or what financial ratios could we calculate that would be useful in valuing a company? I don't really know much about fundamental analysis but that's where you guys come in! there is also the entire key statistics page on Yahoo which we could use to automate giving a company a "rating" of buy/sell/hold or whatever.
Oh, BTW, I'm lazy so I didn't code any logic to handle division by zero, so if you use it on a company that doesn't have all those fields filled out on the Yahoo! Finance financial statements, it chokes. Lol, I think I probably just got bored with it but maybe we can revive it from the dead.
I keep getting this error, tried it on multiple stocks. Just want to know if its just me or if you get it too.
Collecting data
Traceback (most recent call last):
File "yscrape.py", line 195, in <module>
accept_input()
File "yscrape.py", line 22, in accept_input
build_vars()
File "yscrape.py", line 59, in build_vars
scrape_all()
File "yscrape.py", line 65, in scrape_all
scrape(income)
File "yscrape.py", line 189, in scrape
create_income_vars()
File "yscrape.py", line 93, in create_income_vars
incomedict[var + str(z)] = data3[y][x]
I've never seen that error...what symbol are you running it on? Have you checked the fin statements to verify that they have all the data filled out? There is no error checking in the code yet.
So, coding and theoretical stuff aside, what do you guys think of the calculations this thing already runs? e.g., does the fact that a company's revenue is increasing actually mean anything, or is that just a naive way of telling myself that the company is in good financial shape? How about the cash flow stuff? I don't really know anything about analyzing financial statements, so I'm curious if the stuff I have considered is even relevant in determining the actual value of the company, or if there is something else I should be considering. Ultimately if this is already off to a good start I would like to modify it to do more detailed analysis and give a company a buy/sell rating based on popular interpretation of what people think "matters", but I don't know enough about the actual analysis to automate any part of it. I probably wouldn't really use it much as most of my income comes from day/swing trading, but who knows. If I could sit on my ass and make more than I do now by using this, then I would. lol
as a day trader you buy stocks, what do you use to make a decision on a particular stock? I do day trading with small virtual items for fun and was looking for some info into analysing the market from someone with experience.
Thanks! It looks like it could be pretty useful. However I get the following message when running it: axes.py:4747: UserWarning: No labeled objects found. Use label='...' kwarg on individual plots
Excel and, by extension VBA, are truly a pain once you get passed anything too basic. I often have to do things in Excel at work and eventually, if they get complex enough, you want to move on to another language. If you haven't learned python yet I'd strongly recommend taking a look at it.
I have learned basic python, I used to use it scrape pages all the time.
But with financial data, calculating static ratios isn't valuable for all companies. For example, for a REIT, you'd want FFO and AFFO, which you might be able to calculate in Excel to calculate other ratios etc.
That's why I recommended Excel, it allows you to do more complex things depending on the type of equity you're analyzing, you can pull in more data and present more to the user and users look at the data themselves.
It does slow down in pulling data, but for something like this it works really well.
I used to have a complex Excel spreadsheet to compare the yields on a variety of funds, pulling data was slow but it gave a lot of flexibility.
I wasn't disagreeing with you, just adding to the conversation. You seem to have found a use for Excel. I tend to find that once I move beyond a certain complexity its best I go with something else. But I'm working in aerospace software, not finance, and I'm far more familiar with all of python's libraries than I am with Excel.
Those are interesting libraries, I just used Regex to load and scrape pages but your solution is probably more elegant. I'm interested in seeing how it works.
Haha, until Yahoo changes their table structure, then the whole thing will break because it depends on gleaning data between specific tags. Luckily it hasn't changed in like five years though so I don't see it changing any time soon.
That's cool, I appreciate the input. However, this isn't really worth enough to me to learn a whole new language or api for. If it was useful as is and could become more useful by just making changes to the codebase that's already there I'd do it but I don't care enough about it to learn an entirely new language. Lol
If you want. Understand though that this is just something I found in an old folder and gave it 30 seconds of "hmmm that's cool I forgot I made this!" and decided to post it here. I'm not overly attached to doing anything with it, as I don't really trade this way anyway. I am always willing to learn new things though!
I'm a big fan of enthought's canopy. It comes with most of the modules you would need for finance and data analysis. The only problem is that they make it a pain in the ass to install libraries that don't come pre-packaged...unless you want to pay them.
7
u/bennyturns Mar 01 '14
Looks interesting! Can you share the source?
2
u/fenec860 Mar 01 '14
i was thiking about working on a project like this. i will share my code in a couple of days. I was inspired by http://wiki.quantsoftware.org/
2
u/watersign Mar 02 '14
i think it would be cool to use some data mining techniques on a fundamental news like shareholder reports and news articles, tweets, etc ...not sure how you'd get any insights via text mining though since there would be some bias
3
u/123_hgg Mar 01 '14
needs more exclamation points!!
2
u/greenbartrading Mar 02 '14
Ok, updated the OP w/ the source. Now... let's make it do cool shit! What kinds of fundamental factors might be useful or what financial ratios could we calculate that would be useful in valuing a company? I don't really know much about fundamental analysis but that's where you guys come in! there is also the entire key statistics page on Yahoo which we could use to automate giving a company a "rating" of buy/sell/hold or whatever.
Oh, BTW, I'm lazy so I didn't code any logic to handle division by zero, so if you use it on a company that doesn't have all those fields filled out on the Yahoo! Finance financial statements, it chokes. Lol, I think I probably just got bored with it but maybe we can revive it from the dead.
2
u/greenbartrading Mar 02 '14
So, coding and theoretical stuff aside, what do you guys think of the calculations this thing already runs? e.g., does the fact that a company's revenue is increasing actually mean anything, or is that just a naive way of telling myself that the company is in good financial shape? How about the cash flow stuff? I don't really know anything about analyzing financial statements, so I'm curious if the stuff I have considered is even relevant in determining the actual value of the company, or if there is something else I should be considering. Ultimately if this is already off to a good start I would like to modify it to do more detailed analysis and give a company a buy/sell rating based on popular interpretation of what people think "matters", but I don't know enough about the actual analysis to automate any part of it. I probably wouldn't really use it much as most of my income comes from day/swing trading, but who knows. If I could sit on my ass and make more than I do now by using this, then I would. lol
1
u/Boozybrain Mar 02 '14
Looking forward to the source
1
u/disruptivedurden Mar 02 '14
Thanks for sharing this. I am learning python and, I think, I'll be able to learn some things from the code you shared.
1
u/FlashDave Mar 02 '14
How does this differ from your regular day to day stuff?
1
u/mtradius Jul 17 '14
Thanks! It looks like it could be pretty useful. However I get the following message when running it: axes.py:4747: UserWarning: No labeled objects found. Use label='...' kwarg on individual plots
-4
u/komal Mar 02 '14 edited Mar 02 '14
You would be better off doing this in Excel.
Excel can pull data straight off a webpage and with Excel, you could manipulate the data to do other things more easily.
Did you use Regex?
0
u/[deleted] Mar 02 '14
[deleted] — view deleted comment
0
u/[deleted] Mar 02 '14
[deleted] — view deleted comment