All Projects → dchrostowski → investopedia_simulator_api

dchrostowski / investopedia_simulator_api

Licence: MIT license
A simple Python API for Investopedia's stock simulator games. This programmatically logs into Investopedia and can retrieve portfolio summary, get stock quotes & option chain lookups, execute trades - buy & sell shares, puts, calls, sell short, etc.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to investopedia simulator api

Finance-Robinhood
Trade stocks and ETFs with free brokerage Robinhood and Perl
Stars: ✭ 42 (+90.91%)
Mutual labels:  stock-market, api-wrapper, options-trading
TradeAlgo
Stock trading algorithm written in Python for TD Ameritrade.
Stars: ✭ 147 (+568.18%)
Mutual labels:  stock-market, stock-trading
robinhood.tools
📈🤑💰 Advanced trading tools and resources for Robinhood Web.
Stars: ✭ 27 (+22.73%)
Mutual labels:  stock-market, stock-trading
Yahooquery
Python wrapper for an unofficial Yahoo Finance API
Stars: ✭ 288 (+1209.09%)
Mutual labels:  stock-market, api-wrapper
TradeTheEvent
Implementation of "Trade the Event: Corporate Events Detection for News-Based Event-Driven Trading." In Findings of ACL2021
Stars: ✭ 64 (+190.91%)
Mutual labels:  stock-market, stock-trading
alpha-vantage-cli
Command line tool and API for retrieving stock market data from Alpha Vantage
Stars: ✭ 33 (+50%)
Mutual labels:  stock-market, stock-trading
MarketCycles.jl
Digital Signal Processing Indicators For Market Data.
Stars: ✭ 26 (+18.18%)
Mutual labels:  stock-market, stock-trading
stockbot
Alpaca algo stock trading bot
Stars: ✭ 105 (+377.27%)
Mutual labels:  stock-market, stock-trading
market-monitor
Interactive app to monitor market using Python
Stars: ✭ 20 (-9.09%)
Mutual labels:  stock-market, options-trading
insomnia-workspace
An Insomnia Workspace for Alpaca API
Stars: ✭ 34 (+54.55%)
Mutual labels:  stock-market, stock-trading
StockScreener
A handy tool for screening stocks based on certain criteria from several markets around the world. The list can then be delivered to your email address (one-off or regularly via crontab).
Stars: ✭ 51 (+131.82%)
Mutual labels:  stock-market, stock-trading
php-currency-api
Standardized wrapper for popular currency rate APIs. Currently supports FixerIO, CurrencyLayer, Open Exchange Rates and Exchange Rates API.
Stars: ✭ 17 (-22.73%)
Mutual labels:  api-wrapper
activecampaign-python
ActiveCampaign API wrapper written in python.
Stars: ✭ 25 (+13.64%)
Mutual labels:  api-wrapper
zoho-crm-php
An API wrapper library for Zoho CRM, written in PHP.
Stars: ✭ 15 (-31.82%)
Mutual labels:  api-wrapper
PostcodesioR
API wrapper around postcodes.io - free UK postcode lookup and geocoder
Stars: ✭ 36 (+63.64%)
Mutual labels:  api-wrapper
tmdbv3api
A lightweight Python library for The Movie Database (TMDb) API. The TMDb API is a resource for developers to integrate movie, TV show and cast data along with posters or movie fan art.
Stars: ✭ 145 (+559.09%)
Mutual labels:  api-wrapper
stock-market-prediction-via-google-trends
Attempt to predict future stock prices based on Google Trends data.
Stars: ✭ 45 (+104.55%)
Mutual labels:  stock-market
bold
Interface to the Bold Systems barcode webservice
Stars: ✭ 14 (-36.36%)
Mutual labels:  api-wrapper
notionapi-agent
Unofficial Node.js API client for Notion.so
Stars: ✭ 89 (+304.55%)
Mutual labels:  api-wrapper
intrinio-realtime-python-sdk
Intrinio Python SDK for Real-Time Stock Prices
Stars: ✭ 79 (+259.09%)
Mutual labels:  stock-market

Description

A simple Python API for Investopedia's stock simulator games.

Features

Currently you can:

  • Read all positions in your option, stock, and short portfolios
  • Buy/Sell long positions
  • Short sell/cover short positions
  • Perform option chain lookups
  • Buy/sell options
  • Read pending/open trades

Todo:

  • Setting the default game, changing games
  • Whatever else I can think of

Authentication

Simply pass a dict to InvetopediaAPI constructor with a username and password.

from investopedia_api import InvestopediaApi
credentials = {"username" "[email protected]", "password": "your password"}
client = InvestopediaAPI(credentials)
p = client.portfolio
print("account value: %s" % p.account_value)

Environment

Python 3.6.7. I just use a virtualenv and install using pip from requirements.txt. If you don't know how to do that:

git clone https://github.com/dchrostowski/investopedia_simulator_api.git
cd investopedia_simulator_api
pip install virtualenv
virtualenv -p /path/to/python3 ./venv
source venv/bin/activate
pip install -r requirements.txt
python exmaple.py

Example

code

from investopedia_api import InvestopediaApi
import json

credentials = {}
with open('credentials.json') as ifh:
    credentials = json.load(ifh)

# look at credentials_example.json
# credentials = {"username": "[email protected]", "password": "yourpassword"}
client = InvestopediaApi(credentials)

p = client.portfolio
print("account value: %s" % p.account_value)
print("cash: %s" % p.cash)
print("buying power: %s" % p.buying_power)
print("annual return pct: %s" % p.annual_return_pct)

# get a quote
quote = client.get_stock_quote('GOOG')
print(quote.__dict__)

# Read your portfolio
long_positions = client.portfolio.stock_portfolio
short_positions = client.portfolio.short_portfolio
my_options = client.portfolio.option_portfolio

# Place a buy order for 10 shares of Google with a limit of $1000/share

# shorthand for client.TradeProperties.TradeType.BUY()
trade_type = 'buy'

#shorthand for client.TradeProperties.OrderType.LIMIT(1000)
limit_1000 = 'limit 1000'

trade = client.StockTrade('GOOG',10,trade_type,order_type=limit_1000)
trade_info = trade.validate()
if trade.validated:
    print(trade_info)
    trade.execute()

# See example.py for more examples.

More Info / Documentation

This is a work in progress. I'll add more documentation as I continue developing. I also plan on making this a module and publishing to pip.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].