Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions benchmarks/test_benchmark_indicators.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ def test_benchmark_ht_trendline(benchmark, quotes):

def test_benchmark_hurst(benchmark, quotes):
benchmark(indicators.get_hurst, quotes)

def test_benchmark_hurst_longlong(benchmark, longish_quotes):
benchmark(indicators.get_hurst, longish_quotes+longish_quotes)

def test_benchmark_ichimoku(benchmark, quotes):
benchmark(indicators.get_ichimoku, quotes)
Expand Down
12 changes: 7 additions & 5 deletions stock_indicators/_cstypes/list.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
from collections import deque

from stock_indicators._cslib import CsList


class List:
"""
Class for converting Python's iterator type into C#'s `System.Collections.Generic.List` class.
Expand Down Expand Up @@ -29,8 +32,7 @@ class List:
"""

def __new__(cls, generic, sequence) -> CsList:
clist = CsList[generic]()
for i in sequence:
clist.Add(i)

return clist
cs_list = CsList[generic]()
deque(map(cs_list.Add, sequence), maxlen=0)

return cs_list