Giter Site home page Giter Site logo

py-stock-sl's Introduction

py-stock-sl

Prices historical stock lots to determine after-tax valuation of a portfolio based on short-term and long-term holding period capital gains impact.

Assumes that the tax rate for a short sale is 28%, and for a long sale is 15%. This can be adjusted by changing

shortRate = 0.28
longRate = 0.15

Note:

This is just for fun, please talk to your accountant and verify the numbers before making any assumptions based on the calculations (and if you find ways to improve the accuracy, please share!)

Requires

Developed using: Python3, but also tested and planned to remain compatible with Python2.7

Users need to have an API key from Alpha Vantage which is inserted into the personalParams.py file

apikey = "1234"

personalParams.py file also needs the stock positions:

st = [
      ["AMZN",[
       [10,305.17,"01-01-2014"],
       [20,352.50,"01-01-2015"]]
      ],
      ["TMUS",
       [[10, 43.92,"06-13-2016"]]
      ]
     ]

The format of st is the ticker, followed by a group listing the number of shares, the purchase price and the purchase date (in the format dd-mm-yyyy)


To-Do

  • Resiliance: make code more able to handle errors
  • Customize: allow user to enter (and store) tax rates and stock lots
    • will this be a web page that stores data in local storage, or server stored (with login requirement)?
    • possibly expose the code as an endpoint to return results based on passing parameters

If you make use of this and like it and want to give something back... I wrote a book! :)

Contribute

This project can be forked from Github. Please issue pull requests from feature branches.

License

See Licence file in repo, or refer to http://unlicense.org

py-stock-sl's People

Contributors

offbeatmammal avatar

Watchers

 avatar  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.