From 3293ad847eff4193747d2416fdbdbba5799818c8 Mon Sep 17 00:00:00 2001 From: David Brazda Date: Thu, 22 Jun 2023 16:01:09 +0200 Subject: [PATCH] bugfixes and two version of strategies --- testy/numpytest.py | 12 ++++++++++++ v2realbot/ENTRY_Vykladaci_RSI_MYSELL.py | 13 +++++++------ v2realbot/__pycache__/config.cpython-310.pyc | Bin 2934 -> 2952 bytes v2realbot/config.py | 2 +- v2realbot/controller/services.py | 4 ++-- .../__pycache__/aggregator.cpython-310.pyc | Bin 7067 -> 7085 bytes v2realbot/loader/aggregator.py | 6 +++--- v2realbot/v2trading.db | 0 8 files changed, 25 insertions(+), 12 deletions(-) create mode 100644 testy/numpytest.py create mode 100644 v2realbot/v2trading.db diff --git a/testy/numpytest.py b/testy/numpytest.py new file mode 100644 index 0000000..c5d5908 --- /dev/null +++ b/testy/numpytest.py @@ -0,0 +1,12 @@ +import numpy as np +from v2realbot.utils.utils import isfalling +arr = np.array([1, np.nan, 3, 4, 5, 6, 2.3]) +print(arr) +b = list(arr) +a = b[-1] +print(a) +if str(a) == "nan": + print(a,"je nan") + +rsi = [1,2,3,4,5] +print(isfalling(rsi,1)) \ No newline at end of file diff --git a/v2realbot/ENTRY_Vykladaci_RSI_MYSELL.py b/v2realbot/ENTRY_Vykladaci_RSI_MYSELL.py index cab78ca..3c0fd47 100644 --- a/v2realbot/ENTRY_Vykladaci_RSI_MYSELL.py +++ b/v2realbot/ENTRY_Vykladaci_RSI_MYSELL.py @@ -14,7 +14,6 @@ from msgpack import packb, unpackb import asyncio import os from traceback import format_exc -import inspect print(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) """" @@ -502,6 +501,8 @@ def next(data, state: StrategyState): source = state.cbar_indicators.tick_price #[-rsi_length:] #state.bars.vwap crsi_res = rsi(source, crsi_length) crsi_value = crsi_res[-1] + if str(crsi_value) == "nan": + crsi_value = 0 state.cbar_indicators.CRSI[-1]=crsi_value #state.ilog(e=f"RSI {rsi_length=} {rsi_value=} {rsi_dont_buy=} {rsi_buy_signal=}", rsi_indicator=state.indicators.RSI14[-5:]) except Exception as e: @@ -653,11 +654,11 @@ def next(data, state: StrategyState): #buy_cond["AND"]["rsi_buy_signal_below"] = state.indicators.RSI14[-1] < safe_get(state.vars, "rsi_buy_signal_below",40) #buy_cond["AND"]["ema_trend_is_falling"] = isfalling(state.indicators.ema,state.vars.Trend) - #pouze RSI nizke a RSI klesa + #pouze RSI nizke a RSI klesa, pripadne k tomu CRSI + #TATO KOMBINACE se da konfigurovat pouze hodnotama, aby platila libovolna kombinace podminek (např. Trend = 1 - vypne stredni podminku) buy_cond["AND"]["rsi_buy_signal_below"] = state.indicators.RSI14[-1] < safe_get(state.vars, "rsi_buy_signal_below",40) buy_cond["AND"]["rsi_is_falling"] = isfalling(state.indicators.RSI14,state.vars.Trend) - - #buy_cond['crsi_below_crsi_buy_limit'] = state.cbar_indicators.CRSI[-1] < safe_get(state.vars, "crsi_buy_signal_below",30) + buy_cond["AND"]['crsi_below_crsi_buy_limit'] = state.cbar_indicators.CRSI[-1] < safe_get(state.vars, "crsi_buy_signal_below",25) #slopME klesa a RSI začalo stoupat # buy_cond["AND"]["rsi_is_rising2"] = isrising(state.indicators.RSI14,2) @@ -668,8 +669,8 @@ def next(data, state: StrategyState): #zkusit jako doplnkovy BUY SIGNAL 3 klesavy cbar RSI pripadne TICK PRICE result, conditions_met = eval_cond_dict(buy_cond) - if result: - state.ilog(e=f"BUY SIGNAL {conditions_met}") + #if result: + state.ilog(e=f"BUY SIGNAL {result} {conditions_met}") return result def eval_buy(): diff --git a/v2realbot/__pycache__/config.cpython-310.pyc b/v2realbot/__pycache__/config.cpython-310.pyc index 8ebf095ba3b000e9fcf2c741a61c4ea672573538..392f1cf0627d6a2a9db7546e8478bafab15c028c 100644 GIT binary patch delta 103 zcmew+)*;TD&&$ij00al#PfD4xk(Y~|F>12}yELP^s(X-sXh3{OkfV!haD2FDh(~;g zr>|>ph@)>nypL;eaD0e|qu;H`9vpg%wst_}b% CLLy24 delta 84 zcmeAW|0c$p&&$ij00a(--6>5QdAZmbZ*7)fmu3_dc64`-_x1FP4+(N~agBFz^$Br| knjFQU#~3xaljAm!Oy$&Oyft|uX9