Namespaces
Namespaces are used to group common functionality in the Balsam code libraries. To begin working with the Backtester, import the Balsam namespace. Most common workflows will require the following namespaces:
using Balsam;using Balsam.DataServers;using Balsam.MoneyManagement;using Balsam.Optimization;Code examples in this documentation may omit the using statements for brevity. Many code editors, including Visual Studio, will offer to import missing namespaces when class names aren’t recognized.
Key namespaces
Section titled “Key namespaces”-
Balsam
The primary namespace, containing foundational data classes like
TimeSeries,BarSeries, andInstrument. This is also the home ofStrategy, the base class for all trading strategies. -
Balsam.DataServers
Includes built-in data servers
AsciiBarServerfor accessing text files,CsiBarServerfor accessing backadjusted continuous contracts exported from CSI’s Unfair Advantage software, andBinaryBarServerfor accessing data stored in a fast, binary format. -
Balsam.MoneyManagement
Contains Money managers responsible for position sizing and generating backtest reports.
FixedFractionalimplements a methodology commonly used by futures trades for risk-based position sizing.FullyInvestedtargets a 100% notional position. -
Balsam.Optimization
Contains classes for automated testing of different parameter sets.
Optimizeris commonly used to perform a brute-force search across the entire parameter space.WalkForwardOptimizerconducts walk-forward optimizations over moving windows of data.
Other namespaces
Section titled “Other namespaces”-
Balsam.TransactionCosts
Contains classes implementing
TransactionCostModelfor modeling slippage and transaction costs. -
Balsam.Compression
Contains classes for compressing or converting data to different timeframes.
-
Balsam.Data
Contains the
DataStoreclass, an in-memory database used to pass trade information between strategies and money managers.