Ratio Assignment System - User Guide
Overview
A clean, efficient ratio management system with minimal VBA dependency. All logic is in Python for reliability and ease of maintenance.
Key Features
What You Can Do:
- Assign Ratios: Assign any created ratio to Excel columns (B, C, D, etc.)
- View Status: See which ratios are assigned and to which columns
- View Notes: Read ratio notes/descriptions
- Calculate Ratios: Compute all ratios for all tickers using Parquet data
- Manual Tickers: Enter tickers manually in Column A
Benefits:
- Fast: Uses Parquet data for quick calculations
- Reliable: Minimal VBA, all logic in Python
- Simple: Clean UI with clear feedback
- Flexible: Assign any ratio to any column
Excel Layout (Ratios Sheet)
Row 1: Financial Ratios [Title]
Row 2: [Empty]
Row 3: [Empty]
Row 4: Ticker | Ratio1 Name | Ratio2 Name | Ratio3 Name | ...
Row 5: [Empty - Reserved]
Row 6: AAPL | 1.2500 | 0.8500 | 2.4500 | ...
Row 7: MSFT | 1.3000 | 0.9200 | 2.5000 | ...
Row 8: GOOGL | 1.1800 | 0.7800 | 2.3200 | ...
...
Column Structure:
- Column A: Ticker symbols (enter manually from Row 6 onwards)
- Column B+: Assigned ratios with calculated values
Row Functions:
- Row 4: Ratio names (set by assignment)
- Row 5: Reserved and left empty
- Row 6+: Your data (tickers + calculated ratios)
How to Use
1. Open Ratio Manager
From Excel:
- Run VBA macro:
OpenRatioManager()
From Python:
python -c "from Internal.Ratios.ratio_manager_ui import launch_ratio_manager; launch_ratio_manager()"
2. Assign a Ratio
In Ratio Manager UI:
- Select a ratio from the list
- Click “Assign to Column”
- Enter column letter (B, C, D, etc.)
- Click OK
Result: Ratio name appears in Row 4, Row 5 stays empty
Rules:
- Can only assign to columns B and onwards
- Cannot assign same ratio to multiple columns
- Cannot assign to a column that is already in use
3. View Ratio Notes
In Ratio Manager UI:
- Select a ratio
- Click “View Notes”
- Read notes in popup dialog
4. Enter Tickers
In Excel (Ratios sheet):
- Go to Column A, Row 6
- Type ticker symbol (e.g., “AAPL”)
- Continue adding tickers in rows below
5. Calculate Ratios
From the FinForge Workspace:
- Open the FinForge workspace window
- Go to the Ratios tab
- Click “Refresh ratios sheet”
Option A - From Excel:
- Run VBA macro:
RefreshRatios()
Option B - From Python:
python -c "from Internal.Ratios.ratio_calculator import calculate_ratios; calculate_ratios()"
What Happens:
- System reads all tickers from Column A
- Loads financial data from Parquet files
- Calculates each assigned ratio for each ticker
- Writes results to Excel
- Shows progress dialog
6. Update an Assignment
- Open Ratio Manager
- Change the ratio assignment in Row 4 if needed
- Refresh the sheet so calculations use the updated layout
VBA Macros (Minimal)
Essential Functions:
' Open the Ratio Manager UI
OpenRatioManager()
' Calculate all ratios
RefreshRatios()
Setting Up Buttons:
- Insert Developer Tab -> Insert -> Button
- Assign macro to button:
- “Manage Ratios” ->
OpenRatioManager - “Calculate Ratios” ->
RefreshRatios
- “Manage Ratios” ->
File Structure
FinForge/
+-- Internal/Ratios/
| +-- ratio_handeling.py (Config management)
| +-- ratio_manager_ui.py (Main UI)
| +-- ratio_calculator.py (Calculation engine)
+-- Importing/
| +-- ratio_config.json (Ratio storage)
| +-- ratio_maker.py (Create ratios)
+-- data/
| +-- fundamentals/ (Financial data in Parquet)
Example Workflow
Complete Example:
-
Create Ratios (using Ratio Maker)
- Current Ratio:
BS: Current Assets / BS: Current Liabilities - Quick Ratio:
BS: Cash / BS: Current Liabilities
- Current Ratio:
-
Open Ratio Manager
- See both ratios as “Not assigned”
-
Assign Ratios
- Current Ratio -> Column B
- Quick Ratio -> Column C
-
Enter Tickers
A7: AAPL A8: MSFT A9: GOOGL -
Calculate
- Click “Refresh ratios sheet” in FinForge or run
RefreshRatios() - See results:
B7: 1.2500 C7: 0.8500 B8: 1.3000 C8: 0.9200 B9: 1.1800 C9: 0.7800 - Click “Refresh ratios sheet” in FinForge or run
-
Update if Needed
- Adjust the Row 4 assignments, then refresh again
Troubleshooting
“No ratios found”
- Solution: Create ratios first using Ratio Maker
“No tickers found”
- Solution: Enter tickers in Column A starting from Row 6
“Failed to load Parquet data”
- Solution: Make sure
data/balance_sheet.parquetanddata/income_statement.parquetexist - Run data import first if needed
“Column already in use”
- Solution: Reassign the ratio in Row 4 and refresh the sheet
Calculation shows “N/A”
- Reason: Financial data not found for that ticker/item
- Check: Ticker spelling and data availability
Calculation shows “DIV/0”
- Reason: Denominator is zero
- Normal: Some ratios can legitimately be undefined
UI Features
Ratio Manager Window:
- Title: Shows current mode
- List: All ratios with assignment status
- Green = Assigned (shows column)
- Gray = Not assigned
- Buttons:
- Assign to Column
- View Notes
- Refresh list
- Close
Progress Dialog:
- Shows during calculation
- Real-time progress updates
- Can cancel if needed
Confirmation Dialogs:
- After successful operations
- Error messages if something fails
Performance
- Fast Data Access: Parquet files are optimized for speed
- Efficient Calculation: Only calculates what’s needed
- Minimal Excel Interaction: Batch writes for better performance
- Progress Tracking: Know exactly what’s happening
Safety Features
- Validation: Prevents invalid column assignments
- Confirmation: Asks before unassigning
- Error Handling: Clear error messages
- Data Preservation: Careful with existing data
Notes
- Column A is Reserved: Only for tickers
- Row 6 is Reserved: For future features
- Columns B+: Available for ratio assignment
- No Limit: Assign as many ratios as you want
- One Ratio Per Column: Keeps things clean
Best Practices
- Create ratios first before trying to assign
- Enter tickers before calculating
- Use meaningful ratio names for easy identification
- Add notes to ratios to remember what they do
- Refresh data regularly to keep ratios up to date
- Save Excel after assigning ratios
This is a clean, simple, and efficient system. Enjoy!