Merge branch 'main' into docs
This commit is contained in:
commit
b3a736582f
199
Core/CoreDraw.py
Normal file
199
Core/CoreDraw.py
Normal file
@ -0,0 +1,199 @@
|
|||||||
|
|
||||||
|
import pandas as pd
|
||||||
|
import datetime
|
||||||
|
import numpy as np
|
||||||
|
import plotly as pl
|
||||||
|
import plotly.graph_objs as go
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
import math
|
||||||
|
import scipy
|
||||||
|
import random
|
||||||
|
import statistics
|
||||||
|
|
||||||
|
|
||||||
|
import datetime
|
||||||
|
import matplotlib.dates as mdates
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
|
||||||
|
import mplfinance as mpf
|
||||||
|
|
||||||
|
import plotly
|
||||||
|
#import plotly.plotly as py
|
||||||
|
import plotly.graph_objs as go
|
||||||
|
# these two lines allow your code to show up in a notebook
|
||||||
|
from plotly.offline import init_notebook_mode, iplot
|
||||||
|
from plotly.subplots import make_subplots
|
||||||
|
init_notebook_mode()
|
||||||
|
|
||||||
|
import CoreTraidMath
|
||||||
|
import plotly.express as px
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class agrigateFig():
|
||||||
|
|
||||||
|
def __init__(self,data=[],needDraw=False ,subplot_titles=None):
|
||||||
|
self.data=data
|
||||||
|
self.ans=self.getAgrPlt()
|
||||||
|
if needDraw:
|
||||||
|
self.subplot_titles=subplot_titles
|
||||||
|
self.fig=coreDraw(self.ans,True,self.subplot_titles)
|
||||||
|
|
||||||
|
|
||||||
|
def getAgrPlt(self):
|
||||||
|
count=0
|
||||||
|
ans=[]
|
||||||
|
for i in self.data:
|
||||||
|
count=count+1
|
||||||
|
if type(i)==list:
|
||||||
|
for g in i:
|
||||||
|
for j in g.figDict:
|
||||||
|
ans.append(j)
|
||||||
|
ans[-1]['row']=count
|
||||||
|
else:
|
||||||
|
for j in i.figDict:
|
||||||
|
ans.append(j)
|
||||||
|
ans[-1]['row']=count
|
||||||
|
return ans
|
||||||
|
|
||||||
|
|
||||||
|
class corePlt():
|
||||||
|
def __init__(self, params={
|
||||||
|
'vtype':'',
|
||||||
|
'df':pd.DataFrame(),
|
||||||
|
'row':1,
|
||||||
|
'col':1,
|
||||||
|
'name':''
|
||||||
|
}):
|
||||||
|
self.vtype=params['vtype']
|
||||||
|
self.df=params['df']
|
||||||
|
self.row=params['row']
|
||||||
|
self.col=params['col']
|
||||||
|
self.name=params['name']
|
||||||
|
if 'colorType' in params.keys():
|
||||||
|
self.colorType=params['colorType']
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class coreDraw():
|
||||||
|
def __init__(self, data=[],needShow=False):
|
||||||
|
self.data=self.getPlts(data)
|
||||||
|
self.needShow=needShow
|
||||||
|
self.ans=self.getAns()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def getBarColorList(self,l,colorType):
|
||||||
|
if colorType=='diffAbs':
|
||||||
|
ans=['green']
|
||||||
|
for i in range(1,len(l)):
|
||||||
|
if abs(l[i])>abs(l[i-1]):
|
||||||
|
ans.append('green')
|
||||||
|
else:
|
||||||
|
ans.append('red')
|
||||||
|
elif colorType=='diff':
|
||||||
|
ans=['green']
|
||||||
|
for i in range(1,len(l)):
|
||||||
|
if (l[i])>(l[i-1]):
|
||||||
|
ans.append('green')
|
||||||
|
else:
|
||||||
|
ans.append('red')
|
||||||
|
elif colorType=='normal':
|
||||||
|
ans=[]
|
||||||
|
for i in range(len(l)):
|
||||||
|
ans.append('gray')
|
||||||
|
return ans
|
||||||
|
|
||||||
|
def getPlts(self, data):
|
||||||
|
ans=None
|
||||||
|
|
||||||
|
if type(data)==list:
|
||||||
|
ans=[]
|
||||||
|
for i in data:
|
||||||
|
ans.append(corePlt(i))
|
||||||
|
else:
|
||||||
|
ans=[corePlt(data)]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return ans
|
||||||
|
|
||||||
|
def getAns(self):
|
||||||
|
'''
|
||||||
|
data list
|
||||||
|
vtype
|
||||||
|
df
|
||||||
|
row=1
|
||||||
|
col=1
|
||||||
|
name
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'''
|
||||||
|
|
||||||
|
ans=None
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
maxRow=1
|
||||||
|
maxCol=1
|
||||||
|
for i in self.data:
|
||||||
|
if i.row > maxRow:
|
||||||
|
maxRow =i.row
|
||||||
|
if i.col > maxCol:
|
||||||
|
maxCol =i.col
|
||||||
|
|
||||||
|
fig = make_subplots(
|
||||||
|
rows=maxRow,
|
||||||
|
cols=maxCol,
|
||||||
|
shared_xaxes=True,
|
||||||
|
vertical_spacing=0.02,
|
||||||
|
shared_yaxes=True,
|
||||||
|
horizontal_spacing=0.02,
|
||||||
|
#column_widths=[]
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
fig.update_layout(xaxis_rangeslider_visible=False)
|
||||||
|
fig.update_layout(barmode='relative')
|
||||||
|
|
||||||
|
for i in self.data:
|
||||||
|
if i.vtype=='Scatter':
|
||||||
|
fig.add_trace(go.Scatter(x=i.df['date'],y=i.df['value'],name=i.name), row=i.row, col=i.col)
|
||||||
|
elif i.vtype=='OCHL':
|
||||||
|
fig.add_trace(go.Candlestick(
|
||||||
|
x=i.df['date'],
|
||||||
|
open=i.df['open'],
|
||||||
|
high=i.df['high'],
|
||||||
|
low=i.df['low'],
|
||||||
|
close=i.df['close'],
|
||||||
|
name=i.name),
|
||||||
|
row=i.row, col=i.col
|
||||||
|
)
|
||||||
|
elif i.vtype=='Bars':
|
||||||
|
for j in i.df.keys():
|
||||||
|
if j!='date':
|
||||||
|
try:
|
||||||
|
colorType=i.colorType
|
||||||
|
except:
|
||||||
|
colorType='normal'
|
||||||
|
colors=self.getBarColorList(i.df[j],colorType)
|
||||||
|
fig.add_trace(go.Bar(x=i.df['date'], y=i.df[j],name=j,marker_color=colors))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ans=fig
|
||||||
|
if self.needShow:
|
||||||
|
plotly.offline.iplot(fig)
|
||||||
|
return ans
|
||||||
200
Core/CoreTraidMath.py
Normal file
200
Core/CoreTraidMath.py
Normal file
@ -0,0 +1,200 @@
|
|||||||
|
|
||||||
|
import pandas as pd
|
||||||
|
import datetime
|
||||||
|
import numpy as np
|
||||||
|
import plotly as pl
|
||||||
|
import plotly.graph_objs as go
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
import math
|
||||||
|
import scipy
|
||||||
|
import random
|
||||||
|
import statistics
|
||||||
|
|
||||||
|
|
||||||
|
import datetime
|
||||||
|
import matplotlib.dates as mdates
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
|
||||||
|
import mplfinance as mpf
|
||||||
|
|
||||||
|
import plotly
|
||||||
|
#import plotly.plotly as py
|
||||||
|
import plotly.graph_objs as go
|
||||||
|
# these two lines allow your code to show up in a notebook
|
||||||
|
from plotly.offline import init_notebook_mode, iplot
|
||||||
|
from plotly.subplots import make_subplots
|
||||||
|
init_notebook_mode()
|
||||||
|
|
||||||
|
import CoreTraidMath
|
||||||
|
import plotly.express as px
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class agrigateFig():
|
||||||
|
|
||||||
|
def __init__(self,data=[],needDraw=False ,subplot_titles=None):
|
||||||
|
self.data=data
|
||||||
|
self.ans=self.getAgrPlt()
|
||||||
|
if needDraw:
|
||||||
|
self.subplot_titles=subplot_titles
|
||||||
|
self.fig=coreDraw(self.ans,True,self.subplot_titles)
|
||||||
|
|
||||||
|
|
||||||
|
def getAgrPlt(self):
|
||||||
|
count=0
|
||||||
|
ans=[]
|
||||||
|
for i in self.data:
|
||||||
|
count=count+1
|
||||||
|
if type(i)==list:
|
||||||
|
for g in i:
|
||||||
|
for j in g.figDict:
|
||||||
|
ans.append(j)
|
||||||
|
ans[-1]['row']=count
|
||||||
|
else:
|
||||||
|
for j in i.figDict:
|
||||||
|
ans.append(j)
|
||||||
|
ans[-1]['row']=count
|
||||||
|
return ans
|
||||||
|
|
||||||
|
|
||||||
|
class corePlt():
|
||||||
|
def __init__(self, params={
|
||||||
|
'vtype':'',
|
||||||
|
'df':pd.DataFrame(),
|
||||||
|
'row':1,
|
||||||
|
'col':1,
|
||||||
|
'name':''
|
||||||
|
}):
|
||||||
|
self.vtype=params['vtype']
|
||||||
|
self.df=params['df']
|
||||||
|
self.row=params['row']
|
||||||
|
self.col=params['col']
|
||||||
|
self.name=params['name']
|
||||||
|
if 'colorType' in params.keys():
|
||||||
|
self.colorType=params['colorType']
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class coreDraw():
|
||||||
|
def __init__(self, data=[],needShow=False,subplot_titles={}):
|
||||||
|
self.data=self.getPlts(data)
|
||||||
|
self.needShow=needShow
|
||||||
|
self.subplot_titles=subplot_titles
|
||||||
|
self.ans=self.getAns()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def getBarColorList(self,l,colorType):
|
||||||
|
if colorType=='diffAbs':
|
||||||
|
ans=['green']
|
||||||
|
for i in range(1,len(l)):
|
||||||
|
if abs(l[i])>abs(l[i-1]):
|
||||||
|
ans.append('green')
|
||||||
|
else:
|
||||||
|
ans.append('red')
|
||||||
|
elif colorType=='diff':
|
||||||
|
ans=['green']
|
||||||
|
for i in range(1,len(l)):
|
||||||
|
if (l[i])>(l[i-1]):
|
||||||
|
ans.append('green')
|
||||||
|
else:
|
||||||
|
ans.append('red')
|
||||||
|
elif colorType=='normal':
|
||||||
|
ans=[]
|
||||||
|
for i in range(len(l)):
|
||||||
|
ans.append('gray')
|
||||||
|
return ans
|
||||||
|
|
||||||
|
def getPlts(self, data):
|
||||||
|
ans=None
|
||||||
|
|
||||||
|
if type(data)==list:
|
||||||
|
ans=[]
|
||||||
|
for i in data:
|
||||||
|
ans.append(corePlt(i))
|
||||||
|
else:
|
||||||
|
ans=[corePlt(data)]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return ans
|
||||||
|
|
||||||
|
def getAns(self):
|
||||||
|
'''
|
||||||
|
data list
|
||||||
|
vtype
|
||||||
|
df
|
||||||
|
row=1
|
||||||
|
col=1
|
||||||
|
name
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'''
|
||||||
|
|
||||||
|
ans=None
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
maxRow=1
|
||||||
|
maxCol=1
|
||||||
|
for i in self.data:
|
||||||
|
if i.row > maxRow:
|
||||||
|
maxRow =i.row
|
||||||
|
if i.col > maxCol:
|
||||||
|
maxCol =i.col
|
||||||
|
|
||||||
|
fig = make_subplots(
|
||||||
|
rows=maxRow,
|
||||||
|
cols=maxCol,
|
||||||
|
shared_xaxes=True,
|
||||||
|
vertical_spacing=0.1,
|
||||||
|
shared_yaxes=True,
|
||||||
|
#horizontal_spacing=0.02,
|
||||||
|
#column_widths=[]
|
||||||
|
subplot_titles=self.subplot_titles
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
fig.update_layout(xaxis_rangeslider_visible=False)
|
||||||
|
fig.update_layout(barmode='relative')
|
||||||
|
|
||||||
|
for i in self.data:
|
||||||
|
if i.vtype=='Scatter':
|
||||||
|
fig.add_trace(go.Scatter(x=i.df['date'],y=i.df['value'],name=i.name), row=i.row, col=i.col)
|
||||||
|
elif i.vtype=='OCHL':
|
||||||
|
fig.add_trace(go.Candlestick(
|
||||||
|
x=i.df['date'],
|
||||||
|
open=i.df['open'],
|
||||||
|
high=i.df['high'],
|
||||||
|
low=i.df['low'],
|
||||||
|
close=i.df['close'],
|
||||||
|
name=i.name),
|
||||||
|
row=i.row, col=i.col
|
||||||
|
)
|
||||||
|
elif i.vtype=='Bars':
|
||||||
|
for j in i.df.keys():
|
||||||
|
if j!='date':
|
||||||
|
try:
|
||||||
|
colorType=i.colorType
|
||||||
|
except:
|
||||||
|
colorType='normal'
|
||||||
|
colors=self.getBarColorList(i.df[j],colorType)
|
||||||
|
fig.add_trace(go.Bar(x=i.df['date'], y=i.df[j],name=j,marker_color=colors),row=i.row, col=i.col)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ans=fig
|
||||||
|
if self.needShow:
|
||||||
|
plotly.offline.iplot(fig)
|
||||||
|
return ans
|
||||||
182
Core/Ind_ADX.py
Normal file
182
Core/Ind_ADX.py
Normal file
@ -0,0 +1,182 @@
|
|||||||
|
|
||||||
|
import pandas as pd
|
||||||
|
import datetime
|
||||||
|
import numpy as np
|
||||||
|
import plotly as pl
|
||||||
|
import plotly.graph_objs as go
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
import math
|
||||||
|
import scipy
|
||||||
|
import random
|
||||||
|
import statistics
|
||||||
|
|
||||||
|
|
||||||
|
import datetime
|
||||||
|
import matplotlib.dates as mdates
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
|
||||||
|
import mplfinance as mpf
|
||||||
|
|
||||||
|
import plotly
|
||||||
|
#import plotly.plotly as py
|
||||||
|
import plotly.graph_objs as go
|
||||||
|
# these two lines allow your code to show up in a notebook
|
||||||
|
from plotly.offline import init_notebook_mode, iplot
|
||||||
|
from plotly.subplots import make_subplots
|
||||||
|
|
||||||
|
|
||||||
|
import CoreTraidMath
|
||||||
|
import CoreDraw
|
||||||
|
init_notebook_mode()
|
||||||
|
|
||||||
|
class ADXI:
|
||||||
|
|
||||||
|
def __init__(self, base_df, options={
|
||||||
|
'dataType':'ohcl',
|
||||||
|
|
||||||
|
}, needFig=False,showOnlyIndex=True,drawFig=False):
|
||||||
|
self.base_df=base_df.reset_index(drop=True)
|
||||||
|
self.options=options
|
||||||
|
#self.norm_df=self.nornalize()
|
||||||
|
#self.col=col
|
||||||
|
#self.npCol=np.asarray(self.norm_df[self.col], dtype=np.float32)
|
||||||
|
#self.options=options
|
||||||
|
self.ans=self.getAns()
|
||||||
|
if needFig:
|
||||||
|
self.fig=self.pltShow(showOnlyIndex,drawFig)
|
||||||
|
|
||||||
|
|
||||||
|
def getDM(self):
|
||||||
|
|
||||||
|
#m,p=self.getMP()
|
||||||
|
dm_m=np.asarray([])
|
||||||
|
dm_p=np.asarray([])
|
||||||
|
tr=np.asarray([])
|
||||||
|
|
||||||
|
|
||||||
|
for i in range(1,self.base_df.shape[0]):
|
||||||
|
if (self.base_df['open'][i]>=
|
||||||
|
self.base_df['open'][i-1]):
|
||||||
|
dm_p=np.append(dm_p,self.base_df['open'][i]-self.base_df['open'][i-1])
|
||||||
|
else:
|
||||||
|
dm_p=np.append(dm_p,0)
|
||||||
|
if (self.base_df['close'][i]<=self.base_df['close'][i-1]):
|
||||||
|
dm_m=np.append(dm_m,self.base_df['close'][i-1]-self.base_df['close'][i])
|
||||||
|
else:
|
||||||
|
dm_m=np.append(dm_m,0)
|
||||||
|
|
||||||
|
tr=np.append(tr,
|
||||||
|
max(self.base_df['close'][i-1],self.base_df['high'][i])-
|
||||||
|
min(self.base_df['close'][i-1],self.base_df['low'][i]))
|
||||||
|
|
||||||
|
|
||||||
|
setattr(self,'dm_m',dm_m)
|
||||||
|
setattr(self,'dm_p',dm_p)
|
||||||
|
setattr(self,'tr',tr)
|
||||||
|
|
||||||
|
return dm_m,dm_p
|
||||||
|
|
||||||
|
def getEMA(self,Col):
|
||||||
|
ser = pd.Series(Col, copy=False)
|
||||||
|
op={'dataType':'series',
|
||||||
|
'action':'findMean',
|
||||||
|
'actionOptions':{'MeanType':'EMA','span':10}
|
||||||
|
}
|
||||||
|
ans=np.asarray(CoreTraidMath.CoreMath(ser,op).ans)
|
||||||
|
#print(ans)
|
||||||
|
#ans = np.asarray(ser.ewm(span=40,adjust=False).mean().to_list())
|
||||||
|
#print(ans)
|
||||||
|
#return(np.asarray(ser.ewm(span=40,adjust=False).mean().to_list()))
|
||||||
|
return ans
|
||||||
|
|
||||||
|
def getDI(self):
|
||||||
|
dm,dp=self.getDM()
|
||||||
|
|
||||||
|
dip=self.getEMA(dp/self.tr)
|
||||||
|
dim=self.getEMA(dm/self.tr)
|
||||||
|
|
||||||
|
return dim,dip
|
||||||
|
|
||||||
|
def getAns(self):
|
||||||
|
|
||||||
|
dim,dip=self.getDI()
|
||||||
|
np.seterr(invalid='ignore')
|
||||||
|
col=abs(np.true_divide((dim-dip),(dim+dip)))
|
||||||
|
setattr(self,'col',col)
|
||||||
|
|
||||||
|
adx=self.getEMA(col)
|
||||||
|
|
||||||
|
ans={
|
||||||
|
'DIM':dim*100,
|
||||||
|
'DIP':dip*100,
|
||||||
|
'ADX':adx*100
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return ans
|
||||||
|
|
||||||
|
def pltShow(self,showOnlyIndex,drawFig):
|
||||||
|
ans=None
|
||||||
|
req=[]
|
||||||
|
|
||||||
|
row=1
|
||||||
|
if not showOnlyIndex:
|
||||||
|
|
||||||
|
row=2
|
||||||
|
req.append({
|
||||||
|
'vtype':'OCHL',
|
||||||
|
'df':self.base_df,
|
||||||
|
'row':1,
|
||||||
|
'col':1,
|
||||||
|
'name':'OHCL'
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
req.append({
|
||||||
|
'vtype':'Scatter',
|
||||||
|
'df':pd.DataFrame(
|
||||||
|
{'value':self.ans['ADX'],'date':self.base_df['date'].to_list()[1:]}) ,
|
||||||
|
'row':row,
|
||||||
|
'col':1,
|
||||||
|
'name':'SenkouSpanB'
|
||||||
|
|
||||||
|
})
|
||||||
|
req.append({
|
||||||
|
'vtype':'Scatter',
|
||||||
|
'df':pd.DataFrame(
|
||||||
|
{'value':self.ans['DIP'],'date':self.base_df['date'].to_list()[1:]}) ,
|
||||||
|
'row':row,
|
||||||
|
'col':1,
|
||||||
|
'name':'+DI'
|
||||||
|
|
||||||
|
})
|
||||||
|
req.append({
|
||||||
|
'vtype':'Scatter',
|
||||||
|
'df':pd.DataFrame(
|
||||||
|
{'value':self.ans['DIM'],'date':self.base_df['date'].to_list()[1:]}) ,
|
||||||
|
'row':row,
|
||||||
|
'col':1,
|
||||||
|
'name':'-DI'
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
self.figDict=req
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ans = CoreDraw.coreDraw(req,drawFig)
|
||||||
|
|
||||||
|
|
||||||
|
return ans
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
114
Core/Ind_Alligator.py
Normal file
114
Core/Ind_Alligator.py
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
import pandas as pd
|
||||||
|
import datetime
|
||||||
|
import numpy as np
|
||||||
|
import plotly as pl
|
||||||
|
import plotly.graph_objs as go
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
import math
|
||||||
|
import scipy
|
||||||
|
import random
|
||||||
|
import statistics
|
||||||
|
|
||||||
|
|
||||||
|
import datetime
|
||||||
|
import matplotlib.dates as mdates
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
|
||||||
|
import mplfinance as mpf
|
||||||
|
|
||||||
|
import plotly
|
||||||
|
#import plotly.plotly as py
|
||||||
|
import plotly.graph_objs as go
|
||||||
|
# these two lines allow your code to show up in a notebook
|
||||||
|
from plotly.offline import init_notebook_mode, iplot
|
||||||
|
from plotly.subplots import make_subplots
|
||||||
|
init_notebook_mode()
|
||||||
|
|
||||||
|
import CoreTraidMath
|
||||||
|
import CoreDraw
|
||||||
|
|
||||||
|
|
||||||
|
class Alligator:
|
||||||
|
|
||||||
|
def __init__(self, base_df,options={}, needFig=False,showOnlyIndex=True,drawFig=False):
|
||||||
|
self.base_df=base_df.reset_index(drop=True)
|
||||||
|
self.options=options
|
||||||
|
self.ans=self.getAns()
|
||||||
|
if needFig:
|
||||||
|
self.fig=self.pltShow(showOnlyIndex,drawFig)
|
||||||
|
|
||||||
|
|
||||||
|
def getMA(self,keyAns):
|
||||||
|
ans=None
|
||||||
|
op={'dataType':'ohcl',
|
||||||
|
'action':'findMean',
|
||||||
|
'actionOptions':{'MeanType':self.options[keyAns]['MeanType'],
|
||||||
|
'valueType':self.options['valueType'],
|
||||||
|
'window':self.options[keyAns]['window']}
|
||||||
|
}
|
||||||
|
ans=CoreTraidMath.CoreMath(self.base_df,op).ans
|
||||||
|
|
||||||
|
return ans
|
||||||
|
|
||||||
|
def getAns(self):
|
||||||
|
ans={'Jaw':{},
|
||||||
|
'Teeth':{},
|
||||||
|
'Lips':{}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
for i in ans.keys():
|
||||||
|
ma=self.getMA(i)
|
||||||
|
ans[i]['y']=ma[:len(ma)-self.options[i]['shift']]
|
||||||
|
ans[i]['x']=self.base_df['date'][self.options[i]['window']+self.options[i]['shift']-1:]
|
||||||
|
|
||||||
|
|
||||||
|
return ans
|
||||||
|
|
||||||
|
|
||||||
|
def pltShow(self,showOnlyIndex,drawFig):
|
||||||
|
ans=None
|
||||||
|
req=[]
|
||||||
|
row=1
|
||||||
|
if not showOnlyIndex:
|
||||||
|
|
||||||
|
#row=2
|
||||||
|
req.append({
|
||||||
|
'vtype':'OCHL',
|
||||||
|
'df':self.base_df,
|
||||||
|
'row':1,
|
||||||
|
'col':1,
|
||||||
|
'name':'OHCL'
|
||||||
|
|
||||||
|
})
|
||||||
|
req.append({
|
||||||
|
'vtype':'Scatter',
|
||||||
|
'df':pd.DataFrame(
|
||||||
|
{'value':self.ans['Jaw']['y'],'date':self.ans['Jaw']['x']}) ,
|
||||||
|
'row':row,
|
||||||
|
'col':1,
|
||||||
|
'name':'Jaw'
|
||||||
|
|
||||||
|
})
|
||||||
|
req.append({
|
||||||
|
'vtype':'Scatter',
|
||||||
|
'df':pd.DataFrame(
|
||||||
|
{'value':self.ans['Teeth']['y'],'date':self.ans['Teeth']['x']}) ,
|
||||||
|
'row':row,
|
||||||
|
'col':1,
|
||||||
|
'name':'Teeth'
|
||||||
|
|
||||||
|
})
|
||||||
|
req.append({
|
||||||
|
'vtype':'Scatter',
|
||||||
|
'df':pd.DataFrame(
|
||||||
|
{'value':self.ans['Lips']['y'],'date':self.ans['Lips']['x']}) ,
|
||||||
|
'row':row,
|
||||||
|
'col':1,
|
||||||
|
'name':'Lips'
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
self.figDict=req
|
||||||
|
ans = CoreDraw.coreDraw(req,drawFig)
|
||||||
|
return ans
|
||||||
108
Core/Ind_DonchianChannel.py
Normal file
108
Core/Ind_DonchianChannel.py
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
import pandas as pd
|
||||||
|
import datetime
|
||||||
|
import numpy as np
|
||||||
|
import plotly as pl
|
||||||
|
import plotly.graph_objs as go
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
import math
|
||||||
|
import scipy
|
||||||
|
import random
|
||||||
|
import statistics
|
||||||
|
|
||||||
|
|
||||||
|
import datetime
|
||||||
|
import matplotlib.dates as mdates
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
|
||||||
|
import mplfinance as mpf
|
||||||
|
|
||||||
|
import plotly
|
||||||
|
#import plotly.plotly as py
|
||||||
|
import plotly.graph_objs as go
|
||||||
|
# these two lines allow your code to show up in a notebook
|
||||||
|
from plotly.offline import init_notebook_mode, iplot
|
||||||
|
from plotly.subplots import make_subplots
|
||||||
|
init_notebook_mode()
|
||||||
|
|
||||||
|
import CoreTraidMath
|
||||||
|
import CoreDraw
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class IDC:
|
||||||
|
|
||||||
|
def __init__(self, base_df,options={}, needFig=False,showOnlyIndex=True,drawFig=False):
|
||||||
|
self.base_df=base_df.reset_index(drop=True)
|
||||||
|
self.options=options
|
||||||
|
self.ans=self.getAns()
|
||||||
|
if needFig:
|
||||||
|
self.fig=self.pltShow(showOnlyIndex,drawFig)
|
||||||
|
|
||||||
|
def getSMA(self,windowSMA):
|
||||||
|
return np.convolve(self.npCol, np.ones(int(windowSMA)), 'valid') / int(windowSMA)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def getAns(self):
|
||||||
|
ans={
|
||||||
|
'MaxExt':[],
|
||||||
|
'MinExt':[],
|
||||||
|
'x':[]
|
||||||
|
|
||||||
|
}
|
||||||
|
opMin={'dataType':'ohcl',
|
||||||
|
'action':'findExt',
|
||||||
|
'actionOptions':{'extremumtype':'min','valueType':'low'}
|
||||||
|
}
|
||||||
|
opMax={'dataType':'ohcl',
|
||||||
|
'action':'findExt',
|
||||||
|
'actionOptions':{'extremumtype':'max','valueType':'high'}
|
||||||
|
}
|
||||||
|
|
||||||
|
for i in range(self.options['window'],len(self.base_df)-self.options['shift']+1):
|
||||||
|
ans['MaxExt'].append(CoreTraidMath.CoreMath(self.base_df[i-self.options['window']:i],opMax).ans)
|
||||||
|
ans['x'].append(self.base_df['date'][i-1+self.options['shift']])
|
||||||
|
ans['MinExt'].append(CoreTraidMath.CoreMath(self.base_df[i-self.options['window']:i],opMin).ans)
|
||||||
|
return ans
|
||||||
|
|
||||||
|
|
||||||
|
def pltShow(self,showOnlyIndex,drawFig):
|
||||||
|
ans=None
|
||||||
|
req=[]
|
||||||
|
row=1
|
||||||
|
if not showOnlyIndex:
|
||||||
|
|
||||||
|
#row=2
|
||||||
|
req.append({
|
||||||
|
'vtype':'OCHL',
|
||||||
|
'df':self.base_df,
|
||||||
|
'row':1,
|
||||||
|
'col':1,
|
||||||
|
'name':'OHCL'
|
||||||
|
|
||||||
|
})
|
||||||
|
req.append({
|
||||||
|
'vtype':'Scatter',
|
||||||
|
'df':pd.DataFrame(
|
||||||
|
{'value':self.ans['MaxExt'],'date':self.ans['x']}) ,
|
||||||
|
'row':row,
|
||||||
|
'col':1,
|
||||||
|
'name':'MaxExt'
|
||||||
|
|
||||||
|
})
|
||||||
|
req.append({
|
||||||
|
'vtype':'Scatter',
|
||||||
|
'df':pd.DataFrame(
|
||||||
|
{'value':self.ans['MinExt'],'date':self.ans['x']}) ,
|
||||||
|
'row':row,
|
||||||
|
'col':1,
|
||||||
|
'name':'MinExt'
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
self.figDict=req
|
||||||
|
ans = CoreDraw.coreDraw(req,drawFig)
|
||||||
|
return ans
|
||||||
124
Core/Ind_Envelopes.py
Normal file
124
Core/Ind_Envelopes.py
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
import pandas as pd
|
||||||
|
import datetime
|
||||||
|
import numpy as np
|
||||||
|
import plotly as pl
|
||||||
|
import plotly.graph_objs as go
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
import math
|
||||||
|
import scipy
|
||||||
|
import random
|
||||||
|
import statistics
|
||||||
|
|
||||||
|
|
||||||
|
import datetime
|
||||||
|
import matplotlib.dates as mdates
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
|
||||||
|
import mplfinance as mpf
|
||||||
|
|
||||||
|
import plotly
|
||||||
|
#import plotly.plotly as py
|
||||||
|
import plotly.graph_objs as go
|
||||||
|
# these two lines allow your code to show up in a notebook
|
||||||
|
from plotly.offline import init_notebook_mode, iplot
|
||||||
|
from plotly.subplots import make_subplots
|
||||||
|
init_notebook_mode()
|
||||||
|
|
||||||
|
import CoreTraidMath
|
||||||
|
import CoreDraw
|
||||||
|
|
||||||
|
class Envelopes:
|
||||||
|
|
||||||
|
def __init__(self, base_df,options={}, needFig=False,showOnlyIndex=True,drawFig=False):
|
||||||
|
self.base_df=base_df.reset_index(drop=True)
|
||||||
|
self.options=options
|
||||||
|
self.ans=self.getAns()
|
||||||
|
if needFig:
|
||||||
|
self.fig=self.pltShow(showOnlyIndex,drawFig)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def getAns(self):
|
||||||
|
ans={
|
||||||
|
'MainEnv':[],
|
||||||
|
'PlusEnv':[],
|
||||||
|
'MinusEnv':[],
|
||||||
|
'x':[]
|
||||||
|
}
|
||||||
|
dictResp={}
|
||||||
|
dictResp['MeanType']=self.options['MeanType']
|
||||||
|
dictResp['valueType']=self.options['valueType']
|
||||||
|
|
||||||
|
try:
|
||||||
|
dictResp['window'] = self.options['window']
|
||||||
|
dictResp['span'] = self.options['window']
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
op={'dataType':'ohcl',
|
||||||
|
'action':'findMean',
|
||||||
|
'actionOptions':dictResp
|
||||||
|
}
|
||||||
|
if dictResp['MeanType']=='SMA':
|
||||||
|
|
||||||
|
y=CoreTraidMath.CoreMath(self.base_df,op).ans
|
||||||
|
ans['MainEnv']=y[:len(y)-self.options['shift']]
|
||||||
|
ans['PlusEnv']=ans['MainEnv']*(1+self.options['kProc']/100)
|
||||||
|
ans['MinusEnv']=ans['MainEnv']*(1-self.options['kProc']/100)
|
||||||
|
ans['x']=self.base_df['date'][self.options['window']-1+self.options['shift']:]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return ans
|
||||||
|
|
||||||
|
def pltShow(self,showOnlyIndex,drawFig):
|
||||||
|
ans=None
|
||||||
|
req=[]
|
||||||
|
row=1
|
||||||
|
if not showOnlyIndex:
|
||||||
|
|
||||||
|
#row=2
|
||||||
|
req.append({
|
||||||
|
'vtype':'OCHL',
|
||||||
|
'df':self.base_df,
|
||||||
|
'row':1,
|
||||||
|
'col':1,
|
||||||
|
'name':'OHCL'
|
||||||
|
|
||||||
|
})
|
||||||
|
req.append({
|
||||||
|
'vtype':'Scatter',
|
||||||
|
'df':pd.DataFrame(
|
||||||
|
{'value':self.ans['MainEnv'],'date':self.ans['x']}) ,
|
||||||
|
'row':row,
|
||||||
|
'col':1,
|
||||||
|
'name':'MainEnv'
|
||||||
|
|
||||||
|
})
|
||||||
|
req.append({
|
||||||
|
'vtype':'Scatter',
|
||||||
|
'df':pd.DataFrame(
|
||||||
|
{'value':self.ans['PlusEnv'],'date':self.ans['x']}) ,
|
||||||
|
'row':row,
|
||||||
|
'col':1,
|
||||||
|
'name':'PlusEnv'
|
||||||
|
|
||||||
|
})
|
||||||
|
req.append({
|
||||||
|
'vtype':'Scatter',
|
||||||
|
'df':pd.DataFrame(
|
||||||
|
{'value':self.ans['MinusEnv'],'date':self.ans['x']}) ,
|
||||||
|
'row':row,
|
||||||
|
'col':1,
|
||||||
|
'name':'MinusEnv'
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
self.figDict=req
|
||||||
|
ans = CoreDraw.coreDraw(req,drawFig)
|
||||||
|
return ans
|
||||||
108
Core/Ind_Gator.py
Normal file
108
Core/Ind_Gator.py
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
import pandas as pd
|
||||||
|
import datetime
|
||||||
|
import numpy as np
|
||||||
|
import plotly as pl
|
||||||
|
import plotly.graph_objs as go
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
import math
|
||||||
|
import scipy
|
||||||
|
import random
|
||||||
|
import statistics
|
||||||
|
|
||||||
|
|
||||||
|
import datetime
|
||||||
|
import matplotlib.dates as mdates
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
|
||||||
|
import mplfinance as mpf
|
||||||
|
|
||||||
|
import plotly
|
||||||
|
#import plotly.plotly as py
|
||||||
|
import plotly.graph_objs as go
|
||||||
|
# these two lines allow your code to show up in a notebook
|
||||||
|
from plotly.offline import init_notebook_mode, iplot
|
||||||
|
from plotly.subplots import make_subplots
|
||||||
|
init_notebook_mode()
|
||||||
|
|
||||||
|
import CoreTraidMath
|
||||||
|
import CoreDraw
|
||||||
|
import Ind_Alligator
|
||||||
|
|
||||||
|
class Gator:
|
||||||
|
|
||||||
|
def __init__(self, base_df,options={}, needFig=False,showOnlyIndex=True,drawFig=False):
|
||||||
|
self.base_df=base_df.reset_index(drop=True)
|
||||||
|
self.options=options
|
||||||
|
self.ans=self.getAns()
|
||||||
|
if needFig:
|
||||||
|
self.fig=self.pltShow(showOnlyIndex,drawFig)
|
||||||
|
|
||||||
|
|
||||||
|
def getAns(self):
|
||||||
|
|
||||||
|
req=Ind_Alligator.Alligator(self.base_df,self.options).ans
|
||||||
|
#self.req=req
|
||||||
|
'''
|
||||||
|
ans={'Jaw-Teeth':{'y':[],'x':[]},
|
||||||
|
'Teeth-Lips':{'y':[],'x':[]},
|
||||||
|
}
|
||||||
|
JawTeethIter=self.options['Jaw']['window']+self.options['Jaw']['shift']-self.options['Teeth']['window']-self.options['Teeth']['shift']
|
||||||
|
TeethLipsIter=self.options['Teeth']['window']+self.options['Teeth']['shift']-self.options['Lips']['window']-self.options['Lips']['shift']
|
||||||
|
|
||||||
|
#print(TeethLipsIter)
|
||||||
|
for i in range(len(req['Jaw']['y'])):
|
||||||
|
ans['Jaw-Teeth']['y'].append(abs(req['Jaw']['y'][i]-req['Teeth']['y'][JawTeethIter+i]))
|
||||||
|
ans['Jaw-Teeth']['x']=req['Jaw']['x']
|
||||||
|
for i in range(len(req['Teeth']['y'])):
|
||||||
|
ans['Teeth-Lips']['y'].append(-abs(req['Teeth']['y'][i]-req['Lips']['y'][TeethLipsIter+i]))
|
||||||
|
ans['Teeth-Lips']['x']=req['Teeth']['x']
|
||||||
|
'''
|
||||||
|
ans={'Jaw-Teeth':[],
|
||||||
|
'Teeth-Lips':[],
|
||||||
|
'x':[]
|
||||||
|
}
|
||||||
|
JawTeethIter=self.options['Jaw']['window']+self.options['Jaw']['shift']-self.options['Teeth']['window']-self.options['Teeth']['shift']
|
||||||
|
TeethLipsIter=self.options['Teeth']['window']+self.options['Teeth']['shift']-self.options['Lips']['window']-self.options['Lips']['shift']
|
||||||
|
for i in range(len(req['Jaw']['y'])):
|
||||||
|
ans['Jaw-Teeth'].append(abs(req['Jaw']['y'][i]-req['Teeth']['y'][JawTeethIter+i]))
|
||||||
|
ans['Teeth-Lips'].append(-abs(req['Teeth']['y'][JawTeethIter+i]-req['Lips']['y'][JawTeethIter+TeethLipsIter+i]))
|
||||||
|
ans['x']=req['Jaw']['x']
|
||||||
|
|
||||||
|
return ans
|
||||||
|
|
||||||
|
|
||||||
|
def pltShow(self,showOnlyIndex,drawFig):
|
||||||
|
ans=None
|
||||||
|
req=[]
|
||||||
|
row=1
|
||||||
|
if not showOnlyIndex:
|
||||||
|
|
||||||
|
row=2
|
||||||
|
req.append({
|
||||||
|
'vtype':'OCHL',
|
||||||
|
'df':self.base_df,
|
||||||
|
'row':1,
|
||||||
|
'col':1,
|
||||||
|
'name':'OHCL'
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
req.append({
|
||||||
|
'vtype':'Bars',
|
||||||
|
'df':pd.DataFrame(
|
||||||
|
{'Jaw-Teeth':self.ans['Jaw-Teeth'],
|
||||||
|
'Teeth-Lips':self.ans['Teeth-Lips'],
|
||||||
|
'date':self.ans['x'].to_list()}
|
||||||
|
) ,
|
||||||
|
'row':row,
|
||||||
|
'col':1,
|
||||||
|
'name':'Gator',
|
||||||
|
'colorType':'diffAbs'
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
self.figDict=req
|
||||||
|
ans = CoreDraw.coreDraw(req,drawFig)
|
||||||
|
return ans
|
||||||
188
Core/Ind_Ishimoku.py
Normal file
188
Core/Ind_Ishimoku.py
Normal file
@ -0,0 +1,188 @@
|
|||||||
|
|
||||||
|
import pandas as pd
|
||||||
|
import datetime
|
||||||
|
import numpy as np
|
||||||
|
import plotly as pl
|
||||||
|
import plotly.graph_objs as go
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
import math
|
||||||
|
import scipy
|
||||||
|
import random
|
||||||
|
import statistics
|
||||||
|
|
||||||
|
|
||||||
|
import datetime
|
||||||
|
import matplotlib.dates as mdates
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
|
||||||
|
import mplfinance as mpf
|
||||||
|
|
||||||
|
import plotly
|
||||||
|
#import plotly.plotly as py
|
||||||
|
import plotly.graph_objs as go
|
||||||
|
# these two lines allow your code to show up in a notebook
|
||||||
|
from plotly.offline import init_notebook_mode, iplot
|
||||||
|
from plotly.subplots import make_subplots
|
||||||
|
import CoreDraw
|
||||||
|
init_notebook_mode()
|
||||||
|
import CoreTraidMath
|
||||||
|
import plotly.express as px
|
||||||
|
|
||||||
|
|
||||||
|
class Ishimoku:
|
||||||
|
|
||||||
|
def __init__(self, base_df, options={
|
||||||
|
'dataType':'ohcl',
|
||||||
|
'short':9,
|
||||||
|
'middle':26,
|
||||||
|
'long':52,
|
||||||
|
'backstep':26,
|
||||||
|
'forwardstep':26
|
||||||
|
},needFig=False,showOnlyIndex=True,drawFig=False
|
||||||
|
):
|
||||||
|
|
||||||
|
self.base_df=base_df.reset_index(drop=True)
|
||||||
|
self.options=options
|
||||||
|
|
||||||
|
self.ans=self.getAns()
|
||||||
|
if needFig:
|
||||||
|
self.fig=self.pltShow(showOnlyIndex,drawFig)
|
||||||
|
|
||||||
|
|
||||||
|
def getTankenSen(self):
|
||||||
|
y=np.asarray([])
|
||||||
|
x=np.asarray([])
|
||||||
|
for i in range(self.options['short'],self.base_df.shape[0]):
|
||||||
|
maxValue=max(self.base_df['high'][i-self.options['short']:i])
|
||||||
|
minValue=min(self.base_df['low'][i-self.options['short']:i])
|
||||||
|
y=np.append(y,(maxValue+minValue)*0.5)
|
||||||
|
x=np.append(x,self.base_df['date'][i])
|
||||||
|
#ts.append(max(self.base_df[self.options['colName']['high']][i-self.options['short']:i]))
|
||||||
|
ans={'y':y,'x':x}
|
||||||
|
return(ans)
|
||||||
|
|
||||||
|
def getKijunSen(self):
|
||||||
|
y=np.asarray([])
|
||||||
|
x=np.asarray([])
|
||||||
|
for i in range(self.options['middle'],self.base_df.shape[0]):
|
||||||
|
maxValue=max(self.base_df['high'][i-self.options['middle']:i])
|
||||||
|
minValue=min(self.base_df['low'][i-self.options['middle']:i])
|
||||||
|
y=np.append(y,(maxValue+minValue)*0.5)
|
||||||
|
x=np.append(x,self.base_df['date'][i])
|
||||||
|
#ts.append(max(self.base_df[self.options['colName']['high']][i-self.options['short']:i]))
|
||||||
|
ans={'y':y,'x':x}
|
||||||
|
return(ans)
|
||||||
|
|
||||||
|
def getChinkoSpan(self):
|
||||||
|
y=np.asarray(self.base_df['close'][self.options['backstep']:])
|
||||||
|
x=np.asarray(self.base_df['date'][:self.base_df.shape[0]-self.options['backstep']])
|
||||||
|
ans={'y':y,'x':x}
|
||||||
|
return(ans)
|
||||||
|
|
||||||
|
def getSenkouSpanA(self, data):
|
||||||
|
y=np.asarray([])
|
||||||
|
x=np.asarray([])
|
||||||
|
shift=len(data['TankenSen']['y'])-len(data['KijunSen']['y'])
|
||||||
|
for i in range(len(data['KijunSen']['x'])-self.options['forwardstep']):
|
||||||
|
y=np.append(y,(data['KijunSen']['y'][i]+data['TankenSen']['y'][i+shift])*0.5)
|
||||||
|
x=np.append(x,data['KijunSen']['x'][i+self.options['forwardstep']])
|
||||||
|
|
||||||
|
ans={'y':y,'x':x}
|
||||||
|
return(ans)
|
||||||
|
|
||||||
|
def getSenkouSpanB(self):
|
||||||
|
y=np.asarray([])
|
||||||
|
x=np.asarray([])
|
||||||
|
for i in range(self.options['long'],self.base_df.shape[0]-self.options['forwardstep']):
|
||||||
|
maxValue=max(self.base_df['high'][i-self.options['long']:i])
|
||||||
|
minValue=min(self.base_df['low'][i-self.options['long']:i])
|
||||||
|
y=np.append(y,(maxValue+minValue)*0.5)
|
||||||
|
x=np.append(x,self.base_df['date'][i+self.options['forwardstep']])
|
||||||
|
#ts.append(max(self.base_df[self.options['colName']['high']][i-sel
|
||||||
|
|
||||||
|
ans={'y':y,'x':x}
|
||||||
|
return(ans)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def getAns(self):
|
||||||
|
ans={}
|
||||||
|
ans['TankenSen']=self.getTankenSen()
|
||||||
|
ans['KijunSen']=self.getKijunSen()
|
||||||
|
ans['ChinkoSpan']=self.getChinkoSpan()
|
||||||
|
ans['SenkouSpanA']=self.getSenkouSpanA(ans)
|
||||||
|
ans['SenkouSpanB']=self.getSenkouSpanB()
|
||||||
|
#print(ans)
|
||||||
|
return(ans)
|
||||||
|
|
||||||
|
|
||||||
|
def pltShow(self,showOnlyIndex,drawFig):
|
||||||
|
ans=None
|
||||||
|
req=[]
|
||||||
|
|
||||||
|
req.append({
|
||||||
|
'vtype':'Scatter',
|
||||||
|
'df':pd.DataFrame(
|
||||||
|
{'value':self.ans['TankenSen']['y'],'date':self.ans['TankenSen']['x']}) ,
|
||||||
|
'row':1,
|
||||||
|
'col':1,
|
||||||
|
'name':'TankenSen'
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
req.append({
|
||||||
|
'vtype':'Scatter',
|
||||||
|
'df':pd.DataFrame(
|
||||||
|
{'value':self.ans['KijunSen']['y'],'date':self.ans['KijunSen']['x']}) ,
|
||||||
|
'row':1,
|
||||||
|
'col':1,
|
||||||
|
'name':'KijunSen'
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
req.append({
|
||||||
|
'vtype':'Scatter',
|
||||||
|
'df':pd.DataFrame(
|
||||||
|
{'value':self.ans['ChinkoSpan']['y'],'date':self.ans['ChinkoSpan']['x']}) ,
|
||||||
|
'row':1,
|
||||||
|
'col':1,
|
||||||
|
'name':'ChinkoSpan'
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
req.append({
|
||||||
|
'vtype':'Scatter',
|
||||||
|
'df':pd.DataFrame(
|
||||||
|
{'value':self.ans['SenkouSpanA']['y'],'date':self.ans['SenkouSpanA']['x']}) ,
|
||||||
|
'row':1,
|
||||||
|
'col':1,
|
||||||
|
'name':'SenkouSpanA'
|
||||||
|
|
||||||
|
})
|
||||||
|
req.append({
|
||||||
|
'vtype':'Scatter',
|
||||||
|
'df':pd.DataFrame(
|
||||||
|
{'value':self.ans['SenkouSpanB']['y'],'date':self.ans['SenkouSpanB']['x']}) ,
|
||||||
|
'row':1,
|
||||||
|
'col':1,
|
||||||
|
'name':'SenkouSpanB'
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
if not showOnlyIndex:
|
||||||
|
req.append({
|
||||||
|
'vtype':'OCHL',
|
||||||
|
'df':self.base_df,
|
||||||
|
'row':1,
|
||||||
|
'col':1,
|
||||||
|
'name':'OHCL'
|
||||||
|
|
||||||
|
})
|
||||||
|
self.figDict=req
|
||||||
|
ans = CoreDraw.coreDraw(req,drawFig)
|
||||||
|
#print(ans)
|
||||||
|
return ans
|
||||||
104
Core/Ind_LRI.py
Normal file
104
Core/Ind_LRI.py
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
|
||||||
|
import pandas as pd
|
||||||
|
import datetime
|
||||||
|
import numpy as np
|
||||||
|
import plotly as pl
|
||||||
|
import plotly.graph_objs as go
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
import math
|
||||||
|
import scipy
|
||||||
|
import random
|
||||||
|
import statistics
|
||||||
|
|
||||||
|
|
||||||
|
import datetime
|
||||||
|
import matplotlib.dates as mdates
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
|
||||||
|
import mplfinance as mpf
|
||||||
|
|
||||||
|
import plotly
|
||||||
|
#import plotly.plotly as py
|
||||||
|
import plotly.graph_objs as go
|
||||||
|
# these two lines allow your code to show up in a notebook
|
||||||
|
from plotly.offline import init_notebook_mode, iplot
|
||||||
|
from plotly.subplots import make_subplots
|
||||||
|
init_notebook_mode()
|
||||||
|
|
||||||
|
import CoreTraidMath
|
||||||
|
import CoreDraw
|
||||||
|
|
||||||
|
|
||||||
|
class LRI:
|
||||||
|
def __init__(self, base_df,options={}, needFig=False,showOnlyIndex=True,drawFig=False):
|
||||||
|
self.base_df=base_df.reset_index(drop=True)
|
||||||
|
self.options=options
|
||||||
|
self.col=self.base_df[self.options['valueType']]
|
||||||
|
self.ans=self.getAns()
|
||||||
|
if needFig:
|
||||||
|
self.fig=self.pltShow(showOnlyIndex,drawFig)
|
||||||
|
|
||||||
|
def getAns(self):
|
||||||
|
ans=None
|
||||||
|
|
||||||
|
l=np.asarray(list(range(len(self.col))))
|
||||||
|
k,b=np.polyfit(l,self.col,1)
|
||||||
|
setattr(self,'k',k)
|
||||||
|
setattr(self,'b',b)
|
||||||
|
b1=b+self.options['k']*pow(1-k*k,0.5)
|
||||||
|
b2=b-self.options['k']*pow(1-k*k,0.5)
|
||||||
|
ans={
|
||||||
|
'LRI':l*k+b,
|
||||||
|
'LRI+':l*k+b1,
|
||||||
|
'LRI-':l*k+b2,
|
||||||
|
'x':self.base_df['date']
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return ans
|
||||||
|
def pltShow(self,showOnlyIndex,drawFig):
|
||||||
|
ans=None
|
||||||
|
req=[]
|
||||||
|
row=1
|
||||||
|
if not showOnlyIndex:
|
||||||
|
|
||||||
|
#row=2
|
||||||
|
req.append({
|
||||||
|
'vtype':'OCHL',
|
||||||
|
'df':self.base_df,
|
||||||
|
'row':1,
|
||||||
|
'col':1,
|
||||||
|
'name':'OHCL'
|
||||||
|
|
||||||
|
})
|
||||||
|
req.append({
|
||||||
|
'vtype':'Scatter',
|
||||||
|
'df':pd.DataFrame(
|
||||||
|
{'value':self.ans['LRI'],'date':self.ans['x']}) ,
|
||||||
|
'row':row,
|
||||||
|
'col':1,
|
||||||
|
'name':'LRI'
|
||||||
|
|
||||||
|
})
|
||||||
|
req.append({
|
||||||
|
'vtype':'Scatter',
|
||||||
|
'df':pd.DataFrame(
|
||||||
|
{'value':self.ans['LRI+'],'date':self.ans['x']}) ,
|
||||||
|
'row':row,
|
||||||
|
'col':1,
|
||||||
|
'name':'LRI+'
|
||||||
|
|
||||||
|
})
|
||||||
|
req.append({
|
||||||
|
'vtype':'Scatter',
|
||||||
|
'df':pd.DataFrame(
|
||||||
|
{'value':self.ans['LRI-'],'date':self.ans['x']}) ,
|
||||||
|
'row':row,
|
||||||
|
'col':1,
|
||||||
|
'name':'LRI-'
|
||||||
|
|
||||||
|
})
|
||||||
|
self.figDict=req
|
||||||
|
ans = CoreDraw.coreDraw(req,drawFig)
|
||||||
|
return ans
|
||||||
88
Core/Ind_STD.py
Normal file
88
Core/Ind_STD.py
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
|
||||||
|
import pandas as pd
|
||||||
|
import datetime
|
||||||
|
import numpy as np
|
||||||
|
import plotly as pl
|
||||||
|
import plotly.graph_objs as go
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
import math
|
||||||
|
import scipy
|
||||||
|
import random
|
||||||
|
import statistics
|
||||||
|
|
||||||
|
|
||||||
|
import datetime
|
||||||
|
import matplotlib.dates as mdates
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
|
||||||
|
import mplfinance as mpf
|
||||||
|
|
||||||
|
import plotly
|
||||||
|
#import plotly.plotly as py
|
||||||
|
import plotly.graph_objs as go
|
||||||
|
# these two lines allow your code to show up in a notebook
|
||||||
|
from plotly.offline import init_notebook_mode, iplot
|
||||||
|
from plotly.subplots import make_subplots
|
||||||
|
init_notebook_mode()
|
||||||
|
|
||||||
|
import CoreTraidMath
|
||||||
|
import CoreDraw
|
||||||
|
|
||||||
|
class ISTD:
|
||||||
|
def __init__(self, base_df,options={}, needFig=False,showOnlyIndex=True,drawFig=False):
|
||||||
|
self.base_df=base_df.reset_index(drop=True)
|
||||||
|
self.options=options
|
||||||
|
self.ans=self.getAns()
|
||||||
|
if needFig:
|
||||||
|
self.fig=self.pltShow(showOnlyIndex,drawFig)
|
||||||
|
|
||||||
|
def getAns(self):
|
||||||
|
ans=None
|
||||||
|
try:
|
||||||
|
op={'dataType':'ohcl',
|
||||||
|
'action':'findSTD',
|
||||||
|
'actionOptions':{
|
||||||
|
'valueType':self.options['valueType'],
|
||||||
|
'window':self.options['window']
|
||||||
|
}
|
||||||
|
}
|
||||||
|
x=self.base_df['date'][self.options['window']-1:].to_list()
|
||||||
|
except:
|
||||||
|
op={'dataType':'ohcl',
|
||||||
|
'action':'findSTD',
|
||||||
|
'actionOptions':{'valueType':self.options['valueType']}
|
||||||
|
}
|
||||||
|
x=self.base_df['date'].to_list()
|
||||||
|
y= CoreTraidMath.CoreMath(self.base_df,op).ans
|
||||||
|
ans={'y':y,'x':x}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return ans
|
||||||
|
def pltShow(self,showOnlyIndex,drawFig):
|
||||||
|
ans=None
|
||||||
|
req=[]
|
||||||
|
row=1
|
||||||
|
if not showOnlyIndex:
|
||||||
|
|
||||||
|
row=2
|
||||||
|
req.append({
|
||||||
|
'vtype':'OCHL',
|
||||||
|
'df':self.base_df,
|
||||||
|
'row':1,
|
||||||
|
'col':1,
|
||||||
|
'name':'OHCL'
|
||||||
|
|
||||||
|
})
|
||||||
|
req.append({
|
||||||
|
'vtype':'Scatter',
|
||||||
|
'df':pd.DataFrame(
|
||||||
|
{'value':self.ans['y'],'date':self.ans['x']}) ,
|
||||||
|
'row':row,
|
||||||
|
'col':1,
|
||||||
|
'name':'ISTD'
|
||||||
|
|
||||||
|
})
|
||||||
|
self.figDict=req
|
||||||
|
ans = CoreDraw.coreDraw(req,drawFig)
|
||||||
|
return ans
|
||||||
147
Core/Ind_Stochastic.py
Normal file
147
Core/Ind_Stochastic.py
Normal file
@ -0,0 +1,147 @@
|
|||||||
|
|
||||||
|
import pandas as pd
|
||||||
|
import datetime
|
||||||
|
import numpy as np
|
||||||
|
import plotly as pl
|
||||||
|
import plotly.graph_objs as go
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
import math
|
||||||
|
import scipy
|
||||||
|
import random
|
||||||
|
import statistics
|
||||||
|
|
||||||
|
|
||||||
|
import datetime
|
||||||
|
import matplotlib.dates as mdates
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
|
||||||
|
import mplfinance as mpf
|
||||||
|
|
||||||
|
import plotly
|
||||||
|
#import plotly.plotly as py
|
||||||
|
import plotly.graph_objs as go
|
||||||
|
# these two lines allow your code to show up in a notebook
|
||||||
|
from plotly.offline import init_notebook_mode, iplot
|
||||||
|
from plotly.subplots import make_subplots
|
||||||
|
init_notebook_mode()
|
||||||
|
|
||||||
|
import CoreTraidMath
|
||||||
|
import CoreDraw
|
||||||
|
|
||||||
|
class Stochastic:
|
||||||
|
|
||||||
|
def __init__(self, base_df, options={
|
||||||
|
'dataType':'ohcl',
|
||||||
|
'window':14,
|
||||||
|
'windowSMA':5
|
||||||
|
}, needFig=False,showOnlyIndex=True,drawFig=False
|
||||||
|
):
|
||||||
|
|
||||||
|
self.base_df=base_df.reset_index(drop=True)
|
||||||
|
self.options=options
|
||||||
|
|
||||||
|
self.ans=self.getAns()
|
||||||
|
if needFig:
|
||||||
|
self.fig=self.pltShow(showOnlyIndex,drawFig)
|
||||||
|
|
||||||
|
def getKn(self):
|
||||||
|
ans={}
|
||||||
|
y=np.asarray([])
|
||||||
|
x=np.asarray([])
|
||||||
|
for i in range(self.options['window'],self.base_df.shape[0]):
|
||||||
|
minValue=min(self.base_df['low'][i-self.options['window']:i])
|
||||||
|
maxValue=max(self.base_df['high'][i-self.options['window']:i])
|
||||||
|
|
||||||
|
y=np.append(y,(self.base_df['close'][i-1]-minValue)/(maxValue-minValue))
|
||||||
|
x=np.append(x,self.base_df['date'][i-1])
|
||||||
|
#print(i,minValue,maxValue,self.base_df[self.options['colName']['close']][i],y[-1])
|
||||||
|
ans['y'],ans['x']=y,x
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return ans
|
||||||
|
|
||||||
|
|
||||||
|
def getSMA(self,col):
|
||||||
|
ans=None
|
||||||
|
ser = pd.Series(col, copy=False)
|
||||||
|
op={'dataType':'series',
|
||||||
|
'action':'findMean',
|
||||||
|
'actionOptions':{'MeanType':'SMA','window':self.options['windowSMA']}
|
||||||
|
}
|
||||||
|
ans=np.asarray(CoreTraidMath.CoreMath(ser,op).ans)
|
||||||
|
return ans
|
||||||
|
#return np.convolve(col, np.ones(self.options['windowSMA']), 'valid') /self.options['windowSMA']
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def getDn(self,col):
|
||||||
|
ans={}
|
||||||
|
y=np.asarray([])
|
||||||
|
x=np.asarray([])
|
||||||
|
for i in range(self.options['windowSMA'],len(col['y'])):
|
||||||
|
y=np.append(y, self.getSMA(col['y'][i-self.options['windowSMA']:i]))
|
||||||
|
x=np.append(x,col['x'][i])
|
||||||
|
|
||||||
|
ans['y'],ans['x']=y,x
|
||||||
|
return ans
|
||||||
|
|
||||||
|
def getAns(self):
|
||||||
|
ans={}
|
||||||
|
ans['Kn']=self.getKn()
|
||||||
|
ans['Dn']=self.getDn(ans['Kn'])
|
||||||
|
|
||||||
|
#print(ans)
|
||||||
|
return(ans)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def pltShow(self,showOnlyIndex,drawFig):
|
||||||
|
ans=None
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
req=[]
|
||||||
|
|
||||||
|
row=1
|
||||||
|
if not showOnlyIndex:
|
||||||
|
|
||||||
|
row=2
|
||||||
|
req.append({
|
||||||
|
'vtype':'OCHL',
|
||||||
|
'df':self.base_df,
|
||||||
|
'row':1,
|
||||||
|
'col':1,
|
||||||
|
'name':'OHCL'
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
req.append({
|
||||||
|
'vtype':'Scatter',
|
||||||
|
'df':pd.DataFrame(
|
||||||
|
{'value':self.ans['Kn']['y'],'date':self.ans['Kn']['x']}) ,
|
||||||
|
'row':row,
|
||||||
|
'col':1,
|
||||||
|
'name':'Kn'
|
||||||
|
|
||||||
|
})
|
||||||
|
req.append({
|
||||||
|
'vtype':'Scatter',
|
||||||
|
'df':pd.DataFrame(
|
||||||
|
{'value':self.ans['Dn']['y'],'date':self.ans['Dn']['x']}) ,
|
||||||
|
'row':row,
|
||||||
|
'col':1,
|
||||||
|
'name':'Dn'
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
self.figDict=req
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ans = CoreDraw.coreDraw(req,drawFig)
|
||||||
|
|
||||||
|
return ans
|
||||||
|
|
||||||
109
Core/Ind_bollingerBands.py
Normal file
109
Core/Ind_bollingerBands.py
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
import pandas as pd
|
||||||
|
import datetime
|
||||||
|
import numpy as np
|
||||||
|
import plotly as pl
|
||||||
|
import plotly.graph_objs as go
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
import math
|
||||||
|
import scipy
|
||||||
|
import random
|
||||||
|
import statistics
|
||||||
|
|
||||||
|
|
||||||
|
import datetime
|
||||||
|
import matplotlib.dates as mdates
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
|
||||||
|
import mplfinance as mpf
|
||||||
|
|
||||||
|
import plotly
|
||||||
|
#import plotly.plotly as py
|
||||||
|
import plotly.graph_objs as go
|
||||||
|
# these two lines allow your code to show up in a notebook
|
||||||
|
from plotly.offline import init_notebook_mode, iplot
|
||||||
|
from plotly.subplots import make_subplots
|
||||||
|
init_notebook_mode()
|
||||||
|
|
||||||
|
import CoreTraidMath
|
||||||
|
import CoreDraw
|
||||||
|
|
||||||
|
|
||||||
|
class BB:
|
||||||
|
|
||||||
|
def __init__(self, base_df,options={}, needFig=False,showOnlyIndex=True,drawFig=False):
|
||||||
|
self.base_df=base_df.reset_index(drop=True)
|
||||||
|
self.options=options
|
||||||
|
self.ans=self.getAns()
|
||||||
|
if needFig:
|
||||||
|
self.fig=self.pltShow(showOnlyIndex,drawFig)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def getAns(self):
|
||||||
|
ans={}
|
||||||
|
|
||||||
|
opMA={'dataType':'ohcl',
|
||||||
|
'action':'findMean',
|
||||||
|
'actionOptions':{
|
||||||
|
'MeanType':self.options['MeanType'],
|
||||||
|
'valueType':self.options['valueType'],
|
||||||
|
'window':self.options['window']
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ans['BB']=CoreTraidMath.CoreMath(self.base_df,opMA).ans
|
||||||
|
opSTD={'dataType':'ohcl',
|
||||||
|
'action':'findSTD',
|
||||||
|
'actionOptions':{'valueType':self.options['valueType'],'window':self.options['window']}
|
||||||
|
}
|
||||||
|
ans['STD']=CoreTraidMath.CoreMath(self.base_df,opSTD).ans
|
||||||
|
ans['pSTD']=ans['BB']+ans['STD']*self.options['kDev']
|
||||||
|
ans['mSTD']=ans['BB']-ans['STD']*self.options['kDev']
|
||||||
|
ans['x']=np.array(self.base_df['date'][self.options['window']-1:].to_list())
|
||||||
|
return ans
|
||||||
|
|
||||||
|
def pltShow(self,showOnlyIndex,drawFig):
|
||||||
|
ans=None
|
||||||
|
req=[]
|
||||||
|
row=1
|
||||||
|
if not showOnlyIndex:
|
||||||
|
|
||||||
|
#row=2
|
||||||
|
req.append({
|
||||||
|
'vtype':'OCHL',
|
||||||
|
'df':self.base_df,
|
||||||
|
'row':1,
|
||||||
|
'col':1,
|
||||||
|
'name':'OHCL'
|
||||||
|
|
||||||
|
})
|
||||||
|
req.append({
|
||||||
|
'vtype':'Scatter',
|
||||||
|
'df':pd.DataFrame(
|
||||||
|
{'value':self.ans['BB'],'date':self.ans['x']}) ,
|
||||||
|
'row':row,
|
||||||
|
'col':1,
|
||||||
|
'name':'BB'
|
||||||
|
|
||||||
|
})
|
||||||
|
req.append({
|
||||||
|
'vtype':'Scatter',
|
||||||
|
'df':pd.DataFrame(
|
||||||
|
{'value':self.ans['pSTD'],'date':self.ans['x']}) ,
|
||||||
|
'row':row,
|
||||||
|
'col':1,
|
||||||
|
'name':'pSTD'
|
||||||
|
|
||||||
|
})
|
||||||
|
req.append({
|
||||||
|
'vtype':'Scatter',
|
||||||
|
'df':pd.DataFrame(
|
||||||
|
{'value':self.ans['mSTD'],'date':self.ans['x']}) ,
|
||||||
|
'row':row,
|
||||||
|
'col':1,
|
||||||
|
'name':'mSTD'
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
self.figDict=req
|
||||||
|
ans = CoreDraw.coreDraw(req,drawFig)
|
||||||
|
return ans
|
||||||
2
Core/readme.txt
Normal file
2
Core/readme.txt
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
|
||||||
|
Ind_Envelopes - SMA only
|
||||||
1
Docs/readme.txt
Normal file
1
Docs/readme.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
|
||||||
1
Docs/с4.drawio
Normal file
1
Docs/с4.drawio
Normal file
@ -0,0 +1 @@
|
|||||||
|
<mxfile host="app.diagrams.net" modified="2022-04-23T16:24:24.185Z" agent="5.0 (Windows)" etag="FTT9fDegLeg4QNuYGNq3" version="16.6.4" type="device" pages="2"><diagram id="RiWZ9U7_gL--o0N2Vmwu" name="C1">7Vhtj6M2EP41fLwITCDkY8jLtVXvdO2u2t6nygEHvCGYGueF/vqOjQETWHSrnm5Pp11lWebxzNgej59HG8tdn27vOS7SDywmmYXs+Ga5GwshZ46QJT92XNXIwl3UQMJprJ064IH+SzRoa/RMY1L2HAVjmaBFH4xYnpNI9DDMObv23Q4s689a4IQMgIcIZ0P0TxqLtEYDtOjwnwhN0mZmx1/WIyfcOOudlCmO2dWA3K3lrjljon473dYkk8Vr6lLH7Z4ZbRfGSS6+JODv62bp8+r48Y/STqqn334p8Oqdp9cmqmbDJIb9a5NxkbKE5TjbdmjI2TmPicxqg9X5/MpYAaAD4BMRotKHic+CAZSKU6ZHyY2Kv2T4zNPWZ2Nkc9OZlVEZxifC6YkIwhssF7wyEknzsznWpVJWZVr3yYbl1BUu2ZlHZKKGTVtinhAx4advgiywMYE+rPeEwWp4BQ6cZFjQS78Bse7jpPXrjhpe9Gkrk+2f5E2AzWQ4Iil0POF3l2X+EZ90fqhDyXIAcwnp4cequBuu8Q0pI04LQQFSwyaAbHaQs6qIWR2S4T3JalcL+RmUJzywXPRazv/nzJqBd6VqmhU4OH5x6wbhLdF/VZZ9B3h6O8hrBqEg+/sAwOqZ+3BMLy3k1cnU5iGZtzFiTb9mCXwq2Ut360ztVmeJWMZ4L4uF3Ej9jMV6/QPr1WesFvfblAdIy98JzmhJNIvscFbqNpkkFrO3NREZJGOQgVyIZgpH2jEu05ZcrikVpCywun9XUBgZQLNs3RbCtQN3t5DXvxScHYk54ruOt9ZTGPhB/ciIFKs2P90SKV6zaD6rmxdWHsKmE9nkEfCBJIkQrh3exlTodReM5kJdK092jqQgtLbVr2ycNWCOtDTexxZ9UAPOHTiGoRFwNGV/bvgAcRPoN7xXhzBJeRfCBblNkpQedZ15HXLtxBHZWvFSUxgD+8VEBqbmshcoml7PBWdn3WwWbHa5k89wq56hBScYuOq5UIinnhv1DDQCcipfVk0gOKPGAd5tIyEy3ldNYDDCEzLQGQR6TUJ4BpPracPnhlvYn/0V9LzV4Z4Kd6L8bXQYfaEOu9+lDod0j8s1K6qhBj+wg7hCQQB+qEpBTs/K8QfMj0RO+chxTPOkjniT4h9DiqdoD03qbXfFnUZVH/qqalxn1Sghjo6JCmuUM2c5GcqvY/tOaE+I7EBHMY8avbdHZXvj2UtnKLj36jUQYDRU4DFVbqVyKMtoTKu/C/02MNQX9a8g4mipRbNqbHso6vMxUUf/W9RfRpKPND+yg/wvQ6aHK5FfSClWn36GmwKtc1u1BTH5U5IhWRX0WdpMhZBfJ6xU0p2oJ5klVKTn/YwywIyJdsZc/UAdEDEg6F271LvYNyr+0anYfSUqDtbBfOl/TSpeuP4iQG9U/O2oeOHbr0bFYHbfRipX4ztdd/sf</diagram><diagram id="4YQuiaAyOnZQqMlcwOd5" name="C2">7Vxbd6O2Fv41fowXd+xHfOu0Z9rxmeSsTp66ZJAxMxg5ICdxf/2RhAQSyDh2Lh63djss2JK2hNj69rc3Ij17vH7+JQeb1e8ogmnPMqLnnj3pWZbpWFaP/m9Eu1LiD4xSEOdJxCvVgtvkb8iFoto2iWChVMQIpTjZqMIQZRkMsSIDeY6e1GpLlKq9bkAMW4LbEKRt6Z9JhFeldGD5tfwTTOKV6Nn0hmXJGojK/E6KFYjQkySypz17nCOEy7P18ximdPLEvNwEw9SdIw/eP9x+Gm0e7ubj+KZUNjumSXULOczwyarH7jb84S++5J/+O/WjL+sw+uO3G36vjyDd8vnqTYze0KHHkcGOE3E0e4MRO3dJC3ZSVhuxopkQTtmlJc7J0WQSQ9LpcT21/kGtxPJScpejRU7OYnomVTBV5ZXaAT/SMcjV5H6rhmW/ttRw2KseMt4Jy4ERMSR+iXK8QjHKQDqtpaMcbbMI0vk1yFVd5zNCGyI0ifA7xHjHVwXYYkREK7xOeSl8TvA36fyequq7/GryzDWzi510MYd5soYY5kKW4Xz3rW5ML+/lsloVu9rJV01l5UTQu2+soAPmx+sVaJuHsKMeBxQM8hjiDtv0qjVGwAkiMsR8R9rlMAU4eVQHBzhKxFW9eiWQE74Y2CVafKc4Q24oBSFcETyBeQOKnD/Amuv/369EcJeDCIqyu92Gl41RhkGSkYkTRTBcZShFMcfK+Y5YREbMuGfZzwGZ2gkoVtLlPEU43YnWE1iEebLBCWlS971/oc0k854KsyfnY3UZSkuArw55JZqtyiNRTV4sAZPY7DiU1qN7zIqr1hq93xQsYMohh6/4JZlPZQl6D1skCm4KtogCUsH0Ns91YYUSAjdqgcufpOWKQmILi2YDIit7VsVR8liJ3FIZe/REGRtFKamfOJG7E0mn3L4NaZpOjp0Fs2sWuJaQjC1XtBDbm3r0P11bV7VCZd50c9S8TeuQK7OkNc39k4S4NZ5SQHxaJRjebgADkyfCTlTspOPhwGrSa2ZQIxD+iJmaMb/zDGUUqpdJmo6rybAtO7AmQ65Fki/Zj8hBmsR0GYYE8ygyjkAeit4oSBY4Rz+g1NKY+pNgQkoI/oBplGA+zBySRwYW7BZpww1KMszwxqV2ZfTpJI8N9o/az5gJdTK/LTTpldCgCnUy39WpNDV9N2WWRqhVqenbaAzSnVS28ghzDJ9PcDNttyC02NyRcwi2BF19qsmf5XDZSiZ+ggEc4UrIJfcmesr119fl9E9cfB3+nv717X6ZzdZjULnJsxCNmlzcSyWXTzS0M220icZBUHpDovEyc7C0DDzoduUDLtFZ0ufSscpPvwVmdN0lJEYKeME6iaLS0DrRqnPh8gCON67DJvlx7l8Qexf0jdE3PQoe1jGPhKub0+FLVdByWRBTaD6zqtfX80Vi4wX1nEbGiEeTMoriPYxPcb4GWtJeWYv+5ZOmCyFHIfu9Nznaj1d7yVEH9YlIWFF5B0abCpU2NdiPMbBnvqtlMZ5tuuMOXlSsALPl9XNM80X90OmXFmrpcKbBhVrcZx+j+SnIC4O7JiC+G29xVd5iamiLoaMtg1fTluMA7i6QAti3iIkPBMEsHxVI2aRJK64cSnkkl3tJS84LTaQgeiDi2UaIOlWjaXK0aiVWI8omR0/SNlLC88M6mRKuU06U+arTrxJlk1bvJRkYs+NUutkqJO+gDaYynno2BpfvY66B+am+x74G5tfA/CMDc8c/Y2Ae26sH+1thf0UFSn/JVv/5Pns4U2BeBdRKOF1H1z9TQO20A2rtTBp6S3jzgFr72sDQBtTDmeT1RlI229e9ipJfcgWqM63cqNFyo1Nev6YN7TdZWv8rSAs9DjrHUzV3pGojtfcLywnsX4udOQHyU/DEupQMAXuZFGySE7hzN0k+i4UbH2LSKqG1qldXjUEGatflO68rp/23clrnymmvnPY9Oa1vno/THul0kuwHcW0MSegGgiR7hAUO5r92JnOarqrld1YY021cAVM6w2Un/TjBq+2inyAikzqaSX2pDXmDEK3JRTXURttLx/ELweuPyX8fDBteiddH4fNgPHCG3lvis297/sC64vO5cw7msAHQnnu+pIM2WrXPknTQ7gaoNgC8ejdAldg4U/JCO9Ni87GUvDiYCf3w5IWjT17Iift2mDcWLw/KkK8KgapIyZdCL+NATKhsMTzt9YmlcWm1ho5djFV3jfco0ubgurLbGVsOLy4Psh8e9uIbAVLHcRSEE2Z+jjzIy0zc1Zp48JIUgtEy7o7kgWyp2lSc/GavO3fS7veorInyeu2ftcH8opHe0S+uj0F6X4/0ssHN1Je21fcX1v7FYEjLQHYIlaOojLUC73LLdzsGOflLinPyGf/fTWh+3u8obnEOMIx30yxOslO+pdibg2DLxpEWRmmIXiuDfLo1X3La4Zo+fkE6Yv/6uqaPr+mJd0tPNLZE+LpNf2dMH2vRWdnYXMtrkB9N9kE47Md9UvAlByExMcuYABIRgYKemgfw/b2//vxAlBfAfDSiSw+hhHUPrCnOZItiUym/YvxRGO91YrzY7Bzu0oSAfW5TMOXA6h5G/UXpIj4vhEAluqc7AQHu1jFO4cVe4MW7tE/H8rdG6I/ape1Yl/LCb5QQZB2jza7zBd/trsBwfRuiDRxRGwR5tRE72GzSJAQ1Dt+iJX4i00dKy2Yfh5oSNmm0kmeMb7i5U7UpXOI9YNJm2BrAO5Z3nz4kDuzyVHei9mHKegxnbZLSA2hWfWRiKgzTMhpgxfGrBTce+7URq/wdxEOBZ2wq21naBcIYrSstKCerozkicmtJFt+xpIJRCwRNpjc4B5igJVVI2YSjocgIAyxTZCnoz2mKN4tTKGUCRhniSeca8+cgisp+DXZjKXoKxF86oRI1W1zmKjYgE36DdLPNCxK5f4XcGbEqZIy8RQXiMJ8+whLLWU+LAqVbDIM6PLiS/Pcm+Y3veiyv7TFMY6hxGZ7zapdBLus/T1Pm7+s/8mNP/w8=</diagram></mxfile>
|
||||||
123
News/InvestCal.py
Normal file
123
News/InvestCal.py
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
from selenium import webdriver
|
||||||
|
import time
|
||||||
|
import pandas as pd
|
||||||
|
import requests
|
||||||
|
from bs4 import BeautifulSoup
|
||||||
|
import nest_asyncio
|
||||||
|
import asyncio
|
||||||
|
import requests_html as rh
|
||||||
|
import datetime
|
||||||
|
import pandas as pd
|
||||||
|
import json
|
||||||
|
|
||||||
|
|
||||||
|
def f_write(driver):
|
||||||
|
with open(r'C:\\BinOptions\\exemple_pars_tomorrow.txt', 'w',encoding="utf-8") as f:
|
||||||
|
f.write(driver.page_source)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def investingPars(path_file=None,dateDict=None):
|
||||||
|
ans=None
|
||||||
|
op=webdriver.FirefoxOptions()
|
||||||
|
#op.add_argument("--headless")
|
||||||
|
url='https://ru.investing.com/economic-calendar/'
|
||||||
|
#driver = webdriver.Firefox(executable_path='C:\\Users\\Redsandy\\Downloads\\geckodriver.exe')
|
||||||
|
EXE_PATH = r'C:\\Users\\Redsandy\\Downloads\\geckodriver.exe'
|
||||||
|
driver = webdriver.Firefox(executable_path=EXE_PATH,options=op)
|
||||||
|
try:
|
||||||
|
driver.get(url=url)
|
||||||
|
|
||||||
|
#time.sleep(5)
|
||||||
|
#driver.find_element_by_id('timeFrame_tomorrow').click()
|
||||||
|
#time.sleep(5)
|
||||||
|
#f_write(driver)
|
||||||
|
if dateDict!=None:
|
||||||
|
driver.find_element_by_id('datePickerToggleBtn').click()
|
||||||
|
driver.find_element_by_id("startDate").clear()
|
||||||
|
driver.find_element_by_id("startDate").send_keys(dateDict['startDate'])
|
||||||
|
driver.find_element_by_id("endDate").clear()
|
||||||
|
driver.find_element_by_id("endDate").send_keys(dateDict['endDate'])
|
||||||
|
#driver.find_element_by_id("startDate").send_keys("31/03/2022")
|
||||||
|
driver.find_element_by_id('applyBtn').click()
|
||||||
|
time.sleep(2)
|
||||||
|
driver.execute_script("window.scrollTo(0,document.body.scrollHeight)")
|
||||||
|
time.sleep(2)
|
||||||
|
f_write(driver)
|
||||||
|
page_source=driver.page_source
|
||||||
|
|
||||||
|
except Exception as ex:
|
||||||
|
print(ex)
|
||||||
|
finally:
|
||||||
|
driver.close()
|
||||||
|
driver.quit()
|
||||||
|
|
||||||
|
|
||||||
|
path_file_csv=path_file
|
||||||
|
ans=getDF(page_source,path_file_csv)
|
||||||
|
return ans
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def getTime(strok):
|
||||||
|
ans=None
|
||||||
|
if len(strok.text.split())==2:
|
||||||
|
ans = strok['title'].split()[-1]
|
||||||
|
else:
|
||||||
|
ans = strok.text
|
||||||
|
return ans
|
||||||
|
def getValat(strok):
|
||||||
|
ans=None
|
||||||
|
inc=0
|
||||||
|
for i in strok.find_all('i'):
|
||||||
|
if i['class'][0]=='grayFullBullishIcon':
|
||||||
|
inc=inc+1
|
||||||
|
ans= str(inc)+"/3"
|
||||||
|
return(ans)
|
||||||
|
def getUrl(strok):
|
||||||
|
ans=None
|
||||||
|
baseUrl='https://ru.investing.com'
|
||||||
|
ans=baseUrl+strok.find_all('a', href=True)[0]['href']
|
||||||
|
return ans
|
||||||
|
def getDF(doc,path_file):
|
||||||
|
ans=None
|
||||||
|
|
||||||
|
soup = BeautifulSoup(doc, 'html.parser')
|
||||||
|
tabl=soup.find("table", {"id": "economicCalendarData"}).find('tbody')
|
||||||
|
tdList=[]
|
||||||
|
buff=[]
|
||||||
|
for stats in tabl.find_all('tr'):
|
||||||
|
for row in stats.find_all('td'):
|
||||||
|
buff.append(row)
|
||||||
|
tdList.append(buff)
|
||||||
|
buff=[]
|
||||||
|
col_names=['Время', 'Валюта', 'Важность','Событие','URL', 'Факт.','Прогноз','Пред.','Date']
|
||||||
|
df= pd.DataFrame(columns=col_names)
|
||||||
|
|
||||||
|
|
||||||
|
for i in range(0, len(tdList)):
|
||||||
|
try:
|
||||||
|
if tdList[i][0]["class"][0]=='theDay':
|
||||||
|
colDate = tdList[i][0].text[:-3]
|
||||||
|
else:
|
||||||
|
newRow={
|
||||||
|
col_names[0]:getTime(tdList[i][0]),
|
||||||
|
col_names[1]:tdList[i][1].text.strip(),
|
||||||
|
col_names[2]:getValat(tdList[i][2]),
|
||||||
|
col_names[3]:tdList[i][3].text.strip(),
|
||||||
|
col_names[4]:getUrl(tdList[i][3]),
|
||||||
|
col_names[5]:tdList[i][4].text.strip(),
|
||||||
|
col_names[6]:tdList[i][5].text.strip(),
|
||||||
|
col_names[7]:tdList[i][6].text.strip(),
|
||||||
|
col_names[8]:colDate
|
||||||
|
}
|
||||||
|
df=df.append(newRow, ignore_index=True)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
if path_file!=None:
|
||||||
|
df.to_csv(path_file, index=False, encoding='utf-8-sig')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return df
|
||||||
|
|
||||||
9
News/readme.txt
Normal file
9
News/readme.txt
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
dateDict={
|
||||||
|
'startDate':'30/03/2022',
|
||||||
|
'endDate':'01/04/2022'
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
p='C:\\BinOptions\\df_tomorrow.csv'
|
||||||
|
InvestCal.investingPars(p,dateDict)
|
||||||
|
or InvestCal.investingPars()
|
||||||
@ -1,112 +0,0 @@
|
|||||||
<mxfile host="app.diagrams.net" modified="2022-04-23T16:23:27.589Z" agent="5.0 (Windows)" etag="Z2ssxHRfIMNF3WYeOc4m" version="16.6.4" type="github" pages="2">
|
|
||||||
<diagram id="RiWZ9U7_gL--o0N2Vmwu" name="C1">
|
|
||||||
<mxGraphModel dx="1422" dy="780" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
|
|
||||||
<root>
|
|
||||||
<mxCell id="0" />
|
|
||||||
<mxCell id="1" parent="0" />
|
|
||||||
<mxCell id="_wD96rykNVs0gyjQJpaA-5" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;exitPerimeter=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="1" source="_wD96rykNVs0gyjQJpaA-1" target="_wD96rykNVs0gyjQJpaA-2">
|
|
||||||
<mxGeometry relative="1" as="geometry" />
|
|
||||||
</mxCell>
|
|
||||||
<object placeholders="1" c4Name="Person name" c4Type="Person" c4Description="Description of person." label="<font style="font-size: 16px"><b>%c4Name%</b></font><div>[%c4Type%]</div><br><div><font style="font-size: 11px"><font color="#cccccc">%c4Description%</font></div>" isRealised="False" id="_wD96rykNVs0gyjQJpaA-1">
|
|
||||||
<mxCell style="html=1;fontSize=11;dashed=0;whitespace=wrap;fillColor=#083F75;strokeColor=#06315C;fontColor=#ffffff;shape=mxgraph.c4.person2;align=center;metaEdit=1;points=[[0.5,0,0],[1,0.5,0],[1,0.75,0],[0.75,1,0],[0.5,1,0],[0.25,1,0],[0,0.75,0],[0,0.5,0]];resizable=0;" vertex="1" parent="1">
|
|
||||||
<mxGeometry x="314" width="200" height="180" as="geometry" />
|
|
||||||
</mxCell>
|
|
||||||
</object>
|
|
||||||
<mxCell id="_wD96rykNVs0gyjQJpaA-4" value="Получение котировок и<br>совершение сделок" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="1" source="_wD96rykNVs0gyjQJpaA-2" target="_wD96rykNVs0gyjQJpaA-3">
|
|
||||||
<mxGeometry relative="1" as="geometry" />
|
|
||||||
</mxCell>
|
|
||||||
<object placeholders="1" c4Name="BibasCopy" c4Type="Software System" c4Description="Market Trading Sys" label="<font style="font-size: 16px"><b>%c4Name%</b></font><div>[%c4Type%]</div><br><div><font style="font-size: 11px"><font color="#cccccc">%c4Description%</font></div>" id="_wD96rykNVs0gyjQJpaA-2">
|
|
||||||
<mxCell style="rounded=1;whiteSpace=wrap;html=1;labelBackgroundColor=none;fillColor=#1061B0;fontColor=#ffffff;align=center;arcSize=10;strokeColor=#0D5091;metaEdit=1;resizable=0;points=[[0.25,0,0],[0.5,0,0],[0.75,0,0],[1,0.25,0],[1,0.5,0],[1,0.75,0],[0.75,1,0],[0.5,1,0],[0.25,1,0],[0,0.75,0],[0,0.5,0],[0,0.25,0]];" vertex="1" parent="1">
|
|
||||||
<mxGeometry x="294" y="290" width="240" height="120" as="geometry" />
|
|
||||||
</mxCell>
|
|
||||||
</object>
|
|
||||||
<object placeholders="1" c4Name="Tinkoff / investAPI
" c4Type="TradeApi" c4Description="https://tinkoff.github.io/investAPI/
https://github.com/Tinkoff/investAPI/" label="<font style="font-size: 16px"><b>%c4Name%</b></font><div>[%c4Type%]</div><br><div><font style="font-size: 11px"><font color="#cccccc">%c4Description%</font></div>" id="_wD96rykNVs0gyjQJpaA-3">
|
|
||||||
<mxCell style="rounded=1;whiteSpace=wrap;html=1;labelBackgroundColor=none;fillColor=#8C8496;fontColor=#ffffff;align=center;arcSize=10;strokeColor=#736782;metaEdit=1;resizable=0;points=[[0.25,0,0],[0.5,0,0],[0.75,0,0],[1,0.25,0],[1,0.5,0],[1,0.75,0],[0.75,1,0],[0.5,1,0],[0.25,1,0],[0,0.75,0],[0,0.5,0],[0,0.25,0]];" vertex="1" parent="1">
|
|
||||||
<mxGeometry x="760" y="290" width="240" height="120" as="geometry" />
|
|
||||||
</mxCell>
|
|
||||||
</object>
|
|
||||||
</root>
|
|
||||||
</mxGraphModel>
|
|
||||||
</diagram>
|
|
||||||
<diagram id="4YQuiaAyOnZQqMlcwOd5" name="C2">
|
|
||||||
<mxGraphModel dx="1422" dy="780" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
|
|
||||||
<root>
|
|
||||||
<mxCell id="-A9l5Po6eYqSHBpqTPCg-0" />
|
|
||||||
<mxCell id="-A9l5Po6eYqSHBpqTPCg-1" parent="-A9l5Po6eYqSHBpqTPCg-0" />
|
|
||||||
<mxCell id="C5uck7bOrHQE7dOmcdNJ-9" value="Данные для отображения <br>истории стратегий " style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;exitPerimeter=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="-A9l5Po6eYqSHBpqTPCg-1" source="-A9l5Po6eYqSHBpqTPCg-2" target="C5uck7bOrHQE7dOmcdNJ-6">
|
|
||||||
<mxGeometry relative="1" as="geometry" />
|
|
||||||
</mxCell>
|
|
||||||
<object placeholders="1" c4Name="UI Trade" c4Type="Container" c4Technology="Python
Dash
Plotly" c4Description="UI для просмотра работы текущих стратеий" label="<font style="font-size: 16px"><b>%c4Name%</b></font><div>[%c4Type%: %c4Technology%]</div><br><div><font style="font-size: 11px"><font color="#E6E6E6">%c4Description%</font></div>" id="-A9l5Po6eYqSHBpqTPCg-2">
|
|
||||||
<mxCell style="rounded=1;whiteSpace=wrap;html=1;fontSize=11;labelBackgroundColor=none;fillColor=#23A2D9;fontColor=#ffffff;align=center;arcSize=10;strokeColor=#0E7DAD;metaEdit=1;resizable=0;points=[[0.25,0,0],[0.5,0,0],[0.75,0,0],[1,0.25,0],[1,0.5,0],[1,0.75,0],[0.75,1,0],[0.5,1,0],[0.25,1,0],[0,0.75,0],[0,0.5,0],[0,0.25,0]];" vertex="1" parent="-A9l5Po6eYqSHBpqTPCg-1">
|
|
||||||
<mxGeometry x="130" y="280" width="240" height="120" as="geometry" />
|
|
||||||
</mxCell>
|
|
||||||
</object>
|
|
||||||
<mxCell id="_RfEWtsR9Ml_XYfnFmCa-1" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;exitPerimeter=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="-A9l5Po6eYqSHBpqTPCg-1" source="_RfEWtsR9Ml_XYfnFmCa-0" target="-A9l5Po6eYqSHBpqTPCg-2">
|
|
||||||
<mxGeometry relative="1" as="geometry" />
|
|
||||||
</mxCell>
|
|
||||||
<mxCell id="_RfEWtsR9Ml_XYfnFmCa-2" value="Смотрит" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="_RfEWtsR9Ml_XYfnFmCa-1">
|
|
||||||
<mxGeometry x="-0.1625" relative="1" as="geometry">
|
|
||||||
<mxPoint as="offset" />
|
|
||||||
</mxGeometry>
|
|
||||||
</mxCell>
|
|
||||||
<object placeholders="1" c4Name="Person name" c4Type="Person" c4Description="Description of person." label="<font style="font-size: 16px"><b>%c4Name%</b></font><div>[%c4Type%]</div><br><div><font style="font-size: 11px"><font color="#cccccc">%c4Description%</font></div>" id="_RfEWtsR9Ml_XYfnFmCa-0">
|
|
||||||
<mxCell style="html=1;fontSize=11;dashed=0;whitespace=wrap;fillColor=#083F75;strokeColor=#06315C;fontColor=#ffffff;shape=mxgraph.c4.person2;align=center;metaEdit=1;points=[[0.5,0,0],[1,0.5,0],[1,0.75,0],[0.75,1,0],[0.5,1,0],[0.25,1,0],[0,0.75,0],[0,0.5,0]];resizable=0;" vertex="1" parent="-A9l5Po6eYqSHBpqTPCg-1">
|
|
||||||
<mxGeometry x="150" y="10" width="200" height="180" as="geometry" />
|
|
||||||
</mxCell>
|
|
||||||
</object>
|
|
||||||
<object placeholders="1" c4Name="TA
" c4Type="Container" c4Technology="Python
Plotly" c4Description="Контейнер индикаторов и осцилляторов с возможностью их отрисовки" label="<font style="font-size: 16px"><b>%c4Name%</b></font><div>[%c4Type%: %c4Technology%]</div><br><div><font style="font-size: 11px"><font color="#E6E6E6">%c4Description%</font></div>" id="_RfEWtsR9Ml_XYfnFmCa-3">
|
|
||||||
<mxCell style="rounded=1;whiteSpace=wrap;html=1;fontSize=11;labelBackgroundColor=none;fillColor=#23A2D9;fontColor=#ffffff;align=center;arcSize=10;strokeColor=#0E7DAD;metaEdit=1;resizable=0;points=[[0.25,0,0],[0.5,0,0],[0.75,0,0],[1,0.25,0],[1,0.5,0],[1,0.75,0],[0.75,1,0],[0.5,1,0],[0.25,1,0],[0,0.75,0],[0,0.5,0],[0,0.25,0]];" vertex="1" parent="-A9l5Po6eYqSHBpqTPCg-1">
|
|
||||||
<mxGeometry x="130" y="470" width="240" height="120" as="geometry" />
|
|
||||||
</mxCell>
|
|
||||||
</object>
|
|
||||||
<mxCell id="g3hq3Xs3RosolGnhKjFq-1" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="-A9l5Po6eYqSHBpqTPCg-1" source="_RfEWtsR9Ml_XYfnFmCa-4" target="g3hq3Xs3RosolGnhKjFq-0">
|
|
||||||
<mxGeometry relative="1" as="geometry" />
|
|
||||||
</mxCell>
|
|
||||||
<mxCell id="C5uck7bOrHQE7dOmcdNJ-0" value="Получение котировок и<br>совершение сделок" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="g3hq3Xs3RosolGnhKjFq-1">
|
|
||||||
<mxGeometry x="-0.1111" y="2" relative="1" as="geometry">
|
|
||||||
<mxPoint as="offset" />
|
|
||||||
</mxGeometry>
|
|
||||||
</mxCell>
|
|
||||||
<object placeholders="1" c4Name="TradeApi" c4Type="Container" c4Technology="" c4Description="Получение котировок и совершение сделок от брокера" label="<font style="font-size: 16px"><b>%c4Name%</b></font><div>[%c4Type%: %c4Technology%]</div><br><div><font style="font-size: 11px"><font color="#E6E6E6">%c4Description%</font></div>" id="_RfEWtsR9Ml_XYfnFmCa-4">
|
|
||||||
<mxCell style="rounded=1;whiteSpace=wrap;html=1;fontSize=11;labelBackgroundColor=none;fillColor=#23A2D9;fontColor=#ffffff;align=center;arcSize=10;strokeColor=#0E7DAD;metaEdit=1;resizable=0;points=[[0.25,0,0],[0.5,0,0],[0.75,0,0],[1,0.25,0],[1,0.5,0],[1,0.75,0],[0.75,1,0],[0.5,1,0],[0.25,1,0],[0,0.75,0],[0,0.5,0],[0,0.25,0]];" vertex="1" parent="-A9l5Po6eYqSHBpqTPCg-1">
|
|
||||||
<mxGeometry x="710" y="470" width="240" height="120" as="geometry" />
|
|
||||||
</mxCell>
|
|
||||||
</object>
|
|
||||||
<object placeholders="1" c4Name="Tinkoff / investAPI
" c4Type="TradeApi" c4Description="https://tinkoff.github.io/investAPI/
https://github.com/Tinkoff/investAPI/" label="<font style="font-size: 16px"><b>%c4Name%</b></font><div>[%c4Type%]</div><br><div><font style="font-size: 11px"><font color="#cccccc">%c4Description%</font></div>" id="g3hq3Xs3RosolGnhKjFq-0">
|
|
||||||
<mxCell style="rounded=1;whiteSpace=wrap;html=1;labelBackgroundColor=none;fillColor=#8C8496;fontColor=#ffffff;align=center;arcSize=10;strokeColor=#736782;metaEdit=1;resizable=0;points=[[0.25,0,0],[0.5,0,0],[0.75,0,0],[1,0.25,0],[1,0.5,0],[1,0.75,0],[0.75,1,0],[0.5,1,0],[0.25,1,0],[0,0.75,0],[0,0.5,0],[0,0.25,0]];" vertex="1" parent="-A9l5Po6eYqSHBpqTPCg-1">
|
|
||||||
<mxGeometry x="1190" y="465" width="240" height="120" as="geometry" />
|
|
||||||
</mxCell>
|
|
||||||
</object>
|
|
||||||
<mxCell id="C5uck7bOrHQE7dOmcdNJ-3" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;exitPerimeter=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="-A9l5Po6eYqSHBpqTPCg-1" source="C5uck7bOrHQE7dOmcdNJ-1" target="_RfEWtsR9Ml_XYfnFmCa-3">
|
|
||||||
<mxGeometry relative="1" as="geometry" />
|
|
||||||
</mxCell>
|
|
||||||
<mxCell id="C5uck7bOrHQE7dOmcdNJ-4" value="Использует значениея индикаторв<br>для принятия решений" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="C5uck7bOrHQE7dOmcdNJ-3">
|
|
||||||
<mxGeometry x="0.2444" y="-1" relative="1" as="geometry">
|
|
||||||
<mxPoint as="offset" />
|
|
||||||
</mxGeometry>
|
|
||||||
</mxCell>
|
|
||||||
<mxCell id="C5uck7bOrHQE7dOmcdNJ-5" value="Совершает сделики<br>и получает котировки" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;exitPerimeter=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="-A9l5Po6eYqSHBpqTPCg-1" source="C5uck7bOrHQE7dOmcdNJ-1" target="_RfEWtsR9Ml_XYfnFmCa-4">
|
|
||||||
<mxGeometry relative="1" as="geometry" />
|
|
||||||
</mxCell>
|
|
||||||
<mxCell id="C5uck7bOrHQE7dOmcdNJ-7" value="Записывает результаты<br> стратегий" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.75;exitY=0;exitDx=0;exitDy=0;exitPerimeter=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="-A9l5Po6eYqSHBpqTPCg-1" source="C5uck7bOrHQE7dOmcdNJ-1" target="C5uck7bOrHQE7dOmcdNJ-6">
|
|
||||||
<mxGeometry relative="1" as="geometry" />
|
|
||||||
</mxCell>
|
|
||||||
<object placeholders="1" c4Name="StrategyEngine" c4Type="Container" c4Technology="" c4Description="Движок стратегий" label="<font style="font-size: 16px"><b>%c4Name%</b></font><div>[%c4Type%: %c4Technology%]</div><br><div><font style="font-size: 11px"><font color="#E6E6E6">%c4Description%</font></div>" id="C5uck7bOrHQE7dOmcdNJ-1">
|
|
||||||
<mxCell style="rounded=1;whiteSpace=wrap;html=1;fontSize=11;labelBackgroundColor=none;fillColor=#23A2D9;fontColor=#ffffff;align=center;arcSize=10;strokeColor=#0E7DAD;metaEdit=1;resizable=0;points=[[0.25,0,0],[0.5,0,0],[0.75,0,0],[1,0.25,0],[1,0.5,0],[1,0.75,0],[0.75,1,0],[0.5,1,0],[0.25,1,0],[0,0.75,0],[0,0.5,0],[0,0.25,0]];" vertex="1" parent="-A9l5Po6eYqSHBpqTPCg-1">
|
|
||||||
<mxGeometry x="130" y="710" width="240" height="120" as="geometry" />
|
|
||||||
</mxCell>
|
|
||||||
</object>
|
|
||||||
<object placeholders="1" c4Type="Container name" c4Container="StratBD" c4Technology="e.g. Oracle Database 12" c4Description="Истории стратегий" label="<font style="font-size: 16px"><b>%c4Type%</font><div>[%c4Container%:&nbsp;%c4Technology%]</div><br><div><font style="font-size: 11px"><font color="#E6E6E6">%c4Description%</font></div>" id="C5uck7bOrHQE7dOmcdNJ-6">
|
|
||||||
<mxCell style="shape=cylinder3;size=15;whiteSpace=wrap;html=1;boundedLbl=1;rounded=0;labelBackgroundColor=none;fillColor=#23A2D9;fontSize=12;fontColor=#ffffff;align=center;strokeColor=#0E7DAD;metaEdit=1;points=[[0.5,0,0],[1,0.25,0],[1,0.5,0],[1,0.75,0],[0.5,1,0],[0,0.75,0],[0,0.5,0],[0,0.25,0]];resizable=0;" vertex="1" parent="-A9l5Po6eYqSHBpqTPCg-1">
|
|
||||||
<mxGeometry x="420" y="470" width="240" height="120" as="geometry" />
|
|
||||||
</mxCell>
|
|
||||||
</object>
|
|
||||||
<object placeholders="1" c4Name="BibasCopy
" c4Type="SystemScopeBoundary" c4Application="Software System" label="<font style="font-size: 16px"><b><div style="text-align: left">%c4Name%</div></b></font><div style="text-align: left">[%c4Application%]</div>" id="C5uck7bOrHQE7dOmcdNJ-11">
|
|
||||||
<mxCell style="rounded=1;fontSize=11;whiteSpace=wrap;html=1;dashed=1;arcSize=20;fillColor=none;strokeColor=#666666;fontColor=#333333;labelBackgroundColor=none;align=left;verticalAlign=bottom;labelBorderColor=none;spacingTop=0;spacing=10;dashPattern=8 4;metaEdit=1;rotatable=0;perimeter=rectanglePerimeter;noLabel=0;labelPadding=0;allowArrows=0;connectable=0;expand=0;recursiveResize=0;editable=1;pointerEvents=0;absoluteArcSize=1;points=[[0.25,0,0],[0.5,0,0],[0.75,0,0],[1,0.25,0],[1,0.5,0],[1,0.75,0],[0.75,1,0],[0.5,1,0],[0.25,1,0],[0,0.75,0],[0,0.5,0],[0,0.25,0]];" vertex="1" parent="-A9l5Po6eYqSHBpqTPCg-1">
|
|
||||||
<mxGeometry x="50" y="260" width="1090" height="640" as="geometry" />
|
|
||||||
</mxCell>
|
|
||||||
</object>
|
|
||||||
</root>
|
|
||||||
</mxGraphModel>
|
|
||||||
</diagram>
|
|
||||||
</mxfile>
|
|
||||||
Loading…
x
Reference in New Issue
Block a user