Add data._normalize.py ...

bar_select
Tyler Goodlet 2020-09-26 14:20:55 -04:00
parent bc65040601
commit acc8dd66f5
1 changed files with 21 additions and 0 deletions

View File

@ -0,0 +1,21 @@
"""
Stream format enforcement.
"""
from typing import AsyncIterator, Optional
import numpy as np
def iterticks(
quote: dict,
type: str = 'trade',
) -> AsyncIterator:
"""Iterate through ticks delivered per quote cycle.
"""
# print(f"{quote}\n\n")
ticks = quote.get('ticks', ())
if ticks:
for tick in ticks:
# print(tick)
if tick.get('type') == type:
yield tick