Get chart data.
()
| 678 | |
| 679 | @self.app.route('/api/data') |
| 680 | def get_data(): |
| 681 | """Get chart data.""" |
| 682 | try: |
| 683 | # Reload data on each request (when page refreshes) |
| 684 | self._load_data() |
| 685 | |
| 686 | data = self._prepare_chart_data() |
| 687 | |
| 688 | # Check if we have data |
| 689 | if not data["timestamps"]: |
| 690 | return jsonify({ |
| 691 | "error": "No data available", |
| 692 | "message": "No account values found in records" |
| 693 | }), 400 |
| 694 | |
| 695 | account_value_chart = self._create_account_value_chart(data) |
| 696 | returns_chart = self._create_returns_chart(data) |
| 697 | crypto_prices_chart = self._create_crypto_prices_chart(data) |
| 698 | |
| 699 | return jsonify({ |
| 700 | "account_value_chart": account_value_chart, |
| 701 | "returns_chart": returns_chart, |
| 702 | "crypto_prices_chart": crypto_prices_chart, |
| 703 | "action_points": data["action_points"] |
| 704 | }) |
| 705 | except Exception as e: |
| 706 | import traceback |
| 707 | error_msg = f"Error preparing chart data: {str(e)}\n{traceback.format_exc()}" |
| 708 | print(error_msg) |
| 709 | return jsonify({ |
| 710 | "error": "Failed to prepare chart data", |
| 711 | "message": str(e) |
| 712 | }), 500 |
| 713 | |
| 714 | @self.app.route('/api/action/<int:point_index>') |
| 715 | def get_action_details(point_index: int): |
nothing calls this directly
no test coverage detected