Contents Menu Expand Light mode Dark mode Auto light/dark mode
Trading Strategy documentation

Table of contents

  • Getting started
  • Overview
    • About Trading Strategy
    • Supported markets and venues
    • Accessing market data
    • Tooling
    • Oracles
    • Wrapped tokens
  • Developing strategies
    • Code examples
      • Running the examples
      • Getting started coding tutorial
      • Charts and diagrams
      • Interactive charts
      • Technical analysis
      • Exploring trading pairs
      • Liquidity analysis
      • Price impact estimation
      • Query pool liquidity on a decentralised exchange
      • Dataset download
    • Market data
      • Market data client
      • Tracked trading pairs and tokens
      • US dollar price conversion
      • Internal ids
      • Token tax and deflationary tokens
    • Strategy examples
      • EMA crossover strategy
      • EMA cross over strategy with stop loss
      • Synthetic data backtesting example
      • Synthetic data w/stop loss backtesting example
      • Osmosis ATOM-OSMO mean reversion strategy
      • Backtest template
    • API documentation
      • Market data client
        • client
          • Client
        • chain
          • ChainId
        • exchange
          • Exchange
          • ExchangeType
          • ExchangeUniverse
        • pair
          • DEXPair
          • LegacyPairUniverse
          • PandasPairUniverse
          • StablecoinFilteringMode
          • filter_for_exchanges
          • filter_for_quote_tokens
          • filter_for_stablecoins
          • resolve_pairs_based_on_ticker
        • candle
          • Candle
          • CandleResult
          • GroupedCandleUniverse
          • is_candle_green
          • is_candle_red
        • liquidity
          • GroupedLiquidityUniverse
          • LiquidityResult
          • XYLiquidity
        • timebucket
          • TimeBucket
        • reader
          • read_parquet
        • priceimpact
          • HistoricalXYPriceImpactCalculator
          • LiquiditySampleMeasure
          • PriceImpact
          • estimate_xyk_price_impact
        • stablecoin
          • is_stablecoin_like
        • types
          • BasisPoint
          • BlockNumber
          • NonChecksummedAddress
          • PrimaryKey
          • TradingStrategyType
          • UNIXTimestamp
          • USDollarAmount
        • portfolioanalyzer
          • AssetSnapshot
          • PortfolioAnalyzer
          • PortfolioSnapshot
          • expand_snapshot_to_row
          • expand_timeline
        • profitdistribution
          • plot_trade_profit_distribution
        • tradeanalyzer
          • AssetTradeHistory
          • SpotTrade
          • TradeAnalyzer
          • TradePosition
          • TradeSummary
          • expand_timeline
        • tradehint
          • TradeHint
          • TradeHintType
      • Trade execution engine
        • state
          • blockhain_transaction
            • BlockchainTransaction
          • freeze
            • freeze_position_on_failed_trade
          • identifier
            • AssetIdentifier
            • TradingPairIdentifier
          • metadata
            • Metadata
          • portfolio
            • Portfolio
          • position
            • PositionType
            • TradingPosition
          • reserve
            • ReservePosition
          • revaluation
            • RevalueEvent
          • state
            • State
          • statistics
            • FinalPositionStatistics
            • PortfolioStatistics
            • PositionStatistics
            • Statistics
          • store
            • JSONFileStore
            • NoneStore
            • StateStore
            • StateStoreModel
          • sync
            • apply_sync_events
          • trade
            • TradeExecution
            • TradeStatus
            • TradeType
          • types
            • NaiveDatetime
            • USDollarAmount
          • validator
            • validate_nested_state_dict
            • validate_state_serialisation
            • validate_state_value
            • walk
          • visualisation
            • Plot
            • PlotKind
            • Visualisation
        • strategy
          • approval
            • ApprovalModel
            • ApprovalType
            • UncheckedApprovalModel
          • bootstrap
            • bootstrap_strategy
            • import_strategy_file
            • make_factory_from_strategy_mod
          • cycle
            • CycleDuration
            • round_datetime_down
            • round_datetime_up
            • snap_to_next_tick
            • snap_to_previous_tick
          • default_routing_options
            • TradeRouting
          • description
            • StrategyExecutionDescription
          • dummy
            • DummyExecutionModel
          • execution_context
            • ExecutionContext
            • ExecutionMode
          • execution_model
            • ExecutionModel
            • TradeExecutionType
          • factory
            • StrategyFactory
          • output
            • format_position
            • format_trade
            • output_positions
            • output_trades
          • pandas_trader
            • position_manager
              • PositionManager
            • rebalance
              • check_normalised_weights
              • clip_to_normalised
              • get_existing_portfolio_weights
              • get_weight_diffs
              • rebalance_portfolio
            • runner
              • PandasTraderRunner
            • trade_decision
              • TradeDecider
          • pricing_model
            • PricingModel
          • qstrader
            • alpha_model
              • AlphaModel
          • reserve_currency
            • ReserveCurrency
          • routing
            • RoutingModel
            • RoutingState
          • runner
            • StrategyRunner
          • stoploss
            • check_position_triggers
          • strategy_module
            • CreateTradingUniverseProtocol
            • DecideTradesProtocol
            • StrategyModuleInformation
            • parse_strategy_module
            • pregenerated_create_trading_universe
            • read_strategy_module
          • strategy_type
            • StrategyType
          • trading_strategy_universe
            • Dataset
            • DefaultTradingStrategyUniverseModel
            • TradingStrategyUniverse
            • TradingStrategyUniverseModel
            • create_pair_universe_from_code
            • load_all_data
            • load_pair_data_for_single_exchange
            • translate_token
            • translate_trading_pair
          • universe_model
            • StaticUniverseModel
            • StrategyExecutionUniverse
            • UniverseModel
            • UniverseOptions
          • valuation
            • ValuationModel
            • ValuationModelFactory
        • analysis
          • trade_analyser
            • AssetTradeHistory
            • SpotTrade
            • TimelineRowStylingMode
            • TimelineStyler
            • TradeAnalysis
            • TradePosition
            • TradeSummary
            • build_trade_analysis
            • expand_timeline
        • visual
          • benchmark
            • visualise_all_cash
            • visualise_benchmark
            • visualise_buy_and_hold
            • visualise_portfolio_statistics
          • single_pair
            • export_plot_as_dataframe
            • export_trade_for_dataframe
            • export_trades_as_dataframe
            • visualise_single_pair
            • visualise_technical_indicators
            • visualise_trades
        • backtest
          • backtest_execution
            • BacktestExecutionModel
          • backtest_pricing
            • BacktestSimplePricingModel
            • backtest_pricing_factory
          • backtest_routing
            • BacktestRoutingModel
            • BacktestRoutingState
          • backtest_runner
            • BacktestSetup
            • run_backtest
            • run_backtest_inline
            • setup_backtest
            • setup_backtest_for_universe
          • backtest_sync
            • BacktestSyncer
          • backtest_valuation
            • BacktestValuationModel
            • backtest_valuation_factory
          • data_preload
            • preload_data
          • simulated_wallet
            • SimulatedWallet
        • ethereum
          • default_routes
            • create_pancake_routing
            • get_backtest_routing_model
            • get_pancake_default_routing_parameters
            • get_routing_model
          • execution
            • approve_infinity
            • approve_tokens
            • broadcast
            • broadcast_and_resolve
            • confirm_approvals
            • get_current_price
            • get_held_assets
            • get_swap_transactions
            • get_token_for_asset
            • is_swap_function
            • prepare_swaps
            • resolve_trades
            • translate_to_naive_swap
            • wait_trades_to_complete
          • hot_wallet_sync
            • EthereumHotWalletReserveSyncer
          • tx
            • TransactionBuilder
          • uniswap_v2_execution
            • UniswapV2ExecutionModel
          • uniswap_v2_execution_v0
            • UniswapV2ExecutionModelVersion0
            • UniswapV2RoutingInstructions
          • uniswap_v2_live_pricing
            • UniswapV2LivePricing
            • uniswap_v2_live_pricing_factory
          • uniswap_v2_routing
            • UniswapV2RoutingState
            • UniswapV2SimpleRoutingModel
            • get_uniswap_for_pair
            • route_tokens
          • uniswap_v2_valuation
            • UniswapV2PoolRevaluator
            • uniswap_v2_sell_valuation_factory
          • uniswap_v2_valuation_v0
            • UniswapV2PoolValuationMethodV0
            • uniswap_v2_sell_valuation_factory
          • universe
            • create_exchange_universe
            • create_pair_universe
          • wallet
            • ReserveUpdateEvent
            • sync_reserves
            • update_wallet_balances
          • web3config
            • Web3Config
        • cli
          • approval
            • CLIApprovalModel
          • latest_release
            • main
          • log
            • setup_custom_log_levels
            • setup_discord_logging
            • setup_logging
            • setup_logstash_logging
            • setup_notebook_logging
            • setup_pytest_logging
          • loop
            • ExecutionLoop
          • result
            • display_backtesting_results
          • testtrade
            • make_test_trade
        • utils
          • blockchain
            • get_latest_block_timestamp
          • dataclass
            • EthereumAddress
            • UTCFriendlyDataClassJsonMixin
          • format
            • calculate_percentage
          • fullname
            • get_object_full_name
          • price
            • is_legit_price_value
          • timer
            • timed_task
          • timestamp
            • convert_and_validate_timestamp
            • convert_and_validate_timestamp_as_int
            • json_decode_timedelta
            • json_encode_timedelta
          • typing
          • url
            • get_url_domain
            • redact_url_password
        • webhook
        • testing
          • backtest_trader
            • BacktestTrader
          • dummy_trader
            • DummyTestTrader
          • ethereumtrader
            • EthereumTestTrader
            • execute_trades_simple
          • pairuniversetrader
            • PairUniverseTestTrader
          • simulated_execution_loop
            • set_up_simulated_execution_loop_uniswap_v2
          • simulated_trader
            • SimulatedTestTrader
          • synthetic_ethereum_data
            • generate_random_ethereum_address
          • synthetic_exchange_data
            • generate_exchange
            • generate_simple_routing_model
          • synthetic_price_data
            • generate_fixed_price_candles
            • generate_ohlcv_candles
            • load_ohlcv_parquet_file
        • monkeypatch
          • dataclasses_json
            • patch_dataclasses_json
      • Technical analysis
        • Statistics
          • entropy
          • kurtosis
          • mad
          • median
          • skew
          • stdev
          • tos_stdevall
          • variance
          • zscore
        • Overlap and moving averages
          • alma
          • dema
          • ema
          • fwma
          • hilo
          • hl2
          • hlc3
          • hma
          • hwma
          • ichimoku
          • jma
          • kama
          • linreg
          • ma
          • mcgd
          • midpoint
          • midprice
          • ohlc4
          • pwma
          • rma
          • sinwma
          • sma
          • ssf
          • supertrend
          • swma
          • t3
          • tema
          • trima
          • vidya
          • vwap
          • vwma
          • wcp
          • wma
          • zlma
        • Trend indicators
          • adx
          • amat
          • aroon
          • chop
          • cksp
          • decay
          • decreasing
          • dpo
          • increasing
          • long_run
          • psar
          • qstick
          • short_run
          • tsignals
          • ttm_trend
          • vhf
          • vortex
          • xsignals
        • Momentum indicators
          • ao
          • apo
          • bias
          • bop
          • brar
          • cci
          • cfo
          • cg
          • cmo
          • coppock
          • cti
          • dm
          • er
          • eri
          • fisher
          • inertia
          • kdj
          • kst
          • macd
          • mom
          • pgo
          • ppo
          • psl
          • pvo
          • qqe
          • roc
          • rsi
          • rsx
          • rvgi
          • slope
          • smi
          • squeeze
          • squeeze_pro
          • stc
          • stoch
          • stochrsi
          • td_seq
          • trix
          • tsi
          • uo
          • willr
        • Volatility indicators
          • aberration
          • accbands
          • atr
          • bbands
          • donchian
          • hwc
          • kc
          • massi
          • natr
          • pdist
          • rvi
          • thermo
          • true_range
          • ui
        • Volume based indicators
          • ad
          • adosc
          • aobv
          • cmf
          • efi
          • eom
          • kvo
          • mfi
          • nvi
          • obv
          • pvi
          • pvol
          • pvr
          • pvt
          • vp
        • Candle pattern indicators
          • cdl_doji
          • cdl_inside
          • cdl_pattern
          • cdl_z
          • ha
        • Market cycles
          • ebsw
        • Portfolio performance
          • drawdown
          • log_return
          • percent_return
      • Web3 Ethereum DeFi
    • Binder development
    • Visual Studio Code development
    • Learning resources
    • Troubleshooting
    • Development process and tips
    • Release notes
    • Old example strategies
      • Entropy Monkey (flip the coin)
      • Ape in (buy the latest token)
      • Double 7
      • Double 7 (advanced)
  • Running strategies
    • Architecture
    • Backtesting
    • Live trading
    • Command line application
    • Webhook server
    • Strategy types
    • Serialisation
    • Unit testing
    • Live strategy deployment
  • Protocol
    • Overview
    • Comparison
  • Glossary
Back to top
Edit this page

Backtesting#

Backtesting can be performed

  • Directly from Jupyter notebook using tradeexecutor.backtest.backtest_runner.run_backtest_inline()

  • Giving backtest parameters to the command-line application

Backtesting using Jupyter notebook#

Running backtest examples directly from documentation#

See Running the examples.

Next
Live trading
Previous
Architecture

Trading Strategy is in beta and still under development. Any documentation is preliminary and not final.

Contents
  • Backtesting
    • Backtesting using Jupyter notebook
    • Running backtest examples directly from documentation