Fix: RawData Number Format

This commit is contained in:
2025-07-24 10:17:33 -03:00
parent c10924bc35
commit efd0dfb574
5 changed files with 64 additions and 25 deletions

33
.env Normal file
View File

@@ -0,0 +1,33 @@
# =======================================================
# == Fichero de Entorno para la Aplicación de Mercados ==
# =======================================================
# Este fichero debe estar en /opt/mercados-app/.env en el servidor.
# Contiene todos los secretos y configuraciones específicas del entorno.
# --- Conexión a la Base de Datos ---
# Cadena de conexión para SQL Server.
# IMPORTANTE: El 'Server' debe ser el nombre del servicio de la base de datos en la red Docker compartida.
ConnectionStrings__DefaultConnection="Server=;Database=;User ID=;Password=;TrustServerCertificate=True;Encrypt=False;"
# --- Horarios de Ejecución del Worker (formato Cron) ---
Schedules__MercadoAgroganadero="0 10,12,15,18 * * 1-5"
Schedules__BCR="30 11 * * 1-5"
Schedules__Bolsas="10 11-17 * * 1-5"
# --- Claves de APIs Externas ---
ApiKeys__Finnhub=""
ApiKeys__Bcr__Key=""
ApiKeys__Bcr__Secret=""
# --- Configuración de Email para Alertas (SMTP) ---
SmtpSettings__Host=""
SmtpSettings__Port=""
SmtpSettings__User=""
SmtpSettings__Pass=""
SmtpSettings__SenderName="Servicio de Mercados"
SmtpSettings__Recipient=""
# --- Configuración del Entorno de ASP.NET Core ---
# Esto asegura que la aplicación se ejecute en modo Producción,
# desactivando páginas de error detalladas, etc.
ASPNETCORE_ENVIRONMENT="Production"

BIN
Widgets-ELDIA-1.1.pdf Normal file

Binary file not shown.

View File

@@ -2,7 +2,7 @@ services:
# Servicio del Backend API
mercados-api:
build:
context: ./Mercados-Web # Asumiendo que clonaste el repo en esta carpeta
context: ./Mercados-Web
dockerfile: src/Mercados.Api/Dockerfile
container_name: mercados-api
restart: always
@@ -60,4 +60,4 @@ networks:
driver: bridge
shared-net:
external: true
external: true

View File

