From f5eb3708dcf9316aba546719f6c5fcd2618c11cc Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Thu, 24 Mar 2022 17:03:36 +0000 Subject: [PATCH 1/2] Restyled by black --- .../stocks/src/commands/services.py | 18 +++++++++--------- .../tests/test_commands/test_services.py | 1 - 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/tutorials/stock-wallet/microservices/stocks/src/commands/services.py b/tutorials/stock-wallet/microservices/stocks/src/commands/services.py index 9a2a9b98c..35dbbe315 100644 --- a/tutorials/stock-wallet/microservices/stocks/src/commands/services.py +++ b/tutorials/stock-wallet/microservices/stocks/src/commands/services.py @@ -31,8 +31,9 @@ async def set_stock_ticker(self, request: Request): def call_remote(self, ticker, from_: str, to_: str): with RESTClient("") as client: - resp = client.stocks_equities_aggregates(ticker, 1, "hour", from_, to_, adjusted=True, sort="asc", - limit=50000) + resp = client.stocks_equities_aggregates( + ticker, 1, "hour", from_, to_, adjusted=True, sort="asc", limit=50000 + ) return resp.results @enroute.periodic.event("* * * * *") @@ -43,16 +44,15 @@ async def get_stock_values(self, request: Request): if len(tickers) > 0: for ticker in tickers: ticker_updated = pendulum.parse(ticker["updated"]) - results = await self.call_remote(ticker["ticker"], - now_minus_one_month.to_date_string(), - now.to_date_string()) + results = await self.call_remote( + ticker["ticker"], now_minus_one_month.to_date_string(), now.to_date_string() + ) for result in results: result_date = pendulum.parse(result["t"]) difference_ticker_result = ticker_updated.diff(result_date).in_hours() if difference_ticker_result < 0: await StocksAggregate.update_time_ticker(ticker["uuid"], result_date.to_datetime_string()) when = result_date.to_datetime_string() - await StocksAggregate.add_quotes(ticker["uuid"], {"close": result['c'], - "volume": result['v'], - "when": when}) - + await StocksAggregate.add_quotes( + ticker["uuid"], {"close": result["c"], "volume": result["v"], "when": when} + ) diff --git a/tutorials/stock-wallet/microservices/stocks/tests/test_commands/test_services.py b/tutorials/stock-wallet/microservices/stocks/tests/test_commands/test_services.py index f5719d3e7..bb934a877 100644 --- a/tutorials/stock-wallet/microservices/stocks/tests/test_commands/test_services.py +++ b/tutorials/stock-wallet/microservices/stocks/tests/test_commands/test_services.py @@ -39,6 +39,5 @@ async def test_get_remote_quotes(self): self.assertIsInstance(response, list) - if __name__ == "__main__": unittest.main() From 1e8d5d56d46ebeaecb39dc22dc509ff0ab769d2e Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Thu, 24 Mar 2022 17:03:38 +0000 Subject: [PATCH 2/2] Restyled by isort --- .../microservices/stocks/src/commands/services.py | 5 ++++- .../stocks/tests/test_commands/test_services.py | 1 - 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tutorials/stock-wallet/microservices/stocks/src/commands/services.py b/tutorials/stock-wallet/microservices/stocks/src/commands/services.py index 35dbbe315..83043dc1c 100644 --- a/tutorials/stock-wallet/microservices/stocks/src/commands/services.py +++ b/tutorials/stock-wallet/microservices/stocks/src/commands/services.py @@ -1,6 +1,10 @@ import logging import pendulum +from polygon import ( + RESTClient, +) + from minos.aggregate import ( Event, ) @@ -15,7 +19,6 @@ from ..aggregates import ( StocksAggregate, ) -from polygon import RESTClient logger = logging.getLogger(__name__) diff --git a/tutorials/stock-wallet/microservices/stocks/tests/test_commands/test_services.py b/tutorials/stock-wallet/microservices/stocks/tests/test_commands/test_services.py index bb934a877..4a36c5c85 100644 --- a/tutorials/stock-wallet/microservices/stocks/tests/test_commands/test_services.py +++ b/tutorials/stock-wallet/microservices/stocks/tests/test_commands/test_services.py @@ -2,7 +2,6 @@ import unittest import pendulum - from src import ( Stocks, StocksCommandService,