Client API Reference
tyba_client.client
- class Market(*values)
Indicator for which market to pull pricing data for
- RT = 'realtime'
Indicates pricing data for the Real Time (RT) Market is desired
- DA = 'dayahead'
Indicates pricing data for the Day Ahead (DA) Market is desired
- class AncillaryService(*values)
Indicator for which service to pull pricing data for
- REGULATION_UP = 'Regulation Up'
Indicates pricing data for the Regulation Up service is desired
- REGULATION_DOWN = 'Regulation Down'
Indicates pricing data for the Regulation Down service is desired
- RESERVES = 'Reserves'
Indicates pricing data for the Reserves service is desired
- ECRS = 'ECRS'
Indicates pricing data for the ERCOT Contingency Reserve Service is desired
- class Ancillary(services)
Interface for accessing Tyba’s historical ancillary price data
- get_pricing_regions(*, iso, service, market)
Get the name and available year ranges for all ancillary service pricing regions that meet the ISO, service and market criteria.
- Parameters:
iso (
str
) – ISO name. Possible values can be found by callingServices.get_all_isos()
service (
AncillaryService
) – specifies which ancillary service to pull prices formarket (
Market
) – specifies whether to pull day ahead or real time prices for the given service
- Return type:
- Returns:
Response
containing an array of JSON objects with schemaAncillaryRegionData
. For example:[ { 'region': 'Pacific Northwest - SP15', 'start_year': 2010, 'end_year': 2025 }, { 'region': 'WAPA', ... }, ... ]
- get_prices(*, iso, service, market, region, start_year, end_year)
Get price time series data for a single region/service combination
- Parameters:
iso (
str
) – ISO name. Possible values can be found by callingServices.get_all_isos()
service (
AncillaryService
) – specifies which ancillary service to pull prices formarket (
Market
) – specifies whether to pull day ahead or real time prices for the given serviceregion (
str
) – specific region within the ISO to pull prices for. Possible values can be found by callingget_pricing_regions()
start_year (
int
) – the year prices should startend_year (
int
) – the year prices should end
- Return type:
- Returns:
Response
containing a JSON object with schemaPriceTimeSeries
. For example:{ 'prices': [ 61.7929, 58.1359, 61.4939, .... ], 'datetimes': [ '2022-01-01T00:00:00Z', '2022-01-01T01:00:00Z', '2022-01-01T02:00:00Z', .... ], }
- class LMP(services)
Interface for accessing Tyba’s historical energy price data
- get_all_nodes(*, iso)
Get node names, IDs and other metadata for all nodes within the given ISO territory.
- Parameters:
iso (
str
) – ISO name. Possible values can be found by callingServices.get_all_isos()
- Return type:
- Returns:
Response
containing an array of JSON objects with schemaNodeData
. For example:[ {'da_end_year': 2025, 'rt_end_year': 2025, 'rt_start_year': 2023, 'name': 'CLAP_WWRSR1-APND', 'id': '10017280350', 'da_start_year': 2023, 'zone': 'SDGE', 'type': 'GENERATOR'}, {'da_start_year': 2015, 'rt_end_year': 2025, 'zone': '', 'name': 'ELCENTRO_2_N001:IVLY2', 'type': 'SPTIE', 'substation': '', 'da_end_year': 2025, 'id': '10003899356', 'rt_start_year': 2015}, ... ]
- get_prices(*, node_ids, market, start_year, end_year)
Get price time series data for a list of node IDs
- Parameters:
- Return type:
- Returns:
Response
containing a JSON object whose keys are node IDs and whose values are objects with schemaPriceTimeSeries
. For example:{ '10000802793': { 'prices': [ 61.7929, 58.1359, 61.4939, .... ], 'datetimes': [ '2022-01-01T00:00:00', '2022-01-01T01:00:00', '2022-01-01T02:00:00', .... ], ... }, '20000004677': { ... }, ... }
- search_nodes(location=None, node_name_filter=None, iso_override=None)
Get a list of matching nodes based on search criteria. Multiple search criteria (e.g. location and node_name_filter) can be applied in a single request.
- Parameters:
location information. There are 3 possible forms:
city/state, e.g. ‘dallas, tx’
address, e.g. ‘12345 Anywhere Street, Anywhere, TX 12345’
latitude and longitude, e.g. ‘29.760427, -95.369804’
node_name_filter (
Optional
[str
]) – partial node name with which to perform a pattern-match, e.g. ‘HB_’iso_override (
Optional
[str
]) – ISO signifier, used to constrain search to a single ISO. When equal toNone
, all ISOs are searched based on other criteria. Possible values can be found by callingServices.get_all_isos()
- Return type:
- Returns:
Response
containing a JSON object. If matching nodes are found, a ‘nodes’ item will contain an array of objects with schemaNodeSearchData
. If no matching nodes are found, an error code will be returned. As an example, a successful search result might look like:{ "nodes": [ { "node/name": "HB_BUSAVG", "node/id": "10000698380", "node/iso": "ERCOT", "node/lat": 30.850714, "node/lng": -97.877628, "node/distance-meters": 500.67458 }, { "node/name": ..., ... }, ... ] }
- class Services(client)
Interface for accessing Tyba’s historical price data
- class Client(personal_access_token, host='https://dev.tybaenergy.com', request_args=None)
High level interface for interacting with Tyba’s API.
- Parameters:
personal_access_token (
str
) – required for using the python client/API, contact Tyba to obtain
- property ancillary: Ancillary
Shortcut to
client.services.ancillary
- property lmp: LMP
Shortcut to
client.services.lmp
- schedule(model)
Schedule a model simulation based on the given inputs
- Parameters:
model (
Union
[StandaloneStorageModel
,PVStorageModel
,PVGenerationModel
,DCExternalGenerationModel
,ACExternalGenerationModel
]) – a class instance of one of the model classes, e.g.StandaloneStorageModel
. Contains all required inputs for running a simulation- Return type:
- Returns:
Response
whose status code indicates whether the model was successfully scheduled. If successful, the response will contain a JSON object with an'id'
for the scheduled model run. This id can be used with theget_status()
andwait_on_result()
endpoints to retrieve status updates and model results. The presence of issues can be easily checked by calling theraise_for_status()
method of the response object. For example:resp = client.schedule(pv) resp.raise-for_status() # this will raise an error if the model was not successfully scheduled id_ = resp.json()["id"] res = client.wait_on_result(id_)
- get_status(run_id)
Check the status and retrieve the results of a scheduled model simulation. If a simulation has not completed, this endpoint returns the simulation status/progress. If the simulation has completed, it returns the model results.
- Parameters:
run_id (
str
) – ID of the scheduled model simulation- Returns:
Response
containing a JSON object with schemaModelStatus
- get_status_v1(run_id)
Deprecated, please use
get_status()
, which will support additional results schemas in the near future. Identical toget_status()
, but returns results for completed simulations in the “V1” SLD-style schema- Parameters:
run_id (
str
) – ID of the scheduled model simulation- Returns:
Response
containing a JSON object with schemaModelStatus
(except with a different schema forresult
)
- wait_on_result(run_id, wait_time=5, log_progress=False)
Poll for simulation status and, once complete, return the model results
- Parameters:
- Return type:
- Returns:
results dictionary equivalent to
ModelStatus.result
returned byget_status()
, with the exact schema depending on the model inputs
- wait_on_result_v1(run_id, wait_time=5, log_progress=False)
Deprecated, please use :meth:`wait_on_result, which will support additional results schemas in the near future`. Identical to
wait_on_result()
, but returns results for completed simulations in the “V1” SLD-style schema- Parameters:
- Returns:
results dictionary with “V1” SLD-style schema
- class NodeType(*values)
Indicator of which type of physical infrastructure is associated with a particular market node
- GENERATOR = 'GENERATOR'
Not sure
- SPTIE = 'SPTIE'
Not sure
- LOAD = 'LOAD'
Not sure
- INTERTIE = 'INTERTIE'
Not sure
- AGGREGATE = 'AGGREGATE'
Not sure
- HUB = 'HUB'
Not sure
- NA = 'N/A'
Not sure
- class NodeData
Schema for node metadata
-
field type:
NodeType
[Required] Identifier that indicates physical infrastructure associated with this node
-
field da_start_year:
float
[Required] First year in the Day Ahead (DA) market price dataset for this node
-
field da_end_year:
float
[Required] Final year in the Day Ahead (DA) market price dataset for this node
-
field rt_start_year:
int
[Required] First year in the Real Time (RT) market price dataset for this node
-
field type:
- class PriceTimeSeries
Schema for pricing data associated with a particular energy price node or ancillary pricing region
-
field datetimes:
list
[str
] [Required] Beginning-of-interval datetimes for the hourly pricing given in local time.
For energy prices, the datetimes are timezone-naive (no timezone identifier) but given in the local timezone (i.e. including Daylight Savings Time or DST). E.g. The start of the year 2022 in ERCOT is given as ‘2022-01-01T00:00:00’ as opposed to ‘2022-01-01T00:00:00-6:00’. Leap days are represented by a single hour, which should be dropped as a post-processing step.
For ancillary prices, the datetimes are in local standard time (i.e. not including DST) but appear to be in UTC (“Z” timezone identifier). E.g. The start of the year 2022 in ERCOT is given as ‘2022-01-01T00:00:00Z’ and not ‘2022-01-01T00:00:00-6:00’. Leap days are not included.
-
field datetimes:
- class NodeSearchData
Schema for search-specific node metadata. The (name ‘xxxx’) to the right of the field names can be ignored
-
field node_longitude:
float
[Required] (alias 'node/lng') longitude of the point on the electrical grid associated with the node
-
field node_latitude:
float
[Required] (alias 'node/lat') latitude of the point on the electrical grid associated with the node
-
field node_distance_meters:
Optional
[float
] = None (alias 'node/distance-meters') Distance from the node to the location parameter passed to
search_nodes()
. Not present if location is not given.
-
field node_longitude:
- class AncillaryRegionData
Schema for ancillary region metadata
- class ModelStatus
Schema for model status and results
-
field status:
str
[Required] Status of the scheduled run. Possible values are explained in Tyba Model Run Status Codes
-
field progress:
Optional
[str
] [Required] Percentage value indicating the progress towards completing a model simulation. Only present if
status
is not'complete'
.Note that in some cases the simulation may involve multiple optimization iterations, and the progress may appear to start over as each additional iteration is undertaken
-
field result:
Union
[GenerationModelResults
,PVStorageModelResults
,StandaloneStorageModelSimpleResults
,StandaloneStorageModelWithDownstreamResults
,None
] [Required] Model simulation results dictionary with schema defined depending on the model inputs, e.g. scheduling a
PVGenerationModel
will return a dictionary with schemaGenerationModelResults
. Only present ifstatus
is'complete'
-
field status:
tyba_client.forecast
- class Forecast(client)
- most_recent(object_name, product, start_time, end_time, forecast_type=None, predictions_per_hour=None, prediction_lead_time_mins=None, horizon_mins=None)
- most_recent_probabilistic(object_name, product, start_time, end_time, quantiles, forecast_type=None, predictions_per_hour=None, prediction_lead_time_mins=None, horizon_mins=None)
- vintaged(object_name, product, start_time, end_time, days_ago, before_time, exact_vintage=False, forecast_type=None, predictions_per_hour=None, prediction_lead_time_mins=None, horizon_mins=None)
- vintaged_probabilistic(object_name, product, start_time, end_time, quantiles, days_ago, before_time, exact_vintage=False, forecast_type=None, predictions_per_hour=None, prediction_lead_time_mins=None, horizon_mins=None)
- by_vintage(object_name, product, vintage_start_time, vintage_end_time, forecast_type=None, predictions_per_hour=None, prediction_lead_time_mins=None, horizon_mins=None)
- by_vintage_probabilistic(object_name, product, quantiles, vintage_start_time, vintage_end_time, forecast_type=None, predictions_per_hour=None, prediction_lead_time_mins=None, horizon_mins=None)
tyba_client.io (deprecated)
See Importing PAN and OND files instead
- pv_module_from_pan(pan_file, bifacial_ground_clearance_height=1.0, bifacial_transmission_factor=0.013)
DEPRECATED. See
generation_models.utils.pvsyst_readers.pv_module_from_pan()
.- Return type:
- inverter_from_ond(ond_file, includes_xfmr=True)
DEPRECATED. See
generation_models.utils.pvsyst_readers.inverter_from_ond()
.- Return type: