Skip to main content

Game Sessions

Every bidding benchmark is unique to a given client, asset, and use case (buying load, selling solar, selling wind, trading DARTs). Each benchmark has a game_id.

A game session is a database object that points to a given optimization run. It can either be a live, backtest or search. It includes all of the performance data for various agent IDs and how they bid into markets over a given time range.

Trial Access

Forecast subscribers will need to request access to a trial bidding benchmark for these examples to work.

Each session contains four types of data structures:

  • Agents contains metadata about the agents that were run for the given range, including the forecast models that were used
  • Info contains metadata about the given run
  • Bids contains actual bids that were made by the agents, including the volume and market in which they participated
  • Paths is a large file that contains information on the exact price predictions that were used to generate bids

List Game Sessions

Grab your game_id from the front end (these rarely change unless you add new assets). Then, use the code below to list the runs available to you.



import pandas as pd
import requests
import arrow
import json

token = '<api-token>'

url = "https://app.enertel.ai/api/grid/game/<game_id>/sessions"


start = arrow.get()
response = requests.get(
url,
headers={
'Authorization': f'Bearer {token}'
},
)
end = arrow.get()
print(f"Time taken: {end - start}")

sessions = response.json()
pd.DataFrame(sessions)


Select most recent live run


# Sort by the ISO-format timestamp
live_sorted_sessions = sorted([s for s in sessions if s['type'] == 'live'], key=lambda x: arrow.get(x["created_at"]))

# Now live_sorted_sessions is ordered from earliest to latest

print(f"Last run live session:")
last_session = live_sorted_sessions[-1]
print(last_session)

Load Session Data


url = f"https://app.enertel.ai/api/grid/game/session/{last_session['id']}"

params = {
'distribution': 'false', # True if you want to see distribution of price paths (increases response time)
'paths': 'false' # True if you want to see raw price paths (increases response time)
}

start = arrow.get()
response = requests.get(
url,
headers={
'Authorization': f'Bearer {token}'
},
params=params

)

end = arrow.get()
print(f"Time taken: {end - start}")

bids = response.json()['data']['bids']

pd.DataFrame(bids).head(10)

API Docs

More comprehensive information on API response structures can be found here.