Skip to content

Commit 11ff0b1

Browse files
committed
Update example
1 parent e996435 commit 11ff0b1

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

README.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,8 @@ The following example connects to Binance and buys BTC every 2 hours.
7272
import logging.config
7373
from 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

7978
load_dotenv()
8079
logging.config.dictConfig(DEFAULT_LOGGING_CONFIG)
@@ -97,10 +96,9 @@ bitvavo_btc_eur_ticker = CCXTTickerMarketDataSource(
9796
app = create_app()
9897
# Registered bitvavo market, credentials are read from .env file by default
9998
app.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-
120116
if __name__ == "__main__":
121117
app.run()
122118
```

0 commit comments

Comments
 (0)