From 1d52c20e897da4affbda92f5328a58a861dd35c8 Mon Sep 17 00:00:00 2001 From: nanoric Date: Mon, 18 Feb 2019 22:29:59 -0400 Subject: [PATCH 1/4] [Mod] requirements.txt: ta-lib for windows use whl from www.lfd.uci.edu --- requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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" From 20e4ef6c6e9f181db35095e9cd084e4d22b6dda7 Mon Sep 17 00:00:00 2001 From: nanoric Date: Mon, 18 Feb 2019 05:40:15 -0400 Subject: [PATCH 2/4] [Add] added setup.py --- setup.py | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 setup.py diff --git a/setup.py b/setup.py new file mode 100644 index 00000000..43391004 --- /dev/null +++ b/setup.py @@ -0,0 +1,39 @@ +from setuptools import Extension, find_packages, setup + +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=[], + 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=[], + extra_link_args=[], + depends=[], + language="cpp", + ) + +setup( + name="vnpy", + version="2.0.dev0", + packages=find_packages(exclude=["tests", "tests.*", "*.tests.*"]), + ext_modules=[vnctptd, vnctpmd], +) From 762e7781997ad6dffdb4f8600c86dc62f07ce8ff Mon Sep 17 00:00:00 2001 From: nanoric Date: Mon, 18 Feb 2019 22:39:23 -0400 Subject: [PATCH 3/4] [Add] setup.py: added linux support --- setup.py | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index 43391004..a49ce40a 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,12 @@ +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", @@ -10,7 +17,7 @@ vnctpmd = Extension('vnpy.api.ctp.vnctpmd', library_dirs=["vnpy/api/ctp/libs"], libraries=["thostmduserapi", "thosttraderapi", ], # runtime_library_dirs=["vnpy/api/ctp/libs", ], - extra_compile_args=[], + extra_compile_args=compiler_flags, extra_link_args=[], depends=[], language="cpp", @@ -25,15 +32,22 @@ vnctptd = Extension('vnpy.api.ctp.vnctptd', library_dirs=["vnpy/api/ctp/libs"], libraries=["thostmduserapi", "thosttraderapi", ], # runtime_library_dirs=["vnpy/api/ctp/libs", ], - extra_compile_args=[], + extra_compile_args=compiler_flags, extra_link_args=[], depends=[], language="cpp", ) -setup( +pkgs = find_packages() + +s = setup( name="vnpy", version="2.0.dev0", - packages=find_packages(exclude=["tests", "tests.*", "*.tests.*"]), + include_package_data=True, + packages=pkgs, + package_data={'': [ + '*.json', '*.md', '*.ico', + '*.dll', '*.so', + ]}, ext_modules=[vnctptd, vnctpmd], ) From 6690af6f9950f58c051fb8cc2abd75611ca2f082 Mon Sep 17 00:00:00 2001 From: nanoric Date: Mon, 18 Feb 2019 22:42:12 -0400 Subject: [PATCH 4/4] [Mod] api.ctp.vnctp.vnctp.h: added some include for gcc(linux) support --- vnpy/api/ctp/vnctp/vnctp.h | 2 ++ 1 file changed, 2 insertions(+) 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"