Skip to main content
engratepy is Engrate’s Python SDK for Cost of Energy. Use it to:
  • calculate tariff cost from your own time-series data
  • discover which input datasets a tariff needs
  • embed tariff cost into optimisation models (HiGHS and Gurobi)

Install

pip install engratepy # Coming soon
Contact support@engrate.io if you want to try it out before the public release.

Authenticate

Create a client with your API key:
from engratepy import Engrate

engrate = Engrate(api_key="YOUR_API_KEY")

Calculate Cost

Run a cost calculation over a period:
component_costs = await engrate.calculate_cost(
    tariff_id=tariff_id,
    start_time=start_time,
    end_time=end_time,
    data=data,
)

for component in component_costs:
    print(component.component.name, list(component.cost.values()))

Discover Required Input Datasets

Before calculating or optimising, you can ask the SDK which datasets are required:
datasets = await engrate.get_input_datasets(
    tariff_id=tariff_id,
    start_time=start_time,
    end_time=end_time,
)

for dataset in datasets:
    print(dataset.id, dataset.resolution, dataset.unit)

Use in Optimisation Models

engratepy can add tariff cost directly to solver models:
  • add_to_highs_model(...)
  • add_to_gurobi_model(...)
Need support for another solver? We would love to hear from you - contact support@engrate.io and we can discuss your use case.

License

engratepy is available under an evaluation license. You are welcome to use it for internal evaluation, testing, learning, and prototyping in non-production environments. Production or commercial use requires a separate signed commercial license with Engrate. To discuss commercial licensing, contact support@engrate.io.