Tags: ema, trend-analysis, get-started

EMA crossover strategy#

This is an example notebook how to create and run backtests with tradeexecutor framework.

Some highlights of this notebook:

  • The backtest has all its code within a single Jupyter notebook

    • The backtest code and charts are self-contained in a single file

    • The example code is easy to read

    • Easy to test different functionalities of tradeexecutor library

  • Runs a backtest for Exponential moving average crossover strategy on a single trading pair

    • Uses PancakeSwap on BNB chain for trading

    • Based on fast EMA and slow EMA

    • Depending on the moving average overlap, enters in to a position

  • You need a Trading Strategy API key to run the notebook

  • This backtest is made to demostrate the features

    • The strategy may or may not generate any profits, as it is not the purpose of this example

Set up#

Set up the parameters used in in this strategy backtest study.

  • Backtested blockchain, exchange and trading pair

  • Backtesting period

  • Strategy parameters for EMA crossovers

[1]:
import datetime
import pandas as pd

from tradingstrategy.chain import ChainId
from tradingstrategy.timebucket import TimeBucket
from tradeexecutor.strategy.cycle import CycleDuration
from tradeexecutor.strategy.strategy_module import StrategyType, TradeRouting, ReserveCurrency

# Tell what trade execution engine version this strategy needs to use
trading_strategy_engine_version = "0.1"

# What kind of strategy we are running.
# This tells we are going to use
trading_strategy_type = StrategyType.managed_positions

# How our trades are routed.
# PancakeSwap basic routing supports two way trades with BUSD
# and three way trades with BUSD-BNB hop.
trade_routing = TradeRouting.pancakeswap_busd

# How often the strategy performs the decide_trades cycle.
# We do it for every 16h.
trading_strategy_cycle = CycleDuration.cycle_16h

# Strategy keeps its cash in BUSD
reserve_currency = ReserveCurrency.busd

# Time bucket for our candles
candle_time_bucket = TimeBucket.h4

# Which chain we are trading
chain_id = ChainId.bsc

# Which exchange we are trading on.
exchange_slug = "pancakeswap-v2"

# Which trading pair we are trading
trading_pair_ticker = ("WBNB", "BUSD")

# How much of the cash to put on a single trade
position_size = 0.10

#
# Strategy thinking specific parameter
#

batch_size = 90

slow_ema_candle_count = 15

fast_ema_candle_count = 5


# Range of backtesting and synthetic data generation.
# Because we are using synthetic data actual dates do not really matter -
# only the duration

start_at = datetime.datetime(2021, 6, 1)

end_at = datetime.datetime(2022, 1, 1)

# Start with 10,000 USD
initial_deposit = 10_000


Strategy logic and trade decisions#

decide_trades function decide what trades to take. In this example, we calculate two exponential moving averages (EMAs) and make decisions based on those.

[2]:
from typing import List, Dict

from pandas_ta.overlap import ema

from tradeexecutor.state.visualisation import PlotKind
from tradeexecutor.state.trade import TradeExecution
from tradeexecutor.strategy.pricing_model import PricingModel
from tradeexecutor.strategy.pandas_trader.position_manager import PositionManager
from tradeexecutor.state.state import State
from tradingstrategy.universe import Universe


def decide_trades(
        timestamp: pd.Timestamp,
        universe: Universe,
        state: State,
        pricing_model: PricingModel,
        cycle_debug_data: Dict) -> List[TradeExecution]:
    """The brain function to decide the trades on each trading strategy cycle.

    - Reads incoming execution state (positions, past trades)

    - Reads the current universe (candles)

    - Decides what to do next

    - Outputs strategy thinking for visualisation and debug messages

    :param timestamp:
        The Pandas timestamp object for this cycle. Matches
        trading_strategy_cycle division.
        Always truncated to the zero seconds and minutes, never a real-time clock.

    :param universe:
        Trading universe that was constructed earlier.

    :param state:
        The current trade execution state.
        Contains current open positions and all previously executed trades, plus output
        for statistics, visualisation and diangnostics of the strategy.

    :param pricing_model:
        Pricing model can tell the buy/sell price of the particular asset at a particular moment.

    :param cycle_debug_data:
        Python dictionary for various debug variables you can read or set, specific to this trade cycle.
        This data is discarded at the end of the trade cycle.

    :return:
        List of trade instructions in the form of :py:class:`TradeExecution` instances.
        The trades can be generated using `position_manager` but strategy could also hand craft its trades.
    """

    # The pair we are trading
    pair = universe.pairs.get_single()

    # How much cash we have in the hand
    cash = state.portfolio.get_current_cash()

    # Get OHLCV candles for our trading pair as Pandas Dataframe.
    # We could have candles for multiple trading pairs in a different strategy,
    # but this strategy only operates on single pair candle.
    # We also limit our sample size to N latest candles to speed up calculations.
    candles: pd.DataFrame = universe.candles.get_single_pair_data(timestamp, sample_count=batch_size)

    # We have data for open, high, close, etc.
    # We only operate using candle close values in this strategy.
    close = candles["close"]

    # Calculate exponential moving averages based on slow and fast sample numbers.
    slow_ema_series = ema(close, length=slow_ema_candle_count)
    fast_ema_series = ema(close, length=fast_ema_candle_count)

    if slow_ema_series is None or fast_ema_series is None:
        # Cannot calculate EMA, because
        # not enough samples in backtesting
        return []

    slow_ema = slow_ema_series.iloc[-1]
    fast_ema = fast_ema_series.iloc[-1]

    # Get the last close price from close time series
    # that's Pandas's Series object
    # https://pandas.pydata.org/docs/reference/api/pandas.Series.iat.html
    current_price = close.iloc[-1]

    # List of any trades we decide on this cycle.
    # Because the strategy is simple, there can be
    # only zero (do nothing) or 1 (open or close) trades
    # decides
    trades = []

    # Create a position manager helper class that allows us easily to create
    # opening/closing trades for different positions
    position_manager = PositionManager(timestamp, universe, state, pricing_model)

    if not position_manager.is_any_open():

        if current_price >= slow_ema:
        # Entry condition:
        # Close price is higher than the slow EMA
            buy_amount = cash * position_size
            trades += position_manager.open_1x_long(pair, buy_amount)

    else:

        if fast_ema >= slow_ema:
        # Exit condition:
        # Fast EMA crosses slow EMA
            trades += position_manager.close_all()

    # Visualize strategy
    # See available Plotly colours here
    # https://community.plotly.com/t/plotly-colours-list/11730/3?u=miohtama
    visualisation = state.visualisation
    visualisation.plot_indicator(timestamp, "Slow EMA", PlotKind.technical_indicator_on_price, slow_ema, colour="darkblue")
    visualisation.plot_indicator(timestamp, "Fast EMA", PlotKind.technical_indicator_on_price, fast_ema, colour="#003300")

    return trades

Defining the trading universe#

We create a trading universe with a single blockchain, exchange and trading pair. For the sake of easier understanding the code, we name this “Uniswap v2” like exchange with a single ETH-USDC trading pair.

The trading pair contains generated noise-like OHLCV trading data.

[3]:
from tradeexecutor.strategy.universe_model import UniverseOptions
from tradeexecutor.strategy.trading_strategy_universe import TradingStrategyUniverse, \
    load_pair_data_for_single_exchange
from tradeexecutor.strategy.execution_context import ExecutionContext
from tradingstrategy.client import Client
import datetime

