-
-
Notifications
You must be signed in to change notification settings - Fork 15
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
Add channel for high potential meme coins #519
Labels
Difficulty: Hard 😭
This issue is hard to solve, a lot of code needs to be changed
New feature ⭐
New feature or request
Priority: High 🥇
Assign this label if this issue is VERY important or often used
Comments
StephanAkkerman
added
Priority: High 🥇
Assign this label if this issue is VERY important or often used
New feature ⭐
New feature or request
Difficulty: Hard 😭
This issue is hard to solve, a lot of code needs to be changed
labels
Mar 27, 2024
https://dexscreener.com/new-pairs, could not find an easy way to reach their API |
Can take inspiration from: https://github.com/farzadex-eth/tokenfinderbot |
https://github.com/liqtags/DexScreenerClient also has newpairs functionality |
Sample code (does not work because of cloudlflare): import json
import ssl
import websocket
WS_TRENDING = "wss://io.dexscreener.com/dex/screener/pairs/h24/1?rankBy[key]=trendingScoreH6&rankBy[order]=desc"
WS_GAINERS = "wss://io.dexscreener.com/dex/screener/pairs/h24/1?rankBy[key]=priceChangeH24&rankBy[order]=desc&filters[liquidity][min]=25000&filters[txns][h24][min]=50&filters[volume][h24][min]=10000"
WS_NEWEST = "wss://io.dexscreener.com/dex/screener/pairs/h24/1?rankBy[key]=volume&rankBy[order]=desc&filters[pairAge][max]=24"
def get_pairs(uri):
"""
Retrieves a list of pairs from the given URI.
Args:
uri (str): The URI to fetch data from.
Returns:
list: A list of pairs retrieved from the URI.
"""
for i in range(5):
data = call_websocket_load_json(uri)
if pairs := data.get("pairs"):
return pairs
print(f"({i + 1}/{5}) -- {data}")
return []
def call_websocket_load_json(uri) -> dict:
"""
Calls a WebSocket URI and returns the received JSON data as a dictionary.
Args:
uri (str): The URI of the WebSocket server.
Returns:
dict: The received JSON data as a dictionary.
"""
ws = websocket.WebSocket(sslopt={"cert_reqs": ssl.CERT_NONE})
ws.connect(uri, header=get_header(), suppress_origin=True)
return json.loads(ws.recv())
def get_header():
"""
Returns the header dictionary containing the User-Agent and Origin values.
Returns:
dict: The header dictionary.
"""
return {
"User-Agent": " ".join(
[
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)",
"AppleWebKit/537.36 (KHTML, like Gecko)"
"Chrome/113.0.0.0 Safari/537.36",
]
),
"Origin": "https://dexscreener.com",
}
print(get_pairs(WS_TRENDING)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Difficulty: Hard 😭
This issue is hard to solve, a lot of code needs to be changed
New feature ⭐
New feature or request
Priority: High 🥇
Assign this label if this issue is VERY important or often used
Maybe use data from dexscreener.com or other sources to look for anomalies in the data after launch of a new coin.
Dexscreener code:
Check F12, Network, WS for dexscreener websocket connection.
The text was updated successfully, but these errors were encountered: