Skip to content

Commit

Permalink
fix not printing buy price
Browse files Browse the repository at this point in the history
  • Loading branch information
yaqub0r committed Dec 19, 2021
1 parent 679352a commit 46a3d57
Showing 1 changed file with 30 additions and 11 deletions.
41 changes: 30 additions & 11 deletions LimitSwap.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,10 +249,9 @@ def printt_repeating(token_dict, message, print_frequency=500):
repeated_message_quantity = 0

token_dict['_LAST_MESSAGE'] = message


def printt_sell_price(token_dict, token_price):
# Function: printt_buyprice
# Function: printt_sell_price
# --------------------
# Formatted buying information
#
Expand All @@ -277,6 +276,18 @@ def printt_sell_price(token_dict, token_price):

token_dict['_LAST_PRICE_MESSAGE'] = price_message

def printt_buy_price(token_dict, token_price):
# Function: printt_buy_price
# --------------------
# Formatted buying information
#
# token_dict - one element of the tokens{} dictionary
# token_price - the current price of the token we want to buy
#
# returns: nothing

printt_sell_price(token_dict, token_price)

def load_settings_file(settings_path, load_message=True):
# Function: load_settings_file
# ----------------------------
Expand Down Expand Up @@ -667,13 +678,13 @@ def reload_tokens_file(tokens_path, load_message=True):

return tokens

def build_token_list(tokens, all_pairs=False):
# Function: build_token_pair_list
def token_list_report(tokens, all_pairs=False):
# Function: token_list_report
# ----------------------------
# takes our tokens object formated as an array of dicts and returns an array of trading pairs
# takes our tokens and reports on the ones that are still enabled
#
# tokens: array of dicts representing the tokens to trade in the format absorbed by load_tokens_file
# all_pairs: If False (default) returns all enabled pairs - if True returns both enabled and disabled pairs
# all_pairs: If False (default) reports all enabled pairs - if True reports on all pairs
#
# returns: an array of all SYMBOLS we are trading

Expand All @@ -685,9 +696,13 @@ def build_token_list(tokens, all_pairs=False):
token_list = token_list + " "
token_list = token_list + token['SYMBOL']

return token_list

if all_pairs == False:
printt("Quantity of tokens attempting to trade:", len(tokens), "(" , token_list , ")")
else:
printt("Quantity of tokens attempting to trade:", len(tokens), "(" , token_list , ")")



"""""""""""""""""""""""""""
//PRELOAD
"""""""""""""""""""""""""""
Expand Down Expand Up @@ -2525,8 +2540,7 @@ def run():
exit(1)

# Display the number of token pairs we're attempting to trade
# TODO: I have plans to prune failed tokens and duplicate pairs, so displaying this information is going to become important
printt("Quantity of tokens attempting to trade:", len(tokens), "(" , build_token_list(tokens) , ")")
token_list_report(tokens)


# Check to see if the user wants to pre-approve token transactions. If they do, work through that approval process
Expand Down Expand Up @@ -2589,7 +2603,7 @@ def run():
load_token_file_increment = load_token_file_increment + 1

for token in tokens:

if token['ENABLED'] == 'true':


Expand Down Expand Up @@ -2663,6 +2677,11 @@ def run():
elif quote < token['_ALL_TIME_LOW']:
token['_ALL_TIME_LOW'] = quote


# If we're still in the market to buy tokens, the print the buy message
if quote != 0 and token['_REACHED_MAX_TOKENS'] == False:
printt_buy_price(token, quote)

#
# BUY CHECK
# If the liquidity check has returned a quote that is less than our BUYPRICEINBASE and we haven't informrmed
Expand Down

0 comments on commit 46a3d57

Please sign in to comment.