"""Offline teaching calculations for Litecoin.watch, 22 October 2026. All hashrates, prices, costs, pool outcomes and yields below are synthetic. No network access, wallet operations, mining jobs, transfers or file writes. Python 3 standard library only. Save this file as calculations.py and run it. """ from decimal import Decimal as D, getcontext from math import exp, sqrt import json getcontext().prec = 40 def calculate(): fraction = D(16) / D(3000000) # GH/s divided by GH/s, each modeled chain ltc = fraction * D(576) * D("6.25") doge = fraction * D(1440) * D(10000) net_ltc, net_doge = ltc * D(".98"), doge * D(".98") gross_value = ltc * 60 + doge * D(".10") net_value = net_ltc * 60 + net_doge * D(".10") electricity = D("3.36") * 24 * D(".10") gross_after_halving = ltc / 2 * 60 + doge * D(".10") pplns = {str(blocks): D(blocks) * D("6.25") * D(16) / D(300000) * D(".98") for blocks in [40, 58, 75]} pool_lambda = 576 * .10 solo_lambda = float(fraction * 576) interest = D(10) * D(".05") * 90 / 365 net_interest = interest - D(".02") final_ltc = 10 + net_interest lp_x = (D(6000) / 120).sqrt() lp_y = D(6000) / lp_x lp_value = lp_x * 120 + lp_y hold_value = D(10) * 120 + 600 return { "kind": "SYNTHETIC_TEACHING_CALCULATIONS_NOT_LIVE_QUOTES", "gross_ltc_per_day": ltc, "gross_doge_per_day": doge, "net_ltc_per_day_after_assumed_2pct": net_ltc, "net_doge_per_day_after_assumed_2pct": net_doge, "gross_value_usd_per_day": gross_value, "net_coin_revenue_usd_per_day": net_value, "electricity_usd_per_day": electricity, "margin_before_other_costs_usd_per_day": net_value - electricity, "gross_value_after_only_ltc_halving_usd": gross_after_halving, "gross_value_drop_percent": (1-gross_after_halving/gross_value)*100, "idealized_pplns_ltc_by_pool_blocks": pplns, "pool_ltc_blocks_expected_per_day": pool_lambda, "pool_ltc_block_count_cv_day": 1/sqrt(pool_lambda), "pool_ltc_block_count_cv_30days": 1/sqrt(pool_lambda*30), "solo_ltc_blocks_expected_per_day": solo_lambda, "solo_ltc_mean_interval_days": 1/solo_lambda, "solo_ltc_probability_zero_blocks_365days": exp(-solo_lambda*365), "yield_simple_5pct_apr_90days_gross_ltc": interest, "yield_costs_ltc": D(".02"), "yield_90days_net_ltc": net_interest, "yield_final_ltc": final_ltc, "yield_net_period_return_percent": net_interest/10*100, "yield_simple_annualized_net_percent": net_interest/10*365/90*100, "yield_ending_usd_at_assumed_40": final_ltc*40, "apy_5pct_apr_compounded_monthly_percent": ((1+D(".05")/12)**12-1)*100, "one_percent_daily_year_balance_multiplier": D("1.01")**365, "constant_product_ltc_units_at_price_120": lp_x, "constant_product_stable_units_at_price_120": lp_y, "constant_product_value_usd": lp_value, "hold_original_pair_value_usd": hold_value, "constant_product_difference_vs_holding_percent": (lp_value/hold_value-1)*100, "target_cases": [{"work":n,"parent_target":100,"aux_target":400,"meets_parent":n<=100,"meets_aux":n<=400} for n in [80,250,500]] } def check(r): assert r["gross_ltc_per_day"] == D(".0192") assert r["gross_doge_per_day"] == D("76.8") assert r["net_ltc_per_day_after_assumed_2pct"] == D(".018816") assert r["net_doge_per_day_after_assumed_2pct"] == D("75.264") assert r["net_coin_revenue_usd_per_day"] == D("8.65536") assert r["electricity_usd_per_day"] == D("8.064") assert r["margin_before_other_costs_usd_per_day"] == D(".59136") assert r["gross_value_after_only_ltc_halving_usd"] == D("8.256") assert round(r["gross_value_drop_percent"],2) == D("6.52") assert r["idealized_pplns_ltc_by_pool_blocks"]["75"] == D(".0245") assert round(r["idealized_pplns_ltc_by_pool_blocks"]["40"],8) == D(".01306667") assert round(r["idealized_pplns_ltc_by_pool_blocks"]["58"],8) == D(".01894667") assert abs(r["solo_ltc_probability_zero_blocks_365days"]-.32586242366032314) < 1e-14 assert round(r["yield_final_ltc"],8) == D("10.10328767") assert round(r["yield_simple_annualized_net_percent"],4) == D("4.1889") assert round(r["apy_5pct_apr_compounded_monthly_percent"],4) == D("5.1162") assert round(r["one_percent_daily_year_balance_multiplier"],2) == D("37.78") assert round(r["constant_product_value_usd"],2) == D("1697.06") assert round(r["constant_product_difference_vs_holding_percent"],2) == D("-5.72") assert r["target_cases"][1]["meets_aux"] and not r["target_cases"][1]["meets_parent"] assert D(".00002000") * 100000 == 2 assert 200*2 == 400 assert D("1")-D(1410)/100000000 == D(".99998590") assert D(".01")+D(".018816")-D(".02") == D(".008816") return 24 if __name__ == "__main__": results=calculate() checks=check(results) print(json.dumps({"arithmetic_assertions":checks,"results":results},default=str,indent=2))