Skip to content

Commit 965f49f

Browse files
committed
Add examples
1 parent d09ebb8 commit 965f49f

Some content is hidden

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

56 files changed

+29517
-660
lines changed

.vscode/settings.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"python.testing.unittestArgs": [
3+
"-v",
4+
"-s",
5+
"./tests",
6+
"-p",
7+
"test*.py"
8+
],
9+
"python.testing.pytestEnabled": false,
10+
"python.testing.unittestEnabled": true
11+
}

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ Features:
3232
* Stateless running for cloud function deployments
3333
* Polars dataframes support out of the box for fast data processing [pola.rs](https://pola.rs/)
3434

35+
Additional features:
36+
* Indicators (python >= 3.10 required): Set of indicators that can be used in your trading bot. You can donwload the package with `pip install investing-algorithm-framework[indicators]` or `poetry add investing-algorithm-framework[indicators]]`
37+
3538
## Example implementation
3639
The following algorithm connects to binance and buys BTC every 5 seconds.
3740
It also exposes an REST API that allows you to interact with the algorithm.

examples/backtest_example/algorithm/strategy.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,17 @@
99
This strategy is based on the golden cross strategy. It will buy when the
1010
fast moving average crosses the slow moving average from below. It will sell
1111
when the fast moving average crosses the slow moving average from above.
12-
13-
The strategy will also check if the fast moving average is above the trend
14-
moving average. If it is not above the trend moving average it will not buy.
12+
The strategy will also check if the fast moving average is above the trend
13+
moving average. If it is not above the trend moving average it will not buy.
1514
1615
It uses tulipy indicators to calculate the metrics. You need to
1716
install this library in your environment to run this strategy.
1817
You can find instructions on how to install tulipy here:
1918
https://tulipindicators.org/ or go directly to the pypi page:
2019
https://pypi.org/project/tulipy/
2120
"""
21+
22+
2223
def is_below_trend(fast_series, slow_series):
2324
return fast_series[-1] < slow_series[-1]
2425

@@ -87,7 +88,7 @@ def apply_strategy(self, algorithm: Algorithm, market_data):
8788
)
8889

8990
if algorithm.has_position(target_symbol) \
90-
and is_below_trend(fast, slow):
91+
and is_below_trend(fast, slow):
9192
open_trades = algorithm.get_open_trades(
9293
target_symbol=target_symbol
9394
)

examples/backtest_experiment/algorithms/__init__.py

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

examples/backtest_experiment/algorithms/algorithm.py

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

examples/backtest_experiment/app.py

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

examples/backtest_experiment/configuration.json

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

examples/backtest_experiment/data_sources.py

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

0 commit comments

Comments
 (0)