init
This commit is contained in:
@@ -432,17 +432,6 @@ class Bithumb_minute(HTS):
|
|||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
def exist_buy(self, ticker, log_filename):
|
|
||||||
if os.path.exists(log_filename):
|
|
||||||
log_file = open(log_filename, 'r', )
|
|
||||||
reader = csv.reader(log_file)
|
|
||||||
for line in reader:
|
|
||||||
if line[2] == ticker:
|
|
||||||
log_file.close()
|
|
||||||
return True
|
|
||||||
log_file.close()
|
|
||||||
return False
|
|
||||||
|
|
||||||
def notBuy(self, data, i):
|
def notBuy(self, data, i):
|
||||||
if i > 5:
|
if i > 5:
|
||||||
check = True
|
check = True
|
||||||
@@ -717,20 +706,19 @@ class Bithumb_minute(HTS):
|
|||||||
# 10분이 지난 미체결은 취소한다.
|
# 10분이 지난 미체결은 취소한다.
|
||||||
self.cancel_order(log_filename, 10)
|
self.cancel_order(log_filename, 10)
|
||||||
if isRealTime:
|
if isRealTime:
|
||||||
if not self.exist_buy(ticker, log_filename):
|
if max(bsLine['buy'][len(bsLine['buy']) - 2:]) > 100:
|
||||||
if max(bsLine['buy'][len(bsLine['buy']) - 2:]) > 100:
|
tmp = self.bithumb.get_balance(ticker)
|
||||||
tmp = self.bithumb.get_balance(ticker)
|
balance = tmp[2]
|
||||||
balance = tmp[2]
|
count = round((balance * (bsLine['buy_weight'][len(bsLine['buy_weight']) - 1] / 100)) / bsLine['buy'][len(bsLine['buy']) - 1], 2)
|
||||||
count = round((balance * (bsLine['buy_weight'][len(bsLine['buy_weight']) - 1] / 100)) / bsLine['buy'][len(bsLine['buy']) - 1], 2)
|
order = self.bithumb.buy_limit_order(ticker, bsLine['buy'][len(bsLine['buy']) - 1], count)
|
||||||
order = self.bithumb.buy_limit_order(ticker, bsLine['buy'][len(bsLine['buy']) - 1], count)
|
# order: ('bid', 'BTC', 'C0101000000322993432', 'KRW')
|
||||||
# order: ('bid', 'BTC', 'C0101000000322993432', 'KRW')
|
|
||||||
|
|
||||||
with open(log_filename, 'a', newline='', encoding='utf-8') as log_file:
|
with open(log_filename, 'a', newline='', encoding='utf-8') as log_file:
|
||||||
wr = csv.writer(log_file)
|
wr = csv.writer(log_file)
|
||||||
wr.writerow(["buy", datetime.now().strftime('%Y-%m-%d %H:%M:%S'), order[0], order[1], order[2], order[3]])
|
wr.writerow(["buy", datetime.now().strftime('%Y-%m-%d %H:%M:%S'), order[0], order[1], order[2], order[3]])
|
||||||
|
|
||||||
dirName = os.path.join(RESOURCE_PATH, 'analysis', 'bithumb')
|
dirName = os.path.join(RESOURCE_PATH, 'analysis', 'bithumb')
|
||||||
self.writeFile(dirName, ticker, data, bsLine, datetime.now().strftime('%Y%m%d %H%M%S'), 'buy')
|
self.writeFile(dirName, ticker, data, bsLine, datetime.now().strftime('%Y%m%d %H%M%S'), 'buy')
|
||||||
|
|
||||||
if max(bsLine['sell'][len(bsLine['sell']) - 2:]) > 100:
|
if max(bsLine['sell'][len(bsLine['sell']) - 2:]) > 100:
|
||||||
tmp = self.bithumb.get_balance(ticker)
|
tmp = self.bithumb.get_balance(ticker)
|
||||||
@@ -760,7 +748,7 @@ if __name__ == "__main__":
|
|||||||
bithumb = Bithumb_minute(RESOURCE_PATH)
|
bithumb = Bithumb_minute(RESOURCE_PATH)
|
||||||
|
|
||||||
tickers = ['XRP']
|
tickers = ['XRP']
|
||||||
isRealTime = False
|
isRealTime = True
|
||||||
if isRealTime:
|
if isRealTime:
|
||||||
while True:
|
while True:
|
||||||
for ticker in tickers:
|
for ticker in tickers:
|
||||||
|
|||||||
Reference in New Issue
Block a user