bugfix
This commit is contained in:
@ -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 - cílem je identifikovat táhlá klesání, vypnout nákupy, až budou zase růsty
|
||||||
# slope_MA_length = 150
|
slope_MA_length = 5
|
||||||
# state.indicators.slopeMA = ema(state.indicators.slope, slope_MA_length) #state.bars.vwap
|
state.indicators.slopeMA = ema(state.indicators.slope, slope_MA_length) #state.bars.vwap
|
||||||
# #TODO - docasne posilam cele MA
|
# #TODO - docasne posilam cele MA
|
||||||
# try:
|
# try:
|
||||||
# state.ilog(e="Slope - MA"+str(state.indicators.slopeMA[-1]), slopeMA=str(state.indicators.slopeMA[-20:]))
|
# 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)
|
print("INIT v main",state.name)
|
||||||
state.indicators['ema'] = []
|
state.indicators['ema'] = []
|
||||||
state.indicators['slope'] = []
|
state.indicators['slope'] = []
|
||||||
#state.indicators['slopeMA'] = []
|
state.indicators['slopeMA'] = []
|
||||||
#static indicators - those not series based
|
#static indicators - those not series based
|
||||||
state.statinds['angle'] = {}
|
state.statinds['angle'] = {}
|
||||||
state.vars["ticks2reset_backup"] = state.vars.ticks2reset
|
state.vars["ticks2reset_backup"] = state.vars.ticks2reset
|
||||||
|
|||||||
Binary file not shown.
@ -2,13 +2,14 @@ from alpaca.data.enums import DataFeed
|
|||||||
from v2realbot.enums.enums import Mode, Account, FillCondition
|
from v2realbot.enums.enums import Mode, Account, FillCondition
|
||||||
from appdirs import user_data_dir
|
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
|
#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
|
#0 - optimistic, every knot high will fill the order
|
||||||
#N - N consecutive trades required
|
#N - N consecutive trades required
|
||||||
#not impl.yet
|
#not impl.yet
|
||||||
#minimum is 1
|
#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
|
#during bt trade execution logs X-surrounding trades of the one that triggers the fill
|
||||||
BT_FILL_LOG_SURROUNDING_TRADES = 10
|
BT_FILL_LOG_SURROUNDING_TRADES = 10
|
||||||
#fill condition for limit order in bt
|
#fill condition for limit order in bt
|
||||||
@ -16,8 +17,6 @@ BT_FILL_LOG_SURROUNDING_TRADES = 10
|
|||||||
# slow - price has to be bigger <
|
# slow - price has to be bigger <
|
||||||
BT_FILL_CONDITION_BUY_LIMIT = FillCondition.FAST
|
BT_FILL_CONDITION_BUY_LIMIT = FillCondition.FAST
|
||||||
BT_FILL_CONDITION_SELL_LIMIT = FillCondition.FAST
|
BT_FILL_CONDITION_SELL_LIMIT = FillCondition.FAST
|
||||||
#no print in console
|
|
||||||
QUIET_MODE = True
|
|
||||||
#backend counter of api requests
|
#backend counter of api requests
|
||||||
COUNT_API_REQUESTS = False
|
COUNT_API_REQUESTS = False
|
||||||
#stratvars that cannot be changed in gui
|
#stratvars that cannot be changed in gui
|
||||||
|
|||||||
Binary file not shown.
@ -17,7 +17,8 @@ import requests
|
|||||||
from uuid import UUID
|
from uuid import UUID
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
#from v2realbot.enums.enums import Order
|
#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):
|
def safe_get(collection, key, default=None):
|
||||||
"""Get values from a collection without raising errors"""
|
"""Get values from a collection without raising errors"""
|
||||||
@ -61,6 +62,10 @@ def json_serial(obj):
|
|||||||
return obj.__dict__
|
return obj.__dict__
|
||||||
if type(obj) is TradeUpdate:
|
if type(obj) is TradeUpdate:
|
||||||
return obj.__dict__
|
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))
|
raise TypeError (str(obj)+"Type %s not serializable" % type(obj))
|
||||||
|
|
||||||
def parse_toml_string(tomlst: str):
|
def parse_toml_string(tomlst: str):
|
||||||
|
|||||||
Reference in New Issue
Block a user