{"id":88263,"date":"2020-02-10T13:34:58","date_gmt":"2020-02-10T05:34:58","guid":{"rendered":"http:\/\/4563.org\/?p=88263"},"modified":"2020-02-10T13:34:58","modified_gmt":"2020-02-10T05:34:58","slug":"%e9%85%8d%e5%af%b9%e4%ba%a4%e6%98%93-%e4%bd%8e%e9%a3%8e%e9%99%a9%e7%bb%9f%e8%ae%a1%e5%a5%97%e5%88%a9%e9%87%8f%e5%8c%96%e4%ba%a4%e6%98%93-python-%e5%ae%9e%e6%88%98","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=88263","title":{"rendered":"\u914d\u5bf9\u4ea4\u6613-\u4f4e\u98ce\u9669\u7edf\u8ba1\u5957\u5229\u91cf\u5316\u4ea4\u6613 Python \u5b9e\u6218"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u914d\u5bf9\u4ea4\u6613-\u4f4e\u98ce\u9669\u7edf\u8ba1\u5957\u5229\u91cf\u5316\u4ea4\u6613 Python \u5b9e\u6218               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : 1722332572 <\/span>  <span><i><\/i> 42<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<h2>\u914d\u5bf9\u4ea4\u6613\u7b80\u4ecb<\/h2>\n<p>\u914d\u5bf9\u4ea4\u6613\u662f\u6307\u516b\u5341\u5e74\u4ee3\u4e2d\u671f\u534e\u5c14\u8857\u8457\u540d\u6295\u884c Morgan Stanley \u7684\u6570\u91cf\u4ea4\u6613\u5458 Nunzio Tartaglia \u6210\u7acb\u7684\u4e00\u4e2a\u6570\u91cf\u5206\u6790\u56e2\u961f\u63d0\u51fa\u7684\u4e00\u79cd\u5e02\u573a\u4e2d\u6027\u6295\u8d44\u7b56\u7565\uff0c\u5176\u6210\u5458\u4e3b\u8981\u662f\u7269\u7406\u5b66\u5bb6\u3001\u6570\u5b66\u5bb6\u3001\u4ee5\u53ca\u8ba1\u7b97\u673a\u5b66\u5bb6\u3002<\/p>\n<p>Ganapathy Vidyamurthy \u5728\u300a Pairs Trading: Quantitative Methods and Analysis \u300b\u4e00\u4e66\u4e2d\u5b9a\u4e49\u914d\u5bf9\u4ea4\u6613\u4e3a\u4e24\u79cd\u7c7b\u578b\uff1a\u4e00\u7c7b\u662f\u57fa\u4e8e\u7edf\u8ba1\u5957\u5229\u7684\u914d\u5bf9\u4ea4\u6613\uff0c\u4e00\u7c7b\u662f\u57fa\u4e8e\u98ce\u9669\u5957\u5229\u7684\u914d\u5bf9\u4ea4\u6613\u3002<\/p>\n<p>\u57fa\u4e8e\u7edf\u8ba1\u5957\u5229\u7684\u914d\u5bf9\u4ea4\u6613\u7b56\u7565\u662f\u4e00\u79cd\u5e02\u573a\u4e2d\u6027\u7b56\u7565\uff0c\u5177\u4f53\u7684\u8bf4\uff0c\u662f\u6307\u4ece\u5e02\u573a\u4e0a\u627e\u51fa\u5386\u53f2\u80a1\u4ef7\u8d70\u52bf\u76f8\u8fd1\u7684\u80a1\u7968\u8fdb\u884c\u914d\u5bf9\uff0c\u5f53\u914d\u5bf9\u7684\u80a1\u7968\u4ef7\u683c\u5dee\uff08 Spreads \uff09\u504f\u79bb\u5386\u53f2\u5747\u503c\u65f6\uff0c\u5219\u505a\u7a7a\u80a1\u4ef7\u8f83\u9ad8\u7684\u80a1\u7968\u540c\u65f6\u4e70\u8fdb\u80a1\u4ef7\u8f83\u4f4e\u7684\u80a1\u7968\uff0c\u7b49\u5f85\u4ed6\u4eec\u56de\u5f52\u5230\u957f\u671f\u5747\u8861\u5173\u7cfb\uff0c\u7531\u6b64\u8d5a\u53d6\u4e24\u80a1\u7968\u4ef7\u683c\u6536\u655b\u7684\u62a5\u916c\u3002<\/p>\n<h2>\u6570\u636e\u5206\u6790<\/h2>\n<p>\u6570\u636e\u6765\u81ea\u4ea4\u6613\u6240\uff1a\u5e01\u5b89\uff0c\u6570\u636e\u4e0b\u8f7d:http:\/\/www.tf86.com\/binance\/<\/p>\n<p>\u6570\u636e\u5305\u62ec\u51e0\u79cd\u5e38\u89c1\u6570\u636e\u8d27\u5e01\u6bcf\u4e2a\u5c0f\u65f6\u7684\u4ef7\u683c\uff0c\u6bcf\u4e00\u79cd\u6570\u5b57\u706b\u5e01\u7684\u4ea4\u6613\u8bb0\u5f55\u6709 20000 \u6761\u3002 \u5982\u4e0b\u56fe\u6240\u793a\uff1a<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2020\/05\/20200517_5ec114d27860c.jpg\" alt=\"\u914d\u5bf9\u4ea4\u6613-\u4f4e\u98ce\u9669\u7edf\u8ba1\u5957\u5229\u91cf\u5316\u4ea4\u6613 Python \u5b9e\u6218\" \/><\/p>\n<p>\u5177\u4f53\u7684\u6570\u636e\u5982\u4e0b\u56fe\u6240\u793a\uff1a<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2020\/05\/20200517_5ec114d3c9856.jpg\" alt=\"\u914d\u5bf9\u4ea4\u6613-\u4f4e\u98ce\u9669\u7edf\u8ba1\u5957\u5229\u91cf\u5316\u4ea4\u6613 Python \u5b9e\u6218\" \/><\/p>\n<h2>\u6570\u636e\u5904\u7406<\/h2>\n<p>\u56e0\u4e3a\u6bcf\u79cd\u6570\u5b57\u8d27\u5e01\u7684\u4ef7\u683c\u4e0d\u4e00\u6837\uff0c\u4e3a\u4e86\u4f53\u73b0\u51fa\u4ed6\u4eec\u7684\u5173\u8054\u6027\uff0c\u9996\u5148\u8981\u8fdb\u884c\u5f52\u4e00\u5316\u64cd\u4f5c\uff0c\u5c06\u4ef7\u683c\u5f52\u4e00\u5316\u5904\u7406\u3002\u8fd9\u91cc\u91c7\u7528\u7684\u662f sklearn \u4e2d\u7684 MinMaxScaler \u3002<\/p>\n<pre><code>## \u8282\u9009\u4ee3\u7801 from sklearn.preprocessing import MinMaxScaler min_max_scaler = MinMaxScaler() np_list=np.asarray(data_items).reshape(-1,1) X_train_minmax = min_max_scaler.fit_transform(np_list)  <\/code><\/pre>\n<p>\u5f52\u4e00\u5316\u4e4b\u540e\uff0c\u57fa\u4e8e matplotlib \u8fdb\u884c\u53ef\u89c6\u5316<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2020\/05\/20200517_5ec114d5d02ad.png\" alt=\"\u914d\u5bf9\u4ea4\u6613-\u4f4e\u98ce\u9669\u7edf\u8ba1\u5957\u5229\u91cf\u5316\u4ea4\u6613 Python \u5b9e\u6218\" \/><\/p>\n<p>\u8089\u773c\u53ef\u89c1\uff0c\u6700\u4e0a\u9762\u4e24\u4e2a\u66f2\u7ebf\u4e4b\u95f4\u6709\u4e00\u5b9a\u7684\u5173\u8054\u6027\uff0c\u4e24\u8005\u5728\u5206\u79bb\u4e4b\u540e\u591a\u6b21\u6c47\u5408\uff0c\u63a5\u4e0b\u6765\u501f\u52a9\u534f\u65b9\u5dee\u6765\u8bc4\u4f30\u4e8c\u8005\u4e4b\u95f4\u7684\u5173\u8054\u5ea6\u3002<\/p>\n<h2>\u6a21\u578b\u5b9e\u73b0<\/h2>\n<p>\u534f\u65b9\u5dee\u8868\u793a\u7684\u662f\u4e24\u4e2a\u53d8\u91cf\u7684\u603b\u4f53\u7684\u8bef\u5dee\uff0c\u8fd9\u4e0e\u53ea\u8868\u793a\u4e00\u4e2a\u53d8\u91cf\u8bef\u5dee\u7684\u65b9\u5dee\u4e0d\u540c\u3002 \u5982\u679c\u4e24\u4e2a\u53d8\u91cf\u7684\u53d8\u5316\u8d8b\u52bf\u4e00\u81f4\uff0c\u4e5f\u5c31\u662f\u8bf4\u5982\u679c\u5176\u4e2d\u4e00\u4e2a\u5927\u4e8e\u81ea\u8eab\u7684\u671f\u671b\u503c\uff0c\u53e6\u5916\u4e00\u4e2a\u4e5f\u5927\u4e8e\u81ea\u8eab\u7684\u671f\u671b\u503c\uff0c\u90a3\u4e48\u4e24\u4e2a\u53d8\u91cf\u4e4b\u95f4\u7684\u534f\u65b9\u5dee\u5c31\u662f\u6b63\u503c\u3002 \u5982\u679c\u4e24\u4e2a\u53d8\u91cf\u7684\u53d8\u5316\u8d8b\u52bf\u76f8\u53cd\uff0c\u5373\u5176\u4e2d\u4e00\u4e2a\u5927\u4e8e\u81ea\u8eab\u7684\u671f\u671b\u503c\uff0c\u53e6\u5916\u4e00\u4e2a\u5374\u5c0f\u4e8e\u81ea\u8eab\u7684\u671f\u671b\u503c\uff0c\u90a3\u4e48\u4e24\u4e2a\u53d8\u91cf\u4e4b\u95f4\u7684\u534f\u65b9\u5dee\u5c31\u662f\u8d1f\u503c\u3002<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2020\/05\/20200517_5ec114d69a16e.jpg\" alt=\"\u914d\u5bf9\u4ea4\u6613-\u4f4e\u98ce\u9669\u7edf\u8ba1\u5957\u5229\u91cf\u5316\u4ea4\u6613 Python \u5b9e\u6218\" \/><\/p>\n<p>\u91c7\u7528 numpy \u4e2d\u7684 cov \u51fd\u6570\u6765\u5b9e\u73b0\u534f\u65b9\u5dee\u7684\u8ba1\u7b97\u3002<\/p>\n<pre><code>import numpy as np np.cov(x,y) <\/code><\/pre>\n<p>\u8f93\u51fa\u6837\u4f8b\uff1a<\/p>\n<pre><code>[[ 9.44749900e-09 -4.05910662e-09]  [-4.05910662e-09  3.38730102e-08]] <\/code><\/pre>\n<h2>\u6548\u679c\u8bc4\u4f30<\/h2>\n<p>4 \u4e2a\u6570\u5b57\u8d27\u5e01\u7684\u4ea4\u6613\u8bb0\u5f55 <img decoding=\"async\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2020\/05\/20200517_5ec114d7e5a6e.png\" alt=\"\u914d\u5bf9\u4ea4\u6613-\u4f4e\u98ce\u9669\u7edf\u8ba1\u5957\u5229\u91cf\u5316\u4ea4\u6613 Python \u5b9e\u6218\" \/> \u5176\u4e2d 0\uff0c1 \u4e4b\u95f4\u6709\u5f88\u9ad8\u7684\u5173\u8054\u5ea6 <img decoding=\"async\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2020\/05\/20200517_5ec114d90acab.jpg\" alt=\"\u914d\u5bf9\u4ea4\u6613-\u4f4e\u98ce\u9669\u7edf\u8ba1\u5957\u5229\u91cf\u5316\u4ea4\u6613 Python \u5b9e\u6218\" \/><\/p>\n<p>\u53ef\u4ee5\u5728\u4e24\u4e2a\u4ef7\u683c\u5206\u79bb\u7684\u65f6\u5019\uff0c\u4e70\u5165\u4f4e\u4ef7\u7684 A\uff0c\u5356\u51fa\u9ad8\u4ef7\u7684 B\uff0c\u5f53\u4e8c\u8005\u4ef7\u683c\u91cd\u65b0\u56de\u5f52\u7684\u65f6\u5019\u5e73\u4ed3\uff0c\u5373\u53ef\u4ee5\u83b7\u5f97\u76c8\u5229\u3002<\/p>\n<h2>\u76f8\u5173\u77e5\u8bc6<\/h2>\n<p>\u914d\u5bf9\u4ea4\u6613\uff1a https:\/\/wiki.mbalib.com\/wiki\/%E9%85%8D%E5%AF%B9%E4%BA%A4%E6%98%93<\/p>\n<p>\u5e01\u5b89\uff1a https:\/\/www.binance.com\/cn\/register?ref=23297069<\/p>\n<p>\u534f\u65b9\u5dee\uff1a https:\/\/www.zhihu.com\/question\/20852004<\/p>\n<h2>\u76f8\u5173\u6559\u7a0b<\/h2>\n<p>sklearn\uff1ahttp:\/\/sklearn123.com\/<\/p>\n<p>Python\uff1ahttp:\/\/pythonok.com\/<\/p>\n<p>Pytorch\uff1ahttp:\/\/pytorch123.com\/<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>8<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"1138671\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : andy101wong <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u914d\u5bf9\u4ea4\u6613\uff0c\u55ef\uff0c\u4e3b\u4f60\u7b49\u7b49\uff0c\u6211\u660e\u5929\u518d\u6765\u548c\u4f60\u8bf4\u914d\u5bf9\u4ea4\u6613\u662f\u600e\u4e48\u7834\u4ea7\u7684\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1138672\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : 1722332572 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @andy101wong \u4e3a\u4f55\u8981\u660e\u5929\uff0c\u4e0d\u5982\u4eca\u665a\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1138673\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : jarry777 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u627e\u51fa\u5386\u53f2\u80a1\u4ef7\u8d70\u52bf\u76f8\u8fd1\u7684\u80a1\u7968\uff0c\u8fd8\u9700\u8981\u7528 Python \u4e48\uff0c\u9ebb\u70e6\u4e0b\u8f7d\u4e2a\u540c\u82b1\u987a\uff0c\u70b9\u51fb\u5de5\u5177\u680f\u4e0a\u7684\u201c\u9884\u6d4b\u201d\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1138674\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : arthurire <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u96be\u70b9\u4e0d\u662f Pair Trading,\u800c\u662f\u63d0\u524d\u60f3\u597d\u4f55\u65f6\u91c7\u7528 Pair Trading,\u8fd8\u6709\u5c31\u662f\u7206\u4ed3\u4e86\u5728\u54ea\u91cc\u8df3.                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1138675\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : chen1164162915 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8df3\u524d\u8bb0\u5f97\u53d1\u4e2a\u5e16\u5b50 \u8b66\u793a\u540e\u4eba                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1138676\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : randm <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             17 \u5e74\u5165\u5e01\u5708\u81f3\u4eca\uff0c\u6bcf\u5e74\u6b63\u6536\u76ca\uff0c17\/18 \u533a\u5757\u94fe\u5143\u5e74\u4e0d\u8bf4\uff0c\u80c6\u6709\u591a\u5927\u8d5a\u7684\u591a\u5927\uff0c19\/20 \u5e74\u6536\u76ca\u90fd\u7ffb\u500d\u4e86\uff0c\u4ece\u6700\u5f00\u59cb\u5206\u949f\u7ebf\u5230\u5c0f\u65f6\u7ebf\u518d\u5230\u65e5\u7ebf\uff0c\u76ee\u524d\u662f\u770b\u5468\u7ebf\u5728\u73a9\uff0c\u7f51\u683c\u4ea4\u6613\uff0c\u5411\u4e0a\u504f\u79bb\u5747\u7ebf\u5c31\u6162\u6162\u5356\uff0c\u5411\u4e0b\u504f\u79bb\u5c31\u6162\u6162\u4e70\uff0c\u53ea\u73a9\u51e0\u4e2a\u5927\u5e01\u79cd\u73b0\u8d27\u3002\u6f5c\u4f0f\u5728\u51e0\u4e2a\u4ea4\u6613\u6240\u91cf\u5316\u7fa4\uff0c\u706b\u5e01\uff0c\u4e2d\u5e01\u7b49\uff0c\u80fd\u4ee5\u5e74\u4e3a\u5355\u4f4d\u8d62\u7684\u771f\u4e0d\u591a\uff0c\u8017\u8d39\u4e86\u9752\u6625\uff0c\u8e49\u8dce\u4e86\u5c81\u6708\uff0c\u517b\u6d3b\u4e86\u4ea4\u6613\u6240                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1138677\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : 1722332572 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @randm \u6bcf\u5e74\u6b63\u6536\u76ca\u4e0d\u9999\u5417\uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1138678\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : 1722332572 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @jarry777 \u591a\u8c22\uff0c\u5df2\u7ecf\u4e0b\u8f7d\u540c\u82b1\u987a\uff0c\u5b66\u4e60\u4e2d\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u914d\u5bf9\u4ea4\u6613-\u4f4e\u98ce\u9669\u7edf\u8ba1\u5957\u5229\u91cf\u5316\u4ea4\u6613 &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/88263"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=88263"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/88263\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=88263"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=88263"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=88263"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}