Beispiel #1
0
    package_data.append("*.dll")

CTP_HEADER = CTP_LIB

common_args = {
    "cython_include_dirs": [CYTHON2C_HEADER, C2CYTHON_HEADER],
    "include_dirs": [CTP_HEADER, C2CYTHON_HEADER],
    "library_dirs": [CTP_LIB],
    "language": "c++",
    "extra_compile_args": extra_compile_args,
    "extra_link_args": extra_link_args,
}

ext_modules = [
    Cython_Extension(name=PRJ_NAME + ".MdApi",
                     sources=[PRJ_NAME + "/MdApi.pyx"],
                     libraries=["thostmduserapi"],
                     **common_args),
    Cython_Extension(name=PRJ_NAME + ".TraderApi",
                     sources=[PRJ_NAME + "/TraderApi.pyx"],
                     libraries=["thosttraderapi"],
                     **common_args)
]

setup(
    name=PRJ_NAME,
    version=CTP_Version,
    description=CTP_Version,
    long_description=codecs.open("README.md", encoding="utf-8").read(),
    long_description_content_type='text/markdown',
    license="LGPLv3",
    keywords="SimNow,CTP,Future,SHFE,Shanghai Future Exchange",
Beispiel #2
0
if sys.platform in ["linux", "win32"]:
    copy_tree(lib_dir, project_dir)

common_args = {
    "cython_include_dirs": [cython_headers],
    "include_dirs": [header_dir, cpp_header_dir],
    "library_dirs": [lib_dir],
    "language": "c++",
    "extra_compile_args": extra_compile_args,
    "extra_link_args": extra_link_args,
}

ext_modules = [
    Cython_Extension(name="ctpwrapper.MdApi",
                     sources=["ctpwrapper/MdApi.pyx"],
                     libraries=["thostmduserapi_se"],
                     **common_args),
    Cython_Extension(name="ctpwrapper.TraderApi",
                     sources=["ctpwrapper/TraderApi.pyx"],
                     libraries=["thosttraderapi_se"],
                     **common_args),
    Cython_Extension(name="ctpwrapper.datacollect",
                     sources=["ctpwrapper/datacollect.pyx"],
                     libraries=["LinuxDataCollect"]
                     if sys.platform == "linux" else ["WinDataCollect"],
                     **common_args)
]

setup(
    name="ctpwrapper",
    version=find_version("ctpwrapper", "__init__.py"),
Beispiel #3
0
if sys.platform in ["linux", "win32", "darwin"]:
    copy_tree(lib_dir, project_dir)

common_args = {
    "cython_include_dirs": [cython_headers],
    "include_dirs": [header_dir, cpp_header_dir],
    "library_dirs": [project_dir],
    "language": "c++",
    "extra_compile_args": extra_compile_args,
    "extra_link_args": extra_link_args,
}

ext_modules = [
    Cython_Extension(name="xtpwrapper.quote_api",
                     sources=["xtpwrapper/quote_api.pyx"],
                     libraries=["xtpquoteapi"],
                     **common_args),
    Cython_Extension(name="xtpwrapper.trader_api",
                     sources=["xtpwrapper/trader_api.pyx"],
                     libraries=["xtptraderapi"],
                     **common_args)
]

setup(
    name="xtpwrapper",
    version=find_version("xtpwrapper", "__init__.py"),
    description="XTP client v1.1.18.13",
    long_description=codecs.open("README.rst", encoding="utf-8").read(),
    license="LGPLv3",
    keywords="XTP,China Stock API",
    author="Winton Wang",
Beispiel #4
0
    sys.exit(1)

common_args = {
    "cython_include_dirs": [CYTHON2C_HEADER, C2CYTHON_HEADER],
    "include_dirs": [CTP_LIB, C2CYTHON_HEADER],
    "library_dirs": [CTP_LIB],
    "language": "c++",
    "extra_compile_args": extra_compile_args,
    "extra_link_args": extra_link_args,
}

l_setup_ext_modules = cythonize([
    Cython_Extension(name="AlgoPlus.CTP.MdApi",
                     sources=[
                         os.path.join(BASE_DIR, SRC_NAME, PRJ_NAME, API_NAME,
                                      "MdApi.pyx")
                     ],
                     libraries=["thostmduserapi_se"],
                     **common_args),
    Cython_Extension(name="AlgoPlus.CTP.TraderApi",
                     sources=[
                         os.path.join(BASE_DIR, SRC_NAME, PRJ_NAME, API_NAME,
                                      "TraderApi.pyx")
                     ],
                     libraries=["thosttraderapi_se"],
                     **common_args)
],
                                compiler_directives={
                                    'language_level': 3,
                                    "binding": True
                                })
Beispiel #5
0
if sys.platform in ["linux", "win32"]:
    copy_tree(lib_dir, project_dir)

common_args = {
    "cython_include_dirs": [cython_headers],
    "include_dirs": [header_dir, cpp_header_dir],
    "library_dirs": [lib_dir],
    "language": "c++",
    "extra_compile_args": extra_compile_args,
    "extra_link_args": extra_link_args,
}

ext_modules = [
    Cython_Extension(name="ctpwrapper.MdApi",
                     sources=["ctpwrapper/MdApi.pyx"],
                     libraries=["thostmduserapi"],
                     **common_args),
    Cython_Extension(name="ctpwrapper.TraderApi",
                     sources=["ctpwrapper/TraderApi.pyx"],
                     libraries=["thosttraderapi"],
                     **common_args)
]


class BuildExt(build_ext):
    def build_extensions(self):
        # fix waring
        # cc1plus: warning: command line option ‘-Wstrict-prototypes’ is
        # valid for C/ObjC but not for C++ [enabled by default]
        if sys.platform == "linux":
            self.compiler.compiler_so.remove('-Wstrict-prototypes')
Beispiel #6
0
    copy_tree(lib_dir, project_dir)

common_args = {
    'cython_include_dirs': [cython_headers],
    'include_dirs': [headers, cpp_headers],
    'library_dirs': [lib_dir],
    "language": "c++",
    "extra_compile_args": extra_compile_args,
    "extra_link_args": extra_link_args
}

# Cython extension modules (foreign language modules)
ext_modules = [
    Cython_Extension(
        name="ctpwrapper.MdApi",
        sources=['ctpwrapper/MdApi.pyx'
                 ],  # relative to base dir # pxd will be automatically parsed
        libraries=['thostmduserapi'],  # No lib
        **common_args),
    Cython_Extension(name="ctpwrapper.TraderApi",
                     sources=['ctpwrapper/TraderApi.pyx'],
                     libraries=['thosttraderapi'],
                     **common_args)
]

# todo language level
'''
Language level

The str type is special in that it is the byte string in Python 2 and the Unicode string in Python 3 (for Cython code 
compiled with language level 2, i.e. the default). Meaning, it always corresponds exactly with the type that the Python
runtime itself calls str. Thus, in Python 2, both bytes and str represent the byte string type, whereas in Python 3,