-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexamples.py
More file actions
447 lines (361 loc) · 15.6 KB
/
Copy pathexamples.py
File metadata and controls
447 lines (361 loc) · 15.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
"""
LNG Terminal Valuation Skill - Example Use Cases
This file demonstrates the skill in action for different user personas:
1. Investment Analyst (M&A due diligence)
2. Energy Trader (Market intelligence)
3. Project Developer (Feasibility study)
4. Portfolio Manager (Risk assessment)
"""
from lng_analyst import LNGAnalyst
from data_collector import LNGDataCollector
from valuation_engine import LNGTerminalValuation, ValuationAssumptions, compare_terminals
def separator(title):
"""Print formatted section separator"""
print("\n" + "="*80)
print(f" {title}")
print("="*80 + "\n")
# ============================================================================
# USE CASE 1: Investment Analyst - M&A Due Diligence
# ============================================================================
def use_case_investment_analyst():
"""
Scenario: Investment bank analyzing Cameron LNG for potential acquisition
Client wants to know: What's it worth? What are the risks?
"""
separator("USE CASE 1: Investment Analyst - M&A Due Diligence")
print("CLIENT BRIEF:")
print("Our client is considering acquiring Cameron LNG for $10B.")
print("We need to value the asset and identify key risks.\n")
analyst = LNGAnalyst()
collector = LNGDataCollector()
# Step 1: Get terminal data
cameron = collector.get_terminal_by_name('Cameron LNG')
print(f"Target: {cameron['Terminal Name']}")
print(f"Owner: {cameron['Owner']}")
print(f"Capacity: {cameron['Capacity (Bcf/d)']} Bcf/d\n")
# Step 2: Base case valuation
print("STEP 1: Base Case Valuation")
print("-" * 40)
assumptions = ValuationAssumptions(
tolling_fee=3.00,
utilization_rate=0.95,
discount_rate=0.08
)
val = LNGTerminalValuation(cameron, assumptions)
metrics = val.calculate_dcf()
print(f"Enterprise Value: ${metrics['Enterprise Value']/1e9:.2f}B")
print(f"NPV @ 8%: ${metrics['NPV']/1e9:.2f}B")
print(f"EV/EBITDA: {metrics['EV/EBITDA Multiple']:.1f}x")
print(f"Stabilized EBITDA: ${metrics['Stabilized EBITDA']/1e6:.0f}M\n")
# Step 3: Scenario analysis
print("STEP 2: Scenario Analysis (Bull/Base/Bear)")
print("-" * 40)
scenarios = {
'Bear (Recession)': {
'utilization_rate': 0.80,
'tolling_fee': 2.50,
'discount_rate': 0.10
},
'Base Case': {},
'Bull (Energy Crisis)': {
'utilization_rate': 1.05,
'tolling_fee': 3.50,
'discount_rate': 0.07
}
}
scenario_results = val.scenario_analysis(scenarios)
print(scenario_results.to_string(index=False))
print()
# Step 4: Investment recommendation
print("STEP 3: Investment Decision")
print("-" * 40)
purchase_price = 10.0 # $10B
base_ev = metrics['Enterprise Value'] / 1e9
implied_return = (base_ev / purchase_price - 1) * 100
print(f"Proposed Purchase Price: ${purchase_price:.1f}B")
print(f"Our Base Case Value: ${base_ev:.1f}B")
print(f"Implied Return: {implied_return:+.1f}%")
if base_ev > purchase_price * 1.15:
print("\n✅ RECOMMENDATION: STRONG BUY")
print(" Asset trading at significant discount to intrinsic value")
elif base_ev > purchase_price:
print("\n✅ RECOMMENDATION: BUY")
print(" Asset trading below fair value")
elif base_ev > purchase_price * 0.90:
print("\n⚠️ RECOMMENDATION: HOLD")
print(" Asset fairly valued, limited upside")
else:
print("\n❌ RECOMMENDATION: PASS")
print(" Asset overvalued, too much risk")
print("\nKEY RISKS:")
print("• Utilization: Breakeven = {:.0%}".format(val.calculate_breakeven_utilization()))
print("• Tolling fee: Breakeven = ${:.2f}/MMBtu".format(val.calculate_breakeven_tolling_fee()))
print("• Contract risk: {}% coverage".format(cameron['Contract Coverage (%)']))
# ============================================================================
# USE CASE 2: Energy Trader - Market Intelligence
# ============================================================================
def use_case_energy_trader():
"""
Scenario: Gas trader evaluating arbitrage opportunities
Needs to understand: Which terminals are most profitable? Where are margins?
"""
separator("USE CASE 2: Energy Trader - Market Intelligence")
print("TRADING BRIEF:")
print("Evaluate LNG export economics across Gulf Coast terminals.")
print("Identify best arbitrage opportunities.\n")
collector = LNGDataCollector()
# Step 1: Current market conditions
print("STEP 1: Market Snapshot")
print("-" * 40)
henry_hub = collector.get_current_henry_hub()
print(f"Henry Hub Spot: ${henry_hub:.2f}/MMBtu")
forward = collector.get_forward_curve(months=12)
avg_forward = forward['Forward Price ($/MMBtu)'].mean()
print(f"12-Month Forward Avg: ${avg_forward:.2f}/MMBtu")
print()
# Step 2: Terminal economics
print("STEP 2: Terminal Profitability Analysis")
print("-" * 40)
# Get operating terminals
operating = collector.search_terminals(status='Operating')
# Calculate margins for each
print(f"{'Terminal':<25} {'Capacity':<10} {'Est. Margin':<12} {'Economics'}")
print("-" * 70)
for _, terminal in operating.head(5).iterrows():
capacity = terminal['Capacity (Bcf/d)']
# Simplified margin calc: Tolling fee - Variable costs
tolling_fee = 3.00 # Assume market rate
variable_cost = 0.40 # Fixed opex
margin = tolling_fee - variable_cost
# Annual cash flow
annual_cf = capacity * 1000 * 360 * margin / 1e6 # $M
economics = "✅ Strong" if margin > 2.0 else "⚠️ Tight"
print(f"{terminal['Terminal Name']:<25} {capacity:<10.1f} ${margin:<11.2f} {economics}")
print()
# Step 3: Trading recommendation
print("STEP 3: Trading Strategy")
print("-" * 40)
print("BULLISH INDICATORS:")
print("✓ Henry Hub < $4.00 = Attractive feedgas costs")
print("✓ 100%+ utilization = Strong demand signal")
print("✓ Forward curve in contango = Inventory value")
print()
print("RECOMMENDATION: Long US LNG exposure")
print("• Buy Henry Hub calls (hedged feedgas)")
print("• Long Asian LNG spreads (export arb)")
print("• Monitor utilization for demand signals")
# ============================================================================
# USE CASE 3: Project Developer - Feasibility Study
# ============================================================================
def use_case_project_developer():
"""
Scenario: Developer evaluating greenfield LNG terminal in Texas
Needs to know: Is it economically viable? What tolling fee do I need?
"""
separator("USE CASE 3: Project Developer - Feasibility Study")
print("PROJECT BRIEF:")
print("Greenfield 2.0 Bcf/d LNG export terminal on Texas Gulf Coast")
print("Need feasibility analysis and required tolling fee.\n")
collector = LNGDataCollector()
# Project specs
print("STEP 1: Project Specifications")
print("-" * 40)
capacity_bcfd = 2.0
capacity_mtpa = capacity_bcfd * 7.5 # Rough conversion
capex = 8000 # $8B (modular technology)
print(f"Capacity: {capacity_bcfd} Bcf/d ({capacity_mtpa:.1f} mtpa)")
print(f"Technology: Baker Hughes Modular")
print(f"Estimated Capex: ${capex}M")
print(f"Construction: 3.5 years")
print()
# Create synthetic terminal for modeling
import pandas as pd
project = pd.Series({
'Terminal Name': 'Texas Coast LNG (Proposed)',
'Owner': 'NewCo Energy',
'Location': 'Corpus Christi, Texas',
'Capacity (Bcf/d)': capacity_bcfd,
'Capacity (mtpa)': capacity_mtpa,
'Capex ($M)': capex,
'Status': 'Announced',
'Technology': 'Baker Hughes Modular',
'Contract Coverage (%)': 80,
'Start Date': pd.Timestamp('2029-01-01')
})
# Step 2: Economic analysis
print("STEP 2: Financial Modeling")
print("-" * 40)
assumptions = ValuationAssumptions(
tolling_fee=3.00,
utilization_rate=0.95,
discount_rate=0.09, # Higher for greenfield risk
project_life=25
)
val = LNGTerminalValuation(project, assumptions)
metrics = val.calculate_dcf()
print(f"NPV @ 9%: ${metrics['NPV']/1e9:.2f}B")
print(f"IRR: {metrics['IRR']*100:.1f}%" if metrics['IRR'] else "N/A")
print(f"Payback: {metrics['Payback Period (years)']} years")
print()
# Step 3: Required returns
print("STEP 3: Required Economics")
print("-" * 40)
breakeven_fee = val.calculate_breakeven_tolling_fee()
print(f"Breakeven Tolling Fee: ${breakeven_fee:.2f}/MMBtu")
# Check market feasibility
benchmarks = collector.get_industry_benchmarks()
market_low = benchmarks['tolling_fee']['low']
market_high = benchmarks['tolling_fee']['high']
print(f"Market Range: ${market_low:.2f} - ${market_high:.2f}/MMBtu")
if breakeven_fee < market_low:
print("\n✅ PROJECT HIGHLY VIABLE")
print(" Breakeven below market floor")
elif breakeven_fee < market_high:
print("\n✅ PROJECT VIABLE")
print(" Breakeven within market range")
else:
print("\n❌ PROJECT AT RISK")
print(" Breakeven above market ceiling")
print("\nNEXT STEPS:")
print("• Secure 80%+ offtake contracts before FID")
print("• Lock in EPC pricing")
print("• Obtain FERC authorization")
print("• Finalize project financing")
# ============================================================================
# USE CASE 4: Portfolio Manager - Risk Assessment
# ============================================================================
def use_case_portfolio_manager():
"""
Scenario: Fund manager with $1B LNG infrastructure portfolio
Needs to: Stress-test portfolio, identify risks, optimize allocation
"""
separator("USE CASE 4: Portfolio Manager - Risk Assessment")
print("PORTFOLIO BRIEF:")
print("$1B diversified LNG infrastructure portfolio")
print("Holdings: Multiple terminals across operators")
print("Task: Stress test and optimize allocation\n")
collector = LNGDataCollector()
# Define portfolio
print("STEP 1: Current Portfolio Holdings")
print("-" * 40)
portfolio_holdings = {
'Sabine Pass LNG': 0.30, # 30% weight
'Cameron LNG': 0.25, # 25% weight
'Calcasieu Pass LNG': 0.20, # 20% weight
'Freeport LNG': 0.15, # 15% weight
'Corpus Christi LNG': 0.10 # 10% weight
}
total_value = 1.0 # $1B portfolio
print(f"{'Terminal':<25} {'Weight':<10} {'Value ($M)'}")
print("-" * 50)
for terminal, weight in portfolio_holdings.items():
value = weight * total_value * 1000
print(f"{terminal:<25} {weight:<10.0%} ${value:.0f}M")
print()
# Step 2: Stress testing
print("STEP 2: Stress Test Scenarios")
print("-" * 40)
# Get terminals and run stress scenarios
terminals = []
for name in portfolio_holdings.keys():
terminal = collector.get_terminal_by_name(name)
if terminal is not None:
terminals.append(terminal)
# Base case
base_assumptions = ValuationAssumptions(
utilization_rate=0.95,
tolling_fee=3.00,
discount_rate=0.08
)
base_comparison = compare_terminals(terminals, base_assumptions)
base_portfolio_value = sum(
base_comparison.iloc[i]['EV ($B)'] * list(portfolio_holdings.values())[i]
for i in range(len(base_comparison))
)
# Recession scenario
recession_assumptions = ValuationAssumptions(
utilization_rate=0.70,
tolling_fee=2.00,
discount_rate=0.12
)
recession_comparison = compare_terminals(terminals, recession_assumptions)
recession_portfolio_value = sum(
recession_comparison.iloc[i]['EV ($B)'] * list(portfolio_holdings.values())[i]
for i in range(len(recession_comparison))
)
# Energy crisis scenario
crisis_assumptions = ValuationAssumptions(
utilization_rate=1.10,
tolling_fee=4.50,
discount_rate=0.06
)
crisis_comparison = compare_terminals(terminals, crisis_assumptions)
crisis_portfolio_value = sum(
crisis_comparison.iloc[i]['EV ($B)'] * list(portfolio_holdings.values())[i]
for i in range(len(crisis_comparison))
)
print(f"{'Scenario':<20} {'Portfolio Value':<15} {'Change'}")
print("-" * 50)
print(f"{'Base Case':<20} ${base_portfolio_value:.2f}B {' --'}")
print(f"{'Recession (-30%)':<20} ${recession_portfolio_value:.2f}B {(recession_portfolio_value/base_portfolio_value-1)*100:+.1f}%")
print(f"{'Energy Crisis (+50%)':<20} ${crisis_portfolio_value:.2f}B {(crisis_portfolio_value/base_portfolio_value-1)*100:+.1f}%")
print()
# Step 3: Risk metrics
print("STEP 3: Portfolio Risk Metrics")
print("-" * 40)
# Value at Risk (simplified)
downside = base_portfolio_value - recession_portfolio_value
upside = crisis_portfolio_value - base_portfolio_value
print(f"Downside Risk (Recession): ${downside:.2f}B ({downside/base_portfolio_value*100:.1f}%)")
print(f"Upside Potential (Crisis): ${upside:.2f}B ({upside/base_portfolio_value*100:.1f}%)")
print(f"Risk/Reward Ratio: {upside/downside:.2f}x")
print()
# Step 4: Recommendations
print("STEP 4: Portfolio Recommendations")
print("-" * 40)
if downside / base_portfolio_value < 0.20:
print("✅ RISK LEVEL: MODERATE")
print(" Portfolio well-positioned for downturns")
else:
print("⚠️ RISK LEVEL: HIGH")
print(" Consider hedging or rebalancing")
print("\nRECOMMENDATIONS:")
print("• Maintain diversification across operators")
print("• Consider adding international exposure")
print("• Monitor contract expiration dates")
print("• Hedge commodity price risk (Henry Hub options)")
print("• Evaluate adding regasification assets (import side)")
# ============================================================================
# MAIN - Run All Use Cases
# ============================================================================
if __name__ == '__main__':
print("\n" + "="*80)
print(" LNG TERMINAL VALUATION SKILL - REAL-WORLD USE CASES")
print("="*80)
print()
print("This demonstration shows how different professionals use the skill:")
print(" 1. Investment Analyst - M&A due diligence")
print(" 2. Energy Trader - Market intelligence")
print(" 3. Project Developer - Feasibility study")
print(" 4. Portfolio Manager - Risk assessment")
print()
input("Press Enter to start demonstration...")
use_case_investment_analyst()
input("\nPress Enter for next use case...")
use_case_energy_trader()
input("\nPress Enter for next use case...")
use_case_project_developer()
input("\nPress Enter for next use case...")
use_case_portfolio_manager()
print("\n" + "="*80)
print(" DEMONSTRATION COMPLETE")
print("="*80)
print()
print("All use cases completed successfully!")
print("These examples show the skill's flexibility across different workflows.")
print()
print("Next steps:")
print(" • Try interactive mode: python lng_analyst.py")
print(" • Read the documentation: README.md")
print(" • Customize for your needs!")
print()