Code Monkey home page Code Monkey logo

wallstreet's Introduction

Wallstreet: Real time Stock and Option tools

Wallstreet is a Python 3 library for monitoring and analyzing real time Stock and Option data. Quotes are provided from the Google Finance API. Wallstreet requires minimal input from the user, it uses available online data to calculate option greeks and even scrapes the US Treasury website to get the current risk free rate.

Usage

Stocks:

from wallstreet import Stock, Call, Put

>>> s = Stock('AAPL')
>>> s.price
96.44
>>> s.price
96.48
>>> s.change
-0.35
>>> s.last_trade
'21 Jan 2016 13:32:12'

Options:

>>> g = Call('GOOG', d=12, m=2, y=2016, strike=700)
>>> g.price
38.2
>>> g.implied_volatility()
0.49222968442691889
>>> g.delta()
0.56522039722040063
>>> g.vega()
0.685034827159825
>>> g.underlying.price
706.59

Alternative construction:

>>> g = Call('GOOG', d=12, m=2, y=2016)
>>> g
Call(ticker=GOOG, expiration='12-02-2016')
>>> g.strikes
(580, 610, 620, 630, 640, 650, 660, 670, 680, 690, 697.5, 700, 702.5, 707.5, 710, 712.5, 715, 720, ...)
>>> g.set_strike(712.5)
>>> g
Call(ticker=GOOG, expiration='12-02-2016', strike=712.5)

or

>>> g = Put("GOOG")
'No options listed for given date, using 22-01-2016 instead'
>>> g.expirations
['22-01-2016', '29-01-2016', '05-02-2016', '12-02-2016', '19-02-2016', '26-02-2016', '04-03-2016', ...]
>>> g
Put(ticker=GOOG, expiration='22-01-2016')

Yahoo Finance Support (keep in mind that YF quotes might be delayed):

>>> apple = Stock('AAPL', source='yahoo')
>>> call = Call('AAPL', strike=apple.price, source='yahoo')
No options listed for given date, using '26-05-2017' instead
No option for given strike, using 155 instead

Installation

Simply

$ pip install wallstreet

Dependencies

Wallstreet requires Scipy, requests and bs4 (BeautifulSoup4). Requests and bs4 are installed for you when pip installing but you need to have Scipy pre-installed.

Stock Attributes

  • ticker
  • price
  • id
  • exchange
  • last_trade
  • change (change in currency)
  • cp (percentage change)

Option Attributes and Methods

  • strike
  • expiration
  • underlying (underlying stock object)
  • ticker
  • bid
  • ask
  • price (option price)
  • id
  • exchange
  • change (in currency)
  • cp (percentage change)
  • volume
  • open_interest
  • code
  • expirations (list of possible expiration dates for option chain)
  • strikes (list of possible strike prices)
  • set_strike()
  • implied_volatility()
  • delta()
  • gamma()
  • vega()
  • theta()
  • rho()

wallstreet's People

Contributors

mcdallas avatar

Watchers

James Cloos avatar K 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.