Post text and image
Tags: #twitter #ifttt #naas_drivers #snippet
Author: Jeremy Ravenel

Input

Import libraries

1
import naas
2
import naas_drivers
Copied!

Model

Get data from yahoofinance

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

Let's write the post

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

Output

Post data

1
result = naas_drivers.ifttt.webhook(event, key, data)
Copied!
Last modified 2mo ago
Copy link
Edit on GitHub