fixed lint errors
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
"""FastAPI application entry point with lifespan management."""
|
"""FastAPI application entry point with lifespan management."""
|
||||||
|
# ruff: noqa: E402
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# SSL + proxy injection — MUST happen before any HTTP client imports
|
# SSL + proxy injection — MUST happen before any HTTP client imports
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ from __future__ import annotations
|
|||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import ssl
|
|
||||||
from datetime import datetime, timezone
|
from datetime import datetime, timezone
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ from __future__ import annotations
|
|||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import asyncio
|
import asyncio
|
||||||
from datetime import date, datetime, timedelta, timezone
|
from datetime import date, datetime, timezone
|
||||||
|
|
||||||
from apscheduler.schedulers.asyncio import AsyncIOScheduler
|
from apscheduler.schedulers.asyncio import AsyncIOScheduler
|
||||||
from sqlalchemy import case, func, select
|
from sqlalchemy import case, func, select
|
||||||
|
|||||||
@@ -74,8 +74,8 @@ def compute_adx(
|
|||||||
plus_dm: list[float] = []
|
plus_dm: list[float] = []
|
||||||
minus_dm: list[float] = []
|
minus_dm: list[float] = []
|
||||||
for i in range(1, n):
|
for i in range(1, n):
|
||||||
h, l, pc = highs[i], lows[i], closes[i - 1]
|
h, low_val, pc = highs[i], lows[i], closes[i - 1]
|
||||||
tr_list.append(max(h - l, abs(h - pc), abs(l - pc)))
|
tr_list.append(max(h - low_val, abs(h - pc), abs(low_val - pc)))
|
||||||
up = highs[i] - highs[i - 1]
|
up = highs[i] - highs[i - 1]
|
||||||
down = lows[i - 1] - lows[i]
|
down = lows[i - 1] - lows[i]
|
||||||
plus_dm.append(up if up > down and up > 0 else 0.0)
|
plus_dm.append(up if up > down and up > 0 else 0.0)
|
||||||
@@ -208,8 +208,8 @@ def compute_atr(
|
|||||||
|
|
||||||
tr_list: list[float] = []
|
tr_list: list[float] = []
|
||||||
for i in range(1, n):
|
for i in range(1, n):
|
||||||
h, l, pc = highs[i], lows[i], closes[i - 1]
|
h, low_val, pc = highs[i], lows[i], closes[i - 1]
|
||||||
tr_list.append(max(h - l, abs(h - pc), abs(l - pc)))
|
tr_list.append(max(h - low_val, abs(h - pc), abs(low_val - pc)))
|
||||||
|
|
||||||
# Wilder smoothing
|
# Wilder smoothing
|
||||||
atr = sum(tr_list[:period]) / period
|
atr = sum(tr_list[:period]) / period
|
||||||
|
|||||||
@@ -237,7 +237,7 @@ def cluster_sr_zones(
|
|||||||
|
|
||||||
for level in sorted_levels[1:]:
|
for level in sorted_levels[1:]:
|
||||||
# Compute current cluster midpoint
|
# Compute current cluster midpoint
|
||||||
prices = [l["price_level"] for l in current_cluster]
|
prices = [lvl["price_level"] for lvl in current_cluster]
|
||||||
cluster_low = min(prices)
|
cluster_low = min(prices)
|
||||||
cluster_high = max(prices)
|
cluster_high = max(prices)
|
||||||
cluster_mid = (cluster_low + cluster_high) / 2.0
|
cluster_mid = (cluster_low + cluster_high) / 2.0
|
||||||
@@ -259,11 +259,11 @@ def cluster_sr_zones(
|
|||||||
# 3. Compute zone for each cluster
|
# 3. Compute zone for each cluster
|
||||||
zones: list[dict] = []
|
zones: list[dict] = []
|
||||||
for cluster in clusters:
|
for cluster in clusters:
|
||||||
prices = [l["price_level"] for l in cluster]
|
prices = [lvl["price_level"] for lvl in cluster]
|
||||||
low = min(prices)
|
low = min(prices)
|
||||||
high = max(prices)
|
high = max(prices)
|
||||||
midpoint = (low + high) / 2.0
|
midpoint = (low + high) / 2.0
|
||||||
strength = min(100, sum(l["strength"] for l in cluster))
|
strength = min(100, sum(lvl["strength"] for lvl in cluster))
|
||||||
level_count = len(cluster)
|
level_count = len(cluster)
|
||||||
|
|
||||||
# 4. Tag zone type
|
# 4. Tag zone type
|
||||||
|
|||||||
Reference in New Issue
Block a user