Add exchange rate information to market cap CSV exports#43
Add exchange rate information to market cap CSV exports#43
Conversation
- Added get_conversion_rate_info function to retrieve exchange rate details for currency conversions - Modified get_market_caps function to include exchange rate data for EUR and USD conversions - Added new CSV columns: EUR/USD Conversion Pair, Exchange Rate, and Rate Date - Updated both combined_marketcaps and top_100_active exports with exchange rate information - Fixed timestamp handling to properly use integer Unix timestamps from database - All tests pass and functionality works with existing data Co-authored-by: javdl <2742259+javdl@users.noreply.github.com>
|
@claude review this |
|
Claude finished @javdl's task —— View job Code Review Complete ✅Reviewing PR #43: Add exchange rate information to market cap CSV exports Todo List:
Overall AssessmentThis PR successfully implements the requested exchange rate information feature. The core functionality is well-designed and integrates cleanly with the existing codebase. However, there are several issues that should be addressed. ✅ Strengths
❌ Critical Issues1. Incorrect reverse pair naming (src/currencies.rs:283)let reverse_pair = format!("{}/{}", adjusted_to_currency, adjusted_from_currency);
if let Some(rate_info) = get_forex_rate_at_timestamp(pool, &reverse_pair, at_timestamp).await? {
return Ok(Some((reverse_pair, 1.0 / rate_info.0, rate_info.2)));
}Bug: When converting JPY→EUR and finding EUR/JPY rate in database, the function returns Fix: Return the requested pair name, not the database pair name: return Ok(Some((direct_pair, 1.0 / rate_info.0, rate_info.2)));
|
|
@claude fix point 1, 3, and 4 from your review, skip the rest. |
|
Claude finished @javdl's task —— View job Todo List:
✅ All Issues FixedSuccessfully addressed the 3 specific issues from my code review: Point 1 - Fixed Reverse Pair Naming Bug (
|
- Fix reverse pair naming bug: return requested pair name instead of database pair name - Extract shared adjust_currencies() helper to eliminate code duplication - Add comprehensive unit tests for get_conversion_rate_info() function Co-authored-by: Joost <javdl@users.noreply.github.com>
|
@claude Check and fix the ci errors |
|
Claude finished @javdl's task —— View job Todo List:
✅ CI Issues FixedFixed the main compilation error that was blocking the build. The key issue was a lifetime specifier error in What was fixed:
CI Status:
Remaining CI failures are unrelated to our code changes:
The core compilation and code quality checks now pass, which means the PR is ready from a code perspective. The remaining failures are infrastructure/compliance issues that existed before our changes. |
Change return type from (f64, &str, &str) to (f64, String, String) to resolve lifetime conflicts between string literals and input parameter references. Co-authored-by: Joost <javdl@users.noreply.github.com>
|
Claude finished @Copilot's task —— View job Code Review Complete ✅Reviewing PR #43: Add exchange rate information to market cap CSV exports Todo List:
Overall AssessmentThis PR successfully implements the requested exchange rate information feature with excellent code quality and comprehensive test coverage. The implementation is well-designed, follows Rust best practices, and integrates cleanly with the existing codebase. ✅ StrengthsImplementation Quality
Code Quality
Test Coverage - Outstanding 🎯The test suite is exceptionally comprehensive with 8 dedicated tests for
CSV Output FormatThe new columns are well-structured and provide exactly what users need: EUR Conversion Pair,EUR Exchange Rate,EUR Rate Date,USD Conversion Pair,USD Exchange Rate,USD Rate Date
JPY/EUR,0.0058082,2025-08-17,JPY/USD,0.00679824,2025-08-17
|
This PR adds detailed exchange rate information to the market cap CSV exports as requested in the issue. When companies are converted from their original currency to EUR or USD, the system now tracks and exports the specific exchange rates used.
New CSV Columns Added
The following columns have been added to both
combined_marketcaps_*.csvandtop_100_active_*.csvexports:Example Output
For a Japanese company (original currency JPY):
For a European company (original currency EUR):
Implementation Details
get_conversion_rate_info()function to lookup exchange rate details for currency conversionsget_market_caps()to include exchange rate data retrievalTesting
Fixes #42.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.