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

Listing with multiple coins not working #91

Open
rrm1991 opened this issue Nov 23, 2021 · 5 comments
Open

Listing with multiple coins not working #91

rrm1991 opened this issue Nov 23, 2021 · 5 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@rrm1991
Copy link

rrm1991 commented Nov 23, 2021

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!

@RatFou
Copy link

RatFou commented Nov 23, 2021

Many thanks!

@gutster95
Copy link

Can I just implement your solution into the current bot? Bit of a python noob here

@rrm1991
Copy link
Author

rrm1991 commented Nov 25, 2021

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.

@Beard81
Copy link

Beard81 commented Jan 12, 2022

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

@Linus045
Copy link
Collaborator

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.

@Linus045 Linus045 added the bug Something isn't working label Jan 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants