Creating main service business logic
Equity Management Service
In this video, we focus on creating and implementing the business logic for an equity management service. This involves setting up event types and handling specific business events like capitalizations, share releases, share splits, and share purchases.
Steps & Implementation
1. Creating the Service
We will create a service named Equity Management
. This service will handle the core business events and logic for managing equity.
2. Defining Events
Inside the EquityManagement.ts
, we will define four main events that will be used in our equity management system.
Capitalization Event
Share Release Event
Share Split Event
Share Purchase Event
3. Defining Types
For better clarity and understanding, we define several types that will be used throughout our service.
Event Payload
This is a generic type that includes an ID and data field for all events.
Event Types
These are the specific event types we will handle in our service.
Payloads
Specific payloads sent from any event provider or even internally within our express routes.
Combined Payload Type
A generic type that consists of all our payloads.
Business Logic for Capitalization Event
To handle the capitalization event, we need to ensure that we have the necessary information like the company ID and the capitalization payload.