Skip to main content

A financial simulation engine integrated with Google Sheets

Project description

Sheet Simulator 🧼📊

sheet-simulator es un paquete de Python que permite interactuar de forma programática con modelos financieros construidos en Google Sheets.

Permite:

  • Modificar inputs directamente desde Python
  • Leer los outputs calculados por el modelo
  • Correr simulaciones (individuales o múltiples) de escenarios financieros
  • Automatizar pruebas de sensibilidad y escenarios aleatorios

La lógica del modelo vive en Google Sheets. Python actúa como motor de simulación y visualización.


✨ Características

  • Interfaz simple basada en la clase SheetSimulator
  • Definición de inputs y outputs como mapeos de celdas/rangos
  • Restauración automática de los valores originales tras cada simulación
  • Generador de escenarios aleatorios o deterministas (InputGenerator)
  • Soporte nativo para NumPy y operaciones vectoriales
  • Diseñado para funcionar en Google Colab

🚀 Ejemplo rápido

from sheet_simulator import SheetSimulator

# Conectarse a una hoja (autenticación interactiva en Colab)
url = "https://docs.google.com/spreadsheets/d/..."
sim = SheetSimulator.from_sheet_url(url)

# Definir inputs y outputs
sim.set_inputs([
    {"name": "growth_rate", "sheet": "Assumptions", "range": "B2"},
    {"name": "new_users", "sheet": "Inputs", "range": "C2:N2"},
])

sim.set_outputs([
    {"name": "net_income", "sheet": "P&L", "range": "B50"},
    {"name": "ARR", "sheet": "P&L", "range": "B51"},
])

# Leer valores actuales
current = sim.read_inputs()

# Simular un escenario
result = sim.run_simulation({"growth_rate": 0.15})

# Simular múltiples escenarios
scenarios = [{"growth_rate": r/100} for r in range(10, 21)]
results = sim.run_multiple_scenarios(scenarios)

🔬 Generación de escenarios

from sheet_simulator import InputGenerator
import numpy as np

base = {"growth_rate": 0.1}
perturb = {
    "growth_rate": lambda v: InputGenerator.perturb_scalar(v, dist="normal", scale=0.02)
}

scenarios = InputGenerator.generate_scenarios(base, perturbations=perturb, n=100)

🔧 Instalación

pip install sheet-simulator

📎 Requisitos

  • Python 3.8+
  • gspread, google-auth, google-api-python-client, numpy
  • Un Google Sheet compartido con permisos de edición

📄 Licencia

MIT License © 2024 — Created with ❤️ by David Corredor M (and ChattyChat)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sheet_simulator-0.1.1.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sheet_simulator-0.1.1-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file sheet_simulator-0.1.1.tar.gz.

File metadata

  • Download URL: sheet_simulator-0.1.1.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.2

File hashes

Hashes for sheet_simulator-0.1.1.tar.gz
Algorithm Hash digest
SHA256 ab9578762342a5662fae0bcbfec24fa36ec0a31625515a14f3ea9b5498f516ef
MD5 988e959c5fc5379a3ab80fd318b29b52
BLAKE2b-256 cfc71a9abad75c9860983b5bb457210fb0eeeebe46602f00184729ea7873b6f4

See more details on using hashes here.

File details

Details for the file sheet_simulator-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for sheet_simulator-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 09b1ef584b38443e1f2ed8c50c692be514beecd44ed22bc4ef47706e0e9874cf
MD5 c59351623ebe2202039c6f0fb328142e
BLAKE2b-256 79c276205172b71381f2c841444193544250fb83ba308948a1da8b2ec734cfc3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page