@@ -14,12 +14,12 @@ const toTSV = (data: CotizacionBolsa[]) => {
// Formateamos el nombre para que quede como "GGAL.BA (GRUPO FINANCIERO GALICIA)"
const nombreCompleto = `${row.ticker} (${row.nombreEmpresa || ''})`;
const precio = `$${formatCurrency(row.precioActual)}`
const cambio = `${row.porcentajeCambio.toFixed(2)}%`
const cambio = `${formatCurrency(row.porcentajeCambio)}%` //`${row.porcentajeCambio.toFixed(2)}%`
// Unimos los campos con un carácter de tabulación '\t'
return [nombreCompleto, precio, cambio].join('\t');
});
// Unimos todas las filas con un salto de línea
return dataRows.join('\n');
};
@@ -32,14 +32,14 @@ export const RawBolsaLocalTable = () => {
// Separamos los datos en prioritarios y el resto
const priorityData = data?.filter(d => TICKERS_PRIORITARIOS_LOCAL.includes(d.ticker))
.sort((a, b) => TICKERS_PRIORITARIOS_LOCAL.indexOf(a.ticker) - TICKERS_PRIORITARIOS_LOCAL.indexOf(b.ticker)); // Mantenemos el orden
.sort((a, b) => TICKERS_PRIORITARIOS_LOCAL.indexOf(a.ticker) - TICKERS_PRIORITARIOS_LOCAL.indexOf(b.ticker)); // Mantenemos el orden
const otherData = data?.filter(d => !TICKERS_PRIORITARIOS_LOCAL.includes(d.ticker));
const handleCopy = () => {
if (!priorityData) return;
const tsvData = toTSV(priorityData);
copyToClipboard(tsvData)
.then(() => alert('Datos prioritarios copiados al portapapeles.'))
.catch(err => {
@@ -81,7 +81,7 @@ export const RawBolsaLocalTable = () => {
<Typography component="span" sx={{ ml: 1, color: 'text.secondary' }}>({row.nombreEmpresa})</Typography>
</TableCell>
<TableCell align="right">${formatCurrency(row.precioActual)}</TableCell>
<TableCell align="right">{row.porcentajeCambio.toFixed(2)}%</TableCell>
<TableCell align="right">{formatCurrency(row.porcentajeCambio)}%</TableCell>
</TableRow>
))}
</TableBody>
@@ -98,17 +98,20 @@ export const RawBolsaLocalTable = () => {
<Table size="small">
<TableHead>
<TableRow>
<TableCell>Ticker</TableCell>
<TableCell>Nombre</TableCell>
<TableCell align="right">Precio</TableCell>
<TableCell>Símbolo (Nombre)</TableCell>
<TableCell align="right">Precio Actual</TableCell>
<TableCell align="right">% Cambio</TableCell>
</TableRow>
</TableHead>
<TableBody>
{otherData.map(row => (
<TableRow key={row.id}>
<TableCell>{row.ticker}</TableCell>
<TableCell>{row.nombreEmpresa}</TableCell>
<TableCell>
<Typography component="span" sx={{ fontWeight: 'bold' }}>{row.ticker}</Typography>
<Typography component="span" sx={{ ml: 1, color: 'text.secondary' }}>({row.nombreEmpresa})</Typography>
</TableCell>
<TableCell align="right">${formatCurrency(row.precioActual)}</TableCell>
<TableCell align="right">{formatCurrency(row.porcentajeCambio)}%</TableCell>
</TableRow>
))}
</TableBody>

View File

@@ -18,7 +18,7 @@ const toTSV = (data: CotizacionBolsa[]) => {
// Formateamos los datos según los requisitos de redacción
const nombreCompleto = `${row.ticker} (${row.nombreEmpresa || ''})`;
const precio = `$${formatCurrency(row.precioActual)}`;
const cambio = `${row.porcentajeCambio.toFixed(2)}%`;
const cambio = `${formatCurrency(row.porcentajeCambio)}%`;
return [nombreCompleto, precio, cambio].join('\t');
});
@@ -35,14 +35,14 @@ export const RawBolsaUsaTable = () => {
// Separamos los datos en prioritarios y el resto, manteniendo el orden de la lista
const priorityData = data?.filter(d => TICKERS_PRIORITARIOS_USA.includes(d.ticker))
.sort((a, b) => TICKERS_PRIORITARIOS_USA.indexOf(a.ticker) - TICKERS_PRIORITARIOS_USA.indexOf(b.ticker));
.sort((a, b) => TICKERS_PRIORITARIOS_USA.indexOf(a.ticker) - TICKERS_PRIORITARIOS_USA.indexOf(b.ticker));
const otherData = data?.filter(d => !TICKERS_PRIORITARIOS_USA.includes(d.ticker));
const handleCopy = () => {
if (!priorityData) return;
const tsvData = toTSV(priorityData);
copyToClipboard(tsvData)
.then(() => alert('Datos prioritarios copiados al portapapeles!'))
.catch(err => {
@@ -91,8 +91,8 @@ export const RawBolsaUsaTable = () => {
<Typography component="span" sx={{ fontWeight: 'bold' }}>{row.ticker}</Typography>
<Typography component="span" sx={{ ml: 1, color: 'text.secondary' }}>({row.nombreEmpresa})</Typography>
</TableCell>
<TableCell align="right">{formatCurrency(row.precioActual, 'USD')}</TableCell>
<TableCell align="right">{row.porcentajeCambio.toFixed(2)}%</TableCell>
<TableCell align="right">${formatCurrency(row.precioActual)}</TableCell>
<TableCell align="right">{formatCurrency(row.porcentajeCambio)}%</TableCell>
</TableRow>
))}
</TableBody>
@@ -109,17 +109,20 @@ export const RawBolsaUsaTable = () => {
<Table size="small">
<TableHead>
<TableRow>
<TableCell>Ticker</TableCell>
<TableCell>Nombre</TableCell>
<TableCell align="right">Precio</TableCell>
<TableCell>Símbolo (Nombre)</TableCell>
<TableCell align="right">Precio Actual</TableCell>
<TableCell align="right">% Cambio</TableCell>
</TableRow>
</TableHead>
<TableBody>
{otherData.map(row => (
<TableRow key={row.id}>
<TableCell>{row.ticker}</TableCell>
<TableCell>{row.nombreEmpresa}</TableCell>
<TableCell align="right">{formatCurrency(row.precioActual, 'USD')}</TableCell>
<TableCell>
<Typography component="span" sx={{ fontWeight: 'bold' }}>{row.ticker}</Typography>
<Typography component="span" sx={{ ml: 1, color: 'text.secondary' }}>({row.nombreEmpresa})</Typography>
</TableCell>
<TableCell align="right">${formatCurrency(row.precioActual)}</TableCell>
<TableCell align="right">{formatCurrency(row.porcentajeCambio)}%</TableCell>
</TableRow>
))}
</TableBody>