-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: add _approx_equal_price_rounding to allow price in accepable range
- Loading branch information
Showing
5 changed files
with
137 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
WARNING: No schwab award file provided | ||
INFO: No schwab Equity Award JSON file provided | ||
INFO: No trading212 folder provided | ||
INFO: No mssb folder provided | ||
INFO: No sharesight file provided | ||
INFO: No raw file provided | ||
First pass completed | ||
Final portfolio: | ||
Final balance: | ||
Charles Schwab: 1019826.86 (USD) | ||
Dividends: £0.00 | ||
Dividend taxes: £0.00 | ||
Interest: £0.00 | ||
Disposal proceeds: £248079.51 | ||
|
||
|
||
Second pass completed | ||
Portfolio at the end of 2023/2024 tax year: | ||
For tax year 2023/2024: | ||
Number of disposals: 3 | ||
Disposal proceeds: £248079.51 | ||
Allowable costs: £232737.33 | ||
Capital gain: £15342.18 | ||
Capital loss: £0.00 | ||
Total capital gain: £15342.18 | ||
Taxable capital gain: £9342.18 | ||
|
||
Generate calculations report | ||
All done! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
"Date","Action","Symbol","Description","Quantity","Price","Fees & Comm","Amount" | ||
"03/01/2022","MoneyLink Transfer","","Tfr BANK","","","","$1000000.00" | ||
"10/09/2023","Buy","BAR","BAR CORP ROUNDING CASE","300","$135.0075","$1.34","-$40503.61" | ||
"10/24/2023","Sell","BAR","BAR CORP","300","$140.35","$1.34","$42103.66" | ||
"12/01/2023","Buy","FOO","FOO CORP","500","$90.1234","","-$45061.70" | ||
"01/08/2024","Sell","FOO","FOO CORP ROUNDING CASE","500","$100.0001","$1.23","$49998.85" | ||
"02/06/2024","Buy","QUX","QUX CORP ROUNDING CASE","1300","$160.1275","$1.12","-$208166.93" | ||
"02/26/2024","Sell","QUX","QUX CORP ROUNDING CASE","1300","$170.3521","$1.2","$221456.59" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
"""Test Schwab.""" | ||
|
||
from pathlib import Path | ||
import subprocess | ||
import sys | ||
|
||
|
||
def test_run_with_schwab_example_files() -> None: | ||
"""Runs the script and verifies it doesn't fail.""" | ||
cmd = [ | ||
sys.executable, | ||
"-m", | ||
"cgt_calc.main", | ||
"--year", | ||
"2023", | ||
"--schwab", | ||
"tests/test_data/schwab/schwab_transactions-2023.csv", | ||
"--no-pdflatex", | ||
] | ||
result = subprocess.run(cmd, check=True, capture_output=True) | ||
assert result.stderr == b"", "Run with example files generated errors" | ||
expected_file = Path("tests") / "test_data" / "schwab" / "expected_output.txt" | ||
expected = expected_file.read_text() | ||
cmd_str = " ".join([param if param else "''" for param in cmd]) | ||
assert result.stdout.decode("utf-8") == expected, ( | ||
"Run with example files generated unexpected outputs, " | ||
"if you added new features update the test with:\n" | ||
f"{cmd_str} > {expected_file}" | ||
) |