added max_token_age

This commit is contained in:
smypmsa
2025-03-06 22:05:51 +00:00
parent ab186210fd
commit bfcea298fd
3 changed files with 17 additions and 7 deletions
+8 -3
View File
@@ -11,9 +11,14 @@ EXTRA_PRIORITY_FEE = 0.1 # TODO: not implemented. 10% increase in dynamic prior
# Retries and timeouts
MAX_RETRIES: int = 2
WAIT_TIME_AFTER_BUY: int = 15
WAIT_TIME_BEFORE_NEW_TOKEN: int = 120
WAIT_TIME_AFTER_CREATION: int = 15
WAIT_TIME_AFTER_BUY: int = 12
WAIT_TIME_BEFORE_NEW_TOKEN: int = 5
WAIT_TIME_AFTER_CREATION: int = 12
# Maximum age (in seconds) for a token to be considered "fresh" and eligible for processing.
# This threshold is checked before processing starts - tokens older than this are skipped
# since they likely contain outdated information from the websocket stream
MAX_TOKEN_AGE: int = 1
# Node provier configuration
# You can also get a trader node https://docs.chainstack.com/docs/solana-trader-nodes
+3 -4
View File
@@ -73,7 +73,7 @@ class PumpTrader:
self.buy_slippage = buy_slippage
self.sell_slippage = sell_slippage
self.max_retries = max_retries
self.max_token_age = 1 # seconds
self.max_token_age = config.MAX_TOKEN_AGE
# Token processing state
self.token_queue = asyncio.Queue()
@@ -131,9 +131,8 @@ class PumpTrader:
# Record timestamp when token was discovered
self.token_timestamps[token_key] = asyncio.get_event_loop().time()
# Add to queue
await self.token_queue.put(token_info)
logger.info(f"Queued new token: {token_info.symbol} ({token_info.mint})")
# logger.info(f"Queued new token: {token_info.symbol} ({token_info.mint})")
async def _process_token_queue(self, marry_mode: bool, yolo_mode: bool) -> None:
"""Continuously process tokens from the queue, only if they're fresh."""
@@ -141,7 +140,7 @@ class PumpTrader:
token_info = await self.token_queue.get()
token_key = str(token_info.mint)
# Check if token is still fresh
# Check if token is still "fresh"
current_time = asyncio.get_event_loop().time()
token_age = current_time - self.token_timestamps.get(
token_key, current_time
+6
View File
@@ -1,2 +1,8 @@
{"timestamp": "2024-08-22T10:51:30.306580", "action": "buy", "token_address": "LR7TYDeWamU7MsCXFH7ydwJYaZfRJs8pzgCQrh2pump", "price": 1.668947042812354e-07, "tx_hash": "XZDRuEnaBNEeuFAiGyJsqBmVF3uZvFqAQUKsZVKTxsThHxN43LiRqy3T4cSH4dRXGB7c5A4855iYQDLY4BNJJhP"}
{"timestamp": "2024-08-22T10:51:56.116951", "action": "sell", "token_address": "LR7TYDeWamU7MsCXFH7ydwJYaZfRJs8pzgCQrh2pump", "price": 1.668947042812354e-07, "tx_hash": "WQHnEoyztfDf5FJyQRXDGxxtqf2EcMGs8SET43KuYU8Dpdunruku22SHnfiH2xsUi1hTBjC1msvTcnU78fFKrc2"}
{"timestamp": "2025-03-06T21:53:16.417950", "action": "buy", "token_address": "7ztobvXwBd8UBn2mUuatjpmEmn7EZpifXv98xjCrpump", "symbol": "$Auti", "price": 3.3860819583417394e-08, "amount": 29.532657871333047, "tx_hash": "4fUuh16912cK7xiZsvY1scu5P5NtWGwowcAYXQvvr1FWAvPD57mPKfrq5PMMzMULhMiVn86fiDCUfwWt6B7NPNxV"}
{"timestamp": "2025-03-06T21:53:33.704455", "action": "sell", "token_address": "7ztobvXwBd8UBn2mUuatjpmEmn7EZpifXv98xjCrpump", "symbol": "$Auti", "price": 3.38403327639918e-08, "amount": 29.532657, "tx_hash": "4TRFmKYkibrgn2fX4UT7mM8i7Lpu3FgXKvY1d6AsEUaxLj11JxWo61xxqYGW7B6wzdaY9LWVWZnTSDTZUUNs5pFU"}
{"timestamp": "2025-03-06T22:04:01.067407", "action": "buy", "token_address": "5jch2xH14RBWZgKwmxEUJwC4howFNBCBqbnZ5uguGujj", "symbol": "$MOONWEN", "price": 2.8543914418196173e-08, "amount": 35.03373732659877, "tx_hash": "VCWbh79TmNWtt9kjex5LLtWKGHjc3nPBQVJdynC7B85nbnXx4DBgwguqAe6StYVAUS7jzP17pN5FWWGvbiUBRfk"}
{"timestamp": "2025-03-06T22:04:48.843998", "action": "sell", "token_address": "5jch2xH14RBWZgKwmxEUJwC4howFNBCBqbnZ5uguGujj", "symbol": "$MOONWEN", "price": 2.8056120698010214e-08, "amount": 35.033737, "tx_hash": "RLx8hFVd5DVZdUg5vN41Fs8Yz66yTEUEvegasuHwYQ7DTJhPcCdggoNBtipb93VPVdtQLZydxc9ZKRZ1uzK6KzH"}
{"timestamp": "2025-03-06T22:05:11.444317", "action": "buy", "token_address": "C9GrXnLPkD4fdj83ua7TFndtxvCVxdYyZzqrMBBZpump", "symbol": "CRYPTO ", "price": 3.383038210726932e-08, "amount": 29.559228649242023, "tx_hash": "3E4RT5kvRezWJmQKJ9wmcAiDcYZefohxFVNdEZPweE9vhq215rSmqBn4Dv4ypH5KUUuNJzKdhjyrGU2b47woWr9e"}
{"timestamp": "2025-03-06T22:05:25.789876", "action": "sell", "token_address": "C9GrXnLPkD4fdj83ua7TFndtxvCVxdYyZzqrMBBZpump", "symbol": "CRYPTO ", "price": 3.3830384158620706e-08, "amount": 29.559228, "tx_hash": "3oyJVzsRvnQV5qBsEp4hSk97eFWzUjzfWWa16GMUXtMd7JBmbQkTkmvs7N8nagYcJvqfFhzhCKZEG6onxjYYQbwX"}