def create_trading_universe(
        ts: datetime.datetime,
        client: Client,
        execution_context: ExecutionContext,
        universe_options: UniverseOptions,
) -> TradingStrategyUniverse:
    """Creates the trading universe where the strategy trades.

    If `execution_context.live_trading` is true then this function is called for
    every execution cycle. If we are backtesting, then this function is
    called only once at the start of backtesting and the `decide_trades`
    need to deal with new and deprecated trading pairs.

    As we are only trading a single pair, load data for the single pair only.

    :param ts:
        The timestamp of the trading cycle. For live trading,
        `create_trading_universe` is called on every cycle.
        For backtesting, it is only called at the start

    :param client:
        Trading Strategy Python client instance.

    :param execution_context:
        Information how the strategy is executed. E.g.
        if we are live trading or not.

    :return:
        This function must return :py:class:`TradingStrategyUniverse` instance
        filled with the data for exchanges, pairs and candles needed to decide trades.
        The trading universe also contains information about the reserve asset,
        usually stablecoin, we use for the strategy.
    """

    # Load all datas we can get for our candle time bucket
    dataset = load_pair_data_for_single_exchange(
        client,
        execution_context,
        candle_time_bucket,
        chain_id,
        exchange_slug,
        [trading_pair_ticker],
        universe_options,
        )


    # Filter down to the single pair we are interested in
    universe = TradingStrategyUniverse.create_single_pair_universe(
        dataset,
        chain_id,
        exchange_slug,
        trading_pair_ticker[0],
        trading_pair_ticker[1],
    )

    return universe

Set up the market data client#

The Trading Strategy market data client is the Python library responsible for managing the data feeds needed to run the backtest.None

We set up the market data client with an API key.

If you do not have an API key yet, you can register one.

[4]:
from tradingstrategy.client import Client

client = Client.create_jupyter_client()
Started Trading Strategy in Jupyter notebook environment, configuration is stored in /home/alex/.tradingstrategy

Run backtest#

Run backtest using giving trading universe and strategy function.

  • Running the backtest outputs state object that contains all the information on the backtesting position and trades.

  • The trade execution engine will download the necessary datasets to run the backtest. The datasets may be large, several gigabytes.

[5]:
import logging

from tradeexecutor.backtest.backtest_runner import run_backtest_inline

state, universe, debug_dump = run_backtest_inline(
    name="BNB/USD EMA crossover example",
    start_at=start_at,
    end_at=end_at,
    client=client,
    cycle_duration=trading_strategy_cycle,
    decide_trades=decide_trades,
    create_trading_universe=create_trading_universe,
    initial_deposit=initial_deposit,
    reserve_currency=ReserveCurrency.busd,
    trade_routing=trade_routing,
    log_level=logging.WARNING,
)

trade_count = len(list(state.portfolio.get_all_trades()))
print(f"Backtesting completed, backtested strategy made {trade_count} trades")
Backtesting completed, backtested strategy made 174 trades

Examine backtest results#

Examine state that contains all actions the trade executor took.

We plot out a chart that shows - The price action - When the strategy made buys or sells

[6]:
print(f"Positions taken: {len(list(state.portfolio.get_all_positions()))}")
print(f"Trades made: {len(list(state.portfolio.get_all_trades()))}")
Positions taken: 87
Trades made: 174
[7]:
from tradeexecutor.visual.single_pair import visualise_single_pair

figure = visualise_single_pair(
    state,
    universe.universe.candles,
    start_at=start_at,
    end_at=end_at)

figure.show()

Equity curve and drawdown#

Visualise equity curve and related performnace over time.

  • Returns

  • Drawdown

  • Daily returns

[8]:
# Set Jupyter Notebook output mode parameters
# Used to avoid warnings
from tradeexecutor.backtest.notebook import setup_charting_and_output
setup_charting_and_output()

# Needed to improve the resolution of matplotlib chart used here
%config InlineBackend.figure_format = 'svg'

from tradeexecutor.visual.equity_curve import calculate_equity_curve, calculate_returns
from tradeexecutor.visual.equity_curve import visualise_equity_curve

curve = calculate_equity_curve(state)
returns = calculate_returns(curve)
visualise_equity_curve(returns)
[8]:
../../_images/programming_strategy-examples_pancakeswap-ema_17_0.svg

Returns monthly breakdown#

  • Monthly returns

  • Best day/week/month/year

[9]:
from tradeexecutor.visual.equity_curve import visualise_returns_over_time

visualise_returns_over_time(returns)
[9]:
../../_images/programming_strategy-examples_pancakeswap-ema_19_0.svg

Benchmarking the strategy performance#

Here we benchmark the strategy performance against some baseline scenarios.

  • Buy and hold US dollar

  • Buy and hold the underlying trading pair base asset

[10]:
close = universe.universe.candles.get_single_pair_data()["close"]
[11]:
from tradeexecutor.visual.benchmark import visualise_benchmark

traded_pair = universe.universe.pairs.get_single()

fig = visualise_benchmark(
    state.name,
    portfolio_statistics=state.stats.portfolio,
    all_cash=state.portfolio.get_initial_deposit(),
    buy_and_hold_asset_name=traded_pair.base_token_symbol,
    buy_and_hold_price_series=universe.universe.candles.get_single_pair_data()["close"],
    start_at=start_at,
    end_at=end_at
)

fig.show()

Analysing the strategy success#

Here we calculate statistics on how well the strategy performed.

  • Won/lost trades

  • Timeline of taken positions with color coding of trade performance

[12]:
from tradeexecutor.analysis.trade_analyser import build_trade_analysis

analysis = build_trade_analysis(state.portfolio)

Strategy summary#

Overview of strategy performance

[13]:
from IPython.core.display_functions import display

summary = analysis.calculate_summary_statistics(candle_time_bucket, state)

with pd.option_context("display.max_row", None):
    summary.display()
Returns
Annualised return % -0.72%
Lifetime return % -0.42%
Realised PnL $-41.57
Trade period 210 days 0 hours
Holdings
Total assets $9,958.43
Cash left $9,958.43
Open position value $0.00
Open positions 0
Winning Losing Total
Closed Positions
Number of positions 44 43 87
% of total 50.57% 49.43% 100.00%
Average PnL % 2.32% -2.46% -0.04%
Median PnL % 1.27% -1.61% 0.06%
Biggest PnL % 14.08% -17.42% -
Average duration 5 bars 8 bars 7 bars
Max consecutive streak 7 4 -
Max runup / drawdown 2.87% -3.87% -
Stop losses Take profits
Position Exits
Triggered exits 0 0
Percent winning - -
Percent losing - -
Percent of total 0.00% 0.00%
Risk Analysis
Biggest realized risk 10.00%
Average realized risk -0.25%
Max pullback of capital -2.67%
Sharpe Ratio -7.40%
Sortino Ratio -10.38%
Profit Factor 98.82%

Performance metrics#

Here is an example how to use Quantstats library to calculate the tearsheet metrics for the strategy with advanced metrics. The metrics include popular risk-adjusted return comparison metrics.

This includes metrics like:

  • Sharpe

  • Sortino

  • Max drawdown

Note: These metrics are based on equity curve and returns. Analysis here does not go down to the level of an individual trade or a position. Any consecutive wins and losses are measured in days, not in trade or candle counts.

[14]:
from tradeexecutor.visual.equity_curve import calculate_equity_curve, calculate_returns
from tradeexecutor.analysis.advanced_metrics import visualise_advanced_metrics, AdvancedMetricsMode

equity = calculate_equity_curve(state)
returns = calculate_returns(equity)
metrics = visualise_advanced_metrics(returns, mode=AdvancedMetricsMode.full)

with pd.option_context("display.max_row", None):
    display(metrics)
