This project was created to calculate fibonacci retracement and extension numbers on cryptocurrencies for trading purposes. My Email List project accepts an email address and a name as input into an HTML form on a static S3 website and inserts them into a DynamoDB table using a lambda function; this takes that project a few steps further. I had to learn how to interact with API’s, how to process the results of an API call that comes in the form of an array of arrays, how to define API endpoints as new AWS services in Lambda, and the conversion of Unix epoch to human-readable time and vice versa.

The new project interacts with CoinGecko.com’s API to obtain a list of all prices that occurred for a given cryptocurrency between two specified dates (or the defaults) and optionally times. After receiving this list of prices, the code sorts the prices list highest to lowest, creates stats (list length, max price, min price, and the timestamps of both max and min prices) from the sorted list, reduces the list to only prices that chronologically include and come after the timestamp of the higest price, creates stats from the new reduced list, and then finally calculates the fibonacci numbers.

As an added bonus mostly for myself, I created a DynamoDB table to keep a record of all results obtained using default search dates (at the time of this blog post: Friday, January 1, 2016 12:00:00 AM GMT to Friday, May 1, 2020 12:00:00 AM GMT) and VS currency (USD). After calculating a set of fibonacci numbers, the code does a check for default values on times/dates and vs currency variables and, if all are defaults, checks for an existing DynamoDB entry. If there is no entry for that coin, it’s added to the database. This increases data retrieval speed for searches that have already been done before, as well as keeps a database of results for my own use.

As the final step, the code sends the resulting fibonacci numbers and stats back to the original HTML request. The static S3 webpage updates a table with the information, doing a little bit of additional math to add percentages to the information.