Repository navigation
Modern Finance SummarizeReturns
Paul Squires edited this page Oct 19, 2026
·
4 revisions
Home › Finance › Finance › SummarizeReturns
Returns total and yearly return, volatility, Sharpe, Sortino and drawdown in one call.
SummarizeReturns( periodReturns( ), riskFreePerPeriod, frequency )#import "std/money"
using money
'' Every headline figure in one call. It is a CONVENIENCE, not a second
'' implementation -- each field equals its own standalone function.
dim as float64 r( 0 to 11 ) = { 0.02, -0.01, 0.03, 0.015, -0.025, 0.04, _
0.01, -0.005, 0.02, 0.03, -0.015, 0.025 }
dim as float64 b( 0 to 11 ) = { 0.018, -0.012, 0.025, 0.012, -0.02, 0.035, _
0.008, -0.004, 0.018, 0.028, -0.012, 0.022 }
var s = SummarizeReturns( r( ), 0.0002, RETURN_MONTHLY )
print s.Value( ).Observations_ '' 12
print s.Value( ).Total_ '' 0.1410864155548182
print s.Value( ).Volatility_ '' 0.07088723439378913
print s.Value( ).Sharpe_ '' 1.870576573257002
print s.Value( ).MaxDrawdown_ '' 0.02500000000000009
'' The same number, from the standalone function.
print TimeWeightedReturn( r( ) ).Value( ) '' 0.1410864155548182Library: Finance
Category: Finance
Documented under: Nothing Becomes A Keyword
Source: pkg/std/money/finport.tiko in the tiko repository.
tiko-lang · Home · Feature Index · Keyword Index · License
FreeBASIC manual pages reproduced under the GNU FDL 1.3.
- Generics
- Interfaces
- For Each
- Iterators
- Tuples
- Array Results
- Defer
- Lambdas
- Block Strings
- String Slices
- Embed
- Typed Variadics
- C Header Import
- Foreign Library Linking
- UString
- Fixed-Width Types
- Nullptr
- String Library
- Format
- Array
- Map
- Set
- LinkedList
- OrderedMap
- OrderedSet
- Sorting
- Optional
- Result
- Smart Pointers
- Date and Time (Chrono)
- Filesystem
- File Streams
- Config (INI and TOML)
- Codec
- Hash
- UUID
- OS
- Process
- Net
- HTTP and TLS
- Math Library
- Finance
- Logging
- Terminal TUI Library
- PsControls
- tkControls
- sys/win
- Goroutines and Channels
- LLVM Backend
- tiko build
- TIKO_COMPILER
- Variable Declarations
- Standard Data Types
- User Defined Types
- Procedures
- Operators
- Control Flow Statements
- Converting Data Types
- Array Functions
- String Functions
- Mathematical Functions
- Bit Manipulation
- Date and Time Functions
- File I/O Functions
- Console Functions
- User Input (Runtime Library)
- User Input Functions (Graphics Library)
- Screen Functions
- 2D Drawing Functions
- Graphics Library Reference
- Graphics Keyword List
- Memory Functions
- Threading Support Functions
- Error Handling Functions
- Operating System Functions
- Preprocessor
- Intrinsic Defines
- Miscellaneous Keywords
- Modularizing