def heatmap_to_twitter():
try:
now = date.today()
d = now.day
if d == 2:
api = connect()
for broker in Brokers.objects.all():
image_filename = join(settings.STATIC_ROOT, 'collector', 'images', \
'heatmap', '{0}=={1}=={2}=={3}=={4}.png'.format(broker.slug, \
'AI50', '1440', 'AI50', 'longs'))
if isfile(image_filename):
media = "https://quantrade.co.uk/static/collector/images/heatmap/{0}=={1}=={2}=={3}=={4}.png".\
format(broker.slug, 'AI50', '1440', 'AI50', 'longs')
else:
media = None
status = "Results including last month index performance for {}.".format(broker.title)
api.PostUpdate(status=status, media=media)
print(colored.green("Heatmap posted."))
except Exception as e:
print(colored.red("At heatmap_to_twitter {}".format(e)))
评论列表
文章目录