my_config = {
"MISTRAL_API_KEY": "",
}
def get_content():
return """
* U.S. President Donald Trump has signed a resolution repealing a crypto tax rule finalized during the final days of the Biden administration. The rule required custodial brokers to report user transaction data to the IRS and issue Form 1099s for non-employment income. The
* The U.S. SEC’s Division of Corporation Finance issued a statement providing guidance on the application of federal securities laws to offerings and registrations in the crypto asset markets. The statement notes that such offerings may involve equity or debt securities of issuers
* Nova Labs, the team behind Helium, has confirmed that the U.S. SEC has dismissed its claims that Nova Labs sold unregistered securities, affirming that the HNT, IOT, and MOBILE tokens distributed through the Helium Network, as well as compatible hotspot devices, do not constitute
* Grayscale has updated its “Assets Under Consideration” list, outlining digital assets currently being evaluated for potential inclusion in future investment products. These include APT, ARB, TIA, HBAR, MNT, TON, TRX, VET, AERO, BNB, ENA, HYPE, JUP, ONDO, PENDLE, PLUME, AIXBT,
* HashKey and OSL announced that they have obtained approval from the Hong Kong SFC to start providing ETH staking services. Currently, investors can obtain staking income by holding spot Ethereum ETFs, and in the future they can directly hold ETH staking to obtain income.
* ReversingLabs has reported a software supply chain attack involving a malicious npm package named pdf-to-office, which targeted locally installed crypto wallets including Atomic Wallet and Exodus. The package posed as a PDF-to-Office converter but instead injected trojanized code
* Coinbase announced it will list Wayfinder (PROMPT) on the Base network. Trading for the PROMPT-USD pair will launch in phases later today, subject to liquidity conditions. Wayfinder is a multi-agent AI system capable of executing smart contracts and performing on-chain
* According to WSJ, sources familiar with the matter revealed that Trump privately acknowledged his steep tariff plan announced last week could lead to an economic recession but aimed to avoid a depression. Trump expressed willingness to accept the "pain" caused by the policy,
* During the Kaito-Wayfinder airdrop claim, there is an MEV frontrunner: 0x80…D4e4, who is stealing users' PROMPT and swapping them for ETH, according to @0x_ultra. On-chain data shows that this MEV frontrunner has stolen and swapped a total of 120 ETH (~$190k). TokenTable, a
"""
from mistralai import Mistral
# Her we retrieve the content from one of the records stored during Step 1, this is just a placeholder function.
text = get_content()
# Here we generate the prompt for the LLM.
prompt = f"""The following text, enclosed in <text> tags, is a list of news articles with their titles and subtitles.
Your goal is to generate a summary of the main news items, in the form of a list of bullet points in Markdown format.
This list will be used by a social media manager to identify the financial market news that they should post about in order to generate engagement.
The types of news that generate engagement are those that are unexpected, surprising, or controversial, especially those that include large monetary amounts or variation percentages.
When generating the summary, merge or discard the news items that are redundant.
Sumarize the news items to focus on the facts and numbers.
Please do not include any other text than the list of bullet points.
<text>
{text}
</text>
"""
llm_client = Mistral(api_key=my_config["MISTRAL_API_KEY"])
chat_response = llm_client.chat.complete(
model="ministral-3b-latest",
messages=[
{
"role": "user",
"content": prompt,
},
],
)
summary = ""
if chat_response.choices:
summary = chat_response.choices[0].message.content
print(summary)
def get_summaries():
return """
# World economic news
- **Crypto Tax Rule Repealed**: U.S. President Donald Trump signed a resolution repealing a crypto tax rule finalized by the Biden administration, which required custodial brokers to report user transaction data to the IRS.
- **SEC Crypto Guidance**: The U.S. SEC’s Division of Corporation Finance issued guidance on the application of federal securities laws to crypto asset markets, noting that offerings may involve equity or debt securities.
- **Helium SEC Dismissal**: Nova Labs, the team behind Helium, confirmed that the U.S. SEC dismissed its claims, affirming that HNT, IOT, and MOBILE tokens, as well as compatible hotspot devices, do not constitute unregistered securities.
- **Grayscale Asset List Update**: Grayscale updated its “Assets Under Consideration” list, including APT, ARB, TIA, HBAR, MNT, TON, TRX, VET, AERO, BNB, ENA, HYPE, JUP, ONDO, PENDLE, PLUME, AIXBT, and others.
- **Hong Kong ETH Staking Approval**: HashKey and OSL obtained approval from the Hong Kong SFC to start providing ETH staking services, allowing investors to earn staking income directly.
- **Software Supply Chain Attack**: ReversingLabs reported a software supply chain attack involving a malicious npm package named pdf-to-office, which targeted locally installed crypto wallets including Atomic Wallet and Exodus.
- **Coinbase Lists Wayfinder**: Coinbase announced it will list Wayfinder (PROMPT) on the Base network, with trading for the PROMPT-USD pair launching in phases later today.
- **Trump's Tariff Plan**: WSJ reported that Trump privately acknowledged his tariff plan could lead to an economic recession but aimed to avoid a depression, expressing willingness to accept the "pain" caused by the policy.
- **MEV Frontrunner in Airdrop**: During the Kaito-Wayfinder airdrop claim, an MEV frontrunner (0x80…D4e4) stole and swapped a total of 120 ETH (~$190k) from users, according to @0x_ultra and TokenTable.
# Crypto news
- **Crypto Tax Rule Repealed**: U.S. President Donald Trump signed a resolution repealing a crypto tax rule finalized by the Biden administration, which required custodial brokers to report user transaction data to the IRS.
- **SEC Crypto Guidance**: The U.S. SEC’s Division of Corporation Finance issued guidance on the application of federal securities laws to crypto asset markets, noting that offerings may involve equity or debt securities.
- **Helium SEC Dismissal**: The U.S. SEC dismissed Nova Labs' claims that it sold unregistered securities, affirming that HNT, IOT, and MOBILE tokens, as well as compatible hotspot devices, do not constitute securities.
- **Grayscale Asset List Update**: Grayscale updated its "Assets Under Consideration" list, including APT, ARB, TIA, HBAR, MNT, TON, TRX, VET, AERO, BNB, ENA, HYPE, JUP, ONDO, PENDLE, PLUME, AIXBT, and others.
- **Hong Kong ETH Staking Approval**: HashKey and OSL obtained approval from the Hong Kong SFC to start providing ETH staking services, allowing investors to earn staking income directly from holding ETH.
- **Software Supply Chain Attack**: ReversingLabs reported a software supply chain attack involving a malicious npm package named pdf-to-office, which targeted locally installed crypto wallets including Atomic Wallet and Exodus.
- **Coinbase Lists Wayfinder**: Coinbase announced it will list Wayfinder (PROMPT) on the Base network, with trading for the PROMPT-USD pair launching in phases later today.
- **Trump's Tariff Plan**: According to WSJ, Trump privately acknowledged his tariff plan could lead to an economic recession but aimed to avoid a depression, expressing willingness to accept the "pain" caused by the policy.
- **MEV Frontrunner in Airdrop**: During the Kaito-Wayfinder airdrop claim, an MEV frontrunner (0x80…D4e4) stole and swapped a total of 120 ETH (~$190k) from users' PROMPT tokens.
"""
def get_examples():
return """
* The time for mainstream cryptocurrency adoption is now
* In times of high market volatility, don't try to time the market
* Five strategic imperatives for businesses in times of economic uncertainty
* AI technology is primed to transform business and societey
* Are we in a financial bubble?
* Have we reached the market bottom?
* Is Bitcoin the new gold?
"""
from mistralai import Mistral
# Her we retrieve the content from the records stored during Step 2.
text = get_summaries()
examples = get_examples()
# Here we generate the prompt for the LLM.
prompt = f"""The following text, enclosed in <news> tags, is a list of news items.
As a social media manager, your goal it to generate a list of blog post titles, together with the relevant facts and figures that you can use to populate these blog posts.
The types of news that generate engagement are those that are unexpected, surprising, or controversial, especially those that include large monetary amounts or variation percentages.
You will provide your response in Markdown format, where the main bullet points are the blog post titles, and the sub-bullet points are the relevant facts and figures that you can use to populate these blog posts.
For your reference, I am providing you with examples of blog post titles that have been effective in the past, enclosed in <examples> tags.
Note that the blog post titles must not be narrow news titles. As you can see in the examples, they must be broader and engage the reader by suggesting that broader trends are at play.
However, make sure that the sub bullet points are specific and include the relevant facts and figures gathered from the news items.
Bullet points must start with a star character.
Sub bullet points must be indented with 4 spaces followed by a * character.
Please do not include any other text in your response, other than the list of bullet points.
<news >
{text}
</news>
<examples>
{examples}
</examples>
"""
llm_client = Mistral(api_key=my_config["MISTRAL_API_KEY"])
chat_response = llm_client.chat.complete(
model="mistral-large-latest",
messages=[
{
"role": "user",
"content": prompt,
},
],
)
recommendations = ""
if chat_response.choices:
recommendations = chat_response.choices[0].message.content
print(recommendations)