Skip to content

Commit e03a4ee

Browse files
authored
Add support for order executor and portfolio provider (#308)
* Add support for order executor and portfolio provider * Fix flake8 warnings * Fix urls * Fix dependencies
1 parent 49a8898 commit e03a4ee

File tree

91 files changed

+4341
-2006
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+4341
-2006
lines changed

README.md

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ 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, PortfolioConfiguration, \
76-
TimeUnit, CCXTOHLCVMarketDataSource, Context, CCXTTickerMarketDataSource, \
77-
MarketCredential, DEFAULT_LOGGING_CONFIG, Algorithm, Context
75+
from investing_algorithm_framework import create_app, TimeUnit, \
76+
CCXTOHLCVMarketDataSource, CCXTTickerMarketDataSource, \
77+
DEFAULT_LOGGING_CONFIG, Algorithm, Context
7878

7979
load_dotenv()
8080
logging.config.dictConfig(DEFAULT_LOGGING_CONFIG)
@@ -93,17 +93,15 @@ bitvavo_btc_eur_ticker = CCXTTickerMarketDataSource(
9393
market="BITVAVO",
9494
symbol="BTC/EUR",
9595
)
96-
app = create_app()
9796

9897
# Bitvavo market credentials are read from .env file, or you can
9998
# set them manually as params
100-
app.add_market_credential(MarketCredential(market="bitvavo"))
101-
app.add_portfolio_configuration(
102-
PortfolioConfiguration(
103-
market="bitvavo", trading_symbol="EUR", initial_balance=40
104-
)
99+
app = create_app()
100+
app.add_market(
101+
market="BITVAVO",
102+
trading_symbol="EUR",
103+
initial_balance=100
105104
)
106-
107105
algorithm = Algorithm(name="test_algorithm")
108106

109107
# Define a strategy for the algorithm that will run every 10 seconds
@@ -338,8 +336,8 @@ This will ensure that interested parties can give valuable feedback on the featu
338336
339337
## 📬 Support
340338
341-
* Slack Community
342-
* Reddit Community
339+
* [Reddit Community](https://www.reddit.com/r/InvestingBots/)
340+
* [Discord Community](https://discord.gg/dQsRmGZP")
343341
344342
345343
## 🏆 Acknowledgements

examples/backtest_example/run_backtest.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
import time
2-
from datetime import datetime
31
import logging.config
2+
import time
43
from datetime import datetime, timedelta
5-
from investing_algorithm_framework import (
6-
CCXTOHLCVMarketDataSource, CCXTTickerMarketDataSource, PortfolioConfiguration, create_app, pretty_print_backtest, BacktestDateRange, TimeUnit, TradingStrategy, OrderSide, DEFAULT_LOGGING_CONFIG, Context
7-
)
84

95
from pyindicators import ema, is_crossover, is_above, is_below, is_crossunder
106

7+
from investing_algorithm_framework import (
8+
CCXTOHLCVMarketDataSource, CCXTTickerMarketDataSource, create_app,
9+
pretty_print_backtest, BacktestDateRange, TimeUnit, TradingStrategy,
10+
OrderSide, DEFAULT_LOGGING_CONFIG, Context
11+
)
1112

1213
logging.config.dictConfig(DEFAULT_LOGGING_CONFIG)
1314

examples/test.py

Lines changed: 0 additions & 16 deletions
This file was deleted.

investing_algorithm_framework/__init__.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
load_backtest_report, BacktestDateRange, convert_polars_to_pandas, \
1313
DateRange, get_backtest_report, DEFAULT_LOGGING_CONFIG, \
1414
BacktestReport, TradeStatus, MarketDataType, TradeRiskType, \
15-
APPLICATION_DIRECTORY
15+
APPLICATION_DIRECTORY, pretty_print_orders, pretty_print_trades, \
16+
pretty_print_positions, DataSource
1617
from investing_algorithm_framework.infrastructure import \
1718
CCXTOrderBookMarketDataSource, CCXTOHLCVMarketDataSource, \
1819
CCXTTickerMarketDataSource, CSVOHLCVMarketDataSource, \
@@ -77,5 +78,9 @@
7778
"TradeRiskType",
7879
"Context",
7980
"APPLICATION_DIRECTORY",
80-
"download"
81+
"download",
82+
"pretty_print_orders",
83+
"pretty_print_trades",
84+
"pretty_print_positions",
85+
"DataSource",
8186
]

0 commit comments

Comments
 (0)