Created
June 26, 2025 01:15
-
-
Save machard/5a940852aaada4ac7ce0029c566a1bcb to your computer and use it in GitHub Desktop.
bitcoin price model
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
from scipy.interpolate import interp1d | |
# --- Parameters --- | |
k = 0.48 | |
peak_value = 115000 | |
t0 = 2025 | |
A = peak_value * 4 / k # Ensures derivative sigmoid peaks at 115K | |
# Time vector | |
t = np.linspace(2005, 2045, 1000) | |
# Sigmoid and its derivative | |
def sigmoid(t): | |
return A / (1 + np.exp(-k * (t - t0))) | |
def d_sigmoid(t): | |
return (A * k * np.exp(-k * (t - t0))) / ((1 + np.exp(-k * (t - t0)))**2) | |
y_sigmoid = sigmoid(t) | |
y_derivative = d_sigmoid(t) | |
# --- Log-shaped BTC price with chaos --- | |
x = (t - t0) / 5 | |
log_like = np.exp(-0.5 * x**2) | |
np.random.seed(42) | |
noise = np.random.normal(0, 0.15, size=len(t)) | |
btc_raw = log_like * (1 + noise) | |
# Normalize to price range | |
price_min, price_max = 1, peak_value | |
btc_scaled = price_min + (btc_raw - btc_raw.min()) / (btc_raw.max() - btc_raw.min()) * (price_max - price_min) | |
# --- Anchor point correction --- | |
anchor_years = np.array([2010, 2013, 2017, 2018, 2021, 2022, 2025]) | |
anchor_prices = np.array([0.1, 1000, 20000, 3000, 60000, 16000, 115000]) | |
anchor_interp = interp1d(anchor_years, anchor_prices, kind='linear', fill_value='extrapolate') | |
anchor_curve = anchor_interp(t) | |
# Blend anchors into the curve | |
btc_price = 0.85 * btc_scaled + 0.15 * anchor_curve | |
# --- Post-2025 compression --- | |
post_mask = t > t0 | |
compression = np.exp(-0.1 * (t - t0)) # exponential decay after 2025 | |
btc_price[post_mask] *= compression[post_mask] | |
# Final clamp under truth arc | |
btc_price = np.clip(btc_price, price_min, y_derivative * 0.97) | |
# --- Plotting --- | |
fig, ax1 = plt.subplots(figsize=(12, 6)) | |
# Red: Derivative Sigmoid | |
ax1.plot(t, y_derivative, color='red', linewidth=2.5, label='Truth Arc: Derivative Sigmoid') | |
# Blue: BTC Price (log-shaped + noise + anchors + compression) | |
ax1.plot(t, btc_price, color='blue', linewidth=1.8, label='BTC Price (Log-shaped, Anchored, Bounded)') | |
# Left Y axis | |
ax1.set_ylabel('BTC Price Projection (USD)', fontsize=12, color='red') | |
ax1.tick_params(axis='y', labelcolor='red') | |
ax1.set_ylim(0, peak_value * 1.1) | |
# Peak marker | |
ax1.axvline(x=t0, color='gray', linestyle=':', linewidth=1) | |
ax1.text(t0 + 0.5, peak_value * 0.08, 'Peak Year: 2025', color='gray') | |
# Orange: Sigmoid on secondary axis | |
ax2 = ax1.twinx() | |
ax2.plot(t, y_sigmoid, color='orange', linewidth=2.5, linestyle='--', label='Belief Accumulation: Sigmoid') | |
ax2.set_ylabel('Cumulative Belief (Arbitrary Units)', fontsize=12, color='orange') | |
ax2.tick_params(axis='y', labelcolor='orange') | |
ax2.set_ylim(0, max(y_sigmoid) * 1.05) | |
# Grid & Labels | |
plt.title('BTC Emergence: Log-shaped Price, Truth Arc & Belief Sigmoid', fontsize=14) | |
ax1.set_xlabel('Year', fontsize=12) | |
ax1.grid(True, linestyle='--', alpha=0.5) | |
# Unified legend | |
lines1, labels1 = ax1.get_legend_handles_labels() | |
lines2, labels2 = ax2.get_legend_handles_labels() | |
fig.legend(lines1 + lines2, labels1 + labels2, loc='upper left', fontsize=10) | |
plt.tight_layout() | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment