Price difference analysis of the Python Arbitrage series--python Learning notes 22

Source: Internet
Author: User
# # #套利分析
Import Pandas as PD
Import NumPy as NP
Caipo=pd.read_excel (' caipo.xlsx ')
Doupo=pd.read_excel (' doupo.xlsx ')
Caipo.head (5)
Caipo_close.head ()
Doupo_close.head ()
Cc.mean ()
Dc.mean ()
I=dc.mean ()/cc.mean ()
E.head ()

E.plot () ""

#发现基于均值比例的模型随机性太强, we recalculate based on the correlation coefficient.
Cc.corr (dc,method= ' Pearson ')
#从相关系数来看, the correlation between the two is very high, 94%;
#菜粕和豆粕价格相差很大, we calculate in different proportions
E= (ccnew-dcnew)/100
E.head (10)

E.plot ()

Later on, we will make a KDJ-MACD model to calculate whether the price difference can be profitable.

Related Article

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: 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.