Skip to content

Latest commit

 

History

History
69 lines (45 loc) · 2.07 KB

Twitter_Post_text_and_image.md

File metadata and controls

69 lines (45 loc) · 2.07 KB



Template request | Bug report | Generate Data Product

Tags: #twitter #ifttt #naas_drivers #snippet #content

Author: Jeremy Ravenel

Description: This notebook allows users to post text and images to their Twitter account.

Input

Import libraries

import naas
import naas_drivers

Model

Get data from yahoofinance

data = naas_drivers.yahoofinance.get("^FCHI", date_from=-200, moving_averages=[50, 20])
chart = naas_drivers.plotly.stock(data)
chart.show()
name = "chart.png"
naas_drivers.plotly.export(chart, name)
url = naas.assets.add(name, params={"inline": True})

Let's write the post

twitter_post = """📈🚀 Every day at 9AM PST / 6PM CET<br>
CAC40 index value with #MovingAverages 20 and 50
<br>
Don't miss an #opportunity to #invest<br>
<br>
PS : this post has been generated automatically with https://www.naas.ai/ 😎 
#automation #trading #data #analysis @Nasdaq
"""
event = "twitter-post"
key = "ke4AigvXI5-EABaowdLt4fju1aOUxeMxSXQoN8FVyA"
data = {"value1": twitter_post, "value2": url}

Output

Post data

result = naas_drivers.ifttt.webhook(event, key, data)