diff --git a/v2realbot/ENTRY_backtest_strategyVykladaci.py b/v2realbot/ENTRY_backtest_strategyVykladaci.py index 4781d73..c003341 100644 --- a/v2realbot/ENTRY_backtest_strategyVykladaci.py +++ b/v2realbot/ENTRY_backtest_strategyVykladaci.py @@ -207,8 +207,8 @@ def next(data, state: StrategyState): #slope MA - cílem je identifikovat táhlá klesání, vypnout nákupy, až budou zase růsty - # slope_MA_length = 150 - # state.indicators.slopeMA = ema(state.indicators.slope, slope_MA_length) #state.bars.vwap + slope_MA_length = 5 + state.indicators.slopeMA = ema(state.indicators.slope, slope_MA_length) #state.bars.vwap # #TODO - docasne posilam cele MA # try: # state.ilog(e="Slope - MA"+str(state.indicators.slopeMA[-1]), slopeMA=str(state.indicators.slopeMA[-20:])) @@ -428,7 +428,7 @@ def init(state: StrategyState): print("INIT v main",state.name) state.indicators['ema'] = [] state.indicators['slope'] = [] - #state.indicators['slopeMA'] = [] + state.indicators['slopeMA'] = [] #static indicators - those not series based state.statinds['angle'] = {} state.vars["ticks2reset_backup"] = state.vars.ticks2reset diff --git a/v2realbot/__pycache__/config.cpython-310.pyc b/v2realbot/__pycache__/config.cpython-310.pyc index ca1a39a..43a4ca9 100644 Binary files a/v2realbot/__pycache__/config.cpython-310.pyc and b/v2realbot/__pycache__/config.cpython-310.pyc differ diff --git a/v2realbot/config.py b/v2realbot/config.py index 6c44083..23d4f27 100644 --- a/v2realbot/config.py +++ b/v2realbot/config.py @@ -2,13 +2,14 @@ from alpaca.data.enums import DataFeed from v2realbot.enums.enums import Mode, Account, FillCondition from appdirs import user_data_dir - +#no print in console +QUIET_MODE = False #how many consecutive trades with the fill price are necessary for LIMIT fill to happen in backtesting #0 - optimistic, every knot high will fill the order #N - N consecutive trades required #not impl.yet #minimum is 1 -BT_FILL_CONS_TRADES_REQUIRED = 2 +BT_FILL_CONS_TRADES_REQUIRED = 3 #during bt trade execution logs X-surrounding trades of the one that triggers the fill BT_FILL_LOG_SURROUNDING_TRADES = 10 #fill condition for limit order in bt @@ -16,8 +17,6 @@ BT_FILL_LOG_SURROUNDING_TRADES = 10 # slow - price has to be bigger < BT_FILL_CONDITION_BUY_LIMIT = FillCondition.FAST BT_FILL_CONDITION_SELL_LIMIT = FillCondition.FAST -#no print in console -QUIET_MODE = True #backend counter of api requests COUNT_API_REQUESTS = False #stratvars that cannot be changed in gui diff --git a/v2realbot/utils/__pycache__/utils.cpython-310.pyc b/v2realbot/utils/__pycache__/utils.cpython-310.pyc index ab57a5d..85233dc 100644 Binary files a/v2realbot/utils/__pycache__/utils.cpython-310.pyc and b/v2realbot/utils/__pycache__/utils.cpython-310.pyc differ diff --git a/v2realbot/utils/utils.py b/v2realbot/utils/utils.py index 9c5aa43..7424b83 100644 --- a/v2realbot/utils/utils.py +++ b/v2realbot/utils/utils.py @@ -17,7 +17,8 @@ import requests from uuid import UUID from enum import Enum #from v2realbot.enums.enums import Order -from v2realbot.common.model import Order, TradeUpdate +from v2realbot.common.model import Order as btOrder, TradeUpdate as btTradeUpdate +from alpaca.trading.models import Order, TradeUpdate def safe_get(collection, key, default=None): """Get values from a collection without raising errors""" @@ -61,6 +62,10 @@ def json_serial(obj): return obj.__dict__ if type(obj) is TradeUpdate: return obj.__dict__ + if type(obj) is btOrder: + return obj.__dict__ + if type(obj) is btTradeUpdate: + return obj.__dict__ raise TypeError (str(obj)+"Type %s not serializable" % type(obj)) def parse_toml_string(tomlst: str):