Giter VIP home page Giter VIP logo

stocks's Introduction

stocks

Install

uv venv venv
. ./venv/bin/activate

uv pip install -r requirements.txt

Run

export STOCK_FILE=./stock.json 
python3 src/main.py

or
STOCK_FILE=./stock.json python3 src/main.py

or
python3 src/main.py -f stock.json

Example

stock.json.sample

{
    "ticker": {
            "Apple": "AAPL",
            "Microsoft": "MSFT"
    },
    "stocks": [
        {
            "name": "Microsoft",
            "purchase_price": 200.00,
            "amount": 100
        },
        {
            "name": "Apple",
            "purchase_price": 180.00,
            "amount": 100
        },
        {
            "name": "Apple",
            "purchase_price": 100.5400,
            "amount": 20
        },
        {
            "name": "Microsoft",
            "purchase_price": 430.00,
            "amount": 140
        }
    ]
}
❯ python3 src/main.py -f stock.json.sample
┏━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━┓
┃ name      ┃ amount ┃ inverstment(W) ┃  current(W) ┃ earnings(W) ┃   ratio ┃   purchase ┃      today ┃     daily ┃         ┃
┡━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━┩
│ Apple     │    120 │     26,906,921 │  27,798,135 │     891,213 │ 103.31% │     166.76 │     172.28 │      0.91 │   0.53% │
│ Microsoft │    240 │    107,838,523 │ 138,358,167 │  30,519,643 │ 128.30% │     334.17 │     428.74 │     -0.63 │  -0.15% │
├───────────┼────────┼────────────────┼─────────────┼─────────────┼─────────┼────────────┼────────────┼───────────┼─────────┤
│           │        │    134,745,445 │ 166,156,302 │  31,410,857 │         │            │            │           │         │
├───────────┼────────┼────────────────┼─────────────┼─────────────┼─────────┼────────────┼────────────┼───────────┼─────────┤
│ Apple     │    100 │     24,203,159 │  23,165,113 │  -1,038,046 │  95.71% │     180.00 │     172.28 │      0.91 │   0.53% │
│ Apple     │     20 │      2,703,761 │   4,633,022 │   1,929,260 │ 171.35% │     100.54 │     172.28 │      0.91 │   0.53% │
│ Microsoft │    100 │     26,892,399 │  57,649,236 │  30,756,836 │ 214.37% │     200.00 │     428.74 │     -0.63 │  -0.15% │
│ Microsoft │    140 │     80,946,123 │  80,708,930 │    -237,192 │  99.71% │     430.00 │     428.74 │     -0.63 │  -0.15% │
├───────────┼────────┼────────────────┼─────────────┼─────────────┼─────────┼────────────┼────────────┼───────────┼─────────┤
│           │        │    269,490,890 │ 332,312,605 │  62,821,715 │         │            │            │           │         │
└───────────┴────────┴────────────────┴─────────────┴─────────────┴─────────┴────────────┴────────────┴───────────┴─────────┘

stocks's People

Contributors

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