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

Using 24h high to decide whether to buy in on a new announcement (pump detection) #59

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

fievelbud
Copy link

Pull the 24 high, then add a config option to choose how much higher the 24h high has to be above than the current price in % to not buy the coin.

i.e. you run the bot and it detects and announcement for xyz that has already "peaked", let's say at 100 and you have a 24h % set at 5% then if the current price of the coin is 95, the bot won't buy it.

Since this is a customizable number, you get to choose what you believe a big enough price difference is to skip buying. The 24h high pull runs before the current price pull so the price is less likely to be below the 24h price due to a delay in data pull.

I've added the changes and it appears to work. I tested it by adding a coin to new_listings.json to trick the bot into wanting to order it. Tested using RGT as an example, which has spiked already to 62.76 and landed on ~47 atm which is about a 35% difference. When the 24H setting in config was 30%, it did not buy the coin.also merged with Kekkokk's fork.

You can find Kekkokk's fork here: kekkokk@62e9799

Pull the 24 high, then add a config option to choose how much higher the 24h high has to be above than the current price in % to not buy the coin.

i.e. you run the bot and it detects and announcement for xyz that has already "peaked", let's say at 100 and you have a 24h % set at 5% then if the current price of the coin is 95, the bot won't buy it.

Since this is a customizable number, you get to choose what you believe a big enough price difference is to skip buying. The 24h high pull runs before the current price pull so the price is less likely to be below the 24h price due to a delay in data pull.

I've added the changes and it appears to work. I tested it by adding a coin to new_listings.json to trick the bot into wanting to order it. Tested using RGT as an example, which has spiked already to 62.76 and landed on ~47 atm which is about a 35% difference. When the 24H setting in config was 30%, it did not buy the coin.also merged with Kekkokk's fork.

You can find Kekkokk's fork here: kekkokk@62e9799
@@ -9,6 +9,7 @@
# In %
SL: -3
TP: 2
24H: 2
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding % difference between 24h and current price for a buy decision

logger.info(f'get_last_price existing coin: {coin}')
last_price = get_last_price(symbol, pairing)
logger.info(f'get_coin_info existing coin: {coin}')
coin_info = get_coin_info(symbol, pairing)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change from a single unit of information to all the info you can get on the coin. This is a majority of the changes, along with calling the info differently.

logger.info(f'{stored_price + (stored_price*sl /100)=}')

# update stop loss and take profit values if threshold is reached
if float(last_price) > stored_price + (
if float(coin_info.last) > stored_price + (
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here you call the last price with coin_info.last. You can use coin_info.xxx to pull different coin info.

See https://www.gate.io/docs/apiv4/en/#retrieve-ticker-information for the different options.

'price': last_price}
logger.info('Sold coins:\r\n' + str(sold_coins[coin]))
'iceberg': '0'}
logger.info('Sold coins:' + str(sold_coins[coin]))
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know what the \r\n is for, and it bugged me, so I removed it, not important, take it or leave it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's for a newline. Nowadays, both \r and \n are liable to each add a newline, instead of both being required on windows. Generally just \n is good enough (if a newline is desired).

if float(coin_info.high_24h) > float(coin_info.last) + (float(coin_info.last) * float(ath) / 100):
logger.info(f'24h High is {ath}% greater than price, coin not traded')
else:
order[announcement_coin] = {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is where the decision to not start a buy order on a new announced coin based on the % difference between current price and 24h high is done, also added to the logger info below.

"""
Args:
'DOT', 'USDT'
"""
tickers = spot_api.list_tickers(currency_pair=f'{base}_{quote}')
assert len(tickers) == 1
return tickers[0].last
return tickers[0]

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Allowing the array to contain all the info, not just .last.

@fievelbud fievelbud changed the title Using 24h high to decide whether to buy in on a new announcement Using 24h high to decide whether to buy in on a new announcement (pump and dump detection) Nov 8, 2021
@fievelbud fievelbud changed the title Using 24h high to decide whether to buy in on a new announcement (pump and dump detection) Using 24h high to decide whether to buy in on a new announcement (pump detection) Nov 8, 2021
@cryptmjt
Copy link
Collaborator

cryptmjt commented Nov 8, 2021

Since you merged with kekkokk's version, this is not only a PR to address the 24h high, but also the ioc flag and the issue around not including fees correctly. That's a lot to merge at once - how thoroughly have the other changes been tested?

@Triasmus Triasmus mentioned this pull request Nov 9, 2021
@Jrjy3 Jrjy3 marked this pull request as draft November 12, 2021 01:16
@fievelbud
Copy link
Author

There are issues with the 24h high, it seems to update the 24h high faster than the last price... PR on pause/draft till I can collect more data and resolve.

@Linus045 Linus045 changed the base branch from master to develop January 3, 2022 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants