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
      • Drawing DEX prices using OHLCV candle charts
      • Interactive charts
      • Technical analysis
      • Exploring trading pairs
      • Liquidity analysis
      • Price impact estimation
      • Query pool liquidity on a decentralised exchange
      • Dataset download
      • Charts and diagrams (old)
    • Market data
      • Market data client
      • OHLCV Candle format
      • Tracked trading pairs and tokens
      • US dollar price conversion
      • Trading pair naming conventions
      • Internal ids
      • Token tax and deflationary tokens
    • Strategy examples
      • Running the strategy backtests and examples
      • EMA crossover strategy
      • EMA cross over strategy with stop loss
      • Synthetic data backtesting example
      • Synthetic data w/stop loss backtesting example
      • Backtesting fee analysis
      • Generating synthetic trading data
      • Trade execution chart
      • Examining live trading strategy using notebook
      • Debugging live strategy
      • 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
        • 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
            • calculate_naive_profitability
          • store
            • JSONFileStore
            • NoneStore
            • StateStore
            • StateStoreModel
          • sync
            • apply_sync_events
          • trade
            • TradeExecution
            • TradeStatus
            • TradeType
          • types
          • validator
            • validate_nested_state_dict
            • validate_state_serialisation
            • validate_state_value
            • walk
          • visualisation
            • Plot
            • PlotKind
            • PlotShape
            • 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
            • TradePricing
          • qstrader
            • alpha_model
              • AlphaModel
            • order_sizer
              • CashBufferedOrderSizer
            • portfolio_construction_model
              • PortfolioConstructionModel
            • runner
              • QSTraderRunner
          • reserve_currency
            • ReserveCurrency
          • routing
            • RoutingModel
            • RoutingState
          • run_state
            • ExceptionData
            • LatestStateVisualisation
            • RunState
          • runner
            • StrategyRunner
          • stop_loss
            • check_position_triggers
            • report_position_triggered
          • strategy_module
            • CreateTradingUniverseProtocol
            • DecideTradesProtocol
            • StrategyModuleInformation
            • parse_strategy_module
            • pregenerated_create_trading_universe
            • read_strategy_module
          • strategy_type
            • StrategyType
          • summary
            • StrategySummary
            • StrategySummaryStatistics
          • 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
            • avg
            • build_trade_analysis
            • expand_timeline
            • expand_timeline_raw
        • visual
          • benchmark
            • visualise_all_cash
            • visualise_benchmark
            • visualise_buy_and_hold
            • visualise_portfolio_statistics
          • image_output
            • render_plotly_figure_as_image_file
          • single_pair
            • export_plot_as_dataframe
            • export_trade_for_dataframe
            • export_trades_as_dataframe
            • get_position_hover_text
            • visualise_positions_with_duration_and_slippage
            • visualise_single_pair
            • visualise_single_pair_positions_with_duration_and_slippage
            • visualise_technical_indicators
            • visualise_trades
          • strategy_state
            • draw_single_pair_strategy_state
        • 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
          • 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
          • routing_data
            • RoutingData
            • create_uniswap_v2_compatible_routing
            • get_backtest_routing_model
            • get_pancake_default_routing_parameters
            • get_quickswap_default_routing_parameters
            • get_routing_model
            • get_trader_joe_default_routing_parameters
            • get_uniswap_v2_default_routing_parameters
          • 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
          • commands
            • app
            • check_universe
              • check_universe
            • check_wallet
              • check_wallet
            • console
              • console
              • launch_console
            • hello
              • hello
            • perform_test_trade
              • perform_test_trade
            • repair
              • repair
            • start
              • start
            • version
              • version
          • discord
            • get_discord_logging_handler
            • post_logging_discord_image
          • env
            • EnvVarDescription
            • get_available_env_vars
          • init
            • create_approval_model
            • create_metadata
            • create_state_store
            • create_trade_execution_model
            • create_web3_config
            • monkey_patch
            • prepare_cache
            • prepare_executor_id
            • validate_executor_id
          • latest_release
            • main
          • log
            • get_ring_buffer_handler
            • setup_custom_log_levels
            • setup_discord_logging
            • setup_in_memory_logging
            • setup_logging
            • setup_logstash_logging
            • setup_notebook_logging
            • setup_pytest_logging
          • loop
            • ExecutionLoop
          • main
          • result
            • display_backtesting_results
          • testtrade
            • make_test_trade
          • version_info
            • VersionInfo
        • utils
          • blockchain
            • get_latest_block_timestamp
          • dataclass
            • EthereumAddress
            • UTCFriendlyDataClassJsonMixin
          • format
            • calculate_percentage
          • fullname
            • get_object_full_name
          • price
            • is_legit_price_value
          • ring_buffer_logging_handler
            • ExportedRecord
            • RingBufferHandler
          • 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
          • api
            • web_home
            • web_logs
            • web_metadata
            • web_notify
            • web_ping
            • web_source
            • web_state
            • web_status
            • web_visulisation
          • 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
          • 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
    • 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

Release notes#

All new releases are available on PyPi.

See the Change Log file on Github.

Next
Old example strategies
Previous
Development process and tips

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