Skip to content

Instantly share code, notes, and snippets.

View Neelesh2005's full-sized avatar
๐Ÿ˜
Happy

Neelesh Shukla Neelesh2005

๐Ÿ˜
Happy
View GitHub Profile
import json
import numpy as np
from datetime import datetime, timedelta
from scipy.interpolate import RegularGridInterpolator
sample_json_data = '''[
{
"timestamp": "2025-08-25T16:50:00Z",
"underlying_symbol": "NIFTY",
"underlying_price": 24967.75,
import yfinance as yf
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
# Function to calculate the Stochastic Oscillator
def calculate_stochastic(data, n=14, smoothing=3):
"""
Calculate the Stochastic Oscillator (%K and %D).
- n: Lookback period for the high-low range.
@Neelesh2005
Neelesh2005 / cov_plot.py
Created September 12, 2024 19:51
Risk Return plotting of three high return stocks using covariance matrix
import numpy as np
import yfinance as yf
import matplotlib.pyplot as plt
# Define stocks and time period
stocks = ['AAPL', 'GOOGL', 'MSFT']
start_date = '2020-01-01'
end_date = '2023-01-01'
# Download historical adjusted close prices