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

Commit

Permalink
redis uri
Browse files Browse the repository at this point in the history
rsi strength
strength update
  • Loading branch information
fox committed Nov 3, 2023
1 parent 262296d commit 321c47a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .example.env
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
JWT_SECRET="JWT_SECRET here"
DB_URI="Mongo Database here"
DB_URI="Mongo Database here"
REDIS_URI="Redis Uri here"
6 changes: 4 additions & 2 deletions algorithms/rsi.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ def algorithm(prices, window_size=14):
def signal(prices, data, high=70, low=30):
rsi = data
if rsi[-1] > high:
return 'sell', 0.5
strength = rsi[-1] * (1 / low)
return 'sell', strength
elif rsi[-1] < low:
return 'buy', 0.5
strength = 1 - rsi[-1] * (1 / low)
return 'buy', strength
return 'no_action', 0
5 changes: 2 additions & 3 deletions views/internal_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@

def algorithm_output(algorithm, prices):
module = import_module(f'algorithms.{algorithm}')
signal = module.signal(prices, module.algorithm(prices))
signal, strength = module.signal(prices, module.algorithm(prices))

# @TODO strength
return algorithm, signal
return algorithm, (signal, strength)

def internal_checker():
if not ip_address(request.remote_addr).is_private:
Expand Down

0 comments on commit 321c47a

Please sign in to comment.