The Mastodon ecosystem is really nice. The concept of Fediverse bringing in decentralized social network is a breath of fresh air. I created NiftyBot account in botsin.space - a dedicated server for Mastodon Bots.
What is NiftyBot?
- It is a Mastodon Bot Account
What does it do?
- It posts updates about Indian Markets
- Currently it posts NSE closing report at 4.01 PM everyday. Sample post below
How does it work? —————–
It is a Python script running in AWS Lambda.
A scheduler tiggers the Lambda Function at 4.01 every Monday - Friday. The lambda function is a Python Script that fetches the necessary details from NSE’s output data and posts to Mastodon.
Source Code:
https://gist.github.com/tecoholic/ca4f9933335b34388375bceb213a5801.js
Some asked about if this bot is open source. Obviously, you see the source right here. :) Still I will add the license here.
The above source code is released into the Public Domain. You can do what ever you want with it.
How much does it cost to run this Bot?
Nothing.
Numbers Please:
The AWS Lambda Free tier comes with 1 Million requests and 400,000 GBSec, which is a combination of how much memory we use and the time taken by our process. Since I have used the CloudWatch Scheduler Event as the trigger, I am using 20-22 requests, the Python function takes about 60 MB to run so running at the lowest memory of 128MB block, and usually completes in around 2600-2700 msec. The metrics says my worst billed event so far is about 0.3375 GBSec. With about 20-22 trading days in a month, I might use a total of 8-10 GBSeconds, leaving enough room to run many more bots like this one :)