tsa.dashboard.update_balance#

DashboardAPI.update_balance(name, definition)#

Create or update a balance definition.

The definition is validated before being persisted: parsed, type-checked against the balance DSL, and checked for dangling series/basket references. A FigureError is raised on any validation failure.

tsa.dashboard.update_balance(
    'test_balance',
    '(balance "Test"'
    ' (config "UTC" (period "Daily" "D" (today) (today)))'
    ' (series "power.fr" sum (draw_option "power")))'
)

A figure then references the definition by name, rather than embedding it:

tsa.dashboard.update_figure(
    Figure(
        name='balance_view',
        variant=Balance(source='(balance "test_balance" #:period "Daily")'),
    )
)
Parameters:
  • name (str)

  • definition (str)

Return type:

None