gateio-crypto-trading-bot-binance-announcements-new-coins
gateio-crypto-trading-bot-binance-announcements-new-coins copied to clipboard
Listing with multiple coins not working
Last listing: "Binance Will List Amp (AMP) and PlayDapp (PLA)"
Didn't work because the method get_last_coin() from new_listings_scraper.py only gets a new coin if there is just one on the listing title. Check the if statements at the end of get_last_coin() method:
def get_last_coin():
"""
Returns new Symbol when appropriate
"""
latest_announcement = get_announcement()
found_coin = re.findall('\(([^)]+)', latest_announcement)
uppers = None
if 'Will List' not in latest_announcement or found_coin[0] == globals.latest_listing or \
found_coin[0] in previously_found_coins:
return None
else:
if len(found_coin) == 1:
uppers = found_coin[0]
previously_found_coins.add(uppers)
logger.info('New coin detected: ' + uppers)
if len(found_coin) != 1:
uppers = None
print(f'{uppers=}')
return uppers
If we want to get all coins from that same listing message, I would suggest using this method, that will grab the first coin the first time the listing message is passed, the second coin the second time... etc:
def get_last_coin():
"""
Returns new Symbol when appropriate
"""
latest_announcement = get_announcement()
found_coins = re.findall('\(([^)]+)', latest_announcement)
# My method for supporting multi-coin announcements
if 'Will List' not in latest_announcement or len(found_coins) < 1:
return None
else:
for coin in found_coins:
if coin != globals.latest_listing and coin not in previously_found_coins:
previously_found_coins.add(coin)
logger.info('New coin detected: ' + coin)
print(f'{coin=}')
return coin
return None
If you just want to grab the first coin and ignore the second one cause it might cause problems with buying/selling orders (I haven't read the trading code so much) : the method can easily be modified like this:
def get_last_coin():
"""
Returns new Symbol when appropriate
"""
latest_announcement = get_announcement()
found_coins = re.findall('\(([^)]+)', latest_announcement)
# My method for supporting multi-coin announcements
if 'Will List' not in latest_announcement or len(found_coins) < 1:
return None
else:
coin = found_coins[0]
if coin != globals.latest_listing and coin not in previously_found_coins:
previously_found_coins.add(coin)
logger.info('New coin detected: ' + coin)
print(f'{coin=}')
return coin
return None
Hope it helps!
Many thanks!
Can I just implement your solution into the current bot? Bit of a python noob here
The last option I posted, to get only the first coin and ignore the rest on a multi coin announcement is safe to implement. You can just copy this code and replace the original get_last_coin() method.
The other one needs a bit of tweaking, which I am testing right now. Until we get another multi-coin announcement I will not be 100% sure it works.
This is my code from the new_listings_scraper. How would i edit it to be the equivalent of what rrm1991 mentioned above to only get the first coin of a multi-coin listing? I'm a rookie, so I couldn't interpret what rrm1991 said to do and apply it to my code. Any help would be appreciated, thanks.
def get_last_coin(): """ Returns new Symbol when appropriate """ # scan Binance Announcement latest_announcement = get_announcement()
# enable Kucoin Announcements if True in config
if config['TRADE_OPTIONS']['KUCOIN_ANNOUNCEMENTS']:
logger.info('Kucoin announcements enabled, look for new Kucoin coins...')
kucoin_announcement = get_kucoin_announcement()
kucoin_coin = re.findall('\(([^)]+)', kucoin_announcement)
found_coin = re.findall('\(([^)]+)', latest_announcement)
uppers = None
# returns nothing if it's an old coin or it's not an actual coin listing
if 'Will List' not in latest_announcement or found_coin[0] == globals.latest_listing or \
found_coin[0] in previously_found_coins:
# if the latest Binance announcement is not a new coin listing, or the listing has already been returned, check kucoin
if config['TRADE_OPTIONS']['KUCOIN_ANNOUNCEMENTS'] and 'Gets Listed' in kucoin_announcement\
and kucoin_coin[0] != globals.latest_listing and kucoin_coin[0] not in previously_found_coins:
if len(kucoin_coin) == 1:
uppers = kucoin_coin[0]
previously_found_coins.add(uppers)
logger.info('New Kucoin coin detected: ' + uppers)
if len(kucoin_coin) != 1:
uppers = None
else:
if len(found_coin) == 1:
uppers = found_coin[0]
previously_found_coins.add(uppers)
logger.info('New coin detected: ' + uppers)
if len(found_coin) != 1:
uppers = None
return uppers
I've created a new Draft PR to tackle this issue. The first step would be to just grab the first coin similar to @rrm1991's implementation.
See here: #150
In the future we might implement a solution that would monitor and buy/sell all mentioned coins simultaneously. But there are some problems with that as well which we do need to discuss then.