Spaces:
Sleeping
Sleeping
Update utils/model_inference.py
Browse files- utils/model_inference.py +21 -15
utils/model_inference.py
CHANGED
|
@@ -1,20 +1,26 @@
|
|
| 1 |
-
|
| 2 |
-
import
|
| 3 |
-
import pandas as pd
|
| 4 |
|
| 5 |
-
def
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
-
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
-
def generate_forex_signals(capital, risk_level):
|
| 12 |
-
# Logic to combine LSTM and SAC predictions
|
| 13 |
-
# Return currency pair, entry/exit times, ROI, signal strength
|
| 14 |
return {
|
| 15 |
-
"currency_pair": "EUR/USD",
|
| 16 |
-
"entry_time":
|
| 17 |
-
"exit_time": "2
|
| 18 |
-
"roi":
|
| 19 |
-
"signal_strength":
|
| 20 |
}
|
|
|
|
| 1 |
+
from config import RISK_LEVELS
|
| 2 |
+
import random
|
|
|
|
| 3 |
|
| 4 |
+
def generate_forex_signals(capital, risk_level):
|
| 5 |
+
"""
|
| 6 |
+
Generate signals based on trading capital and risk level.
|
| 7 |
+
"""
|
| 8 |
+
# Fetch stop loss and take profit percentages based on risk level
|
| 9 |
+
risk_params = RISK_LEVELS[risk_level]
|
| 10 |
+
stop_loss = risk_params["stop_loss"]
|
| 11 |
+
take_profit = risk_params["take_profit"]
|
| 12 |
|
| 13 |
+
# Simulate ROI based on risk level and trading capital
|
| 14 |
+
roi = random.uniform(take_profit * 80, take_profit * 120) # Randomized ROI in range
|
| 15 |
+
signal_strength = "High" if roi > (take_profit * 100) else "Medium"
|
| 16 |
+
|
| 17 |
+
# Entry and exit logic
|
| 18 |
+
entry_time = "Generated dynamically in app.py" # Placeholder
|
| 19 |
|
|
|
|
|
|
|
|
|
|
| 20 |
return {
|
| 21 |
+
"currency_pair": random.choice(["EUR/USD", "GBP/USD", "USD/JPY", "AUD/USD", "USD/CHF"]),
|
| 22 |
+
"entry_time": entry_time,
|
| 23 |
+
"exit_time": "Entry time + 2 hours",
|
| 24 |
+
"roi": round(roi, 2),
|
| 25 |
+
"signal_strength": signal_strength
|
| 26 |
}
|