@@ -72,9 +72,8 @@ The following example connects to Binance and buys BTC every 2 hours.
7272import logging.config
7373from dotenv import load_dotenv
7474
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
7877
7978load_dotenv()
8079logging.config.dictConfig(DEFAULT_LOGGING_CONFIG )
@@ -97,10 +96,9 @@ bitvavo_btc_eur_ticker = CCXTTickerMarketDataSource(
9796app = create_app()
9897# Registered bitvavo market, credentials are read from .env file by default
9998app.add_market(market = " BITVAVO" , trading_symbol = " EUR" , initial_balance = 100 )
100- algorithm = Algorithm(name = " test_algorithm" )
10199
102100# Define a strategy for the algorithm that will run every 10 seconds
103- @algorithm .strategy (
101+ @app .strategy (
104102 time_unit = TimeUnit.SECOND ,
105103 interval = 10 ,
106104 market_data_sources = [bitvavo_btc_eur_ticker, bitvavo_btc_eur_ohlcv_2h]
@@ -115,8 +113,6 @@ def perform_strategy(context: Context, market_data: dict):
115113 open_trades = context.get_open_trades()
116114 closed_trades = context.get_closed_trades()
117115
118- app.add_algorithm(algorithm)
119-
120116if __name__ == " __main__" :
121117 app.run()
122118```
0 commit comments