Strategy
Start Period 2021-05-31
End Period 2021-12-31
Risk-Free Rate 0.0%
Time in Market 77.0%
Cumulative Return -0.37%
CAGR﹪ -0.62%
Sharpe -0.06
Prob. Sharpe Ratio 47.7%
Smart Sharpe -0.06
Sortino -0.09
Smart Sortino -0.09
Sortino/√2 -0.07
Smart Sortino/√2 -0.06
Omega 0.99
Max Drawdown -3.87%
Longest DD Days 209
Volatility (ann.) 4.85%
Calmar -0.16
Skew 0.51
Kurtosis 8.67
Expected Daily -0.0%
Expected Monthly -0.05%
Expected Yearly -0.37%
Kelly Criterion -0.42%
Risk of Ruin 0.0%
Daily Value-at-Risk -0.42%
Expected Shortfall (cVaR) -0.42%
Max Consecutive Wins 3
Max Consecutive Losses 7
Gain/Pain Ratio -0.01
Gain/Pain (1M) -0.08
Payoff Ratio 1.86
Profit Factor 0.99
Common Sense Ratio 1.1
CPC Index 0.64
Tail Ratio 1.11
Outlier Win Ratio 6.22
Outlier Loss Ratio 4.6
MTD -0.75%
3M 0.9%
6M 0.18%
YTD -0.37%
1Y -0.37%
3Y (ann.) -0.62%
5Y (ann.) -0.62%
10Y (ann.) -0.62%
All-time (ann.) -0.62%
Best Day 1.46%
Worst Day -1.27%
Best Month 1.39%
Worst Month -1.34%
Best Year -0.37%
Worst Year -0.37%
Avg. Drawdown -1.32%
Avg. Drawdown Days 70
Recovery Factor -0.09
Ulcer Index 0.02
Serenity Index -0.01
Avg. Up Month 1.03%
Avg. Down Month -0.86%
Win Days 34.69%
Win Month 42.86%
Win Quarter 33.33%
Win Year 0.0%

Position and trade timeline#

Display all positions and how much profit they made.

[15]:
from tradeexecutor.analysis.trade_analyser import expand_timeline

timeline = analysis.create_timeline()

expanded_timeline, apply_styles = expand_timeline(
        universe.universe.exchanges,
        universe.universe.pairs,
        timeline)

# Do not truncate the row output
with pd.option_context("display.max_row", None):
    display(apply_styles(expanded_timeline))

