Volume Calculation Corrections

Understanding the correct architecture for pseudo positions and volume calculations

Download Full Documentation
Incorrect Approach (Old)
Volume calculated at Base/Main/Real levels
// ❌ WRONG
const basePosition = {
  volume: calculateVolume(
    baseVolumeFactor
  ),
  entryPrice: 50000,
  quantity: volume / entryPrice
}

This approach incorrectly calculates volume before reaching the Exchange level, coupling strategy logic with account balance.

Correct Approach (New)
Volume only at Exchange level
// ✅ CORRECT
const basePseudoPosition = {
  positionCost: 0.1, // 10%
  ratio: 1.0,
  entryPrice: 50000
  // NO volume field
}

// Later at Exchange:
const volume = calculate(
  positionCost,
  accountBalance
)

This approach keeps pseudo positions independent of account balance, calculating volume only when executing on the exchange.

Key Principles

Pseudo Positions Use Ratios

Base/Main/Real levels work with position cost ratios (0.01-1.0) representing percentages

Volume Only at Exchange

Actual volume calculation happens exclusively when executing orders on exchanges

Strategies Use Factors

Block and DCA strategies adjust ratios and factors, not volumes

Account Size Independent

Pseudo positions work the same regardless of account balance

Implementation Checklist
Ensure your code follows these principles
Base pseudo positions use positionCost (ratio) only
Main filtering uses step counts, not volume
Real validation checks affordability via ratios
Volume calculated ONLY at Exchange level
Block strategy adjusts ratios, not volumes
DCA strategy adjusts factors, not volumes
No account balance references before Exchange
No quantity calculations before Exchange
Position cost always in ratio format (0.01-1.0)
Exchange level converts ratios to actual volumes