Fixes
- MarketAPIs to include BinanceWrapper - update RedditWrapper & tests
This commit is contained in:
@@ -18,7 +18,7 @@ class MarketAPIs(BaseWrapper):
|
|||||||
|
|
||||||
def __init__(self, currency: str = "USD"):
|
def __init__(self, currency: str = "USD"):
|
||||||
self.currency = currency
|
self.currency = currency
|
||||||
wrappers = [ CoinBaseWrapper, CryptoCompareWrapper ]
|
wrappers = [ BinanceWrapper, CoinBaseWrapper, CryptoCompareWrapper ]
|
||||||
self.wrappers: WrapperHandler[BaseWrapper] = WrapperHandler.build_wrappers(wrappers)
|
self.wrappers: WrapperHandler[BaseWrapper] = WrapperHandler.build_wrappers(wrappers)
|
||||||
|
|
||||||
def get_product(self, asset_id):
|
def get_product(self, asset_id):
|
||||||
|
|||||||
@@ -21,7 +21,8 @@ class AppModels(Enum):
|
|||||||
GEMINI_PRO = "gemini-2.0-pro" # API online, più costoso ma migliore
|
GEMINI_PRO = "gemini-2.0-pro" # API online, più costoso ma migliore
|
||||||
OLLAMA_GPT = "gpt-oss:latest" # + good - slow (13b)
|
OLLAMA_GPT = "gpt-oss:latest" # + good - slow (13b)
|
||||||
OLLAMA_QWEN = "qwen3:latest" # + good + fast (8b)
|
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
|
@staticmethod
|
||||||
def availables_local() -> list['AppModels']:
|
def availables_local() -> list['AppModels']:
|
||||||
|
|||||||
@@ -4,6 +4,21 @@ from praw.models import Submission, MoreComments
|
|||||||
from .base import SocialWrapper, SocialPost, SocialComment
|
from .base import SocialWrapper, SocialPost, SocialComment
|
||||||
|
|
||||||
MAX_COMMENTS = 5
|
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:
|
def create_social_post(post: Submission) -> SocialPost:
|
||||||
@@ -46,9 +61,8 @@ class RedditWrapper(SocialWrapper):
|
|||||||
client_secret=client_secret,
|
client_secret=client_secret,
|
||||||
user_agent="upo-appAI",
|
user_agent="upo-appAI",
|
||||||
)
|
)
|
||||||
|
self.subreddits = self.tool.subreddit("+".join(SUBREDDITS))
|
||||||
|
|
||||||
def get_top_crypto_posts(self, limit: int = 5) -> list[SocialPost]:
|
def get_top_crypto_posts(self, limit: int = 5) -> list[SocialPost]:
|
||||||
subreddit = self.tool.subreddit("CryptoCurrency")
|
top_posts = self.subreddits.top(limit=limit, time_filter="week")
|
||||||
top_posts = subreddit.top(limit=limit, time_filter="week")
|
|
||||||
return [create_social_post(post) for post in top_posts]
|
return [create_social_post(post) for post in top_posts]
|
||||||
|
|
||||||
|
|||||||
@@ -7,8 +7,7 @@ from app.social.reddit import MAX_COMMENTS, RedditWrapper
|
|||||||
class TestRedditWrapper:
|
class TestRedditWrapper:
|
||||||
def test_initialization(self):
|
def test_initialization(self):
|
||||||
wrapper = RedditWrapper()
|
wrapper = RedditWrapper()
|
||||||
assert wrapper.client_id is not None
|
assert wrapper is not None
|
||||||
assert wrapper.client_secret is not None
|
|
||||||
assert isinstance(wrapper.tool, Reddit)
|
assert isinstance(wrapper.tool, Reddit)
|
||||||
|
|
||||||
def test_get_top_crypto_posts(self):
|
def test_get_top_crypto_posts(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user