Skip to content
This repository has been archived by the owner on Aug 27, 2024. It is now read-only.

Commit

Permalink
Merge pull request #19 from auto-trading-temp-name/ta-lib
Browse files Browse the repository at this point in the history
statements update if if -> if elif
  • Loading branch information
CelestialCrafter authored Oct 5, 2023
2 parents 3d16445 + a8258af commit b89a26e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion algorithms/bollinger_bands.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ def signal(data):
upper_band, lower_band, middle_band = data
if middle_band[-1] > upper_band[-1]:
return 'sell', 1
if middle_band[-1] < lower_band[-1]:
elif middle_band[-1] < lower_band[-1]:
return 'buy', 0.5
return 'no_action', 0
4 changes: 2 additions & 2 deletions algorithms/macd.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ def algorithm(prices, window_sizes=[12, 26, 9]):

def signal(data):
macd, signal = data
# @TODO make this not stupid :3
# @TODO make signals accurate to macd
if macd[-1] > signal[-1]:
return 'sell'
if macd[-1] < signal[-1]:
elif macd[-1] < signal[-1]:
return 'buy'
return 'no_action'
2 changes: 1 addition & 1 deletion algorithms/rsi.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ def signal(data):
rsi = data
if rsi[-1] > 70:
return 'sell'
if rsi[-1] < 30:
elif rsi[-1] < 30:
return 'buy'
return 'no_action'

0 comments on commit b89a26e

Please sign in to comment.