Skip to main content

Yen Currency Trend

 I found the trend by this code. This trend is from Japanese Workers' Pay Day(Every 25th day in a month). '''python import yfinance as yf import matplotlib . pyplot as plt import pandas as pd import seaborn as sns # 分析期間の設定 dateStart = "2015-01-01" dateEnd = "2026-05-23" ticker = "JPY=X" # ドル円 # yfinanceから取得(仕様変更の警告回避のため auto_adjust を明示) df = yf . download ( ticker , start = dateStart , end = dateEnd , auto_adjust = False , progress = False ) # yfinanceの仕様変更(MultiIndex化)に対応して終値を安全に抽出 if isinstance ( df . columns , pd . MultiIndex ): close = df [ "Close" ][ ticker ].dropna() else : close = df [ "Close" ]. dropna () # 前日比の変化率(%)を計算 # ドル円の場合、プラス = ドル買い/円売り、マイナス = ドル売り/円買い daily_return = close . pct_change () * 100 # 分析用のDataFrameを作成 analysis_df = pd . DataFrame ({ "Return" : daily_return }) analysis_df . index = pd . to_datetime ( analysis_df . index ...

Yen Currency Trend

 I found the trend by this code.

This trend is from Japanese Workers' Pay Day(Every 25th day in a month).



'''python

import yfinance as yf
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns

# 分析期間の設定
dateStart = "2015-01-01"
dateEnd = "2026-05-23"

ticker = "JPY=X" # ドル円

# yfinanceから取得(仕様変更の警告回避のため auto_adjust を明示)
df = yf.download(
ticker,
start=dateStart,
end=dateEnd,
auto_adjust=False,
progress=False
)

# yfinanceの仕様変更(MultiIndex化)に対応して終値を安全に抽出
if isinstance(df.columns, pd.MultiIndex):
close = df["Close"][ticker].dropna()
else:
close = df["Close"].dropna()

# 前日比の変化率(%)を計算
# ドル円の場合、プラス = ドル買い/円売り、マイナス = ドル売り/円買い
daily_return = close.pct_change() * 100

# 分析用のDataFrameを作成
analysis_df = pd.DataFrame({"Return": daily_return})
analysis_df.index = pd.to_datetime(analysis_df.index)

# 「第何週目か」を計算(1日〜7日=第1週、8日〜14日=第2週...)
analysis_df["Day_of_Month"] = analysis_df.index.day
analysis_df["Week_of_Month"] = (analysis_df["Day_of_Month"] - 1) // 7 + 1

# 「何曜日か」を取得 (0=月曜, 1=火曜, ..., 4=金曜)
days_map = {0: "1_Mon", 1: "2_Tue", 2: "3_Wed", 3: "4_Thu", 4: "5_Fri"}
analysis_df["Day_of_Week"] = analysis_df.index.dayofweek.map(days_map)

# 為替市場のメインである平日(月〜金)のみに絞る
analysis_df = analysis_df[analysis_df.index.dayofweek < 5]

# 第何週 × 曜日 ごとの「平均変化率」を集計
pivot_table = analysis_df.pivot_table(
values="Return",
index="Week_of_Month",
columns="Day_of_Week",
aggfunc="mean"
)

# ヒートマップで可視化
plt.figure(figsize=(10, 6))
# ゼロを基準(center=0)にして、赤=ドル買い/円売り、青=ドル売り/円買い
sns.heatmap(pivot_table, annot=True, cmap="coolwarm", center=0, fmt=".3f",
cbar_kws={'label': 'Average Daily Return (%)'})

plt.title("USD/JPY Average Daily Return by Week and Day\n(Positive[Red] = USD Buy / JPY Sell)")
plt.xlabel("Day of the Week")
plt.ylabel("Week of the Month (1st to 5th)")
plt.tight_layout()
plt.show()

'''

Comments

Contact Form

Name

Email *

Message *

Popular posts from this blog

Analog Clock2

Analog Clock2 Simple Analog Clock for Extension "Introducing the Analog Clock2 Extension – a minimalist yet elegant solution for those who appreciate the classic look and feel of traditional timekeeping on their digital devices. Key Benefits of Installing the Analog Clock2 Extension: Aesthetic Appeal: Adds a touch of vintage charm to your browser with its octagonal design. Easy Access: Simply click on the extension icon to view the current time, without the need to open a new tab or window. Accurate Timekeeping: Synchronized with your device's internal clock to ensure you always have the precise time. Space-Saving: Unlike other clock widgets, this extension doesn't take up space on your browser's toolbar, keeping things tidy. Customizable Appearance: Choose from a range of colors and designs to match your personal style or browser theme. Elevate your browsing experience with a blend of the old and new. Install the Analog Clock Extension today!"

Quote Clock

 Quote Clock Simple Analog Clock with quotes Item Introduction: Introducing the "Quote Clock" browser extension! This innovative tool seamlessly integrates a beautifully designed analog clock with hand-picked inspirational quotes right into your browser. With every glance at the time, you're not only reminded of the hour but also provided with a dose of wisdom to carry you through your tasks. Benefits of Installation: Visual Elegance: The analog clock design, coupled with carefully selected typography for quotes, provides an aesthetic and refreshing look to your browser. Momentary Inspiration: Whether you're starting your workday, taking a short break, or winding down in the evening, the accompanying quotes aim to inspire, provoke thought, and offer perspective. Timely Reminders: In today's digital age, it's easy to lose track of time. The clock ensures you're always aware of the passing minutes and hours, promoting time management. Ever-changing Wisdom: T...

Visual Box

Visual Box Use Visual Box for assistance of thinking Visual Box: Bridging Visual Thought and Linguistic Expression Have you ever found it challenging to convert your rich visual thoughts into words? Whether you're a visual thinker, a designer, an artist, or just someone who often finds themselves lost in a sea of imaginative ideas, converting those vivid imaginations into textual descriptions can be a daunting task. Enter Visual Box – your personal assistant to help bridge the gap between visual thinking and linguistic articulation. Key Features: Visual-to-Text Assistance: Helps in seamlessly converting your visual thoughts into structured textual content. Intuitive User Interface: Designed keeping the visual thinker in mind, making it easier to navigate and articulate. Expandable Boxes: Think in layers? No problem! Our nested box system allows you to delve deeper into each thought, ensuring no idea is left behind. Easy Export: Save your thoughts and ideas in an organized HTML form...