Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added GH actions using tox, pre-commit, black code formatting, flake8 #119

Merged
merged 16 commits into from
Jan 3, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def buy():
amount = left

logger.info(
f'starting buy place_order with : {announcement_coin=} | {globals.pairing=} | {volume=} | {amount=} x {price=} | side = buy | {status=}',
f'starting buy place_order with : {announcement_coin} | {globals.pairing} | {volume} | {amount} x {price} | side = buy | {status}',
Linus045 marked this conversation as resolved.
Show resolved Hide resolved
extra={'TELEGRAM': 'BUY_START'})


Expand Down Expand Up @@ -176,7 +176,7 @@ def buy():
order_status = order[announcement_coin]['_status']

logger.info(
f'Order created on {announcement_coin} at a price of {price} each. {order_status=}',
f'Order created on {announcement_coin} at a price of {price} each. {order_status}',
extra={'TELEGRAM': 'BUY_ORDER_CREATED'})

if order_status == "closed":
Expand Down Expand Up @@ -215,7 +215,7 @@ def buy():

session[announcement_coin]['orders'].append(copy.deepcopy(order[announcement_coin]))

logger.info(f"Partial fill order detected. {order_status=} | {partial_amount=} out of {amount=} | {partial_fee=} | {price=}")
logger.info(f"Partial fill order detected. {order_status} | {partial_amount} out of {amount} | {partial_fee} | {price}")
# FUTURE: We'll probably want to start attempting to sell in the future immediately after ordering any amount
# It would require at least a minor refactor, since order is getting cleared and
# it seems that this function depends on order being empty, but sell() depends on order not being empty.
Expand All @@ -226,7 +226,7 @@ def buy():
order.pop(announcement_coin) # reset for next iteration
else:
logger.warning(
f'{announcement_coin=} is not supported on gate io',
f'{announcement_coin} is not supported on gate io',
extra={'TELEGRAM': 'COIN_NOT_SUPPORTED'})
logger.info(f"Adding {announcement_coin} to old_coins.json")
globals.old_coins.append(announcement_coin)
Expand Down Expand Up @@ -267,7 +267,7 @@ def sell():
if float(stored_price) == 0:
continue

logger.debug(f'Data for sell: {coin=} | {stored_price=} | {coin_tp=} | {coin_sl=} | {volume=} | {symbol=} ')
logger.debug(f'Data for sell: {coin} | {stored_price} | {coin_tp} | {coin_sl} | {volume} | {symbol} ')

logger.info(f'get_last_price existing coin: {coin}')
obj = get_last_price(symbol, globals.pairing, False)
Expand All @@ -281,7 +281,7 @@ def sell():
if float(last_price) == 0:
continue

logger.info(f'{symbol=}-{last_price=}\t[STOP: ${"{:,.5f}".format(stop_loss_price)} or {"{:,.2f}".format(coin_sl)}%]\t[TOP: ${"{:,.5f}".format(top_position_price)} or {"{:,.2f}".format(coin_tp)}%]\t[BUY: ${"{:,.5f}".format(stored_price)} (+/-): {"{:,.2f}".format(((float(last_price) - stored_price) / stored_price) * 100)}%]')
logger.info(f'{symbol}-{last_price}\t[STOP: ${"{:,.5f}".format(stop_loss_price)} or {"{:,.2f}".format(coin_sl)}%]\t[TOP: ${"{:,.5f}".format(top_position_price)} or {"{:,.2f}".format(coin_tp)}%]\t[BUY: ${"{:,.5f}".format(stored_price)} (+/-): {"{:,.2f}".format(((float(last_price) - stored_price) / stored_price) * 100)}%]')

# update stop loss and take profit values if threshold is reached
if float(last_price) > stored_price + (
Expand Down
2 changes: 1 addition & 1 deletion new_listings_scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def get_last_coin():
logger.info('New coin detected: ' + uppers)
if len(found_coin) != 1:
uppers = None
print(f'{uppers=}')
print(f'{uppers}')

return uppers

Expand Down