This is the first of a series of posts describing my experimentation with AWS AppSync, Lambda, DynamoDB and other AWS resources. I have been wanting to experiment with AWS AppSync for a while and dig into its support for Lambda-based resolvers. Another goal for this experiment was to provision everything from code using an Infrastructure as Code (IaC) approach. Most of the AppSync examples I’ve come across have done everything in the Management Console. That’s fine for experimentation, but that approach won’t cut it if you’re trying to use AppSync (and AWS) professionally. I chose to use the Serverless Framework for creating all of my resources on AWS in this experiment. Everything in the process of creating the AppSync GraphQL API and the supporting resources in AWS had to be repeatable.
What am I building here?
The domain for this experiment is a technical analysis investing API. I will be implementing several analytics that I will represent in a graphical dashboard to demonstrate the use of AWS AppSync for building and hosting GraphQL APIs. The first analytic will be a Simple Moving Average or SMA.
A simple (or arithmetic) moving average is an arithmetic moving average calculated by adding the elements in a time series and dividing this total by the number of time periods. As the name suggests, the simple moving average is the simplest type of moving average. It is arguably the most popular technical analysis tool used by traders. All elements in the SMA have the same weightage. If the moving average period is 5, then each element in the SMA will have a 20% (1/5) weightage in the SMA. The SMA is usually used to identify trend direction, but it can also be used to generate potential trading signals. The formula for calculating the SMA is straightforward:
SMA = (Sum of data points in the moving average period)/(Total number of periods)
The technology stack
- AWS AppSync for the hosted GraphQL engine
- AWS DynamoDB for the data store (used later in the series)
- AWS Lambda for resolvers
- Python 3.7 for the AWS Lambda runtime
- Serverless Framework
- Vue.js for the web application front-end
This was a brief overview of the experiment. The next post will detail the implementation of the first version of the AppSync GraphQL API. I hope you continue to follow on to part two of this journey.