mirror of
https://github.com/farcasclaudiu/xtb-investment-tools.git
synced 2026-06-29 11:02:33 +03:00
Add scripts for environment setup and validation, and implement tests for portfolio performance exporter
- Created requirements.txt for dependencies including pandas, numpy, openpyxl, and yfinance. - Added setup-env.sh script to set up a Python virtual environment and install required packages. - Introduced validate-export.sh script to validate the exporter module and check expected fields. - Implemented test cases in test_portfolio_performance_exporter.py to ensure correct CSV export functionality and data handling.
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
if [[ -n "${PYTHON:-}" ]]; then
|
||||
PYTHON_BIN="$PYTHON"
|
||||
elif [[ -x ".venv/bin/python" ]]; then
|
||||
PYTHON_BIN=".venv/bin/python"
|
||||
else
|
||||
PYTHON_BIN="python3"
|
||||
fi
|
||||
|
||||
PYTHONDONTWRITEBYTECODE=1 "$PYTHON_BIN" - <<PY
|
||||
import importlib.util
|
||||
from pathlib import Path
|
||||
|
||||
script = Path("$SCRIPT_DIR") / "exporter.py"
|
||||
spec = importlib.util.spec_from_file_location("xtb_portfolio_performance_exporter", script)
|
||||
module = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(module)
|
||||
assert module.PORTFOLIO_FIELDS[0] == "Date"
|
||||
assert module.ACCOUNT_FIELDS[0] == "Date"
|
||||
print("Portfolio Performance exporter loaded")
|
||||
PY
|
||||
Reference in New Issue
Block a user