ドル円の基本要約量

import pandas as pd
from pandas.plotting import autocorrelation_plot
import numpy as np
from scipy import stats

from matplotlib import pylab as plt
import seaborn as sns
sns.set()
import statsmodels.api as sm
import heapq as hp
import math

fx_data = pd.read_csv("/Users/ユーザー名/Documents/FX/foreign_exchange_historical_data/USDJPY/USDJPY_DAY.csv")#データの読み込み
#pandasの計算は遅いので、全てnumpy配列に変換
opening = np.array(fx_data["opening"])#始値
high = np.array(fx_data["high"])#高値
low = np.array(fx_data["low"])#低値
closing = np.array(fx_data["closing"])#終値

#平均
opening_mean = np.mean(opening)
high_mean = np.mean(high)
low_mean = np.mean(low)
closing_mean = np.mean(closing)

#標準偏差
opening_sd = np.std(opening)
high_sd = np.std(high)
low_sd = np.std(low)
closing_sd = np.std(closing)

結果は以下。

#平均
opening, high, low, closing
102.00780350978135, 102.4274237629459, 101.5360411392405, 102.01047871116225

#標準偏差
opening, high, low, closing
13.128446697845026, 13.144156607787117, 13.101283871625002, 13.132973566366692
  • その他
#最大値、最小値
max(high), min(low)
125.86, 75.57

#1日の変動の最大値、最小値
max(high-low), min(high-low)
7.929999999999993, 0.03999999999999204

#1日の変動の平均値、標準偏差
np.mean(abs(closing-opening)), np.std(abs(closing-opening))
0.4465123705408514, 0.4547812358889767

#上昇と下降の割合
co = closing - opening
len(co[co >0])/len(co)
0.49108170310701954
#有意性検定を行うほどの差は考えにくい
  • 簡単にやる時は、次のようにする。
fx_data.describe()
           opening         high          low      closing
count  3249.000000  3249.000000  3249.000000  3249.000000
mean    101.057579   101.473152   100.599625   101.064289
std      12.969594    12.987922    12.946784    12.976581
min      75.760000    75.980000    75.570000    75.680000
25%      90.900000    91.300000    90.250000    90.840000
50%     104.210000   104.640000   103.690000   104.190000
75%     110.620000   110.911000   110.240000   110.630000
max     125.660000   125.860000   124.540000   125.550000
  • 解析期間(2007年4月2日から2020年8月15日)