In [88]:
from numpy import *
import pandas as pd
%matplotlib inline
In [89]:
import matplotlib.pyplot as plt
import src.mylib.mfile as mfile
from matplotlib import style
In [90]:
stop =int('101010', 2) #101010 I Ching 63 After Completion
befo =int('010101', 2) #101010 I Ching 64 Before Completion
guai =int('111110', 2) #101010 I Ching 43
qian =int('111111', 2) #101010 I Ching 01
kun =int('000000', 2) #101010 I Ching 02
In [91]:
df = mfile.loadOneSymbol("JPY=X", "src/db/forex.db")
def dateToDouble(d):
return (d.year * 10000.0 + d.month * 100.0 + d.day) / 10000.0
In [92]:
#df.index = df.index.map(dateToDouble)
In [93]:
df = df[['Close']]
In [94]:
df = df.head(100)
In [95]:
df = df.diff()
In [96]:
fn = lambda x: (1.0 if x > 0.0 else 0.0)
In [97]:
xx = df['Close'].apply(fn)
In [98]:
L0 = xx
In [99]:
L1 = xx.shift(-1)
In [100]:
L2 = xx.shift(-2)
L3 = xx.shift(-3)
L4 = xx.shift(-4)
L5 = xx.shift(-5)
In [101]:
yy = L0 * 32 + L1 * 16 + L2 * 8 + L3 * 4 + L4 * 2 + L5
In [102]:
style.use('ggplot')
In [103]:
plt.scatter(yy.index, yy)
Out[103]: