Skip to content

Commit 8a8b76b

Browse files
committed
feat: ui
1 parent f72e229 commit 8a8b76b

33 files changed

+3357
-385
lines changed

README.md

+45-7
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ A FastAPI application that helps you compare different Brazilian investment inde
2424
- Automatic tax calculation based on investment type and period
2525
- Historical data from Brazilian Central Bank API
2626
- Future projections based on historical volatility and trends
27+
- Dynamic IPCA data retrieval with multi-level fallback strategies
2728
- Bitcoin price data from CryptoCompare API
29+
- User-friendly interface with Today buttons for date selection
30+
- Convenient form reset with New Query button
2831
- Robust error handling and logging
2932
- Easy-to-use REST API
3033

@@ -41,16 +44,30 @@ A FastAPI application that helps you compare different Brazilian investment inde
4144
uv pip install -e .
4245
```
4346

47+
## Building the UI
48+
49+
The NestEgg UI is built with TypeScript and requires Node.js to compile the TypeScript code to JavaScript.
50+
51+
1. Make sure you have Node.js installed (version 16+)
52+
53+
2. Build the TypeScript files:
54+
```bash
55+
cd nestegg/static
56+
./build.sh
57+
```
58+
4459
## Usage
4560

4661
1. Start the server:
4762
```bash
4863
uvicorn nestegg.main:app --reload --port 8001
4964
```
5065

51-
2. Open your browser and navigate to `http://localhost:8001/docs` to access the interactive API documentation
66+
2. Access the UI by navigating to `http://localhost:8001` in your browser
5267

53-
3. Make a POST request to `/api/v1/calculate` with a JSON body like:
68+
3. Or access the API documentation at `http://localhost:8001/docs` to use the interactive API
69+
70+
4. Make a POST request to `/api/v1/calculate` with a JSON body like:
5471
```json
5572
{
5673
"investment_type": "cdb",
@@ -61,7 +78,7 @@ A FastAPI application that helps you compare different Brazilian investment inde
6178
}
6279
```
6380

64-
4. Or compare multiple investments at once with:
81+
5. Or compare multiple investments at once with:
6582
```bash
6683
curl -X POST "http://localhost:8001/api/v1/compare?amount=10000&start_date=2024-01-01&end_date=2024-12-31&cdb_rate=14.5&lci_rate=12.0&lca_rate=11.5&ipca_spread=5.5&selic_spread=2.0&cdi_percentage=109.0"
6784
```
@@ -140,13 +157,19 @@ Request parameters:
140157
- `cdb_rate`: CDB rate as percentage (optional)
141158
- `lci_rate`: LCI rate as percentage (optional)
142159
- `lca_rate`: LCA rate as percentage (optional)
143-
- `ipca_spread`: IPCA spread in percentage points (optional, default: 0)
144-
- `selic_spread`: SELIC spread in percentage points (optional, default: 0)
145-
- `cdi_percentage`: CDI percentage (optional, default: 100.0)
160+
- `ipca_spread`: IPCA spread in percentage points (optional)
161+
- `selic_spread`: SELIC spread in percentage points (optional)
162+
- `cdi_percentage`: CDI percentage (optional)
146163
- `lci_cdi_percentage`: LCI CDI percentage (optional)
147164
- `lca_cdi_percentage`: LCA CDI percentage (optional)
148165
- `lci_ipca_spread`: LCI IPCA spread (optional)
149166
- `lca_ipca_spread`: LCA IPCA spread (optional)
167+
- `include_poupanca`: Whether to include Poupança in comparison (optional, default: false)
168+
- `include_selic`: Whether to include base SELIC in comparison (optional, default: false)
169+
- `include_cdi`: Whether to include base CDI in comparison (optional, default: false)
170+
- `include_btc`: Whether to include Bitcoin in comparison (optional, default: false)
171+
172+
The comparison will only include investment types that are explicitly requested through parameters.
150173

151174
Response:
152175
```json
@@ -238,6 +261,11 @@ curl -X POST "http://localhost:8001/api/v1/compare?amount=10000&start_date=2024-
238261
curl -X POST "http://localhost:8001/api/v1/compare?amount=10000&start_date=2024-01-01&end_date=2024-12-31&cdb_rate=14.5&lci_rate=12.0&lca_rate=11.5&ipca_spread=5.5&selic_spread=2.0&cdi_percentage=109.0&lci_cdi_percentage=95.0&lca_cdi_percentage=90.0&lci_ipca_spread=4.5&lca_ipca_spread=4.0"
239262
```
240263

264+
### Compare investments with specific default types included
265+
```bash
266+
curl -X POST "http://localhost:8001/api/v1/compare?amount=10000&start_date=2024-01-01&end_date=2024-12-31&lci_rate=13.5&lci_cdi_percentage=94.0&include_poupanca=true&include_btc=true"
267+
```
268+
241269
### Compare investments with future dates (projections)
242270
```bash
243271
curl -X POST "http://localhost:8001/api/v1/compare?amount=10000&start_date=2025-01-01&end_date=2025-12-31&cdb_rate=14.5&lci_rate=12.0&lca_rate=11.5&ipca_spread=5.5&selic_spread=2.0&cdi_percentage=109.0"
@@ -257,7 +285,17 @@ The application uses the following data sources:
257285
- Current and historical Bitcoin prices in BRL
258286
- Future Bitcoin price projections based on historical volatility
259287

260-
For future dates, the application uses sophisticated projections based on historical data patterns and volatility. These projections are clearly marked in the results.
288+
For future dates, the application uses sophisticated projections based on historical data patterns and volatility. These projections are clearly marked in the results. For IPCA, the system employs a multi-level dynamic fallback strategy using recent historical data.
289+
290+
## UI Features
291+
292+
The web interface provides several user-friendly features:
293+
294+
- **Today Buttons**: Next to date inputs, allowing you to quickly set a date to today
295+
- **New Query Button**: Resets all selections and results to start fresh
296+
- **Responsive Design**: Works well on desktop and mobile devices
297+
- **Dynamic Investment Selection**: Only selected investment types are included in comparisons
298+
- **Interactive Results**: Clear visualization of investment performance
261299

262300
## Changelog
263301

0 commit comments

Comments
 (0)