Files
xtb-investment-tools/skills/xtb-portfolio-performance-export/scripts/validate-export.sh
T
farcasclaudiu 68cfec926e 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.
2026-06-21 21:06:08 +03:00

25 lines
703 B
Bash
Executable File

#!/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