diff --git a/cli.py b/cli.py index c5228d8..7f0c2dc 100644 --- a/cli.py +++ b/cli.py @@ -62,12 +62,8 @@ async def main() -> None: args = parse_args() # Get configuration values, preferring command line args over config.py - rpc_endpoint: str | None = ( - os.environ.get("SOLANA_NODE_RPC_ENDPOINT") or config.PUBLIC_RPC_ENDPOINT - ) - wss_endpoint: str | None = ( - os.environ.get("SOLANA_NODE_WSS_ENDPOINT") or config.PUBLIC_WSS_ENDPOINT - ) + rpc_endpoint: str | None = os.environ.get("SOLANA_NODE_RPC_ENDPOINT") + wss_endpoint: str | None = os.environ.get("SOLANA_NODE_WSS_ENDPOINT") private_key: str | None = os.environ.get("SOLANA_PRIVATE_KEY") # Validate configuration values diff --git a/config.py b/config.py index 3f075d8..4e499be 100644 --- a/config.py +++ b/config.py @@ -3,37 +3,51 @@ Configuration for the pump.fun trading bot. """ # Trading parameters -BUY_AMOUNT: float = 0.000_001 # Amount of SOL to spend when buying +BUY_AMOUNT: int | float = 0.000_001 # Amount of SOL to spend when buying BUY_SLIPPAGE: float = 0.4 # 40% slippage tolerance for buying SELL_SLIPPAGE: float = 0.4 # 40% slippage tolerance for selling + # Configuration for priority fee settings -ENABLE_DYNAMIC_PRIORITY_FEE: bool = True # Enable dynamic priority fee calculation -ENABLE_FIXED_PRIORITY_FEE: bool = False # Enable fixed priority fee -FIXED_PRIORITY_FEE: int = 50_000 # Fixed priority fee in microlamports +ENABLE_DYNAMIC_PRIORITY_FEE: bool = False # Enable dynamic priority fee calculation +ENABLE_FIXED_PRIORITY_FEE: bool = True # Enable fixed priority fee +FIXED_PRIORITY_FEE: int = 2_000 # Fixed priority fee in microlamports EXTRA_PRIORITY_FEE: float = ( - 0.1 # Percentage increase applied to priority fee (0.1 = 10%) + 0.0 # Percentage increase applied to priority fee (0.1 = 10%) ) HARD_CAP_PRIOR_FEE: int = ( 200_000 # Maximum allowed priority fee in microlamports (hard cap) ) + # Retries and timeouts -MAX_RETRIES: int = 2 -WAIT_TIME_AFTER_BUY: int = 15 -WAIT_TIME_BEFORE_NEW_TOKEN: int = 30 -WAIT_TIME_AFTER_CREATION: int = 15 +MAX_RETRIES: int = 10 # Number of retries for transaction sending +# TODO: waiting times will be replaced with retries to shorten delays +WAIT_TIME_AFTER_CREATION: int | float = ( + 15 # Time to wait after token creation (in seconds) + # Too short a delay may cause the RPC node to be unaware of the bonding curve account +) +WAIT_TIME_AFTER_BUY: int | float = ( + 15 # Time to wait after a buy transaction is confirmed (in seconds) + # Acts as a simple holding period + # Too short delay may cause the RPC node to be unaware of account balance +) +WAIT_TIME_BEFORE_NEW_TOKEN: int | float = ( + 5 # Time to wait after a sell transaction is confirmed (in seconds) + # Provides a pause between completed trades, can be set to 0 +) + # 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: float = 0.1 +MAX_TOKEN_AGE: int | float = 0.1 -# Node provier configuration -# You can also get a trader node https://docs.chainstack.com/docs/solana-trader-nodes + +# Node provider configuration +# Tested with Chainstack nodes (https://console.chainstack.com), but you can use any node provider +# You can get a trader node https://docs.chainstack.com/docs/solana-trader-nodes MAX_RPS: int = 25 # TODO: not implemented. Max RPS to avoid rate limit errors -PUBLIC_RPC_ENDPOINT = "https://api.mainnet-beta.solana.com" -PUBLIC_WSS_ENDPOINT = "wss://api.mainnet-beta.solana.com" def validate_priority_fee_config() -> None: