init
This commit is contained in:
27
hts/HTS.py
27
hts/HTS.py
@@ -1,10 +1,10 @@
|
||||
import win32com.client
|
||||
#import win32com.client
|
||||
import time
|
||||
import os
|
||||
from datetime import datetime, timedelta
|
||||
import pandas as pd
|
||||
from enum import Enum
|
||||
#import plotly.graph_objects as go
|
||||
import plotly.graph_objects as go
|
||||
from stockpredictor.analysis.Common import Common
|
||||
|
||||
# enum 주문 상태 세팅용
|
||||
@@ -788,7 +788,7 @@ class HTS:
|
||||
bsLine['buy'] = [-1 for i in range(len(lower))]
|
||||
bsLine['sell'] = [-1 for i in range(len(lower))]
|
||||
|
||||
for i in range(5, size-1):
|
||||
for i in range(5, size-5):
|
||||
status = self.checkStatus(STOCK, i)
|
||||
count_1 = 0
|
||||
if "arrange_" in status: count_1 += 1
|
||||
@@ -819,9 +819,9 @@ class HTS:
|
||||
# 시뮬레이션은 이번에 사고 파는 것으로 판단했기 때문에, 다음 봉에서 사고 판 위치를 표시한다.
|
||||
if count_0 == 0 and count_1 > 0:
|
||||
bsLine['buy'][i + 1] = STOCK[i]['close'] - 5
|
||||
bsLine['sell'][i + 1] = STOCK[i]['close']
|
||||
if count_0 > 0:
|
||||
bsLine['sell'][i+1] = STOCK[i]['close'] + 5
|
||||
bsLine['sell'][i + 2] = STOCK[i]['close']
|
||||
#if count_0 > 0:
|
||||
# bsLine['sell'][i + 2] = STOCK[i]['close'] + 5
|
||||
|
||||
return bsLine
|
||||
|
||||
@@ -851,7 +851,7 @@ class HTS:
|
||||
self.draw(stock_code, given_day, data, upper, lower, bsLine)
|
||||
|
||||
# 가져온 만큼 데이터를 누적해서 파일로 작성한다.
|
||||
self.write(given_day, result)
|
||||
# self.write(given_day, result)
|
||||
|
||||
return
|
||||
|
||||
@@ -962,19 +962,20 @@ if __name__ == "__main__":
|
||||
RESOURCE_DIR = PROJECT_HOME + "/resources/analysis/"+today.strftime("%Y%m%d")
|
||||
|
||||
stock_codes = ["252670", "122630"]
|
||||
#given_days = ['20210901','20210902','20210903','20210906','20210907','20210908','20210909','20210910','20210913','20210914','20210915','20210916','20210917','20210923','20210924','20210927','20210928','20210929','20210930','20211001']
|
||||
stock_codes = ["252670"]
|
||||
given_days = ['20210901','20210902','20210903','20210906','20210907','20210908','20210909','20210910','20210913','20210914','20210915','20210916','20210917','20210923','20210924','20210927','20210928','20210929','20210930','20211001']
|
||||
|
||||
hts = HTS()
|
||||
|
||||
#hts.all_stocks()
|
||||
#hts.getChartData(stock_codes)
|
||||
#hts.currentStock(stock_codes)
|
||||
#for given_day in given_days:
|
||||
for given_day in given_days:
|
||||
#hts.writeStockData(stock_codes, given_day)
|
||||
#for stock_code in stock_codes:
|
||||
# hts.simulate(stock_code, given_day)
|
||||
for stock_code in stock_codes:
|
||||
hts.simulate(stock_code, given_day)
|
||||
|
||||
given_day = datetime.today().strftime('%Y%m%d')
|
||||
hts.buyRealTime(stock_codes[0], given_day)
|
||||
#given_day = datetime.today().strftime('%Y%m%d')
|
||||
#hts.buyRealTime(stock_codes[0], given_day)
|
||||
|
||||
print ("done...")
|
||||
|
||||
Reference in New Issue
Block a user