3 changed files with 22 additions and 0 deletions
@ -1,3 +1,4 @@ |
|||||||
|
|
||||||
from .ema import EMA |
from .ema import EMA |
||||||
from .rsi import RSI |
from .rsi import RSI |
||||||
|
from .intradaybarnumber import IntradayBarNumber |
||||||
|
|||||||
@ -0,0 +1,18 @@ |
|||||||
|
|
||||||
|
def IntradayBarNumber(bars): |
||||||
|
result = [] |
||||||
|
if len(bars.timestamp) == 0: |
||||||
|
return result |
||||||
|
ibn = 0 |
||||||
|
current_date = None |
||||||
|
for ts in bars.timestamp: |
||||||
|
if current_date != ts.date(): |
||||||
|
ibn = 0 |
||||||
|
current_date = ts.date() |
||||||
|
else: |
||||||
|
ibn += 1 |
||||||
|
result.append(ibn) |
||||||
|
|
||||||
|
return result |
||||||
|
|
||||||
|
|
||||||
Loading…
Reference in new issue