Skip to content

Commit 5278f0d

Browse files
committed
fixed some mypy bugs
1 parent fd232e9 commit 5278f0d

2 files changed

Lines changed: 6 additions & 14 deletions

File tree

src/graph.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,12 @@
55

66

77
class PricePath:
8-
def __init__(self, exchanges: list = None, gdict: dict = None, cache: dict = None):
9-
if not gdict:
10-
gdict = {}
11-
if not cache:
12-
cache = {}
8+
def __init__(self, exchanges: list = [], gdict: dict = {}, cache: dict = {}):
139
if not exchanges:
1410
exchanges = ["binance", "coinbasepro"]
1511
self.gdict = gdict
1612
self.cache = cache
17-
self.priority = {}
13+
self.priority : dict= {}
1814
allpairs = []
1915

2016
for exchange_id in exchanges:
@@ -249,7 +245,6 @@ def get_active_timeframe(path, starttimestamp=0, stoptimestamp=-1):
249245

250246
if __name__ == "__main__":
251247
g = PricePath()
252-
allpairs = []
253248
start = "IOTA"
254249
to = "EUR"
255250
preferredexchange = "binance"

src/price_data.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,6 @@ class PriceData:
4747
def __init__(self):
4848
self.path = PricePath()
4949

50-
def __init__(self):
51-
self.path = PricePath()
52-
5350
def get_db_path(self, platform: str) -> Path:
5451
return Path(config.DATA_PATH, f"{platform}.db")
5552

@@ -426,13 +423,13 @@ def get_cost(
426423

427424
def get_candles(self, start: int, stop: int, symbol: str, exchange: str) -> list:
428425
exchange_class = getattr(ccxt, exchange)
429-
exchange = exchange_class()
430-
if exchange.has["fetchOHLCV"]:
431-
sleep(exchange.rateLimit / 1000) # time.sleep wants seconds
426+
exchange_obj = exchange_class()
427+
if exchange_obj.has["fetchOHLCV"]:
428+
sleep(exchange_obj.rateLimit / 1000) # time.sleep wants seconds
432429
# get 2min before and after range
433430
startval = start - 1000 * 60 * 2
434431
rang = max(int((stop - start) / 1000 / 60) + 2, 1)
435-
return exchange.fetch_ohlcv(symbol, "1m", startval, rang)
432+
return list(exchange_obj.fetch_ohlcv(symbol, "1m", startval, rang))
436433
else:
437434
log.error(
438435
"fetchOHLCV not implemented on exchange, skipping priceloading using ohlcv"

0 commit comments

Comments
 (0)