fix: unexpected recusion caused by same name functions
This commit is contained in:
parent
375b09b0e9
commit
e4a439ea92
|
|
@ -1,8 +1,6 @@
|
||||||
from .blockbeats_utils import get_blockbeats_news
|
from .blockbeats_utils import fetch_news_from_blockbeats
|
||||||
from .coindesk_utils import get_coindesk_news
|
from .coindesk_utils import fetch_news_from_coindesk
|
||||||
from .finnhub_utils import get_data_in_range
|
|
||||||
from .googlenews_utils import getNewsData
|
from .googlenews_utils import getNewsData
|
||||||
from .yfin_utils import YFinanceUtils
|
|
||||||
from .binance_utils import *
|
from .binance_utils import *
|
||||||
from .reddit_utils import fetch_top_from_category
|
from .reddit_utils import fetch_top_from_category
|
||||||
from .stockstats_utils import StockstatsUtils
|
from .stockstats_utils import StockstatsUtils
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ from binance.um_futures import UMFutures
|
||||||
|
|
||||||
um_futures_client = UMFutures()
|
um_futures_client = UMFutures()
|
||||||
|
|
||||||
def get_binance_klines(symbol: str, interval: str, limit: int = 75):
|
def fetch_klines_from_binance(symbol: str, interval: str, limit: int = 75):
|
||||||
"""
|
"""
|
||||||
Fetch historical klines (candlestick data) from Binance.
|
Fetch historical klines (candlestick data) from Binance.
|
||||||
|
|
||||||
|
|
@ -14,7 +14,7 @@ def get_binance_klines(symbol: str, interval: str, limit: int = 75):
|
||||||
"""
|
"""
|
||||||
return um_futures_client.klines(symbol=symbol, interval=interval, limit=limit)
|
return um_futures_client.klines(symbol=symbol, interval=interval, limit=limit)
|
||||||
|
|
||||||
def get_binance_depth(symbol: str, limit: int = 50):
|
def fetch_depth_from_binance(symbol: str, limit: int = 50):
|
||||||
"""
|
"""
|
||||||
Fetch the order book depth from Binance.
|
Fetch the order book depth from Binance.
|
||||||
|
|
||||||
|
|
@ -24,7 +24,7 @@ def get_binance_depth(symbol: str, limit: int = 50):
|
||||||
"""
|
"""
|
||||||
return um_futures_client.depth(symbol=symbol, limit=limit)
|
return um_futures_client.depth(symbol=symbol, limit=limit)
|
||||||
|
|
||||||
def get_binance_24hr_pricechange(symbol: str):
|
def fetch_24hr_pricechange_from_binance(symbol: str):
|
||||||
"""
|
"""
|
||||||
Fetch 24-hour ticker price change statistics from Binance.
|
Fetch 24-hour ticker price change statistics from Binance.
|
||||||
|
|
||||||
|
|
@ -33,7 +33,7 @@ def get_binance_24hr_pricechange(symbol: str):
|
||||||
"""
|
"""
|
||||||
return um_futures_client.ticker_24hr_price_change(symbol=symbol)
|
return um_futures_client.ticker_24hr_price_change(symbol=symbol)
|
||||||
|
|
||||||
def get_binance_toplongshort_position_ratio(symbol: str, period: str, limit: int = 50):
|
def fetch_toplongshort_position_ratio_from_binance(symbol: str, period: str, limit: int = 50):
|
||||||
"""
|
"""
|
||||||
Fetch the top long/short position ratio from Binance.
|
Fetch the top long/short position ratio from Binance.
|
||||||
|
|
||||||
|
|
@ -44,7 +44,7 @@ def get_binance_toplongshort_position_ratio(symbol: str, period: str, limit: int
|
||||||
"""
|
"""
|
||||||
return um_futures_client.top_long_short_position_ratio(symbol=symbol, period=period, limit=limit)
|
return um_futures_client.top_long_short_position_ratio(symbol=symbol, period=period, limit=limit)
|
||||||
|
|
||||||
def get_binance_toplongshort_account_ratio(symbol: str, period: str, limit: int = 50):
|
def fetch_toplongshort_account_ratio_from_binance(symbol: str, period: str, limit: int = 50):
|
||||||
"""
|
"""
|
||||||
Fetch the top long/short account ratio from Binance.
|
Fetch the top long/short account ratio from Binance.
|
||||||
|
|
||||||
|
|
@ -55,7 +55,7 @@ def get_binance_toplongshort_account_ratio(symbol: str, period: str, limit: int
|
||||||
"""
|
"""
|
||||||
return um_futures_client.top_long_short_account_ratio(symbol=symbol, period=period, limit=limit)
|
return um_futures_client.top_long_short_account_ratio(symbol=symbol, period=period, limit=limit)
|
||||||
|
|
||||||
def get_binance_global_longshort_account_ratio(symbol: str, period: str, limit: int = 50):
|
def fetch_global_longshort_account_ratio_from_binance(symbol: str, period: str, limit: int = 50):
|
||||||
"""
|
"""
|
||||||
Fetch the global long/short account ratio from Binance.
|
Fetch the global long/short account ratio from Binance.
|
||||||
|
|
||||||
|
|
@ -66,7 +66,7 @@ def get_binance_global_longshort_account_ratio(symbol: str, period: str, limit:
|
||||||
"""
|
"""
|
||||||
return um_futures_client.long_short_account_ratio(symbol=symbol, period=period, limit=limit)
|
return um_futures_client.long_short_account_ratio(symbol=symbol, period=period, limit=limit)
|
||||||
|
|
||||||
def get_binance_taker_longshort_ratio(symbol: str, period: str, limit: int = 50):
|
def fetch_taker_longshort_ratio_from_binance(symbol: str, period: str, limit: int = 50):
|
||||||
"""
|
"""
|
||||||
Fetch the taker long/short ratio from Binance.
|
Fetch the taker long/short ratio from Binance.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
def get_blockbeats_news(count = 10):
|
def fetch_news_from_blockbeats(count = 10):
|
||||||
url = f"https://api.theblockbeats.news/v1/open-api/open-flash?page=1&size={count}&type=push&lang=cn"
|
url = f"https://api.theblockbeats.news/v1/open-api/open-flash?page=1&size={count}&type=push&lang=cn"
|
||||||
response = requests.get(url)
|
response = requests.get(url)
|
||||||
if response.status_code == 200:
|
if response.status_code == 200:
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
import os
|
import os
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
def get_coindesk_news(tickers=[], count=10) -> list[dict[str, str]]:
|
def fetch_news_from_coindesk(tickers=[], count=10) -> list[dict[str, str]]:
|
||||||
"""
|
"""
|
||||||
Fetches the latest news from Coindesk for a given ticker.
|
Fetches the latest news from Coindesk for a given ticker.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
from typing import Annotated, Dict
|
from typing import Annotated, Dict
|
||||||
from .blockbeats_utils import get_blockbeats_news
|
from .blockbeats_utils import fetch_news_from_blockbeats
|
||||||
from .coindesk_utils import get_coindesk_news
|
from .coindesk_utils import fetch_news_from_coindesk
|
||||||
from .reddit_utils import fetch_top_from_category
|
from .reddit_utils import fetch_top_from_category
|
||||||
from .yfin_utils import *
|
from .yfin_utils import *
|
||||||
from .stockstats_utils import *
|
from .stockstats_utils import *
|
||||||
|
|
@ -29,7 +29,7 @@ def get_blockbeats_news(count: Annotated[int, "news' count, no more than 50"] =
|
||||||
if count > 50:
|
if count > 50:
|
||||||
raise ValueError("Count should not be more than 50")
|
raise ValueError("Count should not be more than 50")
|
||||||
|
|
||||||
news = get_blockbeats_news(count)
|
news = fetch_news_from_blockbeats(count)
|
||||||
|
|
||||||
if len(news) == 0:
|
if len(news) == 0:
|
||||||
return ""
|
return ""
|
||||||
|
|
@ -54,7 +54,7 @@ def get_coindesk_news(
|
||||||
Returns:
|
Returns:
|
||||||
str: A formatted string containing the latest news articles and meta information.
|
str: A formatted string containing the latest news articles and meta information.
|
||||||
"""
|
"""
|
||||||
news = get_coindesk_news(tickers, count)
|
news = fetch_news_from_coindesk(tickers, count)
|
||||||
|
|
||||||
if len(news) == 0:
|
if len(news) == 0:
|
||||||
return ""
|
return ""
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue