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

HTTP error 429 when trying to buy token #18

Open
fm360 opened this issue Nov 29, 2024 · 5 comments
Open

HTTP error 429 when trying to buy token #18

fm360 opened this issue Nov 29, 2024 · 5 comments

Comments

@fm360
Copy link

fm360 commented Nov 29, 2024

After executing trade.py, whenever the bot tries to buy a coin it always receives an HTTP error 429

Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/solana/exceptions.py", line 60, in argument_decorator
return await func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/solana/rpc/providers/async_http.py", line 59, in make_request
raw = await self.make_request_unparsed(body)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/solana/rpc/providers/async_http.py", line 66, in make_request_unparsed
return _after_request_unparsed(raw_response)
File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/solana/rpc/providers/core.py", line 137, in _after_request_unparsed
raw_response.raise_for_status()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/httpx/_models.py", line 829, in raise_for_status
raise HTTPStatusError(message, request=request, response=self)
httpx.HTTPStatusError: Client error '429 Too Many Requests' for url 'https://nd-312-312-038.p2pify.com/REDACTED'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/Users/f/pump-fun-bot/trade.py", line 157, in
asyncio.run(main(yolo_mode=args.yolo, match_string=args.match, bro_address=args.bro, marry_mode=args.marry))
~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/asyncio/runners.py", line 194, in run
return runner.run(main)
~~~~~~~~~~^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/asyncio/base_events.py", line 721, in run_until_complete
return future.result()
~~~~~~~~~~~~~^^
File "/Users/f/pump-fun-bot/trade.py", line 140, in main
await trade(websocket, match_string, bro_address, marry_mode, yolo_mode)
File "/Users/f/pump-fun-bot/trade.py", line 52, in trade
await _trade(websocket, match_string, bro_address, marry_mode, yolo_mode)
File "/Users/f/pump-fun-bot/trade.py", line 96, in _trade
buy_tx_hash = await buy_token(mint, bonding_curve, associated_bonding_curve, BUY_AMOUNT, BUY_SLIPPAGE)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/f/pump-fun-bot/buy.py", line 72, in buy_token
curve_state = await get_pump_curve_state(client, bonding_curve)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/f/pump-fun-bot/buy.py", line 47, in get_pump_curve_state
response = await conn.get_account_info(curve_address)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/solana/rpc/async_api.py", line 188, in get_account_info
return await self._provider.make_request(body, GetAccountInfoResp)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/solana/exceptions.py", line 62, in argument_decorator
raise internal_exception_cls(exc, func, *args, **kwargs) from exc
solana.exceptions.SolanaRpcException

@Sahilkhurana
Copy link

Was this ever resolved? I am getting same error on many occasions. On other occasions, it just fails to create associated token account.

@akegaviar
Copy link
Member

Hey guys, 429 means you are getting rate limited. Check these:

@Sahilkhurana
Copy link

Thanks. Looks like it is near impossible to run this in free (developer plan) to test proof of concept. Have tried 20+ times with each time getting rate limited.

@Firesampo
Copy link

Yeah, same problem here. I'm not sure how trying to make a purchase could make it already exceed the rate, I haven't had success to execute this even once. This happens every time, on the first coin I try to buy.

@akegaviar
Copy link
Member

You can try the public RPC or other RPCs if you want to stay on the free plan. I'll also update the project with a bunch of features and requests and will include the ability to set the RPS pace in config.py,

(in the meantime you can do it yourself btw, just play around with the code and tune it to your needs like setting the RPS to match the one of the RPC node you use)

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

No branches or pull requests

4 participants