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
  • 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
      • Synthetic data backtesting example
      • Single trading pair EMA crossover strategy
      • Osmosis ATOM-OSMO mean reversion
      • Defining trading universe
      • Backtest template
    • API documentation
      • Market data client
        • client
          • Client
        • chain
          • ChainId
        • exchange
          • Exchange
          • ExchangeType
          • ExchangeUniverse
        • pair
          • DEXPair
          • LegacyPairUniverse
          • PairType
          • PandasPairUniverse
          • StablecoinFilteringMode
          • filter_for_exchanges
          • filter_for_quote_tokens
          • filter_for_stablecoins
        • 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
        • backtrader
          • DEXFeed
          • DEXStrategy
          • TradeRecorder
          • add_dataframes_as_feeds
          • analyse_strategy_trades
          • convert_backtrader_timestamp
          • prepare_candles_for_backtrader
          • reindex_pandas_for_backtrader
        • qstrader
          • DEXAsset
          • TradingStrategyDataSource
          • analyse_portfolio_development
          • analyse_trade_history
          • create_portfolio_snapshot
          • prepare_candles_for_qstrader
      • 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
          • visualisation
            • Plot
            • PlotKind
            • Visualisation
        • strategy
          • approval
            • ApprovalModel
            • ApprovalType
            • UncheckedApprovalModel
          • bootstrap
            • bootstrap_strategy
            • import_strategy_file
          • 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
            • make_runner_for_strategy_mod
          • output
            • format_position
            • format_trade
            • output_positions
            • output_trades
          • pandas_trader
            • position_manager
              • PositionManager
            • runner
              • PandasTraderRunner
            • trade_decision
              • TradeDecider
          • pricing_model
            • PricingModel
          • qstrader
            • alpha_model
              • AlphaModel
            • order_sizer
              • CashBufferedOrderSizer
            • portfolio_construction_model
              • PortfolioConstructionModel
            • runner
              • QSTraderRunner
          • reserve_currency
            • ReserveCurrency
          • routing
            • RoutingModel
            • RoutingState
          • runner
            • StrategyRunner
          • stoploss
            • check_position_triggers
          • strategy_module
            • CreateTradingUniverseProtocol
            • DecideTradesProtocol
            • StrategyModuleInformation
            • parse_strategy_module
            • pregenerated_create_trading_universe
          • strategy_type
            • StrategyType
          • trading_strategy_universe
            • Dataset
            • DefaultTradingStrategyUniverseModel
            • TradingStrategyUniverse
            • TradingStrategyUniverseModel
            • create_pair_universe_from_code
            • load_all_data
            • translate_token
            • translate_trading_pair
          • universe_model
            • StaticUniverseModel
            • StrategyExecutionUniverse
            • UniverseModel
          • valuation
            • ValuationModel
            • ValuationModelFactory
        • analysis
          • trade_analyser
            • AssetTradeHistory
            • SpotTrade
            • 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
        • cli
          • approval
            • CLIApprovalModel
          • discord_handler
            • DiscordHandler
          • env
            • EnvVarDescription
            • get_available_env_vars
          • log
            • setup_discord_logging
            • setup_logging
            • setup_notebook_logging
            • setup_pytest_logging
          • loop
            • ExecutionLoop
          • main
            • check_universe
            • check_wallet
            • create_approval_model
            • create_metadata
            • create_state_store
            • create_trade_execution_model
            • create_web3
            • monkey_patch
            • start
        • utils
          • dataclass
            • EthereumAddress
            • UTCFriendlyDataClassJsonMixin
          • price
            • is_legit_price_value
          • timer
            • timed_task
          • timestamp
            • convert_and_validate_timestamp
            • convert_and_validate_timestamp_as_int
          • url
            • redact_url_password
        • webhook
          • api
            • web_home
            • web_metadata
            • web_notify
            • web_ping
            • web_state
          • app
            • Root
            • create_pyramid_app
            • forbidden_view
            • init_web_api
          • error
            • convert_to_api_error_response
            • error_tween_factory
            • exception_response
            • exception_view
          • events
            • add_cors_headers
          • server
            • WebhookServer
            • create_webhook_server
        • testing
          • backtest_trader
            • BacktestTrader
          • dummy_trader
            • DummyTestTrader
          • ethereumtrader
            • EthereumTestTrader
            • execute_trades_simple
          • pairuniversetrader
            • PairUniverseTestTrader
          • synthetic_ethereum_data
            • generate_random_ethereum_address
          • synthetic_exchange_data
            • generate_exchange
            • generate_simple_routing_model
          • synthetic_price_data
            • 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
  • Protocol
    • Overview
    • Comparison
  • Glossary
Back to top
Edit this page

Old example strategies#

This section contains old example algorithmic trading strategies. These were written for Backtrader and QSTrader backtesting engines. However, they have been phased oun in the favour of our internal tradeexecutor engine. The examples are here for a historical reference and might not run.

  • Entropy Monkey (flip the coin)
  • Ape in (buy the latest token)
  • Double 7
  • Double 7 (advanced)
Next
Entropy Monkey (flip the coin)
Previous
Release notes

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