Python stock market analysis tools?

M

Mudcat

I have done a bit of searching and can't seem to find a stock market
tool written in Python that is active. Anybody know of any? I'm trying
not to re-create the wheel here.
 
R

Raymond Hettinger

I have done a bit of searching and can't seem to find a stock market
tool written in Python that is active. Anybody know of any? I'm trying
not to re-create the wheel here.

What kind of tool do you want? Getting quotes is the easy part:

import urllib
symbols = 'ibm jpm msft nok'.split()
quotes = urllib.urlopen( 'http://finance.yahoo.com/d/quotes.csv?s=' +
'+'.join(symbols) + '&f=l1&e=.csv').read().split()
print dict(zip(symbols, quotes))

The hard part is raising capital and deciding what to buy, sell, or
hold.


Raymond
 
D

Dag

I have done a bit of searching and can't seem to find a stock market
tool written in Python that is active. Anybody know of any? I'm trying
not to re-create the wheel here.

Depends on what you mean by stock market tool. There's http://ta-lib.org
which while written in C++ claims to have a python wrapper. That being
said last time I looked at it I couldn't get the python binding working,
but I didn't spend much time on it.

Dag
 
B

Beliavsky

What kind of tool do you want? Getting quotes is the easy part:

import urllib
symbols = 'ibm jpm msft nok'.split()
quotes = urllib.urlopen( 'http://finance.yahoo.com/d/quotes.csv?s='+
'+'.join(symbols) + '&f=l1&e=.csv').read().split()
print dict(zip(symbols, quotes))

The hard part is raising capital and deciding what to buy, sell, or
hold.

Yes, and a discussion of investment approaches would be off-topic.
Unfortunately, newsgroups such as misc.invest.stocks are dominated by
spam -- the moderated newsgroup misc.invest.financial-plan is better.

Some research says that "mean variance portfolio optimization" can
give good results. I discussed this in a message

http://groups.google.com/group/misc.invest.financial-plan/msg/3b9d13f3d399050c?dmode=source
Newsgroups: misc.invest.financial-plan
From: (e-mail address removed)
Date: Mon, 26 Feb 2007 12:47:25 -0600
Local: Mon, Feb 26 2007 1:47 pm
Subject: Re: Portfolio Optimization Software?

To implement this approach, a needed input is the covariance matrix of
returns, which requires historical stock prices, which one can obtain
using "Python quote grabber" http://www.openvest.org/Databases/ovpyq .

For expected returns -- hmmm. One of the papers I cited found that
assuming equal expected returns of all stocks can give reasonable
results.

Then one needs a "quadratic programming" solver, which appears to be
handled by the CVXOPT Python package.

If someone implements the approach in Python, I'd be happy to hear
about it.

There is a "backtest" package in R (open source stats package callable
from Python) http://cran.r-project.org/src/contrib/Descriptions/backtest.html
"for exploring portfolio-based hypotheses about financial instruments
(stocks, bonds, swaps, options, et cetera)."
 
M

Mudcat

What kind of tool do you want? Getting quotes is the easy part:

import urllib
symbols = 'ibm jpm msft nok'.split()
quotes = urllib.urlopen( 'http://finance.yahoo.com/d/quotes.csv?s='+
'+'.join(symbols) + '&f=l1&e=.csv').read().split()
print dict(zip(symbols, quotes))

The hard part is raising capital and deciding what to buy, sell, or
hold.

Raymond

Yeah, I have something that pulls quotes. So the data isn't hard to
get, but I'm not really interested in building the graphs. I was
hoping to find something already built with the common indicators
already built in that I could add my own to.
 
M

Mudcat

Yes, and a discussion of investment approaches would be off-topic.
Unfortunately, newsgroups such as misc.invest.stocks are dominated by
spam -- the moderated newsgroup misc.invest.financial-plan is better.

Some research says that "mean variance portfolio optimization" can
give good results. I discussed this in a message

I actually checked out some of those newsgroups in trying to find a
tool to use. I think I even posted a question about it. But you're
right in that there's so much spam, and all of the responses I got
were people trying to hock their own wares. Didn't find much in the
way of useful information.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top