坪稽蟹稽 爽縦拭 淫宿聖 亜走惟 鞠檎辞 及 簡惟 爽縦 因採馬壱, 覗稽益轡 因採馬壱 赤柔艦陥.
持唖戚 馬蟹 赤澗汽 拙走幻 箭企 呪斥聖 条聖 呪 赤澗 号狛聖 尻姥馬壱 赤陥亜 庚薦拭 採禦粕 疎箭 掻戚革推. (耕厩 爽縦 賑喰生稽 呪斥懸戚 鋼塘厳 蟹希艦 原戚格什稽 宜焼識 依精 棋 ばば. 謝舛費 顛昔走.... 杉推析戚 砧憩革推)
益君陥
https://mywaystock.tistory.com/entry/%EC%8B%9C%ED%99%A9%EC%97%90-%EB%AC%B4%EA%B4%80%ED%95%98%EA%B2%8C-%EC%97%B0%EC%88%98%EC%9D%B5-130%EC%97%90-%EB%8F%84%EC%A0%84%ED%95%98%EB%8A%94-ETF-%EC%A0%84%EB%9E%B5
戚訓 越聖 挫嬢推.
陪 企酵 尻 130% 呪斥懸? 戚依戚 亜管拝軒亜!?
号狛精
益撹 巷繕闇...神潅 神研 依 旭窮, 鎧険 依 旭窮, 鳶渡戚 嬢胸窮 煽쩧窮 益撹 馬欠亀 照匙走壱 9獣 45歳拭 軒獄什 ETF紫辞 1獣 20歳拭 独壱, 1獣 20歳拭澗 陥獣 kodex200生稽 哀焼展辞 曽亜拭 短至馬壱..戚掘醤 杯艦陥.
戚係陥壱 馬革推.
照 吃 依 旭精汽虞壱 持唖馬檎辞亀 箸獣蟹 馬澗 原製拭 廃 3析 諮霜聖 馬心柔艦陥.
督戚純生稽 汽戚斗覗傾績 獣域伸 俳柔馬壱 凶形帖壱, 陥獣 叡軒馬壱 馬壱, 企重装映 亜脊背辞 5鰍帖 5歳裟 汽戚斗 姥背辞 汽戚斗今戚什 幻級壱......
叔楳背沙 衣引.
益軍 益係走 吃軒亜 赤蟹.....
獣弘傾戚芝 衣引 探 幻据聖 1665556据生稽 幻級嬢爽澗 原狛......
嘘汎 : 蝕獣 室雌 習錘 析 蒸陥.
3析 燈切廃 獣娃戚 焼猿趨辞 坪球蟹 臣形詐艦陥.
def pushButton_input_db_run(self):
name_db = 'tiger_etf(5min).db' # 琶推廃 汽戚斗今戚什 革績
con = sqlite3.connect(name_db) # sqlite3汽戚斗 今戚什拭 羨紗
cur = con.cursor() # 畷増聖 是廃 朕偲 拝雁????
ex_input = 'SELECT * From A123310' # 昔獄什ETF
query = cur.execute(ex_input) # 琶推稽 馬澗 砺戚鷺 災君神奄
cols = [column[0] for column in query.dedeleted ion] # 町軍誤聖 亜閃身
etf_r = pd.DataFrame.from_records(data=query.fetchall(), columns=cols) # 汀軒研 叔楳馬食 汽戚斗覗傾績聖 幻給
# etf_r['date'] = pd.to_datetime(etf_r['date'], format="%Y%m%d%H%M")
etf_r.set_index('date', inplace=True)
self.etf_r = etf_r
con.close() # 汽戚斗今戚什 羨紗聖 丸製.
name_db = 'tiger_etf(5min).db' # 琶推廃 汽戚斗今戚什 革績
con = sqlite3.connect(name_db) # sqlite3汽戚斗 今戚什拭 羨紗
cur = con.cursor() # 畷増聖 是廃 朕偲 拝雁????
ex_input = 'SELECT * From A102110' # ETF
query = cur.execute(ex_input) # 琶推稽 馬澗 砺戚鷺 災君神奄
cols = [column[0] for column in query.dedeleted ion] # 町軍誤聖 亜閃身
etf_s = pd.DataFrame.from_records(data=query.fetchall(), columns=cols) # 汀軒研 叔楳馬食 汽戚斗覗傾績聖 幻給
# etf_s['date'] = pd.to_datetime(etf_s['date'], format="%Y%m%d%H%M")
etf_s.set_index('date', inplace=True)
self.etf_s = etf_s
con.close() # 汽戚斗今戚什 羨紗聖 丸製.
#print(self.etf_s)
#print(self.etf_r)
#print(pd.date_range("2015-8-5", "2019-9-4"))
#print(pd.date_range("2015-8-5", "2019-9-4")[1]
#df = self.etf_r.index[self.etf_r.index.get_level_values(0).indexer_at_time('9:45:00')]
#print(self.etf_r.loc[df])
#df = self.etf_r.index[self.etf_r.index.get_level_values(0).indexer_at_time('13:20:00')]
#print(self.etf_r.loc[df])
#df = self.etf_r.index[self.etf_r.index.get_level_values(0).indexer_at_time('15:00:00')]
#print(self.etf_r.loc[df])
#print(self.etf_r.loc['2019-01-03 09:45:00']['open'])
s_d = datetime.datetime.strptime('20150805', '%Y%m%d') # 20150805 析切研 datetime 梓端稽 鋼発
e_d = datetime.datetime.strptime('20200904', '%Y%m%d')
str_date_list = []
while s_d.strftime('%Y%m%d') <= e_d.strftime('%Y%m%d'):
str_date_list.append(s_d.strftime('%Y%m%d'))
s_d += datetime.timedelta(days=1)
self.taxs = 0.00035 # 毒古 呪呪戟
self.taxb = 0.00035 # 姥古 呪呪戟
self.de_won = 10000000 # for庚 照拭 隔生檎 古析 舛衝生稽, 鉱拭 隔生檎 刊旋生稽
for i in str_date_list:
o_time = int(f'{i}0945')
o_time_2 = int(f'{i}0950')
o_time_3 = int(f'{i}1045')
o_time_4 = int(f'{i}1050')
t_time = int(f'{i}1320')
t_time_2 = int(f'{i}1325')
tr_time = int(f'{i}1520')
tr_time_2 = int(f'{i}1515')
tr_time_3 = int(f'{i}1500')
tr_time_4 = int(f'{i}1455')
time_1 = [o_time, o_time_2, o_time_3, o_time_4]
time_2 = [t_time, t_time_2]
time_3 = [tr_time, tr_time_2, tr_time_3, tr_time_4]
result_1 = self.etf_r_buy(time_1, self.de_won) # 衣引弘 蒸生檎 False, 赤生檎 [接食榎, 左政呪勲]
if result_1 != False:
result_2 = self.etf_r_sell(time_2, result_1[1]) # 衣引弘 蒸生檎 False, 赤生檎 舛至榎
if result_2 != False: # 幻鉦 衣引弘戚 False亜 焼艦虞檎
deposit = result_1[0] + result_2
result_3 = self.etf_s_buy(time_2, deposit) # 衣引弘 蒸生檎 False, 赤生檎 [接食榎, 左政呪勲]
if result_3 != False: # 幻鉦 衣引弘戚 False亜 焼艦虞檎
result_4 = self.etf_s_sell(time_3, result_3[1]) # 衣引弘 蒸生檎 False, 赤生檎 舛至榎
self.de_won = result_3[0] + result_4
print(f'{i} : {self.de_won}')
def etf_r_buy(self, time, won):
t_count = len(time) - 1 # 獣娃税 収切研 室嬢 -1 敗
s_count = 0 # while 姥庚聖 紫遂馬奄 是廃 奄段 朝錘闘
result = False # 汽戚斗亜 蒸聖 井酔研 亜舛馬食 衣引研 蒸陥壱 耕軒 識情
while s_count <= t_count: # 獣娃税 曽嫌幻鏑 朝錘闘
if time[s_count] in self.etf_r.index: # 昔獄什 ETF税 昔畿什拭 獣娃戚 赤澗走 溌昔
price = self.etf_r.loc[time[s_count]][0] # 獣娃戚 糎仙馬檎 獣拙亜研 亜維生稽 舛敗
result = True # 衣引弘戚 赤陥壱 識情
s_count = 99999999 # while 姥庚聖 匙閃蟹亜奄 是背 笛 収切 壕舛
else:
s_count += 1 # 衣引弘戚 蒸生檎 収切 朝錘闘
if result and ((won * 0.99) > price): # 衣引弘戚 赤壱 亜維戚 左政 榎衝税 99%左陥 拙聖 凶
iwon = int(won * (1-self.taxb) ) # 呪呪戟研 持唖馬食 呪呪戟 遁湿闘研 捌 榎衝聖 亜維生稽 至舛
lots = int(iwon / price) # 姥古拝 呪 赤澗 丞
bp = price * lots # 姥古亜維
tax = int(bp * self.taxb) # 呪呪戟 去
spent = tax + bp # 恥 社乞榎衝
r_price = won - spent # 接食榎衝
result = [r_price, lots] # [接食榎衝, 左政呪勲]
return result
def etf_s_buy(self, time, won):
t_count = len(time) - 1 # 獣娃税 収切研 室嬢 -1 敗
s_count = 0 # while 姥庚聖 紫遂馬奄 是廃 奄段 朝錘闘
result = False # 汽戚斗亜 蒸聖 井酔研 亜舛馬食 衣引研 蒸陥壱 耕軒 識情
while s_count <= t_count: # 獣娃税 曽嫌幻鏑 朝錘闘
if time[s_count] in self.etf_s.index: # 昔獄什 ETF税 昔畿什拭 獣娃戚 赤澗走 溌昔
price = self.etf_s.loc[time[s_count]][0] # 獣娃戚 糎仙馬檎 獣拙亜研 亜維生稽 舛敗
result = True # 衣引弘戚 赤陥壱 識情
s_count = 99999999 # while 姥庚聖 匙閃蟹亜奄 是背 笛 収切 壕舛
else:
s_count += 1 # 衣引弘戚 蒸生檎 収切 朝錘闘
if result and ((won * 0.99) > price): # 衣引弘戚 赤壱 亜維戚 左政 榎衝税 99%左陥 拙聖 凶
iwon = int(won * (1-self.taxb) ) # 呪呪戟研 持唖馬食 呪呪戟 遁湿闘研 捌 榎衝聖 亜維生稽 至舛
lots = int(iwon / price) # 姥古拝 呪 赤澗 丞
bp = price * lots # 姥古亜維
tax = int(bp * self.taxb) # 呪呪戟 去
spent = tax + bp # 恥 社乞榎衝
r_price = won - spent # 接食榎衝
result = [r_price, lots] # [接食榎衝, 左政呪勲]
return result
def etf_r_sell(self, time, lots):
t_count = len(time) - 1 # 獣娃税 収切研 室嬢 -1 敗
s_count = 0 # while 姥庚聖 紫遂馬奄 是廃 奄段 朝錘闘
result = False # 汽戚斗亜 蒸聖 井酔研 亜舛馬食 衣引研 蒸陥壱 耕軒 識情
while s_count <= t_count: # 獣娃税 曽嫌幻鏑 朝錘闘
if time[s_count] in self.etf_r.index: # 昔獄什 ETF税 昔畿什拭 獣娃戚 赤澗走 溌昔
price = self.etf_r.loc[time[s_count]][0] # 獣娃戚 糎仙馬檎 獣拙亜研 亜維生稽 舛敗
result = True # 衣引弘戚 赤陥壱 識情
s_count = 99999999 # while 姥庚聖 匙閃蟹亜奄 是背 笛 収切 壕舛
else:
s_count += 1 # 衣引弘戚 蒸生檎 収切 朝錘闘
if result: # 衣引弘戚 赤聖 凶
sp = price * lots # 毒古亜維
tax = int(sp * self.taxs) # 呪呪戟 去
result = sp - tax # 舛至榎衝
return result
def etf_s_sell(self, time, lots):
t_count = len(time) - 1 # 獣娃税 収切研 室嬢 -1 敗
s_count = 0 # while 姥庚聖 紫遂馬奄 是廃 奄段 朝錘闘
result = False # 汽戚斗亜 蒸聖 井酔研 亜舛馬食 衣引研 蒸陥壱 耕軒 識情
while s_count <= t_count: # 獣娃税 曽嫌幻鏑 朝錘闘
if time[s_count] in self.etf_s.index: # 昔獄什 ETF税 昔畿什拭 獣娃戚 赤澗走 溌昔
price = self.etf_s.loc[time[s_count]][0] # 獣娃戚 糎仙馬檎 獣拙亜研 亜維生稽 舛敗
result = True # 衣引弘戚 赤陥壱 識情
s_count = 99999999 # while 姥庚聖 匙閃蟹亜奄 是背 笛 収切 壕舛
else:
s_count += 1 # 衣引弘戚 蒸生檎 収切 朝錘闘
if result: # 衣引弘戚 赤聖 凶
sp = price * lots # 毒古亜維
tax = int(sp * self.taxs) # 呪呪戟 去
result = sp - tax # 舛至榎衝
return result
|