stripe-projects
stripe projects
eptr2-imbalance-costs
Calculate and analyze Turkish electricity imbalance costs including KUPST (Kesinleşmiş Üretim Planından Sapma Tutarı/Production Plan Deviation Cost), positive/negative imbalance penalties, and DSG (Dengeden Sorumlu Grup) tolerance calculations. Use when asking about imbalance settlement, deviatio...
Full skill instructions
This skill helps you calculate and analyze electricity imbalance costs in Turkey's energy market using the eptr2 Python library. Imbalance costs are critical for market participants who deviate from their scheduled positions.
from eptr2 import EPTR2
from eptr2.composite import get_hourly_price_and_cost_data
# Initialize
eptr = EPTR2(use_dotenv=True, recycle_tgt=True)
# Get comprehensive imbalance data
df = get_hourly_price_and_cost_data(
eptr,
start_date="2024-07-29",
end_date="2024-07-29"
)
# Columns include: pos_imb_price, neg_imb_price, pos_imb_cost, neg_imb_cost, kupst_cost
print(df[['date', 'mcp', 'smp', 'pos_imb_cost', 'neg_imb_cost', 'kupst_cost']])
| Turkish | English | Meaning | sd_sign |
|---|---|---|---|
| Enerji Açığı | Energy Deficit | System is short, up-regulation | -1 |
| Enerji Fazlası | Energy Surplus | System is long, down-regulation | +1 |
| Dengede | Balanced | System is balanced | 0 |
| Type | Turkish | When Applied |
|---|---|---|
| Positive Imbalance | Pozitif Dengesizlik | You have surplus energy (produced more or consumed less than scheduled) |
| Negative Imbalance | Negatif Dengesizlik | You have deficit energy (produced less or consumed more than scheduled) |
# Penalty margin = 3%
penalty_margin = 0.03
# Positive imbalance price (you receive)
pos_imb_price = (1 - penalty_margin) * min(MCP, SMP)
pos_imb_price = 0.97 * min(MCP, SMP)
# Negative imbalance price (you pay)
neg_imb_price = (1 + penalty_margin) * max(MCP, SMP)
neg_imb_price = 1.03 * max(MCP, SMP)
# Cost of positive imbalance (revenue foregone)
pos_imb_cost = MCP - pos_imb_price
# Cost of negative imbalance (penalty paid)
neg_imb_cost = neg_imb_price - MCP
KUPST applies to deviations from scheduled production plans (KGÜP).
kupst_multiplier = 0.03 # 3%
kupst_floor_price = 750 # TL/MWh
kupst_cost = max(MCP, SMP, kupst_floor_price) * kupst_multiplier
| Source | Tolerance |
|---|---|
| Wind | 17% |
| Solar | 10% |
| Other | 5% |
from eptr2.util.costs import (
calculate_unit_imbalance_cost,
calculate_unit_kupst_cost,
calculate_imb_cost,
calculate_imbalance_amounts
)
# Unit imbalance cost
mcp, smp = 2500, 2800
unit_costs = calculate_unit_imbalance_cost(mcp=mcp, smp=smp)
print(f"Positive imbalance cost: {unit_costs['pos']:.2f} TL/MWh")
print(f"Negative imbalance cost: {unit_costs['neg']:.2f} TL/MWh")
# KUPST cost
kupst = calculate_unit_kupst_cost(mcp=mcp, smp=smp)
print(f"KUPST cost: {kupst:.2f} TL/MWh")
from eptr2.util.costs import calculate_imb_cost
result = calculate_imb_cost(
actual=100, # Actual generation/consumption (MWh)
forecast=90, # Scheduled position (MWh)
mcp=2500, # Market Clearing Price
smp=2800, # System Marginal Price
is_producer=True, # True for generators
imb_tol=0.1, # 10% tolerance
return_detail=True
)
print(f"Total Imbalance Cost: {result['costs']['total_imb_cost']:.2f} TL")
from eptr2.composite import get_hourly_price_and_cost_data
df = get_hourly_price_and_cost_data(eptr, "2024-07-15", "2024-07-15")
# Example: 5 MWh surplus each hour
surplus_mwh = 5
daily_surplus_cost = (df['pos_imb_cost'] * surplus_mwh).sum()
print(f"Daily cost of 5 MWh/h surplus: {daily_surplus_cost:,.0f} TL")
# Example: 5 MWh deficit each hour
deficit_mwh = 5
daily_deficit_cost = (df['neg_imb_cost'] * deficit_mwh).sum()
print(f"Daily cost of 5 MWh/h deficit: {daily_deficit_cost:,.0f} TL")
df = get_hourly_price_and_cost_data(eptr, "2024-07-01", "2024-07-31")
# Group by system direction
direction_analysis = df.groupby('system_direction').agg({
'pos_imb_cost': 'mean',
'neg_imb_cost': 'mean',
'mcp': 'count'
}).rename(columns={'mcp': 'hours'})
print("Average Imbalance Costs by System Direction:")
print(direction_analysis)
Set credentials in .env file:
[email protected]
EPTR_PASSWORD=your_password
stripe projects
Harvest every `ponytail:` comment in the codebase into a debt ledger, so the deliberate shortcuts and deferrals ponytail leaves behind get tracked instead of rotting into "later means never". One-shot report, changes nothing.
okx dex market
okx agentic wallet
gmgn portfolio
okx dapp discovery
okx agent payments protocol
Stripe payment processing with checkout sessions, subscriptions, webhooks, and customer management.
Build comprehensive 3-5 year financial models with revenue projections, cost structures, cash flow analysis, and scenario planning for early-stage startups. Use this skill when creating financial projections, calculating burn rate or runway, modeling fundraising scenarios, or preparing investor-r...
Stock and cryptocurrency analysis with portfolio management and multi-dimensional scoring.
Real-time crypto derivatives positioning, whale tracking, liquidations, and institutional ETF flows across 37 specialized tools.
Master dbt (data build tool) for analytics engineering with model organization, testing, documentation, and incremental strategies. Use when building data transformations, creating data models, or implementing analytics engineering best practices.
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Stay Ahead with Finalle.ai: The Ultimate Financial News and Tools Platform
AI-powered Pine Script code generator for TradingView
Research stocks at the speed of thought.
Empower your investment strategies with AI signals, option flow data, and advanced chart patterns.
Danelfin review covering its AI stock and ETF scores, rankings, portfolio tools, current pricing, strengths, risks, and alternatives for investors.
A software for comprehensive market sentiment analysis.
'Stock Correlations' App by Freshly.ai: Reveal Stock Patterns and Trends