This commit is contained in:
2022-07-17 10:54:39 +09:00
parent 3bb4ae2926
commit 28c50d053b
4 changed files with 58 additions and 34 deletions

View File

@@ -34,7 +34,7 @@ class EMA_Chicken:
outgo = buy.price * self._lot
self._total -= outgo
self._remain += self._lot
self._logger.info(f"<BUY> {self._lot} / {outgo} ({self._total})")
self._logger.info(f"<BUY> {self._lot} / {outgo} ({self._remain} / {self._total})")
limit_price = buy.price*(1+self._limit_rate)
stop_price = buy.price*(1-self._limit_rate)
@@ -49,7 +49,7 @@ class EMA_Chicken:
self._total += income
self._remain -= amount
if amount > 0:
self._logger.info(f"[WIN] <SELL> {amount} / {income} ({self._total})")
self._logger.info(f"[WIN] <SELL> {amount} / {income} ({self._remain} / {self._total})")
break
if self._pair.ticker.price < stop_price:
@@ -62,5 +62,5 @@ class EMA_Chicken:
self._total += income
self._remain -= amount
if amount > 0:
self._logger.info(f"[LOSE] <SELL> {amount} / {income} ({self._total})")
self._logger.info(f"[LOSE] <SELL> {amount} / {income} ({self._remain} / {self._total})")
break

View File

@@ -41,7 +41,7 @@ class Hige:
self._total += income
self._sell = None
if amount > 0:
self._logger.info("<SELL> {amount} / {income} ({self._total})")
self._logger.info(f"<SELL> {amount} / {income} ({self._remain} / {self._total})")
continue
elif self._sell_price != expected_sell_price:
await self._sell.cancel()
@@ -60,7 +60,7 @@ class Hige:
self._remain += amount
self._buy = None
if amount > 0:
self._logger.info("<BUY> {amount} / {outgo} ({self._total})")
self._logger.info(f"<BUY> {amount} / {outgo} ({self._remain} / {self._total})")
continue
elif self._buy_price != expected_buy_price:
await self._buy.cancel()

View File

@@ -48,17 +48,14 @@ class MM:
if self._sell.done:
amount = self._sell.amount - self._sell.remain
self._remain -= amount
if amount > 0:
income = amount*self._sell.price
self._total += income
self._logger.info(f"<SELL> {amount} / {income} ({self._total})")
self._remain -= amount
self._logger.info(f"<SELL> {amount} / {income} ({self._remain} / {self._total})")
self._sell = None
elif abs(self._sell_price-(ask-self._epsilon)) >= pair.price_unit:
try:
await self._sell.cancel()
except Exception:
pass
await self._sell.cancel()
elif enough_spread and sell_amount >= pair.order_unit:
# order SELL
self._sell_price = ask-self._epsilon
@@ -66,7 +63,6 @@ class MM:
if self._buy is not None:
# check current BUY order
await asyncio.sleep(0.5)
await self._buy.update()
# get lowest bid
@@ -75,17 +71,14 @@ class MM:
if self._buy.done:
amount = self._buy.amount - self._buy.remain
self._remain += amount
if amount > 0:
outgo = amount*self._buy.price
self._total -= outgo
self._logger.info(f"<BUY> {amount} / {outgo} ({self._total})")
self._remain += amount
self._logger.info(f"<BUY> {amount} / {outgo} ({self._remain} / {self._total})")
self._buy = None
elif abs(self._buy_price-(bid+self._epsilon)) >= pair.price_unit:
try:
await self._buy.cancel()
except Exception:
pass
await self._buy.cancel()
elif enough_spread and buy_amount > pair.order_unit:
# order BUY
self._buy_price = bid+self._epsilon