Skip to content

Commit d743b74

Browse files
fix: omen endpoint on script
1 parent 761f60b commit d743b74

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

rank_traders.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,12 @@
2121
"""This script queries the OMEN subgraph to obtain the trades of a given address."""
2222

2323
import datetime
24+
import os
2425
import sys
2526
from argparse import ArgumentParser
2627
from collections import defaultdict
28+
from dotenv import load_dotenv
29+
from pathlib import Path
2730
from string import Template
2831
from typing import Any
2932

@@ -38,6 +41,11 @@
3841
FPMM_CREATOR = "0x89c5cc945dd550bcffb72fe42bff002429f46fec"
3942
DEFAULT_FROM_DATE = "1970-01-01T00:00:00"
4043
DEFAULT_TO_DATE = "2038-01-19T03:14:07"
44+
SCRIPT_PATH = Path(__file__).resolve().parent
45+
STORE_PATH = Path(SCRIPT_PATH, ".trader_runner")
46+
ENV_FILE = Path(STORE_PATH, ".env")
47+
48+
load_dotenv(ENV_FILE)
4149

4250

4351
headers = {
@@ -167,7 +175,8 @@ def _query_omen_xdai_subgraph(
167175
fpmm_to_timestamp: float,
168176
) -> dict[str, Any]:
169177
"""Query the subgraph."""
170-
url = "https://api.thegraph.com/subgraphs/name/protofire/omen-xdai"
178+
subgraph_api_key = os.getenv('SUBGRAPH_API_KEY')
179+
url = f"https://gateway-arbitrum.network.thegraph.com/api/{subgraph_api_key}/subgraphs/id/9fUVQpFwzpdWS9bq5WkAnmKbNNcoBwatMR4yZq81pbbz"
171180

172181
grouped_results = defaultdict(list)
173182
id_gt = ""

0 commit comments

Comments
 (0)