Skip to main content

Calcula el periodo actual según las Tarifas Españolas TD 2.0 y 3.0

Project description

Tariff TD

Tariff TD es una biblioteca para Python que permite determinar el periodo de las tarifas 2.0 TD y 3.0 TD españolas en una fecha determinada así como obtener el precio correspondiente.

Esta biblioteca usa los festivos proporcionados por la biblioteca hollidays pero elimina los Viernes Santos, puesto que dicho festivo, al cambiar de fecha cada año, no es considerado valle.

Ejemplo de suo

from datetime import datetime

from src.tariff_td import Tariff20TD

FORMAT = "%Y-%m-%d %H:%M:%S"

# Creamos la instancia especificando los precios.
# En caso de la Tarifa 3.0, se usaría Tariff30TD
tariff = Tariff20TD(p1=0.17, p2=0.15, p3=0.10)

# Creamos una fecha
date = datetime.strptime("2024-01-02 06:00:00", FORMAT)

# Obtenemos el periodo
period = tariff.get_period(date)

# Obtenemos el precio
price = tariff.get_price(date)

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

tariff_td-1.0.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

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

tariff_td-1.0-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file tariff_td-1.0.tar.gz.

File metadata

  • Download URL: tariff_td-1.0.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.11.8 Linux/6.6.19-1-MANJARO

File hashes

Hashes for tariff_td-1.0.tar.gz
Algorithm Hash digest
SHA256 970b9e8d0bbd6ee880224808260c3ef63dfe96e7619fea211f878bb9b05b2782
MD5 2188b548a5e5ba607805c83fef1874ab
BLAKE2b-256 e8642d3939f4c2df04b6b9d3f6a910e114e625d5209dec1a1945b98f5578954e

See more details on using hashes here.

File details

Details for the file tariff_td-1.0-py3-none-any.whl.

File metadata

  • Download URL: tariff_td-1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.11.8 Linux/6.6.19-1-MANJARO

File hashes

Hashes for tariff_td-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ed243eb6cea097ec7af973ec20fdb8b0015ae866c1363113931dac4015101abf
MD5 c523e886b45cdfcc5654e16813f91b88
BLAKE2b-256 b76fd82ce8349f94eef75ecd196c0f7432e8afeabae1656f3d3ac2f429d75884

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