FinTrack 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,38 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [1.0.0] - 2024-02-13
9
+
10
+ ### Added
11
+ - Initial release of Portfolio Tracker
12
+ - Portfolio management with buy/sell transaction tracking
13
+ - Dynamic stock price fetching using yfinance
14
+ - Multi-currency support with automatic conversion
15
+ - Cash management system with transaction and dividend tracking
16
+ - Historical portfolio value analysis
17
+ - Index return comparison functionality
18
+ - SQLite-based data storage for holdings, prices, and cash balances
19
+ - Support for dividend tracking and automatic cash updates
20
+
21
+ ### Features
22
+ - `Portfolio_tracker` class for portfolio initialization and management
23
+ - `update_portfolio()` method for refreshing portfolio data
24
+ - `get_portfolio_value()` for historical value analysis
25
+ - `get_current_holdings()` for viewing current positions
26
+ - `get_past_holdings()` for viewing all historical positions
27
+ - `get_portfolio_cash()` for cash balance queries
28
+ - `get_index_returns()` for benchmark comparison
29
+
30
+ ## [Unreleased]
31
+
32
+ ### Planned
33
+ - Web dashboard for portfolio visualization
34
+ - Performance analytics and reporting
35
+ - Tax lot tracking
36
+ - Advanced rebalancing suggestions
37
+ - API for programmatic portfolio updates
38
+ - CSV export of holdings and performance data
fintrack-1.0.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 FinTrack Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,8 @@
1
+ include README.md
2
+ include LICENSE
3
+ include CHANGELOG.md
4
+ recursive-include src *.py
5
+ recursive-include tests *.py
6
+ global-exclude __pycache__
7
+ global-exclude *.py[cod]
8
+ global-exclude *$py.class
@@ -0,0 +1,196 @@
1
+ Metadata-Version: 2.4
2
+ Name: FinTrack
3
+ Version: 1.0.0
4
+ Summary: A Python package for tracking a dynamic portfolio of stocks with daily price monitoring, cash management, and dividend handling
5
+ Home-page: https://github.com/arofre/FinTrack
6
+ Author: Aron Fredriksson
7
+ Author-email: Aron Fredriksson <arofre903@gmail.com>
8
+ License: MIT
9
+ Project-URL: Homepage, https://github.com/arofre/FinTrack
10
+ Project-URL: Repository, https://github.com/arofre/FinTrack.git
11
+ Project-URL: Bug Tracker, https://github.com/arofre/FinTrack/issues
12
+ Project-URL: Documentation, https://github.com/arofre/FinTrack#readme
13
+ Keywords: portfolio,stock-tracking,finance,stocks,yfinance,investment
14
+ Classifier: Development Status :: 4 - Beta
15
+ Classifier: Intended Audience :: Financial and Insurance Industry
16
+ Classifier: License :: OSI Approved :: MIT License
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.7
19
+ Classifier: Programming Language :: Python :: 3.8
20
+ Classifier: Programming Language :: Python :: 3.9
21
+ Classifier: Programming Language :: Python :: 3.10
22
+ Classifier: Programming Language :: Python :: 3.11
23
+ Classifier: Programming Language :: Python :: 3.12
24
+ Classifier: Topic :: Office/Business :: Financial :: Investment
25
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
26
+ Requires-Python: >=3.7
27
+ Description-Content-Type: text/markdown
28
+ License-File: LICENSE
29
+ Requires-Dist: pandas>=1.3.0
30
+ Requires-Dist: yfinance>=0.2.0
31
+ Dynamic: author
32
+ Dynamic: home-page
33
+ Dynamic: license-file
34
+ Dynamic: requires-python
35
+
36
+ # FinTrack
37
+
38
+ A Python package for tracking a dynamic portfolio of stocks with daily price monitoring, cash management, and dividend handling. This tool helps you maintain a record of your stock holdings, monitor their values over time, and automatically track cash flows from transactions and dividends.
39
+
40
+ ## Features
41
+
42
+ - **Portfolio Management**: Track multiple stock holdings with buy/sell transactions
43
+ - **Dynamic Price Tracking**: Automatically fetch and store historical stock prices using yfinance
44
+ - **Multi-Currency Support**: Handle stocks traded in different currencies with automatic conversion
45
+ - **Cash Management**: Maintain accurate cash balances accounting for buy/sell transactions and dividend payments
46
+ - **Dividend Tracking**: Automatically capture and account for dividend payments
47
+ - **Historical Analysis**: Query portfolio composition and value at any point in time
48
+ - **Index Comparison**: Compare your portfolio returns against benchmark indices
49
+
50
+ ## Installation
51
+
52
+ Install the package using pip:
53
+
54
+ ```bash
55
+ pip install FinTrack
56
+ ```
57
+
58
+ ## Quick Start
59
+
60
+ ### 1. Create a Transaction CSV File
61
+
62
+ First, create a CSV file with your transactions (`transactions.csv`):
63
+
64
+ ```
65
+ Date;Ticker;Type;Amount;Price
66
+ 2023-01-15;AAPL;Buy;10;150.00
67
+ 2023-02-20;MSFT;Buy;5;250.00
68
+ 2023-03-10;AAPL;Sell;5;165.00
69
+ ```
70
+
71
+ **CSV Columns:**
72
+ - `Date`: Transaction date (YYYY-MM-DD format)
73
+ - `Ticker`: Stock ticker symbol
74
+ - `Type`: Either "Buy" or "Sell"
75
+ - `Amount`: Number of shares
76
+ - `Price`: Price per share (in the stock's native currency)
77
+
78
+ ### 2. Initialize the Portfolio Tracker
79
+
80
+ ```python
81
+ from portfolio_tracker import Portfolio_tracker
82
+ import datetime
83
+
84
+ # Initialize with starting cash and currency
85
+ portfolio = Portfolio_tracker(
86
+ initial_cash=150000,
87
+ currency="SEK", # Your portfolio's base currency
88
+ csv_file="transactions.csv"
89
+ )
90
+
91
+ # Update portfolio (fetches latest prices and processes new transactions)
92
+ portfolio.update_portfolio()
93
+ ```
94
+
95
+ ### 3. Query Your Portfolio
96
+
97
+ ```python
98
+ # Get current holdings
99
+ current_holdings = portfolio.get_current_holdings()
100
+ print(f"Current holdings: {current_holdings}")
101
+
102
+ # Get all holdings ever owned
103
+ all_holdings = portfolio.get_past_holdings()
104
+ print(f"All past holdings: {all_holdings}")
105
+
106
+ # Get portfolio value for a date range
107
+ portfolio_values = portfolio.get_portfolio_value(
108
+ from_date=datetime.date(2023, 1, 1),
109
+ to_date=datetime.date(2023, 12, 31)
110
+ )
111
+
112
+ # Get cash balance at a specific date
113
+ cash_balance = portfolio.get_portfolio_cash(datetime.date(2023, 6, 15))
114
+ print(f"Cash balance: {cash_balance}")
115
+
116
+ # Compare against index returns
117
+ index_returns = portfolio.get_index_returns(
118
+ ticker="^GSPC", # S&P 500
119
+ start_date=datetime.date(2023, 1, 1),
120
+ end_date=datetime.date(2023, 12, 31)
121
+ )
122
+ ```
123
+
124
+ ## How It Works
125
+
126
+ ### Data Storage
127
+
128
+ The package uses SQLite to store three main tables:
129
+
130
+ 1. **Portfolio Table**: Tracks holdings for each date based on transactions
131
+ 2. **Cash Table**: Maintains cash balance accounting for transactions and dividends
132
+ 3. **Prices Table**: Stores historical prices for all stocks in the portfolio
133
+
134
+ ### Price Management
135
+
136
+ - Prices are automatically fetched from Yahoo Finance using yfinance
137
+ - Multi-currency portfolios are supported with automatic conversion to your base currency
138
+ - Prices are forward-filled for missing trading days
139
+ - You can specify custom prices for specific dates by adding a "Prices" sheet to your CSV
140
+
141
+ ### Cash Flow Tracking
142
+
143
+ Cash balance is updated for:
144
+ - Stock purchases (cash out)
145
+ - Stock sales (cash in)
146
+ - Dividend payments (cash in)
147
+
148
+ ## Advanced Features
149
+
150
+ ### Custom Price Specifications
151
+
152
+ You can specify custom prices for certain dates by including them in your transaction CSV. The package will use these instead of fetching from Yahoo Finance when available.
153
+
154
+ ### Portfolio Reset
155
+
156
+ Reset your portfolio to start fresh:
157
+
158
+ ```python
159
+ portfolio.reset_portfolio()
160
+ ```
161
+
162
+ ## Requirements
163
+
164
+ - Python >= 3.7
165
+ - pandas
166
+ - yfinance
167
+
168
+ ## Supported Currencies
169
+
170
+ The package supports any currency pair available on Yahoo Finance, including:
171
+ - Major currencies: USD, EUR, GBP, JPY, CHF, AUD, CAD, SEK, NOK, DKK
172
+ - Cryptocurrencies through crypto tickers
173
+ - Emerging market currencies
174
+
175
+ ## Limitations
176
+
177
+ - Prices are fetched from Yahoo Finance; ensure data quality
178
+ - Intra-day trading is not supported (daily resolution only)
179
+ - Corporate actions (stock splits, mergers) should be manually adjusted in transactions
180
+ - Past dividend data depends on Yahoo Finance's historical dividend records
181
+
182
+ ## Contributing
183
+
184
+ Contributions are welcome! Please feel free to submit a Pull Request on GitHub.
185
+
186
+ ## License
187
+
188
+ This project is licensed under the MIT License - see the LICENSE file for details.
189
+
190
+ ## Disclaimer
191
+
192
+ Always verify your portfolio calculations independently. The author is not responsible for any financial losses resulting from the use of this software.
193
+
194
+ ## Support
195
+
196
+ For issues, questions, or suggestions, please open an issue on the GitHub repository.
@@ -0,0 +1,161 @@
1
+ # FinTrack
2
+
3
+ A Python package for tracking a dynamic portfolio of stocks with daily price monitoring, cash management, and dividend handling. This tool helps you maintain a record of your stock holdings, monitor their values over time, and automatically track cash flows from transactions and dividends.
4
+
5
+ ## Features
6
+
7
+ - **Portfolio Management**: Track multiple stock holdings with buy/sell transactions
8
+ - **Dynamic Price Tracking**: Automatically fetch and store historical stock prices using yfinance
9
+ - **Multi-Currency Support**: Handle stocks traded in different currencies with automatic conversion
10
+ - **Cash Management**: Maintain accurate cash balances accounting for buy/sell transactions and dividend payments
11
+ - **Dividend Tracking**: Automatically capture and account for dividend payments
12
+ - **Historical Analysis**: Query portfolio composition and value at any point in time
13
+ - **Index Comparison**: Compare your portfolio returns against benchmark indices
14
+
15
+ ## Installation
16
+
17
+ Install the package using pip:
18
+
19
+ ```bash
20
+ pip install FinTrack
21
+ ```
22
+
23
+ ## Quick Start
24
+
25
+ ### 1. Create a Transaction CSV File
26
+
27
+ First, create a CSV file with your transactions (`transactions.csv`):
28
+
29
+ ```
30
+ Date;Ticker;Type;Amount;Price
31
+ 2023-01-15;AAPL;Buy;10;150.00
32
+ 2023-02-20;MSFT;Buy;5;250.00
33
+ 2023-03-10;AAPL;Sell;5;165.00
34
+ ```
35
+
36
+ **CSV Columns:**
37
+ - `Date`: Transaction date (YYYY-MM-DD format)
38
+ - `Ticker`: Stock ticker symbol
39
+ - `Type`: Either "Buy" or "Sell"
40
+ - `Amount`: Number of shares
41
+ - `Price`: Price per share (in the stock's native currency)
42
+
43
+ ### 2. Initialize the Portfolio Tracker
44
+
45
+ ```python
46
+ from portfolio_tracker import Portfolio_tracker
47
+ import datetime
48
+
49
+ # Initialize with starting cash and currency
50
+ portfolio = Portfolio_tracker(
51
+ initial_cash=150000,
52
+ currency="SEK", # Your portfolio's base currency
53
+ csv_file="transactions.csv"
54
+ )
55
+
56
+ # Update portfolio (fetches latest prices and processes new transactions)
57
+ portfolio.update_portfolio()
58
+ ```
59
+
60
+ ### 3. Query Your Portfolio
61
+
62
+ ```python
63
+ # Get current holdings
64
+ current_holdings = portfolio.get_current_holdings()
65
+ print(f"Current holdings: {current_holdings}")
66
+
67
+ # Get all holdings ever owned
68
+ all_holdings = portfolio.get_past_holdings()
69
+ print(f"All past holdings: {all_holdings}")
70
+
71
+ # Get portfolio value for a date range
72
+ portfolio_values = portfolio.get_portfolio_value(
73
+ from_date=datetime.date(2023, 1, 1),
74
+ to_date=datetime.date(2023, 12, 31)
75
+ )
76
+
77
+ # Get cash balance at a specific date
78
+ cash_balance = portfolio.get_portfolio_cash(datetime.date(2023, 6, 15))
79
+ print(f"Cash balance: {cash_balance}")
80
+
81
+ # Compare against index returns
82
+ index_returns = portfolio.get_index_returns(
83
+ ticker="^GSPC", # S&P 500
84
+ start_date=datetime.date(2023, 1, 1),
85
+ end_date=datetime.date(2023, 12, 31)
86
+ )
87
+ ```
88
+
89
+ ## How It Works
90
+
91
+ ### Data Storage
92
+
93
+ The package uses SQLite to store three main tables:
94
+
95
+ 1. **Portfolio Table**: Tracks holdings for each date based on transactions
96
+ 2. **Cash Table**: Maintains cash balance accounting for transactions and dividends
97
+ 3. **Prices Table**: Stores historical prices for all stocks in the portfolio
98
+
99
+ ### Price Management
100
+
101
+ - Prices are automatically fetched from Yahoo Finance using yfinance
102
+ - Multi-currency portfolios are supported with automatic conversion to your base currency
103
+ - Prices are forward-filled for missing trading days
104
+ - You can specify custom prices for specific dates by adding a "Prices" sheet to your CSV
105
+
106
+ ### Cash Flow Tracking
107
+
108
+ Cash balance is updated for:
109
+ - Stock purchases (cash out)
110
+ - Stock sales (cash in)
111
+ - Dividend payments (cash in)
112
+
113
+ ## Advanced Features
114
+
115
+ ### Custom Price Specifications
116
+
117
+ You can specify custom prices for certain dates by including them in your transaction CSV. The package will use these instead of fetching from Yahoo Finance when available.
118
+
119
+ ### Portfolio Reset
120
+
121
+ Reset your portfolio to start fresh:
122
+
123
+ ```python
124
+ portfolio.reset_portfolio()
125
+ ```
126
+
127
+ ## Requirements
128
+
129
+ - Python >= 3.7
130
+ - pandas
131
+ - yfinance
132
+
133
+ ## Supported Currencies
134
+
135
+ The package supports any currency pair available on Yahoo Finance, including:
136
+ - Major currencies: USD, EUR, GBP, JPY, CHF, AUD, CAD, SEK, NOK, DKK
137
+ - Cryptocurrencies through crypto tickers
138
+ - Emerging market currencies
139
+
140
+ ## Limitations
141
+
142
+ - Prices are fetched from Yahoo Finance; ensure data quality
143
+ - Intra-day trading is not supported (daily resolution only)
144
+ - Corporate actions (stock splits, mergers) should be manually adjusted in transactions
145
+ - Past dividend data depends on Yahoo Finance's historical dividend records
146
+
147
+ ## Contributing
148
+
149
+ Contributions are welcome! Please feel free to submit a Pull Request on GitHub.
150
+
151
+ ## License
152
+
153
+ This project is licensed under the MIT License - see the LICENSE file for details.
154
+
155
+ ## Disclaimer
156
+
157
+ Always verify your portfolio calculations independently. The author is not responsible for any financial losses resulting from the use of this software.
158
+
159
+ ## Support
160
+
161
+ For issues, questions, or suggestions, please open an issue on the GitHub repository.
@@ -0,0 +1,55 @@
1
+ [build-system]
2
+ requires = ["setuptools>=65.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "FinTrack"
7
+ version = "1.0.0"
8
+ description = "A Python package for tracking a dynamic portfolio of stocks with daily price monitoring, cash management, and dividend handling"
9
+ readme = "README.md"
10
+ requires-python = ">=3.7"
11
+ license = {text = "MIT"}
12
+ authors = [
13
+ {name = "Aron Fredriksson", email = "arofre903@gmail.com"}
14
+ ]
15
+ keywords = [
16
+ "portfolio",
17
+ "stock-tracking",
18
+ "finance",
19
+ "stocks",
20
+ "yfinance",
21
+ "investment"
22
+ ]
23
+ classifiers = [
24
+ "Development Status :: 4 - Beta",
25
+ "Intended Audience :: Financial and Insurance Industry",
26
+ "License :: OSI Approved :: MIT License",
27
+ "Programming Language :: Python :: 3",
28
+ "Programming Language :: Python :: 3.7",
29
+ "Programming Language :: Python :: 3.8",
30
+ "Programming Language :: Python :: 3.9",
31
+ "Programming Language :: Python :: 3.10",
32
+ "Programming Language :: Python :: 3.11",
33
+ "Programming Language :: Python :: 3.12",
34
+ "Topic :: Office/Business :: Financial :: Investment",
35
+ "Topic :: Software Development :: Libraries :: Python Modules"
36
+ ]
37
+ dependencies = [
38
+ "pandas>=1.3.0",
39
+ "yfinance>=0.2.0"
40
+ ]
41
+
42
+ [project.urls]
43
+ Homepage = "https://github.com/arofre/FinTrack"
44
+ Repository = "https://github.com/arofre/FinTrack.git"
45
+ "Bug Tracker" = "https://github.com/arofre/FinTrack/issues"
46
+ Documentation = "https://github.com/arofre/FinTrack#readme"
47
+
48
+ [tool.setuptools]
49
+ package-dir = {"" = "src"}
50
+
51
+ [tool.setuptools.packages.find]
52
+ where = ["src"]
53
+
54
+ [tool.setuptools.package-data]
55
+ portfolio_tracker = ["py.typed"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,53 @@
1
+ #!/usr/bin/env python
2
+ """Setup script for FinTrack package."""
3
+
4
+ from setuptools import setup, find_packages
5
+
6
+ with open("README.md", "r", encoding="utf-8") as fh:
7
+ long_description = fh.read()
8
+
9
+ setup(
10
+ name="FinTrack",
11
+ version="1.0.0",
12
+ author="Aron Fredriksson",
13
+ author_email="arofre903@gmail.com",
14
+ description="A Python package for tracking a dynamic portfolio of stocks with daily price monitoring, cash management, and dividend handling",
15
+ long_description=long_description,
16
+ long_description_content_type="text/markdown",
17
+ url="https://github.com/arofre/FinTrack",
18
+ project_urls={
19
+ "Bug Tracker": "https://github.com/arofre/FinTrack/issues",
20
+ "Documentation": "https://github.com/arofre/FinTrack#readme",
21
+ "Source Code": "https://github.com/arofre/FinTrack",
22
+ },
23
+ packages=find_packages(where="src"),
24
+ package_dir={"": "src"},
25
+ classifiers=[
26
+ "Development Status :: 4 - Beta",
27
+ "Intended Audience :: Financial and Insurance Industry",
28
+ "License :: OSI Approved :: MIT License",
29
+ "Programming Language :: Python :: 3",
30
+ "Programming Language :: Python :: 3.7",
31
+ "Programming Language :: Python :: 3.8",
32
+ "Programming Language :: Python :: 3.9",
33
+ "Programming Language :: Python :: 3.10",
34
+ "Programming Language :: Python :: 3.11",
35
+ "Programming Language :: Python :: 3.12",
36
+ "Topic :: Office/Business :: Financial :: Investment",
37
+ "Topic :: Software Development :: Libraries :: Python Modules",
38
+ ],
39
+ python_requires=">=3.7",
40
+ install_requires=[
41
+ "pandas>=1.3.0",
42
+ "yfinance>=0.2.0",
43
+ ],
44
+ keywords=[
45
+ "portfolio",
46
+ "stock-tracking",
47
+ "finance",
48
+ "stocks",
49
+ "yfinance",
50
+ "investment",
51
+ ],
52
+ zip_safe=False,
53
+ )
@@ -0,0 +1,36 @@
1
+ """FinTrack - A Python package for tracking stock portfolios."""
2
+
3
+ __version__ = "1.0.0"
4
+ __author__ = "Aron Fredriksson"
5
+ __email__ = "arofre903@gmail.com"
6
+ __license__ = "MIT"
7
+
8
+ from .portfolio import FinTrack
9
+ from .yf_tools import (
10
+ get_returns,
11
+ get_dividends,
12
+ get_exchange_rate,
13
+ get_currency_from_ticker,
14
+ )
15
+ from .parsing_tools import (
16
+ build_holding_table,
17
+ get_portfolio,
18
+ build_cash_table,
19
+ generate_price_table,
20
+ get_current_holdings_longnames,
21
+ get_past_holdings_longnames,
22
+ )
23
+
24
+ __all__ = [
25
+ "FinTrack",
26
+ "get_returns",
27
+ "get_dividends",
28
+ "get_exchange_rate",
29
+ "get_currency_from_ticker",
30
+ "build_holding_table",
31
+ "get_portfolio",
32
+ "build_cash_table",
33
+ "generate_price_table",
34
+ "get_current_holdings_longnames",
35
+ "get_past_holdings_longnames",
36
+ ]