statement plugin added
This commit is contained in:
32
v2realbot/strategyblocks/indicators/custom/statement.py
Normal file
32
v2realbot/strategyblocks/indicators/custom/statement.py
Normal file
@ -0,0 +1,32 @@
|
||||
from v2realbot.utils.utils import isrising, isfalling,zoneNY, price2dec, print, safe_get, is_still, is_window_open, eval_cond_dict, crossed_down, crossed_up, crossed, is_pivot, json_serial, pct_diff, create_new_bars, slice_dict_lists
|
||||
from v2realbot.strategy.base import StrategyState
|
||||
import numpy as np
|
||||
|
||||
#allows executing a statement - pozor neni sanitized a zatim se spousti i v globalni scopu
|
||||
#v pripade jineho nez soukromeho uziti zabezpecit
|
||||
|
||||
#do budoucna prozkoumat NUMEXPR - ten omezuje jen na operatory a univerzalni funkce
|
||||
#eval nyni umi i user-defined function, string operation and control statements
|
||||
|
||||
#teroeticky se dá pouzit i SYMPY - kde se daji vytvorit jednotlive symboly s urcitou funkcni
|
||||
def statement(state: StrategyState, params):
|
||||
funcName = "statement"
|
||||
#indicator name
|
||||
operation = safe_get(params, "statement", None)
|
||||
|
||||
if operation is None :
|
||||
return -2, "required param missing"
|
||||
|
||||
#pro zacatek eval
|
||||
val = eval(operation, None, state.ind_mapping)
|
||||
|
||||
#val = ne.evaluate(operation, state.ind_mapping)
|
||||
|
||||
state.ilog(lvl=1,e=f"INSIDE {funcName} {operation=} res:{val}", **params)
|
||||
return 0, val
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -5,21 +5,8 @@ from rich import print as printanyway
|
||||
from v2realbot.indicators.indicators import ema
|
||||
from traceback import format_exc
|
||||
import importlib
|
||||
|
||||
#TODO TENTO IMPORT VYMYSLET, abych naloadoval package custom a nemusel nic pridat (vymyslet dynamicke volani z cele package ci)
|
||||
#from v2realbot.strategyblocks.indicators.custom._upscaled_rsi_wip import upscaledrsi
|
||||
import v2realbot.strategyblocks.indicators.custom as ci
|
||||
# from v2realbot.strategyblocks.indicators.custom.barparams import barparams
|
||||
# from v2realbot.strategyblocks.indicators.custom.basestats import basestats
|
||||
# from v2realbot.strategyblocks.indicators.custom.delta import delta
|
||||
# from v2realbot.strategyblocks.indicators.custom.divergence import divergence
|
||||
# from v2realbot.strategyblocks.indicators.custom.model import model
|
||||
# from v2realbot.strategyblocks.indicators.custom.opengap import opengap
|
||||
# from v2realbot.strategyblocks.indicators.custom.slope import slope
|
||||
# from v2realbot.strategyblocks.indicators.custom.conditional import conditional
|
||||
# from v2realbot.strategyblocks.indicators.custom.mathop import mathop
|
||||
|
||||
# import v2realbot.strategyblocks.indicators.custom as ci
|
||||
|
||||
def populate_dynamic_custom_indicator(data, state: StrategyState, name):
|
||||
ind_type = "custom"
|
||||
|
||||
Reference in New Issue
Block a user