diff --git a/requirements.txt b/requirements.txt index 60d525eb..bcfdc694 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,6 +8,6 @@ pandas matplotlib seaborn jupyter -#ta-lib -#https://download.lfd.uci.edu/pythonlibs/r5uhg2lo/TA_Lib-0.4.17-cp37-cp37m-win_amd64.whl +ta-lib; platform_system=="Unix" +https://download.lfd.uci.edu/pythonlibs/r5uhg2lo/TA_Lib-0.4.17-cp37-cp37m-win_amd64.whl; platform_system=="Windows" diff --git a/setup.py b/setup.py new file mode 100644 index 00000000..a49ce40a --- /dev/null +++ b/setup.py @@ -0,0 +1,53 @@ +import platform + +from setuptools import Extension, find_packages, setup + +if platform.uname().system == "Windows": + compiler_flags = [] +else: + compiler_flags = ['-std=c++11', '-Wno-delete-incomplete'] + +vnctpmd = Extension('vnpy.api.ctp.vnctpmd', + [ + "vnpy/api/ctp/vnctp/vnctpmd/vnctpmd.cpp", + ], + include_dirs=["vnpy/api/ctp/include", "vnpy/api/ctp/vnctp", ], + define_macros=[], + undef_macros=[], + library_dirs=["vnpy/api/ctp/libs"], + libraries=["thostmduserapi", "thosttraderapi", ], + # runtime_library_dirs=["vnpy/api/ctp/libs", ], + extra_compile_args=compiler_flags, + extra_link_args=[], + depends=[], + language="cpp", + ) +vnctptd = Extension('vnpy.api.ctp.vnctptd', + [ + "vnpy/api/ctp/vnctp/vnctptd/vnctptd.cpp", + ], + include_dirs=["vnpy/api/ctp/include", "vnpy/api/ctp/vnctp", ], + define_macros=[], + undef_macros=[], + library_dirs=["vnpy/api/ctp/libs"], + libraries=["thostmduserapi", "thosttraderapi", ], + # runtime_library_dirs=["vnpy/api/ctp/libs", ], + extra_compile_args=compiler_flags, + extra_link_args=[], + depends=[], + language="cpp", + ) + +pkgs = find_packages() + +s = setup( + name="vnpy", + version="2.0.dev0", + include_package_data=True, + packages=pkgs, + package_data={'': [ + '*.json', '*.md', '*.ico', + '*.dll', '*.so', + ]}, + ext_modules=[vnctptd, vnctpmd], +) diff --git a/vnpy/api/ctp/vnctp/vnctp.h b/vnpy/api/ctp/vnctp/vnctp.h index d70bfd78..5e0eb69d 100644 --- a/vnpy/api/ctp/vnctp/vnctp.h +++ b/vnpy/api/ctp/vnctp/vnctp.h @@ -4,6 +4,8 @@ #include #include #include +#include +#include #include "pybind11/pybind11.h"