Uncovering the problem
One of the great aspects of having a day job is that you come across more problems than you have time to solve. I file away interesting ones that don’t fit at work as ideas for potential future development or side projects.
One of the things we do in the normal course of business is notify custodians, brokers, and counterparties about trades executed during the day. The notification requires trade details and a settlement date.
Settlement date differs by security type and for our purposes is T+1 or T+2. As long as there isn’t a holiday the calcuation is simple because it’s just the next or next, next business day. However, Bank and Market holidays push back the settlement date.
We have a few different data providers. Some provide Market Holidays, but they don’t include Bank Holidays and none of them provide a true T+1, T+2 settlement for a given date.
The problem of calculating T+1 and T+2 is simple, but it requires knowledge of both Bank and Market holidays. We can easily store those dates in a database and calculate it, but it’s also a great candidate to build a simple api.
What We’re Building and Using to Build It
I want to keep the initial scope of this project simple so I want to create two primary endpoints:
- The first will be a meta endpoint that returns information about the dates that are available
- The second will return the T+1 and T+2 settlement dates for a given trading day
Because the project is so simple I’m going to use FastAPI, which I’ve used on a few occassions and really enjoy working with. I’m planning to deploy the API on Digital Ocean, but that might change by the time I finish building it. I’ve been wanting to deploy something on AWS for a while and this project is a good excuse to give it a try.
When I push the API out into the world I want it to have a few basic pages:
- A home page or landing page with general information about what’s available
- An about page
- Authentication pages to create an account, login, and a dashboard with usage stats
- The docs page with information about the two endpoints (this is easy with FastAPI)
I’m planning to use FastAPI for the full site and will use it for both the endpoints and site itself.
In the next post we’ll start the process of setting up the project and getting the authentication working. I know from experience that it’s pretty easy to set up the endpoints, but I’ve never used FastAPI for user management and authentication.