PythonStock (18): Use docker to install the quantlib source code & amp; lib library, and pythonstockdocker

Source: Internet
Author: User
Tags automake

PythonStock (18): Use docker to install the quantlib source code & lib library, and pythonstockdocker
Preface

Develop a stock project using Python.
Project address:
Https://github.com/pythonstock/stock
Related information:
Http://blog.csdn.net/freewebsys/article/details/78294566
The main development language is python.
The lib library used is pandas, tushare, TensorFlow, tornado, etc.

The connection of the original article is: http://blog.csdn.net/freewebsys/article/details/79031223
Reprinted without the consent of the blogger.
The master address is: http://blog.csdn.net/freewebsys

1. About quantlib

QuantLib is a C ++ library that focuses on Quantitative Finance computing and development.
A very large lib library.
The official website is:
Http://quantlib.org/index.shtml
The core code is written in c ++ and is encapsulated using swig. It supports many languages such as python and java.
Github Project address:
Https://github.com/lballabio/quantlib
Is a BSD open-source project.
Learning documents:
Http://gouthamanbalaraman.com/blog/quantlib-python-tutorials-with-examples.html
There are quite a few documents about quantlib, but this guy wrote it comprehensively. I will study it later.

2. Compile and install quantlib

Linux installation documentation:
Http://quantlib.org/install/linux-python.shtml

First, prepare the libboost library.
Then compile quantlib and find that the compilation time is too long.
From some problems in compilation, to finding and trying. It took a lot of time:
The installation script is as follows:

cd /root echo "############ 1 download file ############ "curl -o QuantLib-1.11.tar.gz https://codeload.github.com/lballabio/QuantLib/tar.gz/QuantLib-v1.11curl -o QuantLib-SWIG-1.11.tar.gz https://codeload.github.com/lballabio/QuantLib-SWIG/tar.gz/QuantLib-SWIG-v1.11echo "############ 2 install ubuntu libs ############ "apt-get update && apt-get install -y python-dev swig automake autoconf libtool libboost-all-dev#echo "############ 3 uncompress tar files ############ "tar -zxvf QuantLib-1.11.tar.gz && tar -zxvf QuantLib-SWIG-1.11.tar.gz echo "############ 5 install quantlib ############ "cd QuantLib-QuantLib-v1.11 && ./autogen.sh && \./configure && make && make install && ldconfigecho "############ 5 install quantlib-python3 ############ "cd ../QuantLib-SWIG-QuantLib-SWIG-v1.11 && ./autogen.sh && ./configure PYTHON=/usr/bin/python3 && \make -C Python && make -C Python installecho "############ 6 rm tmp files ############ "rm -rf /root/QuantLib-QuantLib-v1.11 /root/QuantLib-SWIG-QuantLib-SWIG-v1.11rm -f /root/QuantLib-1.11.tar.gz /root/QuantLib-SWIG-1.11.tar.gz

It's just a compilation. I don't know why it's so time-consuming.
It took me an hour to compile quantlib. I did it all at night to compile QuantLib-SWIG.
Then I will check it again the next day.

3. Compile a docker Image
# It takes several hours to compile and wait. RUN cd/root & curl-o QuantLib-1.11.tar.gz https://codeload.github.com/lballabio/QuantLib/tar.gz/QuantLib-v1.11 & \ Curl-o QuantLib-SWIG-1.11.tar.gz https://codeload.github.com/lballabio/QuantLib-SWIG/tar.gz/QuantLib-SWIG-v1.11 & \ Apt-get update & apt-get install-y python-dev swig automake autoconf libtool libboost-all-dev & \ tar-zxvf QuantLib-1.11.tar.gz & tar-zxvf QuantLib-SWIG-1.11.tar.gz & \ cd QuantLib-QuantLib-v1.11 &&. /autogen. sh &&. /configure & make install & ldconfig # is converted into two tasks to prevent the second task from being failed. RUN cd/root/QuantLib-SWIG-QuantLib-SWIG-v1.11 &&. /autogen. sh &&. /configure PYTHON =/usr/bin/python3 & \ make-C Python & make-C Python install & apt-get remove-y python-dev swig automake autoconf libtool & & \ rm-rf/root/QuantLib-QuantLib-v1.11 & rm-rf/root/QuantLib-SWIG-QuantLib-SWIG-v1.11 & \ rm-f/root/QuantLib-1.11.tar.gz/root/QuantLib-SWIG-1.11.tar.gz

After compilation, you can use:

>>> import QuantLib as ql >>> print(ql.__version__)1.11
4. Install Python 2 directly

If the python 2 environment is used, use apt-get for installation:

apt-get install -y quantlib-python 

After the installation is complete, version 1.7 was released on July 15, 2015.

>>> import QuantLib as ql>>> print(ql.__version__)1.7

The latest version is 1.11. If you want to install the latest version, you must install the source code.
To facilitate the installation, you must install apt-get quickly.

5. Summary

Quantlib compilation has no technical content, that is, it takes too long to compile.
There is no problem with the latest 1.11 version.

The connection of the original article is: http://blog.csdn.net/freewebsys/article/details/79031223
Reprinted without the consent of the blogger.
The master address is: http://blog.csdn.net/freewebsys

Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger. Master Address: http://blog.csdn.net/freewebsys http://blog.csdn.net/freewebsys/article/details/79031223

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.