🔧 SQA::FPOP¶
Source Information
Defined in: lib/sqa/fpop.rb:28
🏭 Class Methods¶
.fpl(price, fpop: = 14)¶
Calculate Future Period Loss/Profit for each point in price series
For each price point, looks ahead fpop periods and calculates: - Minimum percentage change (worst loss) - Maximum percentage change (best gain)
Parameters
| Name | Type | Description |
|---|---|---|
price |
Array<Numeric> |
Array of prices |
fpop |
Integer |
Future Period of Performance (days to look ahead) |
Returns
Type: Array<Array<Float, Float>>
Array of [min_delta, max_delta] pairs
Usage Examples
Source Location
.fpl_analysis(price, fpop: = 14)¶
Perform comprehensive FPL analysis with risk metrics and classification
Parameters
| Name | Type | Description |
|---|---|---|
price |
Array<Numeric> |
Array of prices |
fpop |
Integer |
Future Period of Performance |
Returns
Type: Array<Hash>
Array of analysis hashes containing:
- :min_delta - Worst percentage loss during fpop
- :max_delta - Best percentage gain during fpop
- :risk - Volatility range (max - min)
- :direction - Movement classification (:UP, :DOWN, :UNCERTAIN, :FLAT)
- :magnitude - Average expected movement
- :interpretation - Human-readable summary
Usage Examples
Source Location
.determine_direction(min_delta, max_delta)¶
Determine directional bias from min/max deltas
Parameters
| Name | Type | Description |
|---|---|---|
min_delta |
Float |
Minimum percentage change |
max_delta |
Float |
Maximum percentage change |
Returns
Type: Symbol
:UP, :DOWN, :UNCERTAIN, or :FLAT
Source Location
.calculate_magnitude(min_delta, max_delta)¶
Calculate average expected movement (magnitude)
Parameters
| Name | Type | Description |
|---|---|---|
min_delta |
Float |
Minimum percentage change |
max_delta |
Float |
Maximum percentage change |
Returns
Type: Float
Average of min and max deltas
Source Location
.build_interpretation(min_delta, max_delta)¶
Build human-readable interpretation string
Parameters
| Name | Type | Description |
|---|---|---|
min_delta |
Float |
Minimum percentage change |
max_delta |
Float |
Maximum percentage change |
Returns
Type: String
Formatted interpretation
Source Location
.filter_by_quality(analysis, min_magnitude: = nil, max_risk: = nil, directions: = [:UP, :DOWN, :UNCERTAIN, :FLAT])¶
Filter FPL analysis results by criteria
Useful for finding high-quality trading opportunities
Parameters
| Name | Type | Description |
|---|---|---|
analysis |
Array<Hash> |
FPL analysis results |
min_magnitude |
Float |
Minimum average movement (default: nil) |
max_risk |
Float |
Maximum acceptable risk (default: nil) |
directions |
Array<Symbol> |
Acceptable directions (default: [:UP, :DOWN, :UNCERTAIN, :FLAT]) |
Returns
Type: Array<Integer>
Indices of points that meet criteria
Usage Examples
Source Location
.risk_reward_ratios(analysis)¶
Calculate risk-reward ratio for each analysis point
Parameters
| Name | Type | Description |
|---|---|---|
analysis |
Array<Hash> |
FPL analysis results |
Returns
Type: Array<Float>
Risk-reward ratios (magnitude / risk)