File tree 2 files changed +12
-7
lines changed
examples/backtest_example
2 files changed +12
-7
lines changed Original file line number Diff line number Diff line change 2
2
3
3
from investing_algorithm_framework import TimeUnit , TradingStrategy , \
4
4
Algorithm , OrderSide
5
+ from .data_sources import bitvavo_btc_eur_ohlcv_2h , bitvavo_btc_eur_ticker , \
6
+ bitvavo_dot_eur_ticker , bitvavo_dot_eur_ohlcv_2h
5
7
6
8
"""
7
9
This strategy is based on the golden cross strategy. It will buy when the
@@ -47,10 +49,10 @@ class CrossOverStrategy(TradingStrategy):
47
49
time_unit = TimeUnit .HOUR
48
50
interval = 2
49
51
market_data_sources = [
50
- "BTC/EUR-ohlcv" ,
51
- "DOT/EUR-ohlcv" ,
52
- "BTC/EUR-ticker" ,
53
- "DOT/EUR-ticker"
52
+ bitvavo_dot_eur_ticker ,
53
+ bitvavo_btc_eur_ticker ,
54
+ bitvavo_dot_eur_ohlcv_2h ,
55
+ bitvavo_btc_eur_ohlcv_2h
54
56
]
55
57
symbols = ["BTC/EUR" , "DOT/EUR" ]
56
58
fast = 21
Original file line number Diff line number Diff line change 5
5
bitvavo_dot_eur_ohlcv_2h , bitvavo_dot_eur_ticker , bitvavo_btc_eur_ticker
6
6
from app import app
7
7
from investing_algorithm_framework import PortfolioConfiguration , \
8
- pretty_print_backtest
8
+ pretty_print_backtest , BacktestDateRange
9
9
10
10
app .add_algorithm (algorithm )
11
11
app .add_market_data_source (bitvavo_btc_eur_ohlcv_2h )
26
26
if __name__ == "__main__" :
27
27
end_date = datetime (2023 , 12 , 2 )
28
28
start_date = end_date - timedelta (days = 100 )
29
+ date_range = BacktestDateRange (
30
+ start_date = start_date ,
31
+ end_date = end_date
32
+ )
29
33
backtest_report = app .run_backtest (
30
34
algorithm = algorithm ,
31
- start_date = start_date ,
32
- end_date = end_date ,
35
+ backtest_date_range = date_range ,
33
36
)
34
37
pretty_print_backtest (backtest_report )
You can’t perform that action at this time.
0 commit comments