# C:\ProgramData\Anaconda3\envs\py35_32\python.exe C:/Users/phj/git/learningTrade/source/testApi.py
# [2210][0]
# [2990][0]
# [5690][0]
# [6490][0]
# [12630][0]
# [14820][0]
# [16580][0]
# [19170][0]
# [32350][0]
# BUY
#  code[33180.0] time[90300.0] 등락율[2.79] 거래량차이[284709] 남은매수대금[256.59113916] 현재_차이[90124] 이전_차이[-172726] DIFF_차이[262850] 체결강도[135.16][-42.22222222222222] 시간차이[100]
# [33180][0.5395652173913044]
# SELL SUCCESS profit[0.5395652173913044]
#  code[33180.0] time[90300.0] 등락율[3.69] 거래량차이[355691] 남은매수대금[-61.3922666] 현재_차이[-17260] 이전_차이[90124] DIFF_차이[-107384] 체결강도[140.24][-3.5714285714285716] 시간차이[0]
# BUY
#  code[33180.0] time[90900.0] 등락율[3.91] 거래량차이[358543] 남은매수대금[194.99361055] 현재_차이[54385] 이전_차이[-242715] DIFF_차이[297100] 체결강도[129.19][15.503875968992247] 시간차이[0]
# [33180][0.20956521739130435]
# SELL FAILED profit[0.20956521739130435]
#  code[33180.0] time[91300.0] 등락율[3.91] 거래량차이[102067] 남은매수대금[-2.24445333] 현재_차이[-2199] 이전_차이[92479] DIFF_차이[-94678] 체결강도[110.4][-0.0] 시간차이[0]
# [33180][0.20956521739130435]
# >>DAY[20191106] - Profit[0.20956521739130435]
# ======================================================
# [2320][0]
# [2780][0]
# [4170][0]
# [7700][0]
# [9580][0]
# [19170][0]
# [20000][0]
# BUY
#  code[33180.0] time[90200.0] 등락율[0.11] 거래량차이[185455] 남은매수대금[108.17775605] 현재_차이[58331] 이전_차이[44168] DIFF_차이[14163] 체결강도[67.25][17.91044776119403] 시간차이[0]
# [33180][-1.517904967602592]
# SELL FAILED profit[-1.517904967602592]
#  code[33180.0] time[90600.0] 등락율[-1.08] 거래량차이[268020] 남은매수대금[210.9558618] 현재_차이[78709] 이전_차이[114357] DIFF_차이[-35648] 체결강도[52.38][28.846153846153847] 시간차이[0]
# [33180][-1.517904967602592]
# [74610][0]
# [229640][0]
# [249420][0]
# >>DAY[20191107] - Profit[-1.517904967602592]
# ======================================================
# [1210][0]
# BUY
#  code[1360.0] time[93600.0] 등락율[12.55] 거래량차이[586492] 남은매수대금[245.69322864] 현재_차이[41892] 이전_차이[-58173] DIFF_차이[100065] 체결강도[124.28][-0.8064516129032259] 시간차이[100]
# [1360][-1.8737392795883363]
# SELL FAILED profit[-1.8737392795883363]
#  code[1360.0] time[93800.0] 등락율[10.81] 거래량차이[560138] 남은매수대금[415.12947456] 현재_차이[74112] 이전_차이[41892] DIFF_차이[32220] 체결강도[118.31][5.084745762711865] 시간차이[200]
# [1360][-1.8737392795883363]
# [2990][0]
# [2995][0]
# BUY
#  code[3280.0] time[93400.0] 등락율[4.17] 거래량차이[285584] 남은매수대금[783.53968576] 현재_차이[274364] 이전_차이[-177929] DIFF_차이[452293] 체결강도[69.62][-0.0] 시간차이[100]
# [3280][0.6223809523809523]
# SELL SUCCESS profit[0.6223809523809523]
#  code[3280.0] time[93700.0] 등락율[5.16] 거래량차이[91621] 남은매수대금[-48.7606962] 현재_차이[-53220] 이전_차이[90164] DIFF_차이[-143384] 체결강도[70.78][-1.4285714285714286] 시간차이[100]
# BUY
#  code[3280.0] time[102700.0] 등락율[0.4] 거래량차이[207772] 남은매수대금[405.415115] 현재_차이[195125] 이전_차이[181773] DIFF_차이[13352] 체결강도[61.18][1.639344262295082] 시간차이[100]
# [3280][2.466293995859213]
# SELL SUCCESS profit[2.466293995859213]
#  code[3280.0] time[103100.0] 등락율[2.58] 거래량차이[296301] 남은매수대금[-409.23020013] 현재_차이[-138113] 이전_차이[173993] DIFF_차이[-312106] 체결강도[64.42][-3.125] 시간차이[100]
# [3280][2.466293995859213]
# [3350][0]
# BUY
#  code[6490.0] time[93400.0] 등락율[5.86] 거래량차이[388863] 남은매수대금[540.43013151] 현재_차이[138977] 이전_차이[117297] DIFF_차이[21680] 체결강도[104.5][2.8846153846153846] 시간차이[100]
# [6490][0.550503144654088]
# SELL SUCCESS profit[0.550503144654088]
#  code[6490.0] time[93800.0] 등락율[6.79] 거래량차이[255085] 남은매수대금[-62.29940955] 현재_차이[-24423] 이전_차이[204708] DIFF_차이[-229131] 체결강도[103.55][-0.0] 시간차이[100]
# BUY
#  code[6490.0] time[94100.0] 등락율[5.06] 거래량차이[335719] 남은매수대금[898.33704334] 현재_차이[267586] 이전_차이[95047] DIFF_차이[172539] 체결강도[100.15][2.0] 시간차이[100]
# [6490][1.2344448430064325]
# SELL SUCCESS profit[1.2344448430064325]
#  code[6490.0] time[94800.0] 등락율[6.13] 거래량차이[274895] 남은매수대금[-355.3457707] 현재_차이[-129266] 이전_차이[229602] DIFF_차이[-358868] 체결강도[97.93][-0.0] 시간차이[200]
# BUY
#  code[6490.0] time[100700.0] 등락율[10.39] 거래량차이[909645] 남은매수대금[312.50853975] 현재_차이[34355] 이전_차이[-197216] DIFF_차이[231571] 체결강도[103.97][-2.912621359223301] 시간차이[200]
# [6490][3.075735554707277]
# SELL SUCCESS profit[3.075735554707277]
#  code[6490.0] time[100800.0] 등락율[12.78] 거래량차이[1459840] 남은매수대금[39.2404992] 현재_차이[2688] 이전_차이[34355] DIFF_차이[-31667] 체결강도[107.11][-3.7383177570093458] 시간차이[100]
# BUY
#  code[6490.0] time[102200.0] 등락율[17.98] 거래량차이[901805] 남은매수대금[414.53270435] 현재_차이[45967] 이전_차이[-184161] DIFF_차이[230128] 체결강도[108.03][1.8518518518518516] 시간차이[200]
# [6490][1.842801017461227]
# SELL FAILED profit[1.842801017461227]
#  code[6490.0] time[102300.0] 등락율[16.91] 거래량차이[657877] 남은매수대금[-327.51090691] 현재_차이[-49783] 이전_차이[45967] DIFF_차이[-95750] 체결강도[106.56][1.8867924528301885] 시간차이[100]
# [6490][1.842801017461227]
# [10770][0]
# [16380][0]
# [20560][0]
# [25620][0]
# [69460][0]
# [123690][0]
# [214420][0]
# [500030][0]
# [500035][0]
# [500036][0]
# [530062][0]
# [550045][0]
# >>DAY[20191108] - Profit[2.435355733732104]
# ======================================================
# [1060][0]
# [1525][0]
# [1527][0]
# BUY
#  code[3560.0] time[125600.0] 등락율[12.85] 거래량차이[1186997] 남은매수대금[799.14573025] 현재_차이[67325] 이전_차이[-52486] DIFF_차이[119811] 체결강도[142.63][1.4084507042253522] 시간차이[100]
# [3560][-0.5775247524752476]
# SELL FAILED profit[-0.5775247524752476]
#  code[3560.0] time[125700.0] 등락율[12.57] 거래량차이[447596] 남은매수대금[-90.54419484] 현재_차이[-20229] 이전_차이[67325] DIFF_차이[-87554] 체결강도[139.67][2.1582733812949644] 시간차이[100]
# BUY
#  code[3560.0] time[125900.0] 등락율[17.88] 거래량차이[1674138] 남은매수대금[1681.90600032] 현재_차이[100464] 이전_차이[-24829] DIFF_차이[125293] 체결강도[147.28][-2.7210884353741496] 시간차이[100]
# [3560][0.9882098446811503]
# SELL SUCCESS profit[0.9882098446811503]
#  code[3560.0] time[130000.0] 등락율[20.11] 거래량차이[1464845] 남은매수대금[-264.9904605] 현재_차이[-18090] 이전_차이[100464] DIFF_차이[-118554] 체결강도[143.23][2.7972027972027975] 시간차이[4100]
# BUY
#  code[3560.0] time[142800.0] 등락율[11.73] 거래량차이[974370] 남은매수대금[1785.435588] 현재_차이[183240] 이전_차이[-173768] DIFF_차이[357008] 체결강도[114.43][1.7543859649122808] 시간차이[200]
# [3560][-0.8417901553188498]
# SELL FAILED profit[-0.8417901553188498]
#  code[3560.0] time[143000.0] 등락율[10.06] 거래량차이[833031] 남은매수대금[1630.59154002] 현재_차이[195742] 이전_차이[84904] DIFF_차이[110838] 체결강도[112.51][0.8928571428571428] 시간차이[100]
# [3560][-0.8417901553188498]
# [7280][0]
# [20000][0]
# BUY
#  code[24900.0] time[90400.0] 등락율[16.73] 거래량차이[526250] 남은매수대금[148.749825] 현재_차이[28266] 이전_차이[0] DIFF_차이[28266] 체결강도[133.25][1] 시간차이[100]
# [24900][2.1175524475524474]
# SELL SUCCESS profit[2.1175524475524474]
#  code[24900.0] time[90500.0] 등락율[19.59] 거래량차이[573138] 남은매수대금[-263.39703066] 현재_차이[-45957] 이전_차이[28266] DIFF_차이[-74223] 체결강도[144.54][-7.638888888888889] 시간차이[100]
# [24900][2.1175524475524474]
# [26940][0]
# [37560][0]
# [39570][0]
# [69460][0]
# [72130][0]
# [163560][0]
# [195920][0]
# [253250][0]
# [267850][0]
# [334700][0]
# [500022][0]
# [500032][0]
# [530038][0]
# >>DAY[20191111] - Profit[1.2757622922335976]
# ======================================================
# [1360][0]
# [1527][0]
# [5257][0]
# [6390][0]
# [00781K][0]
# [12450][0]
# BUY
#  code[20560.0] time[111300.0] 등락율[9.43] 거래량차이[706481] 남은매수대금[362.1421606] 현재_차이[51260] 이전_차이[-513345] DIFF_차이[564605] 체결강도[158.89][4.430379746835443] 시간차이[100]
# [20560][0.1402194357366771]
# SELL SUCCESS profit[0.1402194357366771]
#  code[20560.0] time[111400.0] 등락율[9.95] 거래량차이[621603] 남은매수대금[-3633.58655253] 현재_차이[-584551] 이전_차이[51260] DIFF_차이[-635811] 체결강도[154.83][2.5974025974025974] 시간차이[100]
# BUY
#  code[20560.0] time[142600.0] 등락율[17.67] 거래량차이[2345659] 남은매수대금[2091.8586962] 현재_차이[89180] 이전_차이[-460448] DIFF_차이[549628] 체결강도[130.81][-3.0769230769230766] 시간차이[100]
# [20560][0.5390824094976101]
# SELL SUCCESS profit[0.5390824094976101]
#  code[20560.0] time[142900.0] 등락율[18.52] 거래량차이[1218304] 남은매수대금[-11996.71258624] 현재_차이[-984706] 이전_차이[175413] DIFF_차이[-1160119] 체결강도[129.55][-0.7751937984496123] 시간차이[100]
# [20560][0.5390824094976101]
# [33250][0]
# [39570][0]
# [81660][0]
# [97950][0]
# [118000][0]
# [181480][0]
# [267850][0]
# [317400][0]
# [334700][0]
# [500032][0]
# [530038][0]
# >>DAY[20191112] - Profit[0.5390824094976101]
# ======================================================
# [1065][0]
# [1210][0]
# [1525][0]
# [1527][0]
# [3780][0]
# [4250][0]
# [5725][0]
# [5750][0]
# [9415][0]
# [17370][0]
# BUY
#  code[20560.0] time[90400.0] 등락율[3.95] 거래량차이[1054520] 남은매수대금[539.966966] 현재_차이[51205] 이전_차이[-99580] DIFF_차이[150785] 체결강도[148.13][43.91891891891892] 시간차이[100]
# [20560][-0.6223976608187134]
# SELL FAILED profit[-0.6223976608187134]
#  code[20560.0] time[90500.0] 등락율[3.65] 거래량차이[845898] 남은매수대금[-192.34028724] 현재_차이[-22738] 이전_차이[51205] DIFF_차이[-73943] 체결강도[127.44][16.53543307086614] 시간차이[100]
# [20560][-0.6223976608187134]
# BUY
#  code[39570.0] time[90400.0] 등락율[6.3] 거래량차이[677900] 남은매수대금[222.656255] 현재_차이[32845] 이전_차이[0] DIFF_차이[32845] 체결강도[114.06][1] 시간차이[100]
# [39570][5.593344947735192]
# SELL SUCCESS profit[5.593344947735192]
#  code[39570.0] time[90500.0] 등락율[12.59] 거래량차이[313095] 남은매수대금[-35.3546874] 현재_차이[-11292] 이전_차이[32845] DIFF_차이[-44137] 체결강도[156.84][-26.923076923076923] 시간차이[100]
# [39570][5.593344947735192]
# [51630][0]
# [77500][0]
# [82740][0]
# [112610][0]
# [118000][0]
# [163560][0]
# BUY
#  code[298690.0] time[90300.0] 등락율[5.15] 거래량차이[914361] 남은매수대금[469.83525624] 현재_차이[51384] 이전_차이[-343284] DIFF_차이[394668] 체결강도[80.93][31.25] 시간차이[100]
# [298690][0.28224489795918367]
# SELL SUCCESS profit[0.28224489795918367]
#  code[298690.0] time[90500.0] 등락율[5.79] 거래량차이[504907] 남은매수대금[-347.12861157] 현재_차이[-68751] 이전_차이[60373] DIFF_차이[-129124] 체결강도[77.36][-6.4935064935064934] 시간차이[100]
# [298690][0.28224489795918367]
# [500041][0]
# >>DAY[20191113] - Profit[5.253192184875663]
# ======================================================
# BUY
#  code[1360.0] time[100300.0] 등락율[6.43] 거래량차이[776051] 남은매수대금[322.03012296] 현재_차이[41496] 이전_차이[0] DIFF_차이[41496] 체결강도[41.14][1] 시간차이[0]
# [1360][2.442277227722772]
# SELL SUCCESS profit[2.442277227722772]
#  code[1360.0] time[100400.0] 등락율[9.38] 거래량차이[168637] 남은매수대금[-142.90973928] 현재_차이[-84744] 이전_차이[41496] DIFF_차이[-126240] 체결강도[69.01][-40.57971014492754] 시간차이[100]
# [1360][2.442277227722772]
# [2720][0]
# [3550][0]
# [3850][0]
# [5110][0]
# [19170][0]
# BUY
#  code[33180.0] time[100200.0] 등락율[9.87] 거래량차이[578635] 남은매수대금[169.81201345] 현재_차이[29347] 이전_차이[-15813] DIFF_차이[45160] 체결강도[203.14][-2.4630541871921183] 시간차이[0]
# [33180][0.9687012987012986]
# SELL SUCCESS profit[0.9687012987012986]
#  code[33180.0] time[100300.0] 등락율[11.3] 거래량차이[742857] 남은매수대금[506.67304542] 현재_차이[68206] 이전_차이[29347] DIFF_차이[38859] 체결강도[217.07][-6.451612903225807] 시간차이[100]
# [33180][0.9687012987012986]
# [35420][0]
# [63160][0]
# [336260][0]
# >>DAY[20191114] - Profit[3.4109785264240706]
# ======================================================
# [1140][0]
# [1630][0]
# [1750.0][0]
# [2170][0]
# BUY
#  code[2760.0] time[90200.0] 등락율[12.77] 거래량차이[641574] 남은매수대금[460.6822107] 현재_차이[71805] 이전_차이[-56332] DIFF_차이[128137] 체결강도[201.63][-3.4825870646766175] 시간차이[100]
# [2760][1.8067521367521366]
# SELL SUCCESS profit[1.8067521367521366]
#  code[2760.0] time[90300.0] 등락율[15.18] 거래량차이[620247] 남은매수대금[140.36809857] 현재_차이[22631] 이전_차이[71805] DIFF_차이[-49174] 체결강도[169.47][18.93491124260355] 시간차이[100]
# [2760][1.8067521367521366]
# BUY
#  code[3280.0] time[90300.0] 등락율[16.31] 거래량차이[639678] 남은매수대금[450.67873812] 현재_차이[70454] 이전_차이[0] DIFF_차이[70454] 체결강도[150.0][1] 시간차이[0]
# [3280][0.5047245409015024]
# SELL SUCCESS profit[0.5047245409015024]
#  code[3280.0] time[90400.0] 등락율[17.28] 거래량차이[328980] 남은매수대금[-299.3487714] 현재_차이[-90993] 이전_차이[70454] DIFF_차이[-161447] 체결강도[125.5][20.0] 시간차이[100]
# [3280][0.5047245409015024]
# [3580][0]
# [6490][0]
# [12510][0]
# [12630][0]
# BUY
#  code[21050.0] time[153000.0] 등락율[0.38] 거래량차이[62402] 남은매수대금[129.00115852] 현재_차이[206726] 이전_차이[205727] DIFF_차이[999] 체결강도[87.39][-0.0] 시간차이[1000]
# [21050][0]
# [23800][0]
# [44380][0]
# [58730][0]
# [272210][0]
# BUY
#  code[336260.0] time[92500.0] 등락율[20.91] 거래량차이[328736] 남은매수대금[227.67926624] 현재_차이[69259] 이전_차이[18555] DIFF_차이[50704] 체결강도[147.05][-2.0408163265306123] 시간차이[100]
# [336260][0.40375262054507327]
# SELL SUCCESS profit[0.40375262054507327]
#  code[336260.0] time[92500.0] 등락율[21.8] 거래량차이[253421] 남은매수대금[-4.81753321] 현재_차이[-1901] 이전_차이[69259] DIFF_차이[-71160] 체결강도[145.79][1.3793103448275863] 시간차이[0]
# BUY
#  code[336260.0] time[93900.0] 등락율[19.01] 거래량차이[223879] 남은매수대금[182.98526186] 현재_차이[81734] 이전_차이[67366] DIFF_차이[14368] 체결강도[119.93][4.201680672268908] 시간차이[100]
# [336260][-0.884713833129048]
# SELL FAILED profit[-0.884713833129048]
#  code[336260.0] time[94300.0] 등락율[17.87] 거래량차이[142755] 남은매수대금[128.6051244] 현재_차이[90088] 이전_차이[33681] DIFF_차이[56407] 체결강도[115.49][2.608695652173913] 시간차이[100]
# BUY
#  code[336260.0] time[134700.0] 등락율[15.08] 거래량차이[571487] 남은매수대금[404.51564321] 현재_차이[70783] 이전_차이[-1180] DIFF_차이[71963] 체결강도[91.32][1.0989010989010988] 시간차이[1600]
# [336260][-0.8843173573581229]
# SELL SUCCESS profit[-0.8843173573581229]
#  code[336260.0] time[134900.0] 등락율[15.46] 거래량차이[34555] 남은매수대금[-7.9220793] 현재_차이[-22926] 이전_차이[71602] DIFF_차이[-94528] 체결강도[91.12][-1.0989010989010988] 시간차이[100]
# [336260][-0.8843173573581229]
# [33626L][0]
# >>DAY[20191115] - Profit[1.427159320295516]
# ======================================================
# TOTAL Profit[13.033190716847272]
#
# Process finished with exit code 0


