Account Model
TheAccount model represents trading accounts with comprehensive tracking of prop firm challenges, performance metrics, and payment settings.
Schema Fields
Unique identifier for the account
- Constraint: Primary key, unique
- Default: Auto-generated UUID
Account number identifier
- Unique Constraint: Combination of
numberanduserIdmust be unique - Indexed: Yes (performance optimization)
Name of the proprietary trading firm
- Default: Empty string
- Examples: “TopstepTrader”, “Earn2Trade”
Maximum allowed drawdown for the account
- Default: 0
- Typically a percentage or absolute value
Profit target required to pass evaluation or get payout
- Default: 0
Indicates if this is a performance/funded account
- Default: false
truefor funded accounts,falsefor evaluation
ID of the user who owns this account
- Foreign Key: References
User.idwith cascade delete
Timestamp when the account was created
- Default: Current timestamp
Initial balance of the account
- Default: 0
Number of payouts received from this account
- Default: 0
- Automatically incremented
Whether the account uses trailing drawdown rules
- Default: false
Profit level at which trailing stop is activated
- Optional field
Date when the account was last reset
- Used for tracking evaluation resets
Required consistency percentage for payouts
- Default: 30
- Typically ranges from 20-40%
ID of the group this account belongs to
- Foreign Key: References
Group.id - Indexed: Yes
Size/tier of the account
- Examples: “50K”, “100K”, “200K”
Display name for the account size
Fees required to activate the account
Minimum balance required to maintain the account
Maximum daily loss limit
Whether this account is in evaluation phase
- Default: true
Recursive evaluation settings
Maximum number of funded accounts allowed
Maximum payout amount allowed
Minimum number of days required before payout
Minimum payout amount
Minimum trading days required for payout eligibility
Bonus percentage added to payouts
Description of the payout policy
Price of the account/challenge
Promotional price for the account
Profit sharing percentage with the firm
- Typically 70-90%
Description of daily loss rules
Whether trading during news events is allowed
- Default: true
Trailing drawdown configuration
Whether auto-renewal is enabled
- Default: false
Date of the next scheduled payment
- Indexed: Yes
Frequency of payments
- Enum Values: MONTHLY, QUARTERLY, BIANNUAL, ANNUAL, CUSTOM
Promotional discount percentage
Type of promotion applied
- Enum Values: DIRECT, PERCENTAGE
Number of days notice before renewal
Minimum P&L required for a day to count as a trading day
Buffer amount for drawdown calculations
- Default: 0
Whether to include buffer in calculations
- Default: true
Whether to consider trades before account reset
- Default: true
Indexes
number- Fast lookup by account numbergroupId- Efficient filtering by groupnextPaymentDate- Query optimization for payment processing
Relationships
The user who owns this account
- Foreign Key:
userId→User.id - Delete Behavior: Cascade (account deleted when user is deleted)
The group this account belongs to
- Foreign Key:
groupId→Group.id
All payouts associated with this account
- One-to-Many: One account can have multiple payouts
Unique Constraints
- Combination of
numberanduserIdmust be unique (prevents duplicate accounts per user)
Group Model
TheGroup model allows users to organize multiple accounts into logical groups for easier management.
Schema Fields
Unique identifier for the group
- Constraint: Primary key
- Default: Auto-generated UUID
Name of the group
- Unique Constraint: Combination of
nameanduserIdmust be unique
ID of the user who owns this group
- Foreign Key: References
User.idwith cascade delete - Indexed: Yes
Timestamp when the group was created
- Default: Current timestamp
Timestamp when the group was last updated
- Auto-updated: Updates automatically on modification
Indexes
userId- Fast lookup of groups by user
Relationships
The user who owns this group
- Foreign Key:
userId→User.id - Delete Behavior: Cascade
All accounts in this group
- One-to-Many: One group can contain multiple accounts
Unique Constraints
- Combination of
nameanduserIdmust be unique (prevents duplicate group names per user)
Payout Model
ThePayout model tracks payout requests and their status for trading accounts.
Schema Fields
Unique identifier for the payout
- Constraint: Primary key
- Default: Auto-generated UUID
Payout amount
Date of the payout
Timestamp when the payout was created
- Default: Current timestamp
Current status of the payout
- Default: “PENDING”
- Common values: “PENDING”, “APPROVED”, “COMPLETED”, “REJECTED”
Account number associated with this payout
- Indexed: Yes
ID of the account this payout belongs to
- Foreign Key: References
Account.idwith cascade delete
Indexes
accountNumber- Fast lookup of payouts by account
Relationships
The account this payout belongs to
- Foreign Key:
accountId→Account.id - Delete Behavior: Cascade
Enums
PaymentFrequency
Defines how often payments are made:MONTHLY- Monthly paymentsQUARTERLY- Every 3 monthsBIANNUAL- Twice per yearANNUAL- Once per yearCUSTOM- Custom frequency
PromoType
Defines the type of promotional discount:DIRECT- Direct price reductionPERCENTAGE- Percentage-based discount