@@ -72,9 +72,8 @@ The following example connects to Binance and buys BTC every 2 hours.
72
72
import logging.config
73
73
from dotenv import load_dotenv
74
74
75
- from investing_algorithm_framework import create_app, TimeUnit, \
76
- CCXTOHLCVMarketDataSource, CCXTTickerMarketDataSource, \
77
- DEFAULT_LOGGING_CONFIG , Algorithm, Context
75
+ from investing_algorithm_framework import create_app, TimeUnit, Context, \
76
+ CCXTOHLCVMarketDataSource, CCXTTickerMarketDataSource, DEFAULT_LOGGING_CONFIG
78
77
79
78
load_dotenv()
80
79
logging.config.dictConfig(DEFAULT_LOGGING_CONFIG )
@@ -97,10 +96,9 @@ bitvavo_btc_eur_ticker = CCXTTickerMarketDataSource(
97
96
app = create_app()
98
97
# Registered bitvavo market, credentials are read from .env file by default
99
98
app.add_market(market = " BITVAVO" , trading_symbol = " EUR" , initial_balance = 100 )
100
- algorithm = Algorithm(name = " test_algorithm" )
101
99
102
100
# Define a strategy for the algorithm that will run every 10 seconds
103
- @algorithm .strategy (
101
+ @app .strategy (
104
102
time_unit = TimeUnit.SECOND ,
105
103
interval = 10 ,
106
104
market_data_sources = [bitvavo_btc_eur_ticker, bitvavo_btc_eur_ohlcv_2h]
@@ -115,8 +113,6 @@ def perform_strategy(context: Context, market_data: dict):
115
113
open_trades = context.get_open_trades()
116
114
closed_trades = context.get_closed_trades()
117
115
118
- app.add_algorithm(algorithm)
119
-
120
116
if __name__ == " __main__" :
121
117
app.run()
122
118
```
0 commit comments