Skip to content

Commit

Permalink
removed useless logs and changed print to logs
Browse files Browse the repository at this point in the history
  • Loading branch information
azurwastaken committed Jul 6, 2024
1 parent 311088b commit 271fb0b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,16 @@ class BinanceFutureFetcher(FetcherInterfaceT):
async def _fetch_volume(
self, pair: Pair, session: ClientSession
) -> List[Tuple[str, int]] | PublisherFetchError:
logger.info("Fetch volume 1")
url = f"{self.VOLUME_URL}"
selection = f"{pair.base_currency.id}{pair.quote_currency.id}"
volume_arr = []
logger.info("Fetch volume 2")
async with session.get(url) as resp:
if resp.status == 404:
return PublisherFetchError(f"No data found for {pair} from Binance")
logger.info("Fetch volume 3")
result = await resp.json(content_type="application/json")
for element in result:
if selection in element["symbol"]:
volume_arr.append((element["symbol"], int(float(element["quoteVolume"]))))
logger.info("Fetch volume 4")
return volume_arr

async def fetch_pair( # type: ignore[override]
Expand Down
46 changes: 23 additions & 23 deletions pragma-sdk/pragma_sdk/offchain/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,10 @@ async def get_ohlc(
status_code: int = response_raw.status
response: Dict = await response_raw.json()
if status_code == 200:
print(f"Success: {response}")
print("Get Ohlc successful")
logger.debug(f"Success: {response}")
logger.info("Get Ohlc successful")
else:
print(f"Status Code: {status_code}")
logger.error(f"Status Code: {status_code}")
raise PragmaAPIError(f"Failed to get OHLC data for pair {pair}")

return EntryResult(pair_id=response["pair_id"], data=response["data"])
Expand Down Expand Up @@ -184,11 +184,11 @@ async def _create_entries(
status_code: int = response_raw.status
response: Dict = await response_raw.json()
if status_code == 200:
print(f"Success: {response}")
print("Publish successful")
logger.debug(f"Success: {response}")
logger.info("Publish successful")
return response
print(f"Status Code: {status_code}")
print(f"Response Text: {response}")
logger.debug(f"Status Code: {status_code}")
logger.debug(f"Response Text: {response}")
raise PragmaAPIError("Unable to POST /v1/data")

async def get_entry(
Expand Down Expand Up @@ -234,11 +234,11 @@ async def get_entry(
status_code: int = response_raw.status
response: Dict = await response_raw.json()
if status_code == 200:
print(f"Success: {response}")
print("Get Data successful")
logger.debug(f"Success: {response}")
logger.info(f"Get {base_asset}/{quote_asset} Data successful")
else:
print(f"Status Code: {status_code}")
print(f"Response Text: {response}")
logger.debug(f"Status Code: {status_code}")
logger.debug(f"Response Text: {response}")
raise PragmaAPIError(f"Unable to GET /v1/data for pair {pair}")

return EntryResult(
Expand Down Expand Up @@ -295,11 +295,11 @@ async def get_future_entry(
status_code: int = response.status
response: Dict = await response.json()
if status_code == 200:
print(f"Success: {response}")
print("Get Data successful")
logger.debug(f"Success: {response}")
logger.info(f"Get {base_asset}/{quote_asset} future Data successful")
else:
print(f"Status Code: {status_code}")
print(f"Response Text: {response}")
logger.debug(f"Status Code: {status_code}")
logger.debug(f"Response Text: {response}")
raise PragmaAPIError(f"Unable to GET /v1/data for pair {pair}")

return EntryResult(
Expand Down Expand Up @@ -341,11 +341,11 @@ async def get_volatility(self, pair: str, start: int, end: int):
status_code: int = response_raw.status
response: Dict = await response_raw.json()
if status_code == 200:
print(f"Success: {response}")
print("Get Volatility successful")
logger.debug(f"Success: {response}")
logger.info("Get Volatility successful")
else:
print(f"Status Code: {status_code}")
print(f"Response Text: {response}")
logger.debug(f"Status Code: {status_code}")
logger.debug(f"Response Text: {response}")
raise HTTPError(f"Unable to GET /v1/volatility for pair {pair} ")

return EntryResult(pair_id=response["pair_id"], data=response["volatility"])
Expand Down Expand Up @@ -375,11 +375,11 @@ async def get_expiries_list(self, pair: Pair):
status_code: int = response.status
response: Dict = await response.json()
if status_code == 200:
print(f"Success: {response}")
print("Get expiry successful")
logger.debug(f"Success: {response}")
logger.info(f"Get {base_asset}/{quote_asset} expiry successful")
else:
print(f"Status Code: {status_code}")
print(f"Response Text: {response}")
logger.debug(f"Status Code: {status_code}")
logger.debug(f"Response Text: {response}")
raise HTTPError(f"Unable to GET /v1{base_asset}/{quote_asset}/future_expiries for pair {pair} ")
return response

Expand Down
1 change: 0 additions & 1 deletion price-pusher/price_pusher/core/listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ async def _fetch_all_oracle_prices(self) -> None:
for pair in pairs
]
results = await asyncio.gather(*tasks, return_exceptions=True)
print(f"results : {results}")
results = [subl for subl in results if not isinstance(subl, BaseException)]
results = [val for subl in results for val in (subl if isinstance(subl, (list, tuple)) else [subl])]

Expand Down

0 comments on commit 271fb0b

Please sign in to comment.