An API, written in Python, for Investopedia's paper trading stock simulator. Pull requests welcome!
For this API to be useful you need an Investopedia trading account, and you can make one here.
It also makes extensive use of Python's mechanize library, so you'll need to install that as well. See here.
You'll also need to backported enum library for Python 2.7. See here.
Some usage examples:
Import all the classes:
from investopedia import *
Log into the simulator:
client = Account("emailaddress","password")
Get account status (cash on hand, annual return, etc.):
status = client.getPortfolioStatus()
print status.account_val
print status.buying_power
print status.cash
print status.annual_return
Buying 10 shares of Google (GOOG) at market price:
client.trade("GOOG", Action.buy, 10)
Selling 10 shares of Google at market price:
client.trade("GOOG", Action.sell, 10)
Shorting 10 shares of Google:
client.trade("GOOG", Action.short, 10)
Buying 10 shares of Google with a limit order at $500
client.trade("GOOG", Action.buy, 10, "Limit", 500)