def is_trade(self, debug):
    is_trade = ''
    if self.index == 0 or numpy.isnan(self.df['시간'][self.index]) or numpy.isnan(self.df['시간'][self.index - 1]):
        self.index += 1
        return ('', '')

    시간차이 = int(self.df['시간'][self.index]) - int(self.df['시간'][self.index - 1])
    거래량차이 = int(self.df['거래량'][self.index]) - int(self.df['거래량'][self.index - 1])
    이전_시간_매수_매도_차이 = int(self.df['매수잔량'][self.index - 1]) - int(self.df['매도잔량'][self.index - 1])
    현재_시간_매수_매도_차이 = int(self.df['매수잔량'][self.index]) - int(self.df['매도잔량'][self.index])
    이전시간_현재시간_매수_매도_차이 = 현재_시간_매수_매도_차이 - 이전_시간_매수_매도_차이

    self.거래량_차이_리스트.append(거래량차이)
    self.현재_시간_매수_매도_차이_리스트.append(현재_시간_매수_매도_차이)
    self.이전시간_현재시간_매수_매도_차이_리스트.append(이전시간_현재시간_매수_매도_차이)

    if 거래량차이 > self.max_volume:
        self.max_volume = 거래량차이;

    남은매수대금 = (현재_시간_매수_매도_차이 * 거래량차이) / 100000000

    print_log = 'code[%s] time[%s] 등락율[%s] 거래량차이[%s] 남은매수대금[%s] 현재_차이[%s] 이전_차이[%s] DIFF_차이[%s] 체결강도[%s][%s] 시간차이[%s]' % (
        self.df['단축코드'][self.index], self.df['시간'][self.index], self.df['등락율'][self.index], 거래량차이, 남은매수대금,
        현재_시간_매수_매도_차이, 이전_시간_매수_매도_차이,
        이전시간_현재시간_매수_매도_차이, self.df['체결강도'][self.index],
        get_percent(int(self.df['체결강도'][self.index]), int(self.df['체결강도'][self.index - 1])), 시간차이)

    if debug is True:
        print(print_log)

    if self.is_buy is False \
            and 이전시간_현재시간_매수_매도_차이 > 0 \
            and 현재_시간_매수_매도_차이 > 0 \
            and int(self.df['등락율'][self.index]) <= 20 \
            and self.df['등락율'][self.index] > 0 \
            and 거래량차이 > self.max_volume / 2 \
            and 남은매수대금 > 100:

        self.buy_list.append([self.index])
        self.real_buy_percent = float(self.df['등락율'][self.index])
        self.등략율_list.append(self.df['등락율'][self.index])
        self.is_buy = True
        self.buy_count += 1
        self.preBuyPrice = int(self.df['종가'][self.index])
        if debug is True:
            print('============== Buy')
        if self.index == len(self.df.index) - 1:
            is_trade = 'buy'

    if self.is_buy is True and 남은매수대금 < 0:
        self.real_buy_percent = 50
        self.is_buy = False
        profit = (get_percent(self.preBuyPrice, int(self.df['종가'][self.index])) - TAX)
        if profit > 0:
            self.test_success_sell_index_list.append(self.index)
            self.test_success_sell_price_list.append(self.df['등락율'][self.index])
            if debug is True:
                print('============== SUCCESS Sell[%s][%s][%s]' % (
                self.preBuyPrice, int(self.df['종가'][self.index]), profit))
            if self.index == len(self.df.index) - 1:
                is_trade = 'sell_success'
        else:
            self.test_fail_sell_index_list.append(self.index)
            self.test_fail_sell_price_list.append(self.df['등락율'][self.index])
            if debug is True:
                print('============== FAILED Sell[%s][%s][%s]' % (
                self.preBuyPrice, int(self.df['종가'][self.index]), profit))
            if self.index == len(self.df.index) - 1:
                is_trade = 'sell_failed'
        self.profit += profit

    if self.is_buy is True and float(self.df['등락율'][self.index]) > self.real_buy_percent + 1.0:

        self.real_buy_percent = 50
        self.is_buy = False
        self.test_success_sell_index_list.append(self.index)
        self.test_success_sell_price_list.append(self.df['등락율'][self.index])
        profit = (get_percent(self.preBuyPrice, int(self.df['종가'][self.index])) - TAX)
        self.profit += profit
        if debug is True:
            print(
                '============== SUCCESS Sell[%s][%s][%s]' % (self.preBuyPrice, int(self.df['종가'][self.index]), profit))
        if self.index == len(self.df.index) - 1:
            is_trade = 'sell_success'

    if self.is_buy is True and float(self.df['등락율'][self.index]) < self.real_buy_percent - 1:
        if debug is True:
            print('============== Failed Sell')

        self.real_buy_percent = 50
        self.is_buy = False
        self.test_fail_sell_index_list.append(self.index)
        self.test_fail_sell_price_list.append(self.df['등락율'][self.index])
        profit = (get_percent(self.preBuyPrice, int(self.df['종가'][self.index])) - TAX)
        self.profit += profit
        if debug is True:
            print('============== FAILED Sell[%s][%s][%s]' % (self.preBuyPrice, int(self.df['종가'][self.index]), profit))
        if self.index == len(self.df.index) - 1:
            is_trade = 'sell_failed'

    self.index += 1
    return (is_trade, print_log)
