Giter VIP home page Giter VIP logo

investopedia-trading-api's Introduction

investopedia-trading-api

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)

investopedia-trading-api's People

Contributors

kirkthaker avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.