- MarketAPIs to include BinanceWrapper
- update RedditWrapper & tests
This commit is contained in:
2025-10-01 14:53:00 +02:00
parent 2aa97e264a
commit 6ebd58bdb7
4 changed files with 21 additions and 7 deletions

View File

@@ -18,7 +18,7 @@ class MarketAPIs(BaseWrapper):
def __init__(self, currency: str = "USD"):
self.currency = currency
wrappers = [ CoinBaseWrapper, CryptoCompareWrapper ]
wrappers = [ BinanceWrapper, CoinBaseWrapper, CryptoCompareWrapper ]
self.wrappers: WrapperHandler[BaseWrapper] = WrapperHandler.build_wrappers(wrappers)
def get_product(self, asset_id):

View File

@@ -21,7 +21,8 @@ class AppModels(Enum):
GEMINI_PRO = "gemini-2.0-pro" # API online, più costoso ma migliore
OLLAMA_GPT = "gpt-oss:latest" # + good - slow (13b)
OLLAMA_QWEN = "qwen3:latest" # + good + fast (8b)
OLLAMA_QWEN_4B = "qwen3:4b" # + fast - decent (4b)
OLLAMA_QWEN_4B = "qwen3:4b" # + fast + decent (4b)
OLLAMA_QWEN_1B = "qwen3:1.7b" # + very fast + decent (1.7b)
@staticmethod
def availables_local() -> list['AppModels']:

View File

@@ -4,6 +4,21 @@ from praw.models import Submission, MoreComments
from .base import SocialWrapper, SocialPost, SocialComment
MAX_COMMENTS = 5
# TODO mettere piu' subreddit?
# scelti da https://lkiconsulting.io/marketing/best-crypto-subreddits/
SUBREDDITS = [
"CryptoCurrency",
"Bitcoin",
"Ethereum",
"CryptoMarkets",
"Dogecoin",
"Altcoin",
"DeFi",
"NFT",
"BitcoinBeginners",
"CryptoTechnology",
"btc" # alt subs of Bitcoin
]
def create_social_post(post: Submission) -> SocialPost:
@@ -46,9 +61,8 @@ class RedditWrapper(SocialWrapper):
client_secret=client_secret,
user_agent="upo-appAI",
)
self.subreddits = self.tool.subreddit("+".join(SUBREDDITS))
def get_top_crypto_posts(self, limit: int = 5) -> list[SocialPost]:
subreddit = self.tool.subreddit("CryptoCurrency")
top_posts = subreddit.top(limit=limit, time_filter="week")
top_posts = self.subreddits.top(limit=limit, time_filter="week")
return [create_social_post(post) for post in top_posts]

View File

@@ -7,8 +7,7 @@ from app.social.reddit import MAX_COMMENTS, RedditWrapper
class TestRedditWrapper:
def test_initialization(self):
wrapper = RedditWrapper()
assert wrapper.client_id is not None
assert wrapper.client_secret is not None
assert wrapper is not None
assert isinstance(wrapper.tool, Reddit)
def test_get_top_crypto_posts(self):