Changelog¶
All notable changes to eptr2 are documented here.
Version 1.4.1 (2026-11-17)¶
KÜPST checked against the EPDK decisions, EPİAŞ's GİP bid/ask label swap and duplicated imbalance rows, two new calls and a GİP statistics composite.
Breaking changes¶
idm-qty(get_idm_qty) (#7): EPİAŞ returns GİP purchases (Alış) asclearingQuantityAskand sales (Satış) asclearingQuantityBid. The DataFrame now corrects them:clearingQuantityBid= bought,clearingQuantityAsk= sold. Code that swapped the columns itself must drop that swap.postprocess=Falsestill returns the raw response;get_dabi_idm_data(idm_long/idm_short) was already correct.idm_tadis renamedidm_madinget_org_estimated_activity,calculate_org_activityandcalculate_idm_contract_stats: it is the per-MWh mean absolute deviation of trade prices from WAP (TL/MWh).day_trade_tad = day_trade × idm_madkeeps its name (the total, TL).calculate_org_activitywarns when it gets only the oldidm_tad.get_org_estimated_activitywrites its CSV files by default (export_to_csv=True) and its price file isprices(fromget_hourly_price_and_cost_data) instead ofmcpandwap; files from 1.4.0 are fetched again.get_reference_imbalance_costsis built onget_hourly_price_and_cost_dataand returns its column names (mcp,smp,pos_imb_price, …) plusref_imb_cost.- KÜPST results change for the categories corrected below.
Added¶
get_idm_contract_stats(start_date, end_date, eptr=...): market-wide GİP statistics per hourly contract from the trade log:idm_wap,idm_mad(TL/MWh),idm_tad(TL,idm_mad × idm_volume_mwh), trade count and volume. The log and the statistics are written to CSV and read back before fetching (export_to_csv=True,check_existing=True); logs or files that miss days of the period (e.g. a failed request) are neither written nor read, and a log passed in asidm_log_dfis not written.get_org_estimated_activity(include_tad=True)uses it.calculate_idm_contract_statsnow lives ineptr2.composite.idm_log(still importable fromorg_activity).- New calls
meter-count(Sayaç Adedi: the whole monthly meter count series) andmultiple-factor-bulk(Çarpan Değeri for one distribution company, all profile groups and meter reading types, up to three months fromperiod;distribution_idfrommf-distribution), with wrappersget_meter_countandget_multiple_factor_bulk. 236 call keys. Of the other endpoints in EPİAŞ's technical documentation, AUF (maximum-settlement-price, last data 2023-09) and five YEKDEM endpoints have had no data for years, and the rest serve the platform's home page and charts, so they are not added. eptr.call(..., drop_duplicates=True)(defaultFalse) drops rows that are identical in every column, with a warning. EPİAŞ'smcp-smp-imbreturns every hour of 2026-11-01 twice, which doubled that day in the price and cost functions;get_hourly_price_and_cost_data,calculate_imbalance_pricesand the MCP imbalance price tool use it, andcalculate_imbalance_priceskeeps one row per hour of any input (raisingValueErrorfor conflicting rows of an hour).- KÜPST categories
other_renewable(hydro, geothermal, biomass, …: tolerance and multiplier of other sources, maintenance multiplier from 30 fault entries like wind and solar) and, from 2027-01-01 (Decision 14907, Provisional Article 1),consumption_art17(tolerance 0.75) andconsumption_other(0.30), n = 0.01, in a new27_01regulation row.regulation_period="current"is now27_01(production values unchanged).kupst_appliestells whether KÜPST applies to a unit.
Fixed¶
- KÜPST coefficients of
26_01(2026-01-01 to 2026-10-31) per EPDK Decision 14029 (#8): transmission-connected unlicensed plants n = 0.02 (was 0.05), plants with storage n = 0.10 (fell back toother, 0.05), and the 0.08 maintenance multiplier applies from 30 monthly fault entries for renewables and 25 for other sources (it could never apply before). The26_02row cites Decisions 14907 and 14911. calculate_imbalance_costs: consumers pay KÜPST from 2027-01-01 (a consumer without a consumption category isconsumption_other), and a consumption category makes the row a consumer.calculate_kupst_cost(source=…)took the tolerance from the source but the multiplier and floor fromother;calculate_portfolio_costsused theothermultiplier for every plant. Both follow the category now.calculate_kupst_cost(..., return_detail=True):kupsm_tolis the tolerance amount in MWh, not the ratio; consumption sources before 2027 return zero instead of raising.calculate_kupsmworks with negative (consumption) plans.calculate_unit_kupst_cost_2026(source=…)raised for sources outside its draft-regulation shortcut.normalize_kupst_category:dammedHydro, Hidro, Nehir and BES map toother_renewable; "Depolama tesisi" is standalone storage (battery), not a plant with storage.- Request bodies accept numpy / pandas values: an id taken from a DataFrame
(
int64) raised "not JSON serializable", and arrays and Series are sent as lists. calculate_portfolio_costsreads its cached export without logging in.- Composites reuse other composites and share one client:
calculate_portfolio_costsand the generation organization wrappers no longer log in for each plant, period or step. - Checked against EPİAŞ's electricity technical documentation v1.16.4:
dam-block-bid/dam-block-offerhelp says blocks span at least 3 hours (was 4);ren-total-costhas a newlumUretimYektobcolumn, which passes through.
Documentation¶
calculate_imbalance_costsdocuments the choice offorecast(KUDÜP approximates settlement, with plant-level YAL/YAT unavailable and taken as 0; KGÜP v1 is a what-if with the day-ahead plan unchanged), the storage cases of Article 3(3), and the decision rules it does not model (net UEVM − UEÇM deviation, generation-only for unlicensed plants, per-participant aggregation, the Art. 5 exclusion). Docstring examples show the real outputs (with the 750 TL/MWh floor).- The
idm-qtytrap is documented in AGENTS.md, the help text and the market-operations, convenience-wrappers and API-discovery skills.
Deprecated¶
- The cost list helpers (
calculate_imbalance_cost_list,calculate_diff_costs_list,calculate_kupst_cost_list, the*_pre_2026andtemp_*helpers,calculate_imbalance_price_and_costs_2026) will be removed in 1.5.0; their warnings name the replacements.
Development¶
- CI runs on
mainand pull requests only, with lockeduvinstalls and a cache; a rate limiter test no longer sleeps 30 s (offline suite about 5 s).
Version 1.4.0 (2026-10-30)¶
Endpoint mappings were reviewed against EPİAŞ's technical documentation (electricity, natural gas, reporting) and every call key was exercised against the live API.
Security¶
- Minimum versions raised to patched releases:
urllib3>=2.8.0(runtime dependency; chunked-response memory and HTTPS-proxy TLS advisories) andfastmcp>=3.4.10in themcp/allextrasextras (component authorization advisory). The lock file also movesmcp1.30.0,PyJWT2.15.1,anyio4.14.2 andopentelemetry-api1.45.2 to their patched versions, staying on the same major versions. - The patched versions are also minimums in
pyproject.toml(not only in the lock file), in themcp/allextrasextras:mcp>=1.30.0,pyjwt>=2.15.0,anyio>=4.14.2,opentelemetry-api>=1.45.1. certifi>=2026.10.19in themcp/allextras/docsextras and the docs dependency group: earlier bundles trust emSign roots whose intermediate CA keys were compromised (GHSA-6q48-6c7w-9gw2, critical). certifi reaches eptr2 only through the MCP stack (httpx); eptr2's own API calls use the system trust store.
Fixed¶
calculate_kupst_cost_by_contract,calculate_diff_costs_by_contractandcalculate_unit_price_and_costs_by_contracttook KÜPST tolerance or multiplier from the regulation period's base table instead of the contract's date;include_maintenance_penaltyoverrode a multiplier passed in.gather_and_calculate_plant_costsapplied today's tolerance to every hour and theothermultiplier to every plant type.get_dabi_idm_data/get_day_ahead_and_bilateral_matches: documented columns and signs (nets are long minus short = net purchases), the per-organization GİP bid/ask swap (clearingQuantityAsk= bought,clearingQuantityBid= sold), and a newnet_salescolumn (positive = net seller).get_dabi_idm_data_periodand the GİP fetch now pass**kwargs(retry and timeout options were dropped). Offline regression test with a stubbed client.capacity-demandandintl-capacity-demand-direction-listcalled the line-capacities endpoints (#6); they now return capacity-auction requests (auctionCode,requestedCapacity,allocatedCapacity,clearencePrice, …).eligible-consumer-quantityrequiresstart_date/end_date(it always returned HTTP 400).ra-meterswithra_spg_name(andget_ra_meters) raisedTypeError; the filter now maps tosubscriberProfileGroupName.ra-meter-volumes-period/-version: optional parameters were registered under a misspelled key and dropped; the profile-group filter issubscriber_pg.- Optional parameters passed as
Noneare no longer sent (aNonedate crashed the generated wrappers). page-update-dateraised under the defaultpostprocess=True.- Help entries for
idm-order-historyandng-physical-realization. calculate_unit_imbalance_price_by_contractandcalculate_unit_imbalance_cost_by_contractused the price ceiling in force TODAY, not on the contract's date: January–March 2026 hours at the 3400 TL/MWh cap missed the 1.05 ceiling surcharge (483 of 15,635 published hours 2025-01..2026-10 differed frommcp-smp-imb; 0 after the fix). They now resolve floor and ceiling from the contract like the other*_by_contracthelpers; explicitfloor_price/ceil_pricestill win.get_time_min_max_price_map: the 3,000 TL/MWh cap (GİP 3,090) starts on 2024-07-01, not 2024-06-01. In June 2024 PTF and SMF topped out at exactly 2,700 and GİP trades at exactly 2,781 (= 2,700 × 1.03); the first 3,000 / 3,090 prices are on 2024-07-01. June 2024 contracts now resolve to the 2,700 cap (contract_to_floor_ceil_prices, the*_by_contractimbalance helpers).get_time_min_max_price_map: the GİP (IDM) ceiling is 3,760 TL/MWh from 2023-02-01 (was 3,759.5) and 3,142 from 2023-03-01 (was 3,141.5). EPİAŞ rounds 1.03 × the PTF cap up to the lira: February 2023 PH contracts traded at most 3,760.00 (121 trades at exactly that price, none above) and March 2023 at most 3,142.00 (142 trades, none above).get_uevcb_ids(and theperiodic_orgswrappers that call it) capped the current month at the process's local date instead of today's date in Istanbul: on a host behind Turkey (e.g. Europe/Berlin, UTC) the last day queried was yesterday between Istanbul midnight and local midnight. It now uses Istanbul wall-clock time.
Added¶
- Main cost functions in
eptr2.util.costs, working with or without pandas: calculate_imbalance_prices(start_date, end_date, ...): hourly imbalance prices, unit costs and every parameter used (regulation period, floor/ceiling, V, B, margins, KÜPST tolerance, multiplier and floor), resolved per hour. MCP, SMP and system direction are fetched frommcp-smp-imbunlesspricesis given. EPİAŞ's published imbalance prices are used where available (imb_price_source); they are calculated only for hours without them (scenarios, offline use). Hours without SMP, such as the rest of the current day, are skipped with a warning.include_calculated=Trueadds the calculated prices for comparison.calculate_imbalance_costs(data, category=..., ...): imbalance and KÜPST costs of actual vs forecast rows, usingcalculate_imbalance_prices; the category (any naming convention) and producer/consumer can be set per row.- Regulation values that change over time come from one dated table
(
get_time_regulation_params_map) and are applied by every*_by_contracthelper; explicit arguments still win. From the first delivery hour of 2026-11-01:Vis 100 (was 150), and KÜPST tolerance and multiplier depend on the KÜPST category: wind 15% / 0.05, solar 8% / 0.05, generation with storage (plant_w_battery) 5% / 0.10, other 5% / 0.05, transmission-connected unlicensed 20% / 0.02, distribution-connected unlicensed (per participant) 25% / 0.01, standalone storage (battery) 20% / 0.02. The 0.08 maintenance multiplier applies to wind and solar from 30, other sources from 25 monthly fault entries (is_kupst_maintenance_penalty_applicable).source/categoryaccepts these categories;normalize_kupst_categorymaps other naming conventions (Turkish labels, RES/GES/HES, BESS, ...) to them, andunlicensedmaps tounlicensed_from_transmission. get_org_estimated_activitycomposite: a company's estimated hourly activity over a date range. Splits day-ahead (GÖP + İA) open / intraday close (dabi_idm_close), intraday day trade (min(idm_long, idm_short)), the day-ahead (GÖP + İA) net positiondabi_netand the total net positiondabi_idm_net(to be consumed or generated), from the organization's GÖP, İA and GİP matchings only.include_pnl=Trueadds a fictitious PnL of day-ahead open / intraday close trades (dabi_idm_pnl) from MCP and the published intraday WAP.include_tad=Trueadds volatility metrics, not PnL: the TAD (total absolute deviation, quantity-weighted mean |price − WAP|) of each contract from the market-wide trade log (idm_log_longer) andday_trade_tad = day_trade × TAD. The log is much slower.verbose=Truelogs each step with timings.export_to_csv=Truewrites the raw data (positions, MCP, WAP, trade log, per-contract WAP/TAD) and the result toexport_diras CSV;check_existing=Truereads files of the same period instead of fetching them.end_datemust be before today (Europe/Istanbul). Helperscalculate_idm_contract_statsandcalculate_org_activityare pure.idm_log_longer(verbose=True)logs the trade count and duration of each request.ren-capacity-old— YEKDEM installed capacity up to the YEKDEM deadline.ren-participant-year-list— years available forren-participant-list.
Breaking¶
- Regulation periods: contracts from 2026-11-01 are period
26_02(get_regulation_period_by_contract),26_01covers 2026-01-01 to 2026-10-31, andcurrentmeans the newest period. Each period label pins its own parameter row (get_regulation_params). - Contract-free 2026 functions take their defaults from the newest parameter
row instead of literals:
V,B, margins and floor/ceiling incalculate_unit_imbalance_price_2026/_cost_2026, KÜPST multiplier and floor, KÜPST tolerance and the 5% DSG tolerance. Calls without a contract or period now use V=100 (the 2026-11-01 values); passV=150,regulation_period="26_01"or a contract to reproduce earlier results. Pre-2026 functions keep their fixed values. - Removed
calculate_imb_cost_pre_2026,calculate_diff_cost_pre_2026andcalculate_kupsm_list, deprecated since 1.3.3 for removal in 1.4.0. (calculate_kupst_cost_liststays while the deprecatedcalculate_diff_costs_listuses it.) capacity-demandreturns different columns (the real endpoint's).interim-mcp/get_interim_mcptakestart_dateonly; the endpoint ignoredend_dateand returned the start day.eligible-consumer-countdropsdistrict_name,pg_name,province_id; the endpoint never applied them.
Version 1.3.8 (Development)¶
Added¶
eptr2.callspackage — typed convenience wrappers for every endpoint (get_mcp,get_smp,get_rt_cons, …). 231 endpoints + 2 aliases = 233 top-level functions.- Bilingual (EN/TR) docstrings on each wrapper, sourced from
eptr2.mapping.help.get_help_d, including category and the EPIAS reference URL. - Type hints on every parameter (
str,str | int,list,bool). - Optional
eptrargument with lazyEPTR2()construction when omitted. scripts/generate_call_wrappers.pyregenerator for the wrapper package.- Parametrised test suite
tests/test_call_wrappers.py(655 cases) covering wrapper existence, parameter forwarding, required-arg enforcement, alias routing, and__all__coverage. - New documentation pages: Convenience Wrappers (user guide) and Convenience Wrappers (API reference).
Changed¶
- The legacy
src/eptr2/calls/market.pyis superseded by the generated per-category modules (dam.py,bpm.py,consumption.py,generation.py,idm.py, …).
Version 1.3.4 (Development)¶
Added¶
- MkDocs documentation with Material theme
- GitHub Pages deployment workflow
Changed¶
- Documentation improvements
Version 1.3.3¶
Important¶
- Breaking changes due to regulatory changes by EPDK
- Overhaul planned for version 1.4.0
Changed¶
- Updated API mappings for regulatory compliance
Version 1.3.0¶
Added¶
- MCP (Model Context Protocol) server for AI agent integration
- Claude Desktop integration support
- Agent skills for specialized domain queries
Changed¶
- eptr2 now evolves to be an AI-oriented tool
Version 1.2.4¶
Critical¶
- Authentication method changes require update to 1.2.4+
Added¶
- MCP server module (
eptr2.mcp) eptr2-mcp-servercommand-line entry point
Fixed¶
- Authentication handling improvements
Version 1.2.3¶
Added¶
.envfile support for credentials- TGT (Ticket Granting Ticket) recycling
use_dotenvparameterrecycle_tgtparameter.eptr2-tgtfile for TGT storage
Changed¶
- Improved credential management
Version 1.2.0¶
Added¶
- Composite functions module
get_hourly_consumption_and_forecast_dataget_hourly_price_and_cost_data
Changed¶
- Enhanced DataFrame postprocessing
Version 1.1.0¶
Added¶
- New login method with automatic TGT management
eptr_w_tgt_wrapperfunctiongenerate_eptr2_credentials_fileutility
Deprecated¶
- Direct credentials file path (use
.envinstead)
Version 1.0.2¶
Added¶
- Calculator tutorial app (
run_calc_app) - Imbalance cost calculation helpers
Version 1.0.0¶
Added¶
- Initial stable release
- 213+ API endpoints
- Pandas DataFrame integration
- Streamlit demo app
- Live tutorial feature
Core Features¶
- EPTR2 class for API access
- Automatic authentication
- Response postprocessing
- Call discovery methods
Migration Guides¶
Migrating from 1.2.x to 1.3.x¶
-
Update authentication:
-
Create
.envfile:
Migrating from 1.1.x to 1.2.x¶
- Replace credentials file with
.env: