Add vwap to exposed fsp map

vwap_backup
Tyler Goodlet 2020-11-10 20:18:16 -05:00
parent 6d514a7d5a
commit e76eb790f1
1 changed files with 9 additions and 11 deletions

View File

@ -25,13 +25,18 @@ import numpy as np
from ..log import get_logger
from .. import data
from ._momo import _rsi
from ._momo import _rsi, _wma
from ._volume import _tina_vwap
from ..data import attach_shm_array, Feed
log = get_logger(__name__)
_fsps = {'rsi': _rsi}
_fsps = {
'rsi': _rsi,
'wma': _wma,
'vwap': _tina_vwap,
}
async def latency(
@ -72,7 +77,6 @@ async def increment_signals(
dst_shm.push(last)
@tractor.stream
async def cascade(
ctx: tractor.Context,
@ -112,7 +116,6 @@ async def cascade(
# THERE'S A BIG BUG HERE WITH THE `index` field since we're
# prepending a copy of the first value a few times to make
# sub-curves align with the parent bar chart.
#
# This likely needs to be fixed either by,
# - manually assigning the index and historical data
# seperately to the shm array (i.e. not using .push())
@ -133,15 +136,10 @@ async def cascade(
)
history[fsp_func_name] = history_output
# TODO: talk to ``pyqtgraph`` core about proper way to solve this:
# XXX: hack to get curves aligned with bars graphics: prepend
# a copy of the first datum..
# dst.push(history[:1])
# check for data length mis-allignment and fill missing values
diff = len(src.array) - len(history)
if diff >= 0:
print(f"WTF DIFFZZZ {diff}")
print(f"WTF DIFF SIGNAL to HISTORY {diff}")
for _ in range(diff):
dst.push(history[:1])