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

fix(typings): Ease restrictions. #388

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions report.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from dotenv import dotenv_values
from enum import Enum
from pathlib import Path
from typing import Any
from typing import Any, Dict
miladtsx marked this conversation as resolved.
Show resolved Hide resolved

import docker
import trades
Expand Down Expand Up @@ -148,7 +148,7 @@ def _color_percent(p: float, multiplier: float = 100, symbol: str = "%") -> str:
return _color_string(f"{p*multiplier:.2f} {symbol}", ColorCode.RED)


def _trades_since_message(trades_json: dict[str, Any], utc_ts: float = 0) -> str:
def _trades_since_message(trades_json: Dict[str, Any], utc_ts: float = 0) -> str:
filtered_trades = [
trade
for trade in trades_json.get("data", {}).get("fpmmTrades", [])
Expand All @@ -160,7 +160,7 @@ def _trades_since_message(trades_json: dict[str, Any], utc_ts: float = 0) -> str
return f"{trades_count} trades on {markets_count} markets"


def _calculate_retrades_since(trades_json: dict[str, Any], utc_ts: float = 0) -> tuple[Counter[Any], int, int, int]:
def _calculate_retrades_since(trades_json: Dict[str, Any], utc_ts: float = 0) -> tuple:
miladtsx marked this conversation as resolved.
Show resolved Hide resolved
filtered_trades = Counter((
trade.get("fpmm", {}).get("id", None)
for trade in trades_json.get("data", {}).get("fpmmTrades", [])
Expand Down Expand Up @@ -189,7 +189,7 @@ def _average_trades_since_message(n_trades: int, n_markets: int) -> str:

return f"{average_trades} trades per market"

def _max_trades_per_market_since_message(filtered_trades: Counter[Any]) -> str:
def _max_trades_per_market_since_message(filtered_trades: Counter) -> str:
if not filtered_trades:
max_trades = 0
else:
Expand All @@ -199,7 +199,7 @@ def _max_trades_per_market_since_message(filtered_trades: Counter[Any]) -> str:


def _get_mech_requests_count(
mech_requests: dict[str, Any], timestamp: float = 0
mech_requests: Dict[str, Any], timestamp: float = 0
) -> int:
return sum(
1
Expand Down
4 changes: 2 additions & 2 deletions run_service.sh
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ directory="trader"
service_repo=https://github.com/$org_name/$directory.git
# This is a tested version that works well.
# Feel free to replace this with a different version of the repo, but be careful as there might be breaking changes
service_version="v0.18.2"
service_version="v0.18.7"

# Define constants for on-chain interaction
gnosis_chain_id=100
Expand Down Expand Up @@ -1237,7 +1237,7 @@ export STOP_TRADING_IF_STAKING_KPI_MET=true
export RESET_PAUSE_DURATION=45
export MECH_WRAPPED_NATIVE_TOKEN_ADDRESS=$WXDAI_ADDRESS
export MECH_CHAIN_ID=ethereum
export TOOLS_ACCURACY_HASH=QmNm4BjhAebZjDsTgYhQcRHsobBy33FHzpJGQo9B3fB6jn
export TOOLS_ACCURACY_HASH=QmXhah4pLENsc4pbDTdKmw22GLGb4Z1FSG3FiEsF9ayxxd

if [ -n "$SUBGRAPH_API_KEY" ]; then
export CONDITIONAL_TOKENS_SUBGRAPH_URL="https://gateway-arbitrum.network.thegraph.com/api/$SUBGRAPH_API_KEY/subgraphs/id/7s9rGBffUTL8kDZuxvvpuc46v44iuDarbrADBFw5uVp2"
Expand Down
10 changes: 5 additions & 5 deletions scripts/mech_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from dataclasses import dataclass
from pathlib import Path
from string import Template
from typing import Any, ClassVar, Dict
from typing import Any, ClassVar, Dict, Type

import requests
from tqdm import tqdm
Expand Down Expand Up @@ -193,8 +193,8 @@ def _write_mech_events_data_to_file(


def _query_mech_events_subgraph(
sender: str, event_cls: type[MechBaseEvent]
) -> dict[str, Any]:
sender: str, event_cls: Type[MechBaseEvent]
) -> Dict[str, Any]:
"""Query the subgraph."""

subgraph_event_set_name = f"{event_cls.subgraph_event_name}s"
Expand Down Expand Up @@ -228,7 +228,7 @@ def _query_mech_events_subgraph(
# pylint: disable=too-many-locals
def _update_mech_events_db(
sender: str,
event_cls: type[MechBaseEvent],
event_cls: Type[MechBaseEvent],
) -> None:
"""Get the mech Events database."""

Expand Down Expand Up @@ -290,7 +290,7 @@ def _update_mech_events_db(
print("")


def _get_mech_events(sender: str, event_cls: type[MechBaseEvent]) -> Dict[str, Any]:
def _get_mech_events(sender: str, event_cls: Type[MechBaseEvent]) -> Dict[str, Any]:
"""Updates the local database of Mech events and returns the Mech events."""

_update_mech_events_db(sender, event_cls)
Expand Down
2 changes: 1 addition & 1 deletion trades.py
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,7 @@ def parse_user( # pylint: disable=too-many-locals,too-many-statements
creator: str,
creator_trades_json: Dict[str, Any],
mech_statistics: Dict[str, Any],
) -> tuple[str, Dict[Any, Any]]:
) -> tuple:
miladtsx marked this conversation as resolved.
Show resolved Hide resolved
"""Parse the trades from the response."""

_mech_statistics = dict(mech_statistics)
Expand Down