Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance asset-liability #7

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

goldhaxx
Copy link

@goldhaxx goldhaxx commented Dec 21, 2024

Enhance asset-liability.py summary generation with error handling and data validation. Added try-except for missing market data and improved column checks in the asset-liab matrix display. This ensures robustness against KeyErrors and provides user feedback when data is unavailable.

Fix Asset Liability Matrix Page Data Handling

Problem

The asset liability matrix page was crashing when encountering markets with missing data (specifically markets 29-32: META, ME, PENGU, and BONK). The page would attempt to access and sort by columns that didn't exist in the DataFrame, resulting in KeyErrors.

Changes

  • Added robust error handling for missing market data in the tab display section
  • Improved data validation and display logic for each market tab
  • Added informative warning and info messages for better UX

Specific Changes:

  1. Added validation for required columns before processing each market tab
  2. Made sorting optional - if sorting column doesn't exist, data is displayed unsorted
  3. Added user-friendly messages:
    • Warning when market data is not available
    • Info message when no users have positions in a market
  4. Improved filtering logic for non-zero positions
  5. Refactored market tab processing to handle errors gracefully

Testing

The page now:

  • Successfully loads and displays available market data
  • Shows appropriate warning messages for markets with missing data
  • Continues to function even when some market data is unavailable
  • Maintains all existing functionality for markets with complete data

…ta validation. Added try-except for missing market data and improved column checks in the asset-liab matrix display. This ensures robustness against KeyErrors and provides user feedback when data is unavailable.
…page. Added try-except blocks for API calls, checks for valid response format, and warnings for empty data. Enhanced slot information retrieval with error handling.
@goldhaxx goldhaxx changed the title Enhance asset-liability summary generation with error handling and data validation. Added try-except for missing market data and improved column checks in the asset-liab matrix display. This ensures robustness against KeyErrors and provides user feedback when data is unavailable. Enhance asset-liability Dec 21, 2024
… the presence of 'is_high_leverage' column. Added user feedback for unavailable data, improving robustness and user experience.
- Added volume mapping for logs in docker-compose.yml to persist log data.
- Updated Dockerfile to create and set permissions for the /logs directory.
- Replaced print statements with logging in asset_liability.py and matrix.py for better traceability and debugging.
- Introduced timing metrics in asset_liability.py to monitor loading times and improve user feedback during data fetching and processing.
…anagement

- Changed logging configuration in gunicorn_config.py to direct logs to /logs/access.log and /logs/error.log, and set log level to debug for improved debugging.
- Added matrix_response.json and logs/* to .gitignore to prevent unnecessary files from being tracked.
- Updated Streamlit config to suppress callback and resource warnings, enhancing user experience.
- Introduced a new attribute `last_oracle_slot` initialized to 0 in the BackendState class within state.py. This addition enhances the state management capabilities of the backend, potentially improving tracking of oracle data.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant