Giter VIP home page Giter VIP logo

fintual-solution's Introduction

Portfolio Exercise

El repo consiste en la solucion al siguiente desafio:

Construct a simple Portfolio class that has a collection of Stocks and a "Profit" method that receives 2 dates and returns the profit of the Portfolio between those dates. Assume each Stock has a "Price" method that receives a date and returns its price. Bonus Track: make the Profit method return the "annualized return" of the portfolio between the given dates.

Mi objetivo

Suelo hacer aplicaciones para procesamiento de datos y esto fue un ejercicio bastante diferente para mi, pero lo disfrute mucho.
Me puse como limitaciones hacer el codigo lo mas conciso posible (unpacking, list comprehensions, one liners...de ser posible).

Usage

Importar modulo

from portfolio import Portfolio, Stock

Crear stocks, especificando precio y fecha:

stock_1 = Stock(200, '12/05/2022')
stock_2 = Stock(230, '13/05/2022')
stock_3 = Stock(250, '14/05/2022')

Crear un portfolio:

portfolio = Portfolio()

Hacer compras para el portafolio, especificando fecha de compra y monto de inversion

portfolio.purchase_stock('12/05/2022', 1000)
portfolio.purchase_stock('14/05/2022', 500)

Calcular profit sobre un rango de fecha:

portfolio.profit('11/05/2022', '17/05/2022')

fintual-solution's People

Contributors

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