日本の長期金利の推移(1986〜)
from 金融投資
長期金利=10年国債の利回り
https://gyazo.com/f076a5dfba1e9738bae924c6f54881ed
データ:https://www.mof.go.jp/jgbs/reference/interest_rate/index.htm
https://chat.openai.com/share/e8b42d1e-df30-4a2a-93bc-70e26e6b25df
ChatGPT code interpreterが作成した
マイナス金利付き量的・質的金融緩和(2016年1月)ごろにマイナスになっている
マイナス金利の導入発表を受けて、市中金利は大きく低下しました。長期金利(新発10年物国債)は初めてマイナスになり、2月末以降マイナス圏で推移しています(図表1)。
第75回 金利がマイナスってどういうこと?その影響は?~日本銀行が▲0.1%のマイナス金利導入を決定~ | 日本生命保険相互会社
code:python
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import re
# Define a function to convert the date format
def convert_japanese_date(date_str):
era, year, month, day = re.match(r'(A-Z)(\d+)\.(\d+)\.(\d+)', date_str).groups()
if era == 'S': # Showa era
year = int(year) + 1925
elif era == 'H': # Heisei era
year = int(year) + 1988
elif era == 'R': # Reiwa era
year = int(year) + 2018
return f'{year}-{month}-{day}'
# Load the data with Shift-JIS encoding
data = pd.read_csv('/mnt/data/jgbcm_all.csv', encoding='shift_jis')
# Remove header row and reset column names
data.columns = data.iloc0
data = data1:
# Convert the date column to datetime
data'基準日' = pd.to_datetime(data'基準日'.apply(convert_japanese_date))
# Replace '-' with NaN and convert the 10 year bond yield to numeric
data'10年' = pd.to_numeric(data'10年'.replace('-', float('NaN')))
# Filter the data starting from Showa 61 year, July 5th
start_date = pd.to_datetime('1986-07-05')
filtered_data = data[data'基準日' >= start_date].copy()
# Calculate the 30-day moving average of the yield
filtered_data'10年_30日移動平均' = filtered_data'10年'.rolling(window=30).mean()
# Plot the 30-day moving average of the 10-year bond yield
plt.figure(figsize=(10, 6))
plt.plot(filtered_data'基準日', filtered_data'10年_30日移動平均')
plt.title('30-Day Moving Average of 10 Year Japanese Government Bond Yield Over Time')
plt.xlabel('Date')
plt.ylabel('Yield (%)')
plt.yticks(np.arange(0, filtered_data'10年_30日移動平均'.max() + 0.5, 0.5))
plt.grid(True)
plt.show()