Skip to main content

Account Model

The Account model represents trading accounts with comprehensive tracking of prop firm challenges, performance metrics, and payment settings.

Schema Fields

id
String
required
Unique identifier for the account
  • Constraint: Primary key, unique
  • Default: Auto-generated UUID
number
String
required
Account number identifier
  • Unique Constraint: Combination of number and userId must be unique
  • Indexed: Yes (performance optimization)
propfirm
String
required
Name of the proprietary trading firm
  • Default: Empty string
  • Examples: “TopstepTrader”, “Earn2Trade”
drawdownThreshold
Float
required
Maximum allowed drawdown for the account
  • Default: 0
  • Typically a percentage or absolute value
profitTarget
Float
required
Profit target required to pass evaluation or get payout
  • Default: 0
isPerformance
Boolean
required
Indicates if this is a performance/funded account
  • Default: false
  • true for funded accounts, false for evaluation
userId
String
required
ID of the user who owns this account
  • Foreign Key: References User.id with cascade delete
createdAt
DateTime
required
Timestamp when the account was created
  • Default: Current timestamp
startingBalance
Float
required
Initial balance of the account
  • Default: 0
payoutCount
Int
required
Number of payouts received from this account
  • Default: 0
  • Automatically incremented
trailingDrawdown
Boolean
required
Whether the account uses trailing drawdown rules
  • Default: false
trailingStopProfit
Float
Profit level at which trailing stop is activated
  • Optional field
resetDate
DateTime
Date when the account was last reset
  • Used for tracking evaluation resets
consistencyPercentage
Float
Required consistency percentage for payouts
  • Default: 30
  • Typically ranges from 20-40%
groupId
String
ID of the group this account belongs to
  • Foreign Key: References Group.id
  • Indexed: Yes
accountSize
String
Size/tier of the account
  • Examples: “50K”, “100K”, “200K”
accountSizeName
String
Display name for the account size
activationFees
Float
Fees required to activate the account
balanceRequired
Float
Minimum balance required to maintain the account
dailyLoss
Float
Maximum daily loss limit
evaluation
Boolean
required
Whether this account is in evaluation phase
  • Default: true
isRecursively
String
Recursive evaluation settings
maxFundedAccounts
Int
Maximum number of funded accounts allowed
maxPayout
String
Maximum payout amount allowed
minDays
Int
Minimum number of days required before payout
minPayout
Float
Minimum payout amount
minTradingDaysForPayout
Int
Minimum trading days required for payout eligibility
payoutBonus
Float
Bonus percentage added to payouts
payoutPolicy
String
Description of the payout policy
price
Float
Price of the account/challenge
priceWithPromo
Float
Promotional price for the account
profitSharing
Float
Profit sharing percentage with the firm
  • Typically 70-90%
rulesDailyLoss
String
Description of daily loss rules
tradingNewsAllowed
Boolean
required
Whether trading during news events is allowed
  • Default: true
trailing
String
Trailing drawdown configuration
autoRenewal
Boolean
required
Whether auto-renewal is enabled
  • Default: false
nextPaymentDate
DateTime
Date of the next scheduled payment
  • Indexed: Yes
paymentFrequency
PaymentFrequency
Frequency of payments
  • Enum Values: MONTHLY, QUARTERLY, BIANNUAL, ANNUAL, CUSTOM
promoPercentage
Float
Promotional discount percentage
promoType
PromoType
Type of promotion applied
  • Enum Values: DIRECT, PERCENTAGE
renewalNotice
Int
Number of days notice before renewal
minPnlToCountAsDay
Float
Minimum P&L required for a day to count as a trading day
buffer
Float
required
Buffer amount for drawdown calculations
  • Default: 0
considerBuffer
Boolean
required
Whether to include buffer in calculations
  • Default: true
shouldConsiderTradesBeforeReset
Boolean
required
Whether to consider trades before account reset
  • Default: true

Indexes

  • number - Fast lookup by account number
  • groupId - Efficient filtering by group
  • nextPaymentDate - Query optimization for payment processing

Relationships

user
User
required
The user who owns this account
  • Foreign Key: userIdUser.id
  • Delete Behavior: Cascade (account deleted when user is deleted)
group
Group
The group this account belongs to
  • Foreign Key: groupIdGroup.id
payouts
Payout[]
All payouts associated with this account
  • One-to-Many: One account can have multiple payouts

Unique Constraints

  • Combination of number and userId must be unique (prevents duplicate accounts per user)

Group Model

The Group model allows users to organize multiple accounts into logical groups for easier management.

Schema Fields

id
String
required
Unique identifier for the group
  • Constraint: Primary key
  • Default: Auto-generated UUID
name
String
required
Name of the group
  • Unique Constraint: Combination of name and userId must be unique
userId
String
required
ID of the user who owns this group
  • Foreign Key: References User.id with cascade delete
  • Indexed: Yes
createdAt
DateTime
required
Timestamp when the group was created
  • Default: Current timestamp
updatedAt
DateTime
required
Timestamp when the group was last updated
  • Auto-updated: Updates automatically on modification

Indexes

  • userId - Fast lookup of groups by user

Relationships

user
User
required
The user who owns this group
  • Foreign Key: userIdUser.id
  • Delete Behavior: Cascade
accounts
Account[]
All accounts in this group
  • One-to-Many: One group can contain multiple accounts

Unique Constraints

  • Combination of name and userId must be unique (prevents duplicate group names per user)

Payout Model

The Payout model tracks payout requests and their status for trading accounts.

Schema Fields

id
String
required
Unique identifier for the payout
  • Constraint: Primary key
  • Default: Auto-generated UUID
amount
Float
required
Payout amount
date
DateTime
required
Date of the payout
createdAt
DateTime
required
Timestamp when the payout was created
  • Default: Current timestamp
status
String
required
Current status of the payout
  • Default: “PENDING”
  • Common values: “PENDING”, “APPROVED”, “COMPLETED”, “REJECTED”
accountNumber
String
required
Account number associated with this payout
  • Indexed: Yes
accountId
String
required
ID of the account this payout belongs to
  • Foreign Key: References Account.id with cascade delete

Indexes

  • accountNumber - Fast lookup of payouts by account

Relationships

account
Account
required
The account this payout belongs to
  • Foreign Key: accountIdAccount.id
  • Delete Behavior: Cascade

Enums

PaymentFrequency

Defines how often payments are made:
  • MONTHLY - Monthly payments
  • QUARTERLY - Every 3 months
  • BIANNUAL - Twice per year
  • ANNUAL - Once per year
  • CUSTOM - Custom frequency

PromoType

Defines the type of promotional discount:
  • DIRECT - Direct price reduction
  • PERCENTAGE - Percentage-based discount

Build docs developers (and LLMs) love