Remarks Type Opened at Duration Exchange Base asset Quote asset Position max value PnL USD PnL % Open mid price USD Close mid price USD Trade count LP fees
Long 2021-05-31 16 hours PancakeSwap v2 WBNB BUSD $1,000.00 $2.02 0.20% $347.410409 $348.112896 2 $5.01
Long 2021-06-02 16 hours PancakeSwap v2 WBNB BUSD $1,000.20 $140.82 14.08% $362.849013 $413.935326 2 $5.36
Long 2021-06-03 16 hours PancakeSwap v2 WBNB BUSD $1,014.28 $35.66 3.52% $412.596183 $427.100382 2 $5.17
Long 2021-06-05 2 days PancakeSwap v2 WBNB BUSD $1,017.85 $-60.01 -5.90% $419.376092 $394.652694 2 $4.95
Long 2021-06-10 4 days PancakeSwap v2 WBNB BUSD $1,011.85 $-27.47 -2.71% $375.822229 $365.620982 2 $5.00
Long 2021-06-14 16 hours PancakeSwap v2 WBNB BUSD $1,009.10 $-1.77 -0.18% $375.135561 $374.476018 2 $5.05
Long 2021-06-16 8 days 16 hours PancakeSwap v2 WBNB BUSD $1,008.93 $-175.73 -17.42% $368.275213 $304.130930 2 $4.61
Long 2021-06-28 16 hours PancakeSwap v2 WBNB BUSD $991.35 $21.11 2.13% $291.107056 $297.306405 2 $5.02
Long 2021-06-29 16 hours PancakeSwap v2 WBNB BUSD $993.46 $5.51 0.55% $297.792890 $299.445395 2 $4.99
Long 2021-07-03 16 hours PancakeSwap v2 WBNB BUSD $994.01 $6.59 0.66% $295.039742 $296.995170 2 $4.99
Long 2021-07-04 16 hours PancakeSwap v2 WBNB BUSD $994.67 $-32.95 -3.31% $309.496938 $299.244760 2 $4.90
Long 2021-07-06 16 hours PancakeSwap v2 WBNB BUSD $991.38 $40.44 4.08% $303.592229 $315.976847 2 $5.06
Long 2021-07-07 16 hours PancakeSwap v2 WBNB BUSD $995.42 $-17.69 -1.78% $332.222228 $326.318462 2 $4.94
Long 2021-07-10 2 days PancakeSwap v2 WBNB BUSD $993.65 $9.80 0.99% $318.021650 $321.156760 2 $5.00
Long 2021-07-12 3 days 8 hours PancakeSwap v2 WBNB BUSD $994.63 $-25.51 -2.56% $322.503322 $314.233076 2 $4.92
Long 2021-07-16 5 days 8 hours PancakeSwap v2 WBNB BUSD $992.08 $-63.02 -6.35% $311.734139 $291.931563 2 $4.81
Long 2021-07-22 16 hours PancakeSwap v2 WBNB BUSD $985.78 $-4.10 -0.42% $297.783432 $296.543634 2 $4.92
Long 2021-07-24 16 hours PancakeSwap v2 WBNB BUSD $985.37 $9.59 0.97% $299.446444 $302.359832 2 $4.96
Long 2021-07-25 16 hours PancakeSwap v2 WBNB BUSD $986.33 $-5.19 -0.53% $303.569859 $301.971128 2 $4.92
Long 2021-07-26 16 hours PancakeSwap v2 WBNB BUSD $985.81 $-49.37 -5.01% $318.897635 $302.928082 2 $4.81
Long 2021-07-28 16 hours PancakeSwap v2 WBNB BUSD $980.87 $-2.55 -0.26% $314.068716 $313.253196 2 $4.90
Long 2021-07-29 16 hours PancakeSwap v2 WBNB BUSD $980.62 $5.62 0.57% $314.479613 $316.283352 2 $4.92
Long 2021-07-31 16 hours PancakeSwap v2 WBNB BUSD $981.18 $34.55 3.52% $320.402097 $331.683174 2 $5.00
Long 2021-08-01 16 hours PancakeSwap v2 WBNB BUSD $984.64 $-13.42 -1.36% $339.515095 $334.886770 2 $4.90
Long 2021-08-05 16 hours PancakeSwap v2 WBNB BUSD $983.29 $-18.83 -1.92% $335.930303 $329.495789 2 $4.88
Long 2021-08-06 16 hours PancakeSwap v2 WBNB BUSD $981.41 $13.93 1.42% $336.371773 $341.147840 2 $4.95
Long 2021-08-07 16 hours PancakeSwap v2 WBNB BUSD $982.80 $4.68 0.48% $353.740508 $355.425131 2 $4.93
Long 2021-08-09 16 hours PancakeSwap v2 WBNB BUSD $983.27 $-8.64 -0.88% $356.843433 $353.707201 2 $4.90
Long 2021-08-11 16 hours PancakeSwap v2 WBNB BUSD $982.41 $62.11 6.32% $372.390363 $395.932372 2 $5.07
Long 2021-08-12 16 hours PancakeSwap v2 WBNB BUSD $988.62 $-9.67 -0.98% $387.620641 $383.827381 2 $4.93
Long 2021-08-13 16 hours PancakeSwap v2 WBNB BUSD $987.65 $46.37 4.69% $396.372290 $414.981329 2 $5.06
Long 2021-08-15 16 hours PancakeSwap v2 WBNB BUSD $992.29 $-20.78 -2.09% $410.714699 $402.113445 2 $4.92
Long 2021-08-16 16 hours PancakeSwap v2 WBNB BUSD $990.21 $-13.94 -1.41% $421.974696 $416.032652 2 $4.92
Long 2021-08-17 2 days PancakeSwap v2 WBNB BUSD $988.81 $0.85 0.09% $420.346232 $420.709001 2 $4.95
Long 2021-08-20 16 hours PancakeSwap v2 WBNB BUSD $988.90 $63.12 6.38% $425.528507 $452.690350 2 $5.11
Long 2021-08-21 16 hours PancakeSwap v2 WBNB BUSD $995.21 $-1.51 -0.15% $455.427702 $454.738507 2 $4.98
Long 2021-08-23 16 hours PancakeSwap v2 WBNB BUSD $995.06 $102.62 10.31% $450.099074 $496.515826 2 $5.24
Long 2021-08-24 16 hours PancakeSwap v2 WBNB BUSD $1,005.32 $-56.75 -5.64% $497.864113 $469.760403 2 $4.89
Long 2021-08-25 16 hours PancakeSwap v2 WBNB BUSD $999.65 $-44.09 -4.41% $504.104050 $481.872026 2 $4.89
Long 2021-08-27 16 hours PancakeSwap v2 WBNB BUSD $995.24 $-8.93 -0.90% $490.480501 $486.078296 2 $4.96
Long 2021-09-02 16 hours PancakeSwap v2 WBNB BUSD $994.35 $-16.05 -1.61% $490.290089 $482.375133 2 $4.94
Long 2021-09-03 16 hours PancakeSwap v2 WBNB BUSD $992.74 $2.15 0.22% $484.943346 $485.992147 2 $4.98
Long 2021-09-04 16 hours PancakeSwap v2 WBNB BUSD $992.96 $-17.46 -1.76% $501.682595 $492.863067 2 $4.93
Long 2021-09-06 16 hours PancakeSwap v2 WBNB BUSD $991.21 $-16.63 -1.68% $504.666812 $496.199718 2 $4.92
Long 2021-09-12 2 days 16 hours PancakeSwap v2 WBNB BUSD $989.55 $5.59 0.57% $418.700474 $421.067783 2 $4.97
Long 2021-09-16 16 hours PancakeSwap v2 WBNB BUSD $990.11 $-14.99 -1.51% $431.280621 $424.749225 2 $4.92
Long 2021-09-22 16 hours PancakeSwap v2 WBNB BUSD $988.61 $30.56 3.09% $370.382371 $381.833323 2 $5.03
Long 2021-09-24 6 days PancakeSwap v2 WBNB BUSD $991.66 $-47.03 -4.74% $384.243819 $366.020234 2 $4.85
Long 2021-09-30 16 hours PancakeSwap v2 WBNB BUSD $986.96 $48.03 4.87% $379.652784 $398.126659 2 $5.06
Long 2021-10-02 16 hours PancakeSwap v2 WBNB BUSD $991.76 $23.26 2.34% $421.885939 $431.778667 2 $5.02
Long 2021-10-03 16 hours PancakeSwap v2 WBNB BUSD $994.09 $-3.10 -0.31% $431.053201 $429.708934 2 $4.97
Long 2021-10-05 16 hours PancakeSwap v2 WBNB BUSD $993.78 $17.64 1.77% $434.383414 $442.093380 2 $5.02
Long 2021-10-06 16 hours PancakeSwap v2 WBNB BUSD $995.54 $7.98 0.80% $439.809022 $443.333705 2 $5.00
Long 2021-10-08 5 days 8 hours PancakeSwap v2 WBNB BUSD $996.34 $3.76 0.38% $439.344046 $441.000283 2 $5.00
Long 2021-10-14 16 hours PancakeSwap v2 WBNB BUSD $996.72 $4.80 0.48% $470.471249 $472.735101 2 $5.00
Long 2021-10-15 16 hours PancakeSwap v2 WBNB BUSD $997.20 $11.10 1.11% $467.388177 $472.590969 2 $5.02
Long 2021-10-18 16 hours PancakeSwap v2 WBNB BUSD $998.31 $14.67 1.47% $470.968497 $477.890998 2 $5.03
Long 2021-10-19 16 hours PancakeSwap v2 WBNB BUSD $999.77 $-14.03 -1.40% $493.099284 $486.179491 2 $4.97
Long 2021-10-20 16 hours PancakeSwap v2 WBNB BUSD $998.37 $-21.68 -2.17% $501.079466 $490.200207 2 $4.94
Long 2021-10-24 2 days PancakeSwap v2 WBNB BUSD $996.20 $-3.74 -0.38% $485.280904 $483.458944 2 $4.98
Long 2021-10-28 16 hours PancakeSwap v2 WBNB BUSD $995.83 $6.77 0.68% $486.977493 $490.290213 2 $5.00
Long 2021-10-30 16 hours PancakeSwap v2 WBNB BUSD $996.51 $-19.76 -1.98% $529.771790 $519.266543 2 $4.94
Long 2021-10-31 16 hours PancakeSwap v2 WBNB BUSD $994.53 $-13.45 -1.35% $530.473980 $523.298249 2 $4.95
Long 2021-11-01 16 hours PancakeSwap v2 WBNB BUSD $993.18 $2.78 0.28% $538.033614 $539.539420 2 $4.98
Long 2021-11-03 16 hours PancakeSwap v2 WBNB BUSD $993.46 $-15.44 -1.55% $555.836636 $547.198868 2 $4.93
Long 2021-11-04 16 hours PancakeSwap v2 WBNB BUSD $991.92 $1.31 0.13% $555.975709 $556.711585 2 $4.97
Long 2021-11-05 16 hours PancakeSwap v2 WBNB BUSD $992.05 $23.00 2.32% $601.325049 $615.263847 2 $5.02
Long 2021-11-07 16 hours PancakeSwap v2 WBNB BUSD $994.35 $32.02 3.22% $637.293607 $657.816333 2 $5.06
Long 2021-11-08 16 hours PancakeSwap v2 WBNB BUSD $997.55 $14.15 1.42% $643.396172 $652.521594 2 $5.03
Long 2021-11-10 3 days 8 hours PancakeSwap v2 WBNB BUSD $998.97 $0.72 0.07% $644.800017 $645.262454 2 $5.00
Long 2021-11-14 16 hours PancakeSwap v2 WBNB BUSD $999.04 $7.02 0.70% $645.996456 $650.537883 2 $5.02
Long 2021-11-19 16 hours PancakeSwap v2 WBNB BUSD $999.74 $0.55 0.06% $578.807010 $579.127185 2 $5.01
Long 2021-11-21 16 hours PancakeSwap v2 WBNB BUSD $999.80 $-21.55 -2.16% $605.751497 $592.697213 2 $4.95
Long 2021-11-23 16 hours PancakeSwap v2 WBNB BUSD $997.64 $-15.66 -1.57% $594.616437 $585.280201 2 $4.96
Long 2021-11-25 16 hours PancakeSwap v2 WBNB BUSD $996.07 $84.05 8.44% $591.156419 $641.039665 2 $5.20
Long 2021-11-27 1 days 8 hours PancakeSwap v2 WBNB BUSD $1,004.48 $-2.33 -0.23% $610.200605 $608.783060 2 $5.02
Long 2021-11-29 16 hours PancakeSwap v2 WBNB BUSD $1,004.25 $-8.95 -0.89% $617.939733 $612.435203 2 $5.01
Long 2021-12-01 16 hours PancakeSwap v2 WBNB BUSD $1,003.35 $32.34 3.22% $625.432835 $645.593520 2 $5.10
Long 2021-12-02 4 days 16 hours PancakeSwap v2 WBNB BUSD $1,006.59 $-66.71 -6.63% $627.767768 $586.160836 2 $4.87
Long 2021-12-07 16 hours PancakeSwap v2 WBNB BUSD $999.91 $-19.26 -1.93% $589.715402 $578.358305 2 $4.96
Long 2021-12-09 16 hours PancakeSwap v2 WBNB BUSD $997.99 $-49.39 -4.95% $607.511913 $577.447081 2 $4.87
Long 2021-12-12 16 hours PancakeSwap v2 WBNB BUSD $993.05 $4.56 0.46% $567.745867 $570.354471 2 $4.98
Long 2021-12-16 2 days 16 hours PancakeSwap v2 WBNB BUSD $993.51 $-3.09 -0.31% $534.409175 $532.744752 2 $4.97
Long 2021-12-19 2 days 16 hours PancakeSwap v2 WBNB BUSD $993.20 $-4.73 -0.48% $535.357427 $532.806417 2 $4.96
Long 2021-12-23 1 days 8 hours PancakeSwap v2 WBNB BUSD $992.72 $15.76 1.59% $535.376345 $543.877413 2 $5.01
Long 2021-12-25 16 hours PancakeSwap v2 WBNB BUSD $994.30 $0.65 0.07% $542.649849 $543.006390 2 $4.98
Long 2021-12-27 16 hours PancakeSwap v2 WBNB BUSD $994.37 $14.77 1.49% $547.446509 $555.580102 2 $5.02

Finishing notes#

Print out a line to signal the notebook finished the execution successfully.

[16]:
print("All ok")
All ok