Giter Site home page Giter Site logo

facioquo / stock-indicators-python Goto Github PK

View Code? Open in Web Editor NEW
189.0 11.0 32.0 13.53 MB

Stock Indicators for Python. Maintained by @LeeDongGeon1996

Home Page: https://python.StockIndicators.dev

License: Apache License 2.0

Python 100.00%
technical-analysis quantitative-finance stock-market stock-analysis stock-indicators trading-algorithms stock trading technical-indicators

stock-indicators-python's People

Contributors

alexpvpmindustry avatar daveskender avatar dependabot[bot] avatar imgbot[bot] avatar leedonggeon1996 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

stock-indicators-python's Issues

Release v0.6.0

New features are almost ready to be released.

Here's the checklist for releasing v0.6.0:

  • Add remaining indicators.
  • Write corresponding documentation and review. (#182 )
  • Add docstrings.
  • Update benchmarks.(#183 )
  • Final sanity check and code style.
  • Release to PyPI.
  • Apply release description to tag.

Marubozu with CandleResult

@DaveSkender I'm going to wrap Marubozu indicator, and I heard that you were refactoring it, is it available now?

And Marubozu returns CandleResult, including CandleProperties. So I'm also need to wrap CandleProperties. There are getters and setters for the properties of CandleProperties, for example, Size is calculated by High - Low when the moments it's called. Then, how does getter work once after Size is allocated with new values via setter method.

Package name

I think the name we are using now is too long and does not comply with PEP 8, which is saying that "Python packages should also have short, all-lowercase names, although the use of underscores is discouraged.".
Is there any idea about it?

Suggestions:

# If package name is skender
from skender import indicators

# If package name is indicators
from indicators import indicators

# If package name is stock_indicators
from stock_indicators import indicators

Manual DLL update in Piplines

We should consider updating DLL manually. In Piplines, using the latest DLL automatically can cause failure on tests because the DLL is not updated automatically in development environment. And that old DLL is used when new feature is committed. This interrupts tests for new feature and forces to order tasks to pass testcase.

Release v1.0.0

The version 1.0.0 is ready to be released.

Here's the checklist for releasing v1.0.0:

  • Add/check all of the features of v1, such as new indicators or new params.
  • Write corresponding documentation and review. (#273 )
  • Add docstrings.
  • Update benchmarks.( #Included in updating docs )
  • Final sanity check and code style.
  • Release to PyPI.
  • Apply release description to tag.

Conversion issue of Pythonnet for Enum class

The problem

  • Cannot pass Python Enum as C# Enum.
  • Pythonnet automatically converts C# Enums to int.
  • It seems like 'Pythonnet' is still trying to fix this issue. They said this problem will be fixed in version 3.0 and I think we cannot wait for it. The milestone for version 3.0 indicates 41% yet.

Error message(s):
In Macbook Air(M1), Pythonnet uses Mono runtime for .Net.
Error messages are not quite helpful...

=================================================================
        Native Crash Reporting
=================================================================
Got a segv while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

=================================================================
        Native stacktrace:
=================================================================
        0x10c33cd75 - /Users/<username>/opt/anaconda3/envs/skender/lib/libmonosgen-2.0.1.dylib : mono_dump_native_crash_info
        0x10c2d7b8e - /Users/<username>/opt/anaconda3/envs/skender/lib/libmonosgen-2.0.1.dylib : mono_handle_native_crash
        0x10c33782b - /Users/<username>/opt/anaconda3/envs/skender/lib/libmonosgen-2.0.1.dylib : altstack_handle_and_restore

...skip...

To Reproduce

  1. Checkout to the branch, feat/support-candlepart-sma in my forked repo.
  2. Run pytest -svr A

Related Indicators

  • Williams
  • EMA
  • Stoch Oscillator
  • Beta
  • ZigZag
  • Chandelier
  • MaEnvelopes
  • Pivot Points
  • Pivots

Release v0.2.0

Let's release next preview version v0.2.0. I think it would be great to release every 10 indicators with bumping up minor version.

  • Add 10+ new indicators.
  • Review documentation and docstrings(#80).
  • Final sanity check and code style.
  • Release to PyPI.
  • apply release description to tag

Error getting all is None when using ZigZag Indicator

Hi.

I have been using your libraries for a while and they are working fine until today.

Everything is still the same and I have not edited a single piece of code. 2-3 days ago it was working fine but now it returns all None when using: indicators.get_zig_zag.

Looking forward to your support.

Thanks very much.

incompatible test.pypi.org version number

The problem

When publishing to the test.pypi.org package manager, it's expecting PEP 440 standard version numbers, whereas we're using SemVer standards that allow for pre-release suffixes. See deployment, related to #322

Error message:

ERROR    HTTPError: 400 Bad Request from https://test.pypi.org/legacy/          
         '0.1.dev1+gb71369a' is an invalid value for Version. Error: Can't use  
         PEP 440 local versions. See                                            
         https://packaging.python.org/specifications/core-metadata for more     
         information.       

ZigZag Fatal error. System.AccessViolationException: Attempted to read or write protected memory.

Hello,

I am using the ZigZag indicator exactly as described here
https://python.stockindicators.dev/indicators/ZigZag/#content

quotes = [Quote(d,o,h,l,c,v) for d,o,h,l,c,v in zip(df['date'], df['open'], df['high'], df['low'], df['close'],df['vol'])]

zigzag_objects = indicators.get_zig_zag(quotes, EndType.HIGH_LOW, change)

I am inputting a DataFrame and if it's too large (beyond 20K rows), I'm getting increasing chances of seeing the below error.
At 50K+ rows, I'm yet to see the soft to not crash.
This is the error from the Python terminal.

Fatal error. Fatal error. System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. at Python.Runtime.Runtime.PyObject_TYPE(Python.Runtime.BorrowedReference) at Python.Runtime.Runtime.PyObject_TYPE(Python.Runtime.BorrowedReference) at Python.Runtime.Runtime.NullGCHandles(System.Collections.Generic.IEnumerable1)
at Python.Runtime.Runtime.NullGCHandles(System.Collections.Generic.IEnumerable1<IntPtr>) at Python.Runtime.Runtime.TryCollectingGarbage(Int32, Boolean) at Python.Runtime.Runtime.TryCollectingGarbage(Int32, Boolean) at Python.Runtime.Runtime.Shutdown() at Python.Runtime.Runtime.Shutdown() at Python.Runtime.PythonEngine.Shutdown() at Python.Runtime.PythonEngine.Shutdown() at Python.Runtime.Loader.Shutdown(IntPtr, Int32) at Python.Runtime.Loader.Shutdown(IntPtr, Int32)

I'm using Python 3.10.7

Style: way of method overloading

cc1

  • Real method overloading.
  • Needs a bit of dummy code since Python doesn't support method overloading.

cc2

  • More Python-like code.
  • No need dummy code.

Which one do you think better? Actually, I prefer (little bit) the second one. But I'd like to hear your thought :)

'Assembly' object is not subscriptable error importing "indicators"

The problem

I have installed stock_indicators using pip from jupyter/anaconda environment and the installation ended successfully. Regretfully, when I try to import "indicators" I got an error. The attempts to restart the kernel and restart the full anaconda environment after the library installation have been unsuccessful.

PS: repeated all the installation operations by the command line. Nothing changed.

Error message(s):

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Input In [12], in <cell line: 1>()
----> 1 from stock_indicators import indicators

File ~\anaconda3\lib\site-packages\stock_indicators\__init__.py:17, in <module>
      1 """
      2 Stock Indicators for Python
      3 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
   (...)
     14 library. A Stock Indicators for .NET is also available.
     15 """
---> 17 from stock_indicators import indicators
     18 from stock_indicators.indicators.common import *

File ~\anaconda3\lib\site-packages\stock_indicators\indicators\__init__.py:3, in <module>
      1 """All available APIs for calculating indicators."""
----> 3 from stock_indicators import _cslib
      5 from .adl import (get_adl)
      6 from .adx import (get_adx)

File ~\anaconda3\lib\site-packages\stock_indicators\_cslib\__init__.py:12, in <module>
      1 """
      2 Skender.Stock.Indicators
      3 ~~~~~~~~~~~~~~~~~~~~~~~~
   (...)
      8 It is currently using `.NET Standard 2.1`.
      9 """
     11 import os
---> 12 import clr
     14 skender_stock_indicators_dll_path = os.path.join(
     15     os.path.dirname(__file__),
     16     "lib/Skender.Stock.Indicators.dll"
     17 )
     18 clr.AddReference(skender_stock_indicators_dll_path)

File ~\anaconda3\lib\site-packages\clr.py:6, in <module>
      1 """
      2 Legacy Python.NET loader for backwards compatibility
      3 """
      5 from pythonnet import load
----> 6 load()

File ~\anaconda3\lib\site-packages\pythonnet\__init__.py:42, in load()
     38 dll_path = join(dirname(__file__), "runtime", "Python.Runtime.dll")
     40 _LOADER_ASSEMBLY = _RUNTIME.get_assembly(dll_path)
---> 42 func = _LOADER_ASSEMBLY["Python.Runtime.Loader.Initialize"]
     43 if func(''.encode("utf8")) != 0:
     44     raise RuntimeError("Failed to initialize Python.Runtime.dll")

TypeError: 'Assembly' object is not subscriptable

To Reproduce

In jupyter

pip install stock-indicators
[restart kernel, anaconda, PC, everything]
from stock_indicators import indicators

Release v0.5.0

New features are almost ready to be released.

Here's the checklist for releasing v0.5.0:

  • Add 10+ new indicators.
  • Write corresponding documentation and review. (#160 )
  • Add docstrings.
  • Update benchmarks.(#161 )
  • Final sanity check and code style.
  • Release to PyPI.
  • Apply release description to tag.

importing problem

The problem

I couldn't import the library and got this error:

ImportError: fail to import clr.
Stock Indicators for Python has dependency on pythonnet, which uses CLR.
Check that you have CLR installed. It's currently using .NET6.

i installed .net 6, pythonnet 3.0.2 as you mentioned, and also ckecked for DOTNET_ROOT.

everything seems OK but i still get this error.

Tests: update test data

It seems like that the file containing test data is changed into CSV from spread sheet.
Is it okay to keep using spread sheet file for our test?

Fractals not working.

Sample_Error.csv

The problem

Hi

I am trying to create fractal indicator, quotes are obtained from data frame.
Getting results as below:

fractals
<stock_indicators.indicators.fractal.FractalResult object at 0x00000054F93CBD90>
<stock_indicators.indicators.fractal.FractalResult object at 0x00000054F9404880>
<stock_indicators.indicators.fractal.FractalResult object at 0x00000054F94061A0>
<stock_indicators.indicators.fractal.FractalResult object at 0x00000054FA7867D0>

#Intitialize Fractal Indicator
quotes = [
    Quote(d,o,h,l,c,v) 
    for d,o,h,l,c,v 
    in zip(rates_frame['time'], rates_frame['open'], rates_frame['high'], rates_frame['low'], rates_frame['close'], rates_frame['tick_volume'])
]

# calculate Fractal
rates_frame['fractal'] = indicators.get_fractal(quotes, 5)

#Save to CSV file
rates_frame.to_csv('Sample_Error.csv')

RuntimeError: Could not find libmono

The problem

Using python 3.9 and stock-indicators v0.8.1, installed using pip on Ubuntu 20.04, I get

Error message(s):

RuntimeError: Could not find libmono

The problem seems to originate from pythonnet (pip automatically installs v3.0.0a1 for me). Traceback below.

To Reproduce

Simply using import statements such as import stock_indicators or from stock_indicators.indicators.common.quote import Quote

Full traceback:

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
Input In [1], in <cell line: 1>()
----> 1 import stock_indicators

File ~/miniconda3/envs/trading/lib/python3.9/site-packages/stock_indicators/__init__.py:17, in <module>
      1 """
      2 Stock Indicators for Python
      3 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
   (...)
     14 library. A Stock Indicators for .NET is also available.
     15 """
---> 17 from stock_indicators import indicators
     18 from stock_indicators.indicators.common import *

File ~/miniconda3/envs/trading/lib/python3.9/site-packages/stock_indicators/indicators/__init__.py:3, in <module>
      1 """All available APIs for calculating indicators."""
----> 3 from stock_indicators import _cslib
      5 from .adl import (get_adl)
      6 from .adx import (get_adx)

File ~/miniconda3/envs/trading/lib/python3.9/site-packages/stock_indicators/_cslib/__init__.py:12, in <module>
      1 """
      2 Skender.Stock.Indicators
      3 ~~~~~~~~~~~~~~~~~~~~~~~~
   (...)
      8 It is currently using `.NET Standard 2.1`.
      9 """
     11 import os
---> 12 import clr
     14 skender_stock_indicators_dll_path = os.path.join(
     15     os.path.dirname(__file__),
     16     "lib/Skender.Stock.Indicators.dll"
     17 )
     18 clr.AddReference(skender_stock_indicators_dll_path)

File ~/miniconda3/envs/trading/lib/python3.9/site-packages/clr.py:6, in <module>
      1 """
      2 Legacy Python.NET loader for backwards compatibility
      3 """
      5 from pythonnet import load
----> 6 load()

File ~/miniconda3/envs/trading/lib/python3.9/site-packages/pythonnet/__init__.py:36, in load()
     31 from os.path import join, dirname
     33 if _RUNTIME is None:
     34     # TODO: Warn, in the future the runtime must be set explicitly, either
     35     # as a config/env variable or via set_runtime
---> 36     set_default_runtime()
     38 dll_path = join(dirname(__file__), "runtime", "Python.Runtime.dll")
     40 _LOADER_ASSEMBLY = _RUNTIME.get_assembly(dll_path)

File ~/miniconda3/envs/trading/lib/python3.9/site-packages/pythonnet/__init__.py:22, in set_default_runtime()
     20     set_runtime(clr_loader.get_netfx())
     21 else:
---> 22     set_runtime(clr_loader.get_mono())

File ~/miniconda3/envs/trading/lib/python3.9/site-packages/clr_loader/__init__.py:21, in get_mono(domain, config_file, global_config_file, libmono, sgen, debug, jit_options)
     18 from .mono import Mono
     20 if libmono is None:
---> 21     libmono = find_libmono(sgen)
     23 impl = Mono(
     24     domain=domain,
     25     debug=debug,
   (...)
     29     libmono=libmono,
     30 )
     31 return Runtime(impl)

File ~/miniconda3/envs/trading/lib/python3.9/site-packages/clr_loader/util/find.py:67, in find_libmono(sgen)
     64     path = find_library(unix_name)
     66 if path is None:
---> 67     raise RuntimeError("Could not find libmono")
     69 return path

RuntimeError: Could not find libmono

Refactor test data

It seems like the test data including whole period of results for each indicator is ready to be used. If it is correct, I'm planning to write unit tests using xlsx files in each indicator directory. Is it available now?

migrate build & release to GitHub Actions

We've recently migrated the .NET project to GitHub Actions for build and environment based deployments. Given the recent need to honor Azure DevOps security recommendations, it would require some work to appropriately setup the ability to build from Forks; so it's a good time to make this change now anyway. We'd seen the build not trigger in #318

Support comparison between C# enum with `int`

To support comparison between C# enum with int, the wrapper Enum class should be the subclass of IntEnum. But for now, it is hard to fetch int value from C# enum member.

Fortunately, the next release of pythonnet will enable int(enum.member) to get value from enum. We'll be able to support this feature after bumping pythonnet to 3.0.0.

Related issue

Auto-increment versions in build

One thing I'm going to want to do in the build before we do a public publish is to auto-update the version number in the build process. The GitVersion build task produces an environment variable $(GitVersion.MajorMinorPatch) that I think we can use to text replace version="0.0.0" in setup.py. I'm not sure of the best way to do that with Python commands; however, the worst case is we just do a straight text replacement in the setup.py file in the build process. I'd like the build system to manage the version numbers and not rely on manually updating setup.py.

Ref: https://gitversion.net/docs/reference/variables
Observed in #28

`IEnumerable` won't be auto-converted in pythonnet 3.0.0

The problem

Pythonnet will not convert IEnumerable of C# to list of Python anymore from the version 3.0.0.
Our _verify_data() method checks the data is subclass of list or not and so it'll never be passed.
That means testcases will be failed if we use pythonnet 3.0.0.

https://github.com/DaveSkender/Stock.Indicators.Python/blob/36c45c5d118d360e4a40650996cee1690fe329f0/stock_indicators/indicators/common/results.py#L57

Related Issue

Install error 'The version specified ('egg_info') is an invalid version'

The problem

Hi, first of all thanks for the great work! I am running Freqtrade via docker and wanted to import your indicators into my strategy. I am using a custom dockerfile to install stock-indicators. I couldnt install the version from PyPI (pip3 install stock-indicators) because it's still using pythonnet==2.5.2 which throws an error during install. Now i'm cloning the git repo and try to install it from the repo directly. I got a step further including the following lines in my custom dockerfile but unfortunately i still can't install stock-indicators.

Dockerfile.custom:

FROM freqtradeorg/freqtrade:develop

# Switch user to root if you must install something from apt
# Don't forget to switch the user back below!
USER root
RUN apt-get install git -y
USER ftuser

# Install pandas-ta
RUN pip install pandas_ta

# Requirements for stock-indicators 
# https://github.com/DaveSkender/Stock.Indicators.Python
RUN git clone https://github.com/DaveSkender/Stock.Indicators.Python.git
RUN pip3 install Stock.Indicators.Python/

Error message(s):

Step 6/7 : RUN git clone https://github.com/DaveSkender/Stock.Indicators.Python.git
 ---> Running in 5b711150edb1
Cloning into 'Stock.Indicators.Python'...
Removing intermediate container 5b711150edb1
 ---> 991ad892e105
Step 7/7 : RUN pip3 install Stock.Indicators.Python/
 ---> Running in f484901aff58
Defaulting to user installation because normal site-packages is not writeable
Processing ./Stock.Indicators.Python
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'error'
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [8 lines of output]
      /home/ftuser/.local/lib/python3.9/site-packages/setuptools/dist.py:530: UserWarning: The version specified ('egg_info') is an invalid version, this may not work as expected with newer versions of setuptools, pip, and PyPI. Please see PEP 440 for more details.
        warnings.warn(
      usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
         or: setup.py --help [cmd1 cmd2 ...]
         or: setup.py --help-commands
         or: setup.py cmd --help
      
      error: option --egg-base not recognized
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
The command '/bin/sh -c pip3 install Stock.Indicators.Python/' returned a non-zero code: 1
ERROR: Service 'freqtrade_dev1_bin_dry' failed to build : Build failed

Versions:
python: 3.9.9
pip3: 22.0.4
setuptools: 61.2.0

Thanks for your help.

Migrate test data from `.xlsx` to `.csv`

We are currently using the test data from spread sheet(.xlsx) and going to migrate it to .csv file.

  1. The data should be separated by "sheet" and saved as .csv.
  2. conftest.py has to be changed to read .csv data.

This update is not urgent or strictly required. But PR is always welcome.

getting all is None when using ZigZag Indicator

When using the zigzag indicator, only None is returned

RatesM5 = MT5.copy_rates_from_pos(Pair, M5, 0, 100)
FrameRatesM5 = PD.DataFrame(RatesM5)
QuotesList = [
                            Quote(d,h,l) 
                            for d,h,l
                            in zip(FrameRatesM5['datetime'], FrameRatesM5['high'], FrameRatesM5['low'])
                           ]
ZigzagM5 = indicators.get_zig_zag(QuotesList, EndType.HIGH_LOW, 2)
             for X in range(0, len(ZigzagM5), 1):
                 print(ZigzagM5[X].zig_zag,' ',ZigzagM5[X].date,' ',ZigzagM5[X].retrace_high,' ',ZigzagM5[X].retrace_low)

Having Issue with Setup

I installed the library with "pip install stock-indicators". However, when I try to import the library, it get a report like below:


OSError Traceback (most recent call last)
/var/folders/zw/301wrgp50nb4395pkp_f9xrm0000gn/T/ipykernel_58482/357114019.py in
----> 1 from stock_indicators import indicators

~/opt/anaconda3/lib/python3.9/site-packages/stock_indicators/init.py in
15 """
16
---> 17 from stock_indicators import indicators
18 from stock_indicators.indicators.common import *

~/opt/anaconda3/lib/python3.9/site-packages/stock_indicators/indicators/init.py in
1 """All available APIs for calculating indicators."""
2
----> 3 from stock_indicators import _cslib
4
5 from .adl import (get_adl)

~/opt/anaconda3/lib/python3.9/site-packages/stock_indicators/_cslib/init.py in
10
11 import os
---> 12 import clr
13
14 skender_stock_indicators_dll_path = os.path.join(

~/opt/anaconda3/lib/python3.9/site-packages/clr.py in
4
5 from pythonnet import load
----> 6 load()

~/opt/anaconda3/lib/python3.9/site-packages/pythonnet/init.py in load()
34 # TODO: Warn, in the future the runtime must be set explicitly, either
35 # as a config/env variable or via set_runtime
---> 36 set_default_runtime()
37
38 dll_path = join(dirname(file), "runtime", "Python.Runtime.dll")

~/opt/anaconda3/lib/python3.9/site-packages/pythonnet/init.py in set_default_runtime()
20 set_runtime(clr_loader.get_netfx())
21 else:
---> 22 set_runtime(clr_loader.get_mono())
23
24

~/opt/anaconda3/lib/python3.9/site-packages/clr_loader/init.py in get_mono(config_file, global_config_file, libmono, sgen, debug, jit_options)
56 libmono = find_libmono(sgen=sgen)
57
---> 58 impl = Mono(
59 # domain=domain,
60 debug=debug,

~/opt/anaconda3/lib/python3.9/site-packages/clr_loader/mono.py in init(self, libmono, domain, debug, jit_options, config_file, global_config_file)
28 self._assemblies: Dict[Path, Any] = {}
29
---> 30 self._version = initialize(
31 config_file=optional_path_as_string(config_file),
32 debug=debug,

~/opt/anaconda3/lib/python3.9/site-packages/clr_loader/mono.py in initialize(libmono, debug, jit_options, config_file, global_config_file)
125 global _MONO, _ROOT_DOMAIN
126 if _MONO is None:
--> 127 _MONO = load_mono(libmono)
128
129 # Load in global config (i.e /etc/mono/config)

~/opt/anaconda3/lib/python3.9/site-packages/clr_loader/ffi/init.py in load_mono(path)
38
39 path_str = str(path) if path else None
---> 40 return ffi.dlopen(path_str, ffi.RTLD_GLOBAL)
41
42

~/opt/anaconda3/lib/python3.9/site-packages/cffi/api.py in dlopen(self, name, flags)
148 "or an already-opened 'void *' handle")
149 with self._lock:
--> 150 lib, function_cache = _make_ffi_library(self, name, flags)
151 self._function_caches.append(function_cache)
152 self._libraries.append(lib)

~/opt/anaconda3/lib/python3.9/site-packages/cffi/api.py in _make_ffi_library(ffi, libname, flags)
830 def _make_ffi_library(ffi, libname, flags):
831 backend = ffi._backend
--> 832 backendlib = _load_backend_lib(backend, libname, flags)
833 #
834 def accessor_function(name):

~/opt/anaconda3/lib/python3.9/site-packages/cffi/api.py in _load_backend_lib(backend, name, flags)
825 if first_error is not None:
826 msg = "%s. Additionally, %s" % (first_error, msg)
--> 827 raise OSError(msg)
828 return backend.load_library(path, flags)
829

OSError: cannot load library '/Library/Frameworks/Mono.framework/Versions/Current/lib/libmonosgen-2.0.dylib': dlopen(/Library/Frameworks/Mono.framework/Versions/Current/lib/libmonosgen-2.0.dylib, 0x000A): tried: '/Library/Frameworks/Mono.framework/Versions/Current/lib/libmonosgen-2.0.dylib' (no such file), '/usr/local/lib/libmonosgen-2.0.dylib' (no such file), '/usr/lib/libmonosgen-2.0.dylib' (no such file). Additionally, ctypes.util.find_library() did not manage to locate a library called '/Library/Frameworks/Mono.framework/Versions/Current/lib/libmonosgen-2.0.dylib'

When I try to install with setup.py, I got a warning about the version not being supported, what can I do?

Release v0.3.0

New features are almost ready to be released.

Here's the checklist for releasing v0.3.0:

  • Add 10+ new indicators.
  • Write corresponding documentation and review. (#122)
  • Add docstrings.
  • Final sanity check and code style.
  • Release to PyPI.
  • Apply release description to tag.

What´s the right way to create the iterable "quotes" list from a dataframe?

I use another python TA module and wanted to compare it with this module, but I am already having problems at the beginning.

I can download historical quotes from IBKR into a dataframe "hist_quotes". The df looks like this:

date open high low close volume
954 2022-05-07 01:54:00 3.26 3.27 3.250 3.2599 7600.0
955 2022-05-07 01:55:00 3.26 3.26 3.250 3.2600 3900.0
956 2022-05-07 01:56:00 3.26 3.26 3.250 3.2500 300.0
957 2022-05-07 01:57:00 3.25 3.26 3.230 3.2300 17900.0
958 2022-05-07 01:58:00 3.25 3.27 3.245 3.2600 12500.0
...

The quotes parameter has be of type "Iterable[Quote]", so I converted the df to a list:
quotes = hist_quotes.values.tolist()

and then call the indicator
results = indicators.get_kvo(quotes, 34,55,13)

which breaks off with an error:

Python.Runtime.PythonException: 'list' value cannot be converted to Skender.Stock.Indicators.Quote

The content of "quotes" looks like this and it is iterable:

[[Timestamp('2022-05-06 10:00:00'), 3.23, 3.63, 3.23, 3.61, 98300.0], [Timestamp('2022-05-06 10:01:00'), 3.61, 3.63, 3.55, 3.62, 68900.0], [Timestamp('2022-05-06 10:02:00'), 3.62, 3.63, 3.51, 3.51, 65400.0], ....

I read every post available on this topic on stackoverflow and also tried different ways to create the quotes -- df.to_records(), df.to_dict(), iter(), ... but everything failed.

So, I am a little stuck... I guess the solution is rather simple, could someone show please help me with the right way? What am I missing?

Need to update Beta

Need to add wrappers for new attributes in Beta

  • beta_up
  • beta_down
  • ratio
  • convexity

Chore: update initial README and Guide docs

As we migrated out of the main Stock.Indicators repo, we copied over the README.md and GUIDE.md files that contain C# code examples. We'll need to update these to appropriate Python equivalents. Noted in #1.

CLR error on import stock_indicators

MacOS 13.3.1 - Python 3.11.3 - stock_indicators 1.0.1

import stock_indicators throws this error:

Exception has occurred: ImportError
fail to import clr.
Stock Indicators for Python has dependency on pythonnet, which uses CLR.
Check that you have CLR installed. It's currently using .NET6.
.NET:
	https://dotnet.microsoft.com/en-us/download/dotnet
RuntimeError: Can not determine dotnet root

The above exception was the direct cause of the following exception:

RuntimeError: Failed to create a .NET runtime (coreclr) using the
                parameters {'runtime_config': '/usr/local/lib/python3.11/site-packages/stock_indicators/_cslib/runtimeconfig.json'}

Python 3.10.11 works as excepted but not in a virtual environment.

Initial release v0.1.0

@LeeDongGeon1996 now that you've been able to establish a decent baseline approach, let's discuss some of the next steps towards an initial release and making the repo public. I'd like to do this once we have a core of about 15 of the most popular indicators implemented and working well so we can both start getting user feedback and potentially more community contribution.

To get to an initial v0.1.0 launch, here's what I think we need:

  • 10-15 of the most popular indicators (I've sorted these in the Backlog)
  • Build that produces unit tests, code coverage, and a candidate release package
  • #38
  • General documentation on usage - #53
  • Release to Internal package manager on Azure Artifacts -- this will allow us to get a true Preview and end-use scenario
  • Make repo public
  • Final sanity check on the usability of the actual package
  • Finalize release pipeline and release to PyPI
  • add links to PyPI page in docs and launch doc site - #73
  • Move on, to implement full register of indicators

After we get there, we'll have a good pipeline approach to doing periodic batch releases. Thoughts?

Init documentation

I think that, for the documentation for Python version, what we just need to do is fine-tuning its C# documentation. So I'm going to copy doc files to start writing docs. So it'll be appreciated if you can setup github-page so that we can see the preview while writing. Is there any other thought about it?

Release v0.4.0

New features are almost ready to be released.

Here's the checklist for releasing v0.4.0:

  • Add 10+ new indicators.
  • Write corresponding documentation and review. (#143 )
  • Add docstrings.
  • Update benchmarks.(#145 )
  • Final sanity check and code style.
  • Release to PyPI.
  • Apply release description to tag.

Catch up on all new features up to v2.5.0 of DLL

v1.2.0

v1.3.0

Release v0.8.0

New features are almost ready to be released.

Here's the checklist for releasing v0.8.0:

  • Add enough new features, such as new indicators or new params.
  • Write corresponding documentation and review. (#231 )
  • Add docstrings.
  • Update benchmarks.(#233 )
  • Final sanity check and code style.
  • Release to PyPI.
  • Apply release description to tag.

fail to import clr

my python version is Python 3.10.4
I installed .net6.0 and stock-indicator, but when running 'import from stock_indicators import indicators', still showed the below error messages:

ImportError: fail to import clr.
Stock Indicators for Python has dependency on pythonnet, which uses CLR.
Check that you have CLR installed. It's currently using .NET6.
.NET:
https://dotnet.microsoft.com/en-us/download/dotnet

Release v0.7.0

Only few more steps are left for official v0.7.0 release.

Here's the checklist for releasing v0.7.0:
(Please feel free to add more items)

  • Add remaining indicators.
  • Write corresponding documentation and review. (#209 )
  • Add docstrings.
  • Update benchmarks.(#210 )
  • Final sanity check and code style.
  • Release to PyPI.
  • Apply release description to tag.

refactor: Pages use of GH template, jemoji gem

When updating the Cloudflare Pages deployer (#323), I noticed we were still using remote_theme: pages-themes/[email protected] in the config.yml file. I'd done some work to cleanup (simplify) the general jekyll build on the .NET doc site so it didn't need one of these GitHub Pages unique templates, so we can apply that same refactoring here. To do:

  • add more instructions for developers in contributing.md
  • remove remote_theme: pages-themes/[email protected] templates, similar to .NET project
  • update general stylesheets similarly as well
  • replace use of jemoji gem and GitHub emoji syntax, in favor of plain ASCII emoji (see .NET project)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.