11 Python总结之股票数据量化分析

股票数据分析

目录

1 使用tushare包获取某股票的历史行情数据

2 使用pandas包计算某股票历史数据的5日均线和60日均线

3 matplotlib包可视化历史数据的收盘价和历史均线

4 分析输出所有金叉日志和死叉日期

5 如果从2010年1月1日开始,初试资金为100000元,金叉尽量买入,死叉全部卖出,则到今天为止,我的收益如何?

1 使用tushare包获取某股票的历史行情数据

Tushare是一个免费、开源的python财经数据接口包。主要实现对股票等金融数据从数据采集、清洗加工 到 数据存储的过程,能够为金融分析人员提供快速、整洁、和多样的便于分析的数据,为他们在数据获取方面极大地减轻工作量,使他们更加专注于策略和模型的研究与实现上。

import pandas as pd
import numpy as np
import tushare as ts
%matplotlib auto

df = ts.get_k_data("600519",start="2010-01-01")
df.to_csv("600519.csv")

df = pd.read_csv("600519.csv",index_col="date",parse_dates=["date"])[["open","close","high","low"]]
df
Using matplotlib backend: Qt5Agg
open close high low
date
2010-01-04 109.760 108.446 109.760 108.044
2010-01-05 109.116 108.127 109.441 107.846
2010-01-06 107.840 106.417 108.165 106.129
2010-01-07 106.417 104.477 106.691 103.302
2010-01-08 104.655 103.379 104.655 102.167
2010-01-11 104.400 102.926 105.230 102.422
2010-01-12 103.028 105.708 106.040 102.492
2010-01-13 104.649 103.022 105.389 102.741
2010-01-14 103.379 107.552 107.974 103.379
2010-01-15 107.533 108.401 110.641 107.533
2010-01-18 108.484 109.110 109.926 108.420
2010-01-19 109.116 108.337 109.441 108.165
2010-01-20 108.427 105.881 108.580 105.804
2010-01-21 105.842 106.397 107.450 105.613
2010-01-22 106.314 104.738 106.755 103.309
2010-01-25 104.560 105.957 106.761 103.704
2010-01-26 107.380 106.378 108.593 105.038
2010-01-27 105.951 104.643 107.068 104.400
2010-01-28 104.566 107.974 108.708 104.336
2010-01-29 108.452 107.552 108.612 107.004
2010-02-01 107.769 107.776 108.216 106.576
2010-02-02 107.208 106.263 108.484 106.117
2010-02-03 106.066 105.887 107.272 104.783
2010-02-04 105.868 107.591 108.006 105.376
2010-02-05 106.959 109.282 109.684 106.570
2010-02-08 109.282 109.269 112.058 108.816
2010-02-09 109.760 109.193 110.609 108.822
2010-02-10 109.760 109.652 110.137 108.931
2010-02-11 109.633 110.641 111.318 109.505
2010-02-12 111.018 110.456 111.164 109.888
... ... ... ... ...
2019-03-01 761.500 789.300 790.000 761.000
2019-03-04 795.000 781.860 798.330 777.220
2019-03-05 785.000 779.780 789.550 775.880
2019-03-06 775.000 768.000 779.500 765.880
2019-03-07 762.220 748.600 762.220 745.560
2019-03-08 737.900 737.500 746.830 733.650
2019-03-11 740.040 758.540 766.950 740.040
2019-03-12 763.820 745.010 763.830 739.000
2019-03-13 745.500 754.000 760.750 745.500
2019-03-14 757.000 778.000 785.000 754.000
2019-03-15 776.000 777.300 787.500 764.850
2019-03-18 778.800 810.090 814.530 777.000
2019-03-19 803.000 792.610 807.920 792.300
2019-03-20 790.000 792.800 802.300 785.000
2019-03-21 788.000 785.750 792.800 781.500
2019-03-22 788.220 794.000 799.980 785.000
2019-03-25 786.000 775.600 788.000 773.300
2019-03-26 780.000 773.000 785.940 764.100
2019-03-27 781.000 788.500 793.880 775.000
2019-03-28 793.430 806.800 814.480 785.680
2019-03-29 835.000 853.990 866.680 830.170
2019-04-01 860.000 859.000 868.950 851.000
2019-04-02 859.990 850.000 859.990 836.060
2019-04-03 840.120 844.500 851.740 834.210
2019-04-04 840.000 865.000 865.800 836.200
2019-04-08 900.000 900.200 908.000 890.120
2019-04-09 903.000 905.000 908.200 892.510
2019-04-10 903.000 947.990 951.900 900.000
2019-04-11 948.000 925.200 950.000 905.550
2019-04-12 909.000 914.000 919.990 900.010

2248 rows × 4 columns

2 使用pandas包计算该股票历史数据的5日均线和30日均线

(1)5日均线代码

df["ma5"] = df["open"].rolling(5).mean()
df
open close high low ma5 ma30
date
2010-01-04 109.760 108.446 109.760 108.044 NaN NaN
2010-01-05 109.116 108.127 109.441 107.846 NaN NaN
2010-01-06 107.840 106.417 108.165 106.129 NaN NaN
2010-01-07 106.417 104.477 106.691 103.302 NaN NaN
2010-01-08 104.655 103.379 104.655 102.167 107.5576 NaN
2010-01-11 104.400 102.926 105.230 102.422 106.4856 NaN
2010-01-12 103.028 105.708 106.040 102.492 105.2680 NaN
2010-01-13 104.649 103.022 105.389 102.741 104.6298 NaN
2010-01-14 103.379 107.552 107.974 103.379 104.0222 NaN
2010-01-15 107.533 108.401 110.641 107.533 104.5978 NaN
2010-01-18 108.484 109.110 109.926 108.420 105.4146 NaN
2010-01-19 109.116 108.337 109.441 108.165 106.6322 NaN
2010-01-20 108.427 105.881 108.580 105.804 107.3878 NaN
2010-01-21 105.842 106.397 107.450 105.613 107.8804 NaN
2010-01-22 106.314 104.738 106.755 103.309 107.6366 NaN
2010-01-25 104.560 105.957 106.761 103.704 106.8518 NaN
2010-01-26 107.380 106.378 108.593 105.038 106.5046 NaN
2010-01-27 105.951 104.643 107.068 104.400 106.0094 NaN
2010-01-28 104.566 107.974 108.708 104.336 105.7542 NaN
2010-01-29 108.452 107.552 108.612 107.004 106.1818 NaN
2010-02-01 107.769 107.776 108.216 106.576 106.8236 NaN
2010-02-02 107.208 106.263 108.484 106.117 106.7892 NaN
2010-02-03 106.066 105.887 107.272 104.783 106.8122 NaN
2010-02-04 105.868 107.591 108.006 105.376 107.0726 NaN
2010-02-05 106.959 109.282 109.684 106.570 106.7740 NaN
2010-02-08 109.282 109.269 112.058 108.816 107.0766 NaN
2010-02-09 109.760 109.193 110.609 108.822 107.5870 NaN
2010-02-10 109.760 109.652 110.137 108.931 108.3258 NaN
2010-02-11 109.633 110.641 111.318 109.505 109.0788 NaN
2010-02-12 111.018 110.456 111.164 109.888 109.8906 107.106400
... ... ... ... ... ... ...
2019-03-01 761.500 789.300 790.000 761.000 742.1900 700.726000
2019-03-04 795.000 781.860 798.330 777.220 755.0400 706.126000
2019-03-05 785.000 779.780 789.550 775.880 762.4800 711.364000
2019-03-06 775.000 768.000 779.500 765.880 770.8800 715.264000
2019-03-07 762.220 748.600 762.220 745.560 775.7440 718.571333
2019-03-08 737.900 737.500 746.830 733.650 771.0240 721.001333
2019-03-11 740.040 758.540 766.950 740.040 760.0320 722.669333
2019-03-12 763.820 745.010 763.830 739.000 755.7960 725.263333
2019-03-13 745.500 754.000 760.750 745.500 749.8960 727.872667
2019-03-14 757.000 778.000 785.000 754.000 748.8520 730.762667
2019-03-15 776.000 777.300 787.500 764.850 756.4720 734.100000
2019-03-18 778.800 810.090 814.530 777.000 764.2240 737.260000
2019-03-19 803.000 792.610 807.920 792.300 772.0600 741.443333
2019-03-20 790.000 792.800 802.300 785.000 780.9600 744.943667
2019-03-21 788.000 785.750 792.800 781.500 787.1600 748.543667
2019-03-22 788.220 794.000 799.980 785.000 789.6040 751.583000
2019-03-25 786.000 775.600 788.000 773.300 791.0440 754.616333
2019-03-26 780.000 773.000 785.940 764.100 786.4440 756.516333
2019-03-27 781.000 788.500 793.880 775.000 784.6440 758.449667
2019-03-28 793.430 806.800 814.480 785.680 785.7300 760.524000
2019-03-29 835.000 853.990 866.680 830.170 795.0860 763.861333
2019-04-01 860.000 859.000 868.950 851.000 809.8860 768.161333
2019-04-02 859.990 850.000 859.990 836.060 825.8840 772.129000
2019-04-03 840.120 844.500 851.740 834.210 837.7080 775.633000
2019-04-04 840.000 865.000 865.800 836.200 847.0220 779.633000
2019-04-08 900.000 900.200 908.000 890.120 860.0220 785.733000
2019-04-09 903.000 905.000 908.200 892.510 868.6220 791.474667
2019-04-10 903.000 947.990 951.900 900.000 877.2240 796.648000
2019-04-11 948.000 925.200 950.000 905.550 898.8000 803.814667
2019-04-12 909.000 914.000 919.990 900.010 912.6000 809.518000

2248 rows × 6 columns

(2)30日均线代码

df["ma30"] = df["open"].rolling(30).mean()
df
open close high low ma5 ma30
date
2010-01-04 109.760 108.446 109.760 108.044 NaN NaN
2010-01-05 109.116 108.127 109.441 107.846 NaN NaN
2010-01-06 107.840 106.417 108.165 106.129 NaN NaN
2010-01-07 106.417 104.477 106.691 103.302 NaN NaN
2010-01-08 104.655 103.379 104.655 102.167 107.5576 NaN
2010-01-11 104.400 102.926 105.230 102.422 106.4856 NaN
2010-01-12 103.028 105.708 106.040 102.492 105.2680 NaN
2010-01-13 104.649 103.022 105.389 102.741 104.6298 NaN
2010-01-14 103.379 107.552 107.974 103.379 104.0222 NaN
2010-01-15 107.533 108.401 110.641 107.533 104.5978 NaN
2010-01-18 108.484 109.110 109.926 108.420 105.4146 NaN
2010-01-19 109.116 108.337 109.441 108.165 106.6322 NaN
2010-01-20 108.427 105.881 108.580 105.804 107.3878 NaN
2010-01-21 105.842 106.397 107.450 105.613 107.8804 NaN
2010-01-22 106.314 104.738 106.755 103.309 107.6366 NaN
2010-01-25 104.560 105.957 106.761 103.704 106.8518 NaN
2010-01-26 107.380 106.378 108.593 105.038 106.5046 NaN
2010-01-27 105.951 104.643 107.068 104.400 106.0094 NaN
2010-01-28 104.566 107.974 108.708 104.336 105.7542 NaN
2010-01-29 108.452 107.552 108.612 107.004 106.1818 NaN
2010-02-01 107.769 107.776 108.216 106.576 106.8236 NaN
2010-02-02 107.208 106.263 108.484 106.117 106.7892 NaN
2010-02-03 106.066 105.887 107.272 104.783 106.8122 NaN
2010-02-04 105.868 107.591 108.006 105.376 107.0726 NaN
2010-02-05 106.959 109.282 109.684 106.570 106.7740 NaN
2010-02-08 109.282 109.269 112.058 108.816 107.0766 NaN
2010-02-09 109.760 109.193 110.609 108.822 107.5870 NaN
2010-02-10 109.760 109.652 110.137 108.931 108.3258 NaN
2010-02-11 109.633 110.641 111.318 109.505 109.0788 NaN
2010-02-12 111.018 110.456 111.164 109.888 109.8906 107.106400
... ... ... ... ... ... ...
2019-03-01 761.500 789.300 790.000 761.000 742.1900 700.726000
2019-03-04 795.000 781.860 798.330 777.220 755.0400 706.126000
2019-03-05 785.000 779.780 789.550 775.880 762.4800 711.364000
2019-03-06 775.000 768.000 779.500 765.880 770.8800 715.264000
2019-03-07 762.220 748.600 762.220 745.560 775.7440 718.571333
2019-03-08 737.900 737.500 746.830 733.650 771.0240 721.001333
2019-03-11 740.040 758.540 766.950 740.040 760.0320 722.669333
2019-03-12 763.820 745.010 763.830 739.000 755.7960 725.263333
2019-03-13 745.500 754.000 760.750 745.500 749.8960 727.872667
2019-03-14 757.000 778.000 785.000 754.000 748.8520 730.762667
2019-03-15 776.000 777.300 787.500 764.850 756.4720 734.100000
2019-03-18 778.800 810.090 814.530 777.000 764.2240 737.260000
2019-03-19 803.000 792.610 807.920 792.300 772.0600 741.443333
2019-03-20 790.000 792.800 802.300 785.000 780.9600 744.943667
2019-03-21 788.000 785.750 792.800 781.500 787.1600 748.543667
2019-03-22 788.220 794.000 799.980 785.000 789.6040 751.583000
2019-03-25 786.000 775.600 788.000 773.300 791.0440 754.616333
2019-03-26 780.000 773.000 785.940 764.100 786.4440 756.516333
2019-03-27 781.000 788.500 793.880 775.000 784.6440 758.449667
2019-03-28 793.430 806.800 814.480 785.680 785.7300 760.524000
2019-03-29 835.000 853.990 866.680 830.170 795.0860 763.861333
2019-04-01 860.000 859.000 868.950 851.000 809.8860 768.161333
2019-04-02 859.990 850.000 859.990 836.060 825.8840 772.129000
2019-04-03 840.120 844.500 851.740 834.210 837.7080 775.633000
2019-04-04 840.000 865.000 865.800 836.200 847.0220 779.633000
2019-04-08 900.000 900.200 908.000 890.120 860.0220 785.733000
2019-04-09 903.000 905.000 908.200 892.510 868.6220 791.474667
2019-04-10 903.000 947.990 951.900 900.000 877.2240 796.648000
2019-04-11 948.000 925.200 950.000 905.550 898.8000 803.814667
2019-04-12 909.000 914.000 919.990 900.010 912.6000 809.518000

2248 rows × 6 columns

3 使用matplotlib包可视化历史数据的收盘价和历史均线

# 输出2010-2019年的
import matplotlib.pyplot as plt
%matplotlib inline
df[["close","ma5","ma30"]].plot()
plt.show()

11 Python总结之股票数据量化分析_第1张图片

# 2018年的
df.loc["2018",["close","ma5","ma30"]].plot()
plt.show()

11 Python总结之股票数据量化分析_第2张图片

4 分析输出所有金叉日期和死叉日期

(1)金叉日期

# 金叉:小日期均线上穿大日期均线
golden_cross = []
# 死叉;小日期均线下穿大日期均线
death_cross = []
for i in range(1,len(df)):
    if df["ma5"][i] >= df["ma30"][i] and df["ma5"][i-1] < df["ma30"][i-1]:
        golden_cross.append(df.index[i].to_pydatetime())
    if df["ma5"][i] <= df["ma30"][i] and df["ma5"][i-1] > df["ma30"][i-1]:
        death_cross.append(df.index[i].to_pydatetime())
golden_cross
[datetime.datetime(2010, 6, 7, 0, 0),
 datetime.datetime(2010, 7, 20, 0, 0),
 datetime.datetime(2010, 10, 26, 0, 0),
 datetime.datetime(2010, 11, 11, 0, 0),
 datetime.datetime(2011, 2, 14, 0, 0),
 datetime.datetime(2011, 3, 15, 0, 0),
 datetime.datetime(2011, 4, 28, 0, 0),
 datetime.datetime(2011, 10, 26, 0, 0),
 datetime.datetime(2012, 2, 13, 0, 0),
 datetime.datetime(2012, 4, 9, 0, 0),
 datetime.datetime(2012, 7, 26, 0, 0),
 datetime.datetime(2012, 8, 10, 0, 0),
 datetime.datetime(2012, 9, 13, 0, 0),
 datetime.datetime(2012, 9, 28, 0, 0),
 datetime.datetime(2012, 12, 24, 0, 0),
 datetime.datetime(2013, 1, 9, 0, 0),
 datetime.datetime(2013, 3, 12, 0, 0),
 datetime.datetime(2013, 4, 18, 0, 0),
 datetime.datetime(2013, 7, 4, 0, 0),
 datetime.datetime(2013, 10, 22, 0, 0),
 datetime.datetime(2013, 11, 12, 0, 0),
 datetime.datetime(2013, 11, 29, 0, 0),
 datetime.datetime(2014, 1, 24, 0, 0),
 datetime.datetime(2014, 4, 3, 0, 0),
 datetime.datetime(2014, 6, 24, 0, 0),
 datetime.datetime(2014, 9, 5, 0, 0),
 datetime.datetime(2014, 9, 30, 0, 0),
 datetime.datetime(2014, 11, 18, 0, 0),
 datetime.datetime(2014, 12, 1, 0, 0),
 datetime.datetime(2015, 2, 16, 0, 0),
 datetime.datetime(2015, 6, 12, 0, 0),
 datetime.datetime(2015, 7, 16, 0, 0),
 datetime.datetime(2015, 9, 18, 0, 0),
 datetime.datetime(2015, 10, 8, 0, 0),
 datetime.datetime(2015, 12, 7, 0, 0),
 datetime.datetime(2015, 12, 21, 0, 0),
 datetime.datetime(2016, 2, 22, 0, 0),
 datetime.datetime(2016, 8, 11, 0, 0),
 datetime.datetime(2016, 10, 14, 0, 0),
 datetime.datetime(2016, 11, 28, 0, 0),
 datetime.datetime(2017, 7, 25, 0, 0),
 datetime.datetime(2017, 9, 19, 0, 0),
 datetime.datetime(2017, 12, 15, 0, 0),
 datetime.datetime(2018, 3, 19, 0, 0),
 datetime.datetime(2018, 5, 10, 0, 0),
 datetime.datetime(2018, 7, 19, 0, 0),
 datetime.datetime(2018, 7, 26, 0, 0),
 datetime.datetime(2018, 9, 21, 0, 0),
 datetime.datetime(2018, 12, 4, 0, 0),
 datetime.datetime(2019, 1, 3, 0, 0)]

(3)死叉日期

golden_cross = []
death_cross = []
for i in range(1,len(df)):
    if df["ma5"][i] >= df["ma30"][i] and df["ma5"][i-1] < df["ma30"][i-1]:
        golden_cross.append(df.index[i].to_pydatetime())
    if df["ma5"][i] <= df["ma30"][i] and df["ma5"][i-1] < df["ma30"][i-1]:
        death_cross.append(df.index[i].to_pydatetime())
death_cross
[datetime.datetime(2010, 3, 2, 0, 0),
 datetime.datetime(2010, 3, 3, 0, 0),
 datetime.datetime(2010, 3, 4, 0, 0),
 datetime.datetime(2010, 3, 5, 0, 0),
 datetime.datetime(2010, 3, 8, 0, 0),
 datetime.datetime(2010, 3, 9, 0, 0),
 datetime.datetime(2010, 3, 10, 0, 0),
 datetime.datetime(2010, 3, 11, 0, 0),
 datetime.datetime(2010, 3, 12, 0, 0),
 datetime.datetime(2010, 3, 15, 0, 0),
 datetime.datetime(2010, 3, 16, 0, 0),
 datetime.datetime(2010, 3, 17, 0, 0),
 datetime.datetime(2010, 3, 18, 0, 0),
 datetime.datetime(2010, 3, 19, 0, 0),
 datetime.datetime(2010, 3, 22, 0, 0),
 datetime.datetime(2010, 3, 23, 0, 0),
 datetime.datetime(2010, 3, 24, 0, 0),
 datetime.datetime(2010, 3, 25, 0, 0),
 datetime.datetime(2010, 3, 26, 0, 0),
 datetime.datetime(2010, 3, 29, 0, 0),
 datetime.datetime(2010, 3, 30, 0, 0),
 datetime.datetime(2010, 3, 31, 0, 0),
 datetime.datetime(2010, 4, 1, 0, 0),
 datetime.datetime(2010, 4, 2, 0, 0),
 datetime.datetime(2010, 4, 6, 0, 0),
 datetime.datetime(2010, 4, 7, 0, 0),
 datetime.datetime(2010, 4, 8, 0, 0),
 datetime.datetime(2010, 4, 9, 0, 0),
 datetime.datetime(2010, 4, 12, 0, 0),
 datetime.datetime(2010, 4, 13, 0, 0),
 datetime.datetime(2010, 4, 14, 0, 0),
 datetime.datetime(2010, 4, 15, 0, 0),
 datetime.datetime(2010, 4, 16, 0, 0),
 datetime.datetime(2010, 4, 19, 0, 0),
 datetime.datetime(2010, 4, 20, 0, 0),
 datetime.datetime(2010, 4, 21, 0, 0),
 datetime.datetime(2010, 4, 22, 0, 0),
 datetime.datetime(2010, 4, 23, 0, 0),
 datetime.datetime(2010, 4, 26, 0, 0),
 datetime.datetime(2010, 4, 27, 0, 0),
 datetime.datetime(2010, 4, 28, 0, 0),
 datetime.datetime(2010, 4, 29, 0, 0),
 datetime.datetime(2010, 4, 30, 0, 0),
 datetime.datetime(2010, 5, 4, 0, 0),
 datetime.datetime(2010, 5, 5, 0, 0),
 datetime.datetime(2010, 5, 6, 0, 0),
 datetime.datetime(2010, 5, 7, 0, 0),
 datetime.datetime(2010, 5, 10, 0, 0),
 datetime.datetime(2010, 5, 11, 0, 0),
 datetime.datetime(2010, 5, 12, 0, 0),
 datetime.datetime(2010, 5, 13, 0, 0),
 datetime.datetime(2010, 5, 14, 0, 0),
 datetime.datetime(2010, 5, 17, 0, 0),
 datetime.datetime(2010, 5, 18, 0, 0),
 datetime.datetime(2010, 5, 19, 0, 0),
 datetime.datetime(2010, 5, 20, 0, 0),
 datetime.datetime(2010, 5, 21, 0, 0),
 datetime.datetime(2010, 5, 24, 0, 0),
 datetime.datetime(2010, 5, 25, 0, 0),
 datetime.datetime(2010, 5, 26, 0, 0),
 datetime.datetime(2010, 5, 31, 0, 0),
 datetime.datetime(2010, 6, 1, 0, 0),
 datetime.datetime(2010, 6, 2, 0, 0),
 datetime.datetime(2010, 6, 3, 0, 0),
 datetime.datetime(2010, 6, 4, 0, 0),
 datetime.datetime(2010, 6, 25, 0, 0),
 datetime.datetime(2010, 6, 28, 0, 0),
 datetime.datetime(2010, 6, 29, 0, 0),
 datetime.datetime(2010, 6, 30, 0, 0),
 datetime.datetime(2010, 7, 1, 0, 0),
 datetime.datetime(2010, 7, 2, 0, 0),
 datetime.datetime(2010, 7, 5, 0, 0),
 datetime.datetime(2010, 7, 6, 0, 0),
 datetime.datetime(2010, 7, 7, 0, 0),
 datetime.datetime(2010, 7, 8, 0, 0),
 datetime.datetime(2010, 7, 9, 0, 0),
 datetime.datetime(2010, 7, 12, 0, 0),
 datetime.datetime(2010, 7, 13, 0, 0),
 datetime.datetime(2010, 7, 14, 0, 0),
 datetime.datetime(2010, 7, 15, 0, 0),
 datetime.datetime(2010, 7, 16, 0, 0),
 datetime.datetime(2010, 7, 19, 0, 0),
 datetime.datetime(2010, 10, 19, 0, 0),
 datetime.datetime(2010, 10, 20, 0, 0),
 datetime.datetime(2010, 10, 21, 0, 0),
 datetime.datetime(2010, 10, 22, 0, 0),
 datetime.datetime(2010, 10, 25, 0, 0),
 datetime.datetime(2010, 11, 3, 0, 0),
 datetime.datetime(2010, 11, 4, 0, 0),
 datetime.datetime(2010, 11, 5, 0, 0),
 datetime.datetime(2010, 11, 8, 0, 0),
 datetime.datetime(2010, 11, 9, 0, 0),
 datetime.datetime(2010, 11, 10, 0, 0),
 datetime.datetime(2010, 12, 28, 0, 0),
 datetime.datetime(2010, 12, 29, 0, 0),
 datetime.datetime(2010, 12, 30, 0, 0),
 datetime.datetime(2010, 12, 31, 0, 0),
 datetime.datetime(2011, 1, 4, 0, 0),
 datetime.datetime(2011, 1, 5, 0, 0),
 datetime.datetime(2011, 1, 6, 0, 0),
 datetime.datetime(2011, 1, 7, 0, 0),
 datetime.datetime(2011, 1, 10, 0, 0),
 datetime.datetime(2011, 1, 11, 0, 0),
 datetime.datetime(2011, 1, 12, 0, 0),
 datetime.datetime(2011, 1, 13, 0, 0),
 datetime.datetime(2011, 1, 14, 0, 0),
 datetime.datetime(2011, 1, 17, 0, 0),
 datetime.datetime(2011, 1, 18, 0, 0),
 datetime.datetime(2011, 1, 19, 0, 0),
 datetime.datetime(2011, 1, 20, 0, 0),
 datetime.datetime(2011, 1, 21, 0, 0),
 datetime.datetime(2011, 1, 24, 0, 0),
 datetime.datetime(2011, 1, 25, 0, 0),
 datetime.datetime(2011, 1, 26, 0, 0),
 datetime.datetime(2011, 1, 27, 0, 0),
 datetime.datetime(2011, 1, 28, 0, 0),
 datetime.datetime(2011, 1, 31, 0, 0),
 datetime.datetime(2011, 2, 1, 0, 0),
 datetime.datetime(2011, 2, 9, 0, 0),
 datetime.datetime(2011, 2, 10, 0, 0),
 datetime.datetime(2011, 2, 11, 0, 0),
 datetime.datetime(2011, 3, 4, 0, 0),
 datetime.datetime(2011, 3, 7, 0, 0),
 datetime.datetime(2011, 3, 8, 0, 0),
 datetime.datetime(2011, 3, 9, 0, 0),
 datetime.datetime(2011, 3, 10, 0, 0),
 datetime.datetime(2011, 3, 11, 0, 0),
 datetime.datetime(2011, 3, 14, 0, 0),
 datetime.datetime(2011, 4, 1, 0, 0),
 datetime.datetime(2011, 4, 6, 0, 0),
 datetime.datetime(2011, 4, 7, 0, 0),
 datetime.datetime(2011, 4, 8, 0, 0),
 datetime.datetime(2011, 4, 11, 0, 0),
 datetime.datetime(2011, 4, 12, 0, 0),
 datetime.datetime(2011, 4, 13, 0, 0),
 datetime.datetime(2011, 4, 14, 0, 0),
 datetime.datetime(2011, 4, 15, 0, 0),
 datetime.datetime(2011, 4, 18, 0, 0),
 datetime.datetime(2011, 4, 19, 0, 0),
 datetime.datetime(2011, 4, 20, 0, 0),
 datetime.datetime(2011, 4, 21, 0, 0),
 datetime.datetime(2011, 4, 22, 0, 0),
 datetime.datetime(2011, 4, 25, 0, 0),
 datetime.datetime(2011, 4, 26, 0, 0),
 datetime.datetime(2011, 4, 27, 0, 0),
 datetime.datetime(2011, 9, 13, 0, 0),
 datetime.datetime(2011, 9, 14, 0, 0),
 datetime.datetime(2011, 9, 15, 0, 0),
 datetime.datetime(2011, 9, 16, 0, 0),
 datetime.datetime(2011, 9, 19, 0, 0),
 datetime.datetime(2011, 9, 20, 0, 0),
 datetime.datetime(2011, 9, 21, 0, 0),
 datetime.datetime(2011, 9, 22, 0, 0),
 datetime.datetime(2011, 9, 23, 0, 0),
 datetime.datetime(2011, 9, 26, 0, 0),
 datetime.datetime(2011, 9, 27, 0, 0),
 datetime.datetime(2011, 9, 28, 0, 0),
 datetime.datetime(2011, 9, 29, 0, 0),
 datetime.datetime(2011, 9, 30, 0, 0),
 datetime.datetime(2011, 10, 10, 0, 0),
 datetime.datetime(2011, 10, 11, 0, 0),
 datetime.datetime(2011, 10, 12, 0, 0),
 datetime.datetime(2011, 10, 13, 0, 0),
 datetime.datetime(2011, 10, 14, 0, 0),
 datetime.datetime(2011, 10, 17, 0, 0),
 datetime.datetime(2011, 10, 18, 0, 0),
 datetime.datetime(2011, 10, 19, 0, 0),
 datetime.datetime(2011, 10, 20, 0, 0),
 datetime.datetime(2011, 10, 21, 0, 0),
 datetime.datetime(2011, 10, 24, 0, 0),
 datetime.datetime(2011, 10, 25, 0, 0),
 datetime.datetime(2011, 12, 13, 0, 0),
 datetime.datetime(2011, 12, 14, 0, 0),
 datetime.datetime(2011, 12, 15, 0, 0),
 datetime.datetime(2011, 12, 16, 0, 0),
 datetime.datetime(2011, 12, 19, 0, 0),
 datetime.datetime(2011, 12, 20, 0, 0),
 datetime.datetime(2011, 12, 21, 0, 0),
 datetime.datetime(2011, 12, 22, 0, 0),
 datetime.datetime(2011, 12, 23, 0, 0),
 datetime.datetime(2011, 12, 26, 0, 0),
 datetime.datetime(2011, 12, 27, 0, 0),
 datetime.datetime(2011, 12, 28, 0, 0),
 datetime.datetime(2011, 12, 29, 0, 0),
 datetime.datetime(2011, 12, 30, 0, 0),
 datetime.datetime(2012, 1, 4, 0, 0),
 datetime.datetime(2012, 1, 5, 0, 0),
 datetime.datetime(2012, 1, 6, 0, 0),
 datetime.datetime(2012, 1, 9, 0, 0),
 datetime.datetime(2012, 1, 10, 0, 0),
 datetime.datetime(2012, 1, 11, 0, 0),
 datetime.datetime(2012, 1, 12, 0, 0),
 datetime.datetime(2012, 1, 13, 0, 0),
 datetime.datetime(2012, 1, 16, 0, 0),
 datetime.datetime(2012, 1, 17, 0, 0),
 datetime.datetime(2012, 1, 18, 0, 0),
 datetime.datetime(2012, 1, 19, 0, 0),
 datetime.datetime(2012, 1, 20, 0, 0),
 datetime.datetime(2012, 1, 30, 0, 0),
 datetime.datetime(2012, 1, 31, 0, 0),
 datetime.datetime(2012, 2, 1, 0, 0),
 datetime.datetime(2012, 2, 2, 0, 0),
 datetime.datetime(2012, 2, 3, 0, 0),
 datetime.datetime(2012, 2, 6, 0, 0),
 datetime.datetime(2012, 2, 7, 0, 0),
 datetime.datetime(2012, 2, 8, 0, 0),
 datetime.datetime(2012, 2, 9, 0, 0),
 datetime.datetime(2012, 2, 10, 0, 0),
 datetime.datetime(2012, 8, 6, 0, 0),
 datetime.datetime(2012, 8, 7, 0, 0),
 datetime.datetime(2012, 8, 8, 0, 0),
 datetime.datetime(2012, 8, 9, 0, 0),
 datetime.datetime(2012, 8, 15, 0, 0),
 datetime.datetime(2012, 8, 16, 0, 0),
 datetime.datetime(2012, 8, 17, 0, 0),
 datetime.datetime(2012, 8, 20, 0, 0),
 datetime.datetime(2012, 8, 21, 0, 0),
 datetime.datetime(2012, 8, 22, 0, 0),
 datetime.datetime(2012, 8, 23, 0, 0),
 datetime.datetime(2012, 8, 24, 0, 0),
 datetime.datetime(2012, 8, 27, 0, 0),
 datetime.datetime(2012, 8, 28, 0, 0),
 datetime.datetime(2012, 8, 29, 0, 0),
 datetime.datetime(2012, 8, 30, 0, 0),
 datetime.datetime(2012, 8, 31, 0, 0),
 datetime.datetime(2012, 9, 4, 0, 0),
 datetime.datetime(2012, 9, 5, 0, 0),
 datetime.datetime(2012, 9, 6, 0, 0),
 datetime.datetime(2012, 9, 7, 0, 0),
 datetime.datetime(2012, 9, 10, 0, 0),
 datetime.datetime(2012, 9, 11, 0, 0),
 datetime.datetime(2012, 9, 12, 0, 0),
 datetime.datetime(2012, 9, 25, 0, 0),
 datetime.datetime(2012, 9, 26, 0, 0),
 datetime.datetime(2012, 9, 27, 0, 0),
 datetime.datetime(2012, 11, 9, 0, 0),
 datetime.datetime(2012, 11, 12, 0, 0),
 datetime.datetime(2012, 11, 13, 0, 0),
 datetime.datetime(2012, 11, 14, 0, 0),
 datetime.datetime(2012, 11, 15, 0, 0),
 datetime.datetime(2012, 11, 16, 0, 0),
 datetime.datetime(2012, 11, 19, 0, 0),
 datetime.datetime(2012, 11, 20, 0, 0),
 datetime.datetime(2012, 11, 21, 0, 0),
 datetime.datetime(2012, 11, 22, 0, 0),
 datetime.datetime(2012, 11, 23, 0, 0),
 datetime.datetime(2012, 11, 26, 0, 0),
 datetime.datetime(2012, 11, 27, 0, 0),
 datetime.datetime(2012, 11, 28, 0, 0),
 datetime.datetime(2012, 11, 29, 0, 0),
 datetime.datetime(2012, 11, 30, 0, 0),
 datetime.datetime(2012, 12, 3, 0, 0),
 datetime.datetime(2012, 12, 4, 0, 0),
 datetime.datetime(2012, 12, 5, 0, 0),
 datetime.datetime(2012, 12, 6, 0, 0),
 datetime.datetime(2012, 12, 7, 0, 0),
 datetime.datetime(2012, 12, 11, 0, 0),
 datetime.datetime(2012, 12, 12, 0, 0),
 datetime.datetime(2012, 12, 13, 0, 0),
 datetime.datetime(2012, 12, 14, 0, 0),
 datetime.datetime(2012, 12, 17, 0, 0),
 datetime.datetime(2012, 12, 18, 0, 0),
 datetime.datetime(2012, 12, 19, 0, 0),
 datetime.datetime(2012, 12, 20, 0, 0),
 datetime.datetime(2012, 12, 21, 0, 0),
 datetime.datetime(2012, 12, 27, 0, 0),
 datetime.datetime(2012, 12, 28, 0, 0),
 datetime.datetime(2012, 12, 31, 0, 0),
 datetime.datetime(2013, 1, 4, 0, 0),
 datetime.datetime(2013, 1, 7, 0, 0),
 datetime.datetime(2013, 1, 8, 0, 0),
 datetime.datetime(2013, 1, 21, 0, 0),
 datetime.datetime(2013, 1, 22, 0, 0),
 datetime.datetime(2013, 1, 23, 0, 0),
 datetime.datetime(2013, 1, 24, 0, 0),
 datetime.datetime(2013, 1, 25, 0, 0),
 datetime.datetime(2013, 1, 28, 0, 0),
 datetime.datetime(2013, 1, 29, 0, 0),
 datetime.datetime(2013, 1, 30, 0, 0),
 datetime.datetime(2013, 1, 31, 0, 0),
 datetime.datetime(2013, 2, 1, 0, 0),
 datetime.datetime(2013, 2, 4, 0, 0),
 datetime.datetime(2013, 2, 5, 0, 0),
 datetime.datetime(2013, 2, 6, 0, 0),
 datetime.datetime(2013, 2, 7, 0, 0),
 datetime.datetime(2013, 2, 8, 0, 0),
 datetime.datetime(2013, 2, 18, 0, 0),
 datetime.datetime(2013, 2, 19, 0, 0),
 datetime.datetime(2013, 2, 20, 0, 0),
 datetime.datetime(2013, 2, 21, 0, 0),
 datetime.datetime(2013, 2, 22, 0, 0),
 datetime.datetime(2013, 2, 25, 0, 0),
 datetime.datetime(2013, 2, 26, 0, 0),
 datetime.datetime(2013, 2, 27, 0, 0),
 datetime.datetime(2013, 2, 28, 0, 0),
 datetime.datetime(2013, 3, 1, 0, 0),
 datetime.datetime(2013, 3, 4, 0, 0),
 datetime.datetime(2013, 3, 5, 0, 0),
 datetime.datetime(2013, 3, 6, 0, 0),
 datetime.datetime(2013, 3, 7, 0, 0),
 datetime.datetime(2013, 3, 8, 0, 0),
 datetime.datetime(2013, 3, 11, 0, 0),
 datetime.datetime(2013, 3, 20, 0, 0),
 datetime.datetime(2013, 3, 21, 0, 0),
 datetime.datetime(2013, 3, 22, 0, 0),
 datetime.datetime(2013, 3, 25, 0, 0),
 datetime.datetime(2013, 3, 26, 0, 0),
 datetime.datetime(2013, 3, 27, 0, 0),
 datetime.datetime(2013, 3, 28, 0, 0),
 datetime.datetime(2013, 3, 29, 0, 0),
 datetime.datetime(2013, 4, 1, 0, 0),
 datetime.datetime(2013, 4, 2, 0, 0),
 datetime.datetime(2013, 4, 3, 0, 0),
 datetime.datetime(2013, 4, 8, 0, 0),
 datetime.datetime(2013, 4, 9, 0, 0),
 datetime.datetime(2013, 4, 10, 0, 0),
 datetime.datetime(2013, 4, 11, 0, 0),
 datetime.datetime(2013, 4, 12, 0, 0),
 datetime.datetime(2013, 4, 15, 0, 0),
 datetime.datetime(2013, 4, 16, 0, 0),
 datetime.datetime(2013, 4, 17, 0, 0),
 datetime.datetime(2013, 6, 24, 0, 0),
 datetime.datetime(2013, 6, 25, 0, 0),
 datetime.datetime(2013, 6, 26, 0, 0),
 datetime.datetime(2013, 6, 27, 0, 0),
 datetime.datetime(2013, 6, 28, 0, 0),
 datetime.datetime(2013, 7, 1, 0, 0),
 datetime.datetime(2013, 7, 2, 0, 0),
 datetime.datetime(2013, 7, 3, 0, 0),
 datetime.datetime(2013, 7, 17, 0, 0),
 datetime.datetime(2013, 7, 18, 0, 0),
 datetime.datetime(2013, 7, 19, 0, 0),
 datetime.datetime(2013, 7, 22, 0, 0),
 datetime.datetime(2013, 7, 23, 0, 0),
 datetime.datetime(2013, 7, 24, 0, 0),
 datetime.datetime(2013, 7, 25, 0, 0),
 datetime.datetime(2013, 7, 26, 0, 0),
 datetime.datetime(2013, 7, 29, 0, 0),
 datetime.datetime(2013, 7, 30, 0, 0),
 datetime.datetime(2013, 7, 31, 0, 0),
 datetime.datetime(2013, 8, 1, 0, 0),
 datetime.datetime(2013, 8, 2, 0, 0),
 datetime.datetime(2013, 8, 5, 0, 0),
 datetime.datetime(2013, 8, 6, 0, 0),
 datetime.datetime(2013, 8, 7, 0, 0),
 datetime.datetime(2013, 8, 8, 0, 0),
 datetime.datetime(2013, 8, 9, 0, 0),
 datetime.datetime(2013, 8, 12, 0, 0),
 datetime.datetime(2013, 8, 13, 0, 0),
 datetime.datetime(2013, 8, 14, 0, 0),
 datetime.datetime(2013, 8, 15, 0, 0),
 datetime.datetime(2013, 8, 16, 0, 0),
 datetime.datetime(2013, 8, 19, 0, 0),
 datetime.datetime(2013, 8, 20, 0, 0),
 datetime.datetime(2013, 8, 21, 0, 0),
 datetime.datetime(2013, 8, 22, 0, 0),
 datetime.datetime(2013, 8, 23, 0, 0),
 datetime.datetime(2013, 8, 26, 0, 0),
 datetime.datetime(2013, 8, 27, 0, 0),
 datetime.datetime(2013, 8, 28, 0, 0),
 datetime.datetime(2013, 8, 29, 0, 0),
 datetime.datetime(2013, 8, 30, 0, 0),
 datetime.datetime(2013, 9, 2, 0, 0),
 datetime.datetime(2013, 9, 3, 0, 0),
 datetime.datetime(2013, 9, 4, 0, 0),
 datetime.datetime(2013, 9, 5, 0, 0),
 datetime.datetime(2013, 9, 6, 0, 0),
 datetime.datetime(2013, 9, 9, 0, 0),
 datetime.datetime(2013, 9, 10, 0, 0),
 datetime.datetime(2013, 9, 11, 0, 0),
 datetime.datetime(2013, 9, 12, 0, 0),
 datetime.datetime(2013, 9, 13, 0, 0),
 datetime.datetime(2013, 9, 16, 0, 0),
 datetime.datetime(2013, 9, 17, 0, 0),
 datetime.datetime(2013, 9, 18, 0, 0),
 datetime.datetime(2013, 9, 23, 0, 0),
 datetime.datetime(2013, 9, 24, 0, 0),
 datetime.datetime(2013, 9, 25, 0, 0),
 datetime.datetime(2013, 9, 26, 0, 0),
 datetime.datetime(2013, 9, 27, 0, 0),
 datetime.datetime(2013, 9, 30, 0, 0),
 datetime.datetime(2013, 10, 8, 0, 0),
 datetime.datetime(2013, 10, 9, 0, 0),
 datetime.datetime(2013, 10, 10, 0, 0),
 datetime.datetime(2013, 10, 11, 0, 0),
 datetime.datetime(2013, 10, 14, 0, 0),
 datetime.datetime(2013, 10, 15, 0, 0),
 datetime.datetime(2013, 10, 16, 0, 0),
 datetime.datetime(2013, 10, 17, 0, 0),
 datetime.datetime(2013, 10, 18, 0, 0),
 datetime.datetime(2013, 10, 21, 0, 0),
 datetime.datetime(2013, 10, 29, 0, 0),
 datetime.datetime(2013, 10, 30, 0, 0),
 datetime.datetime(2013, 10, 31, 0, 0),
 datetime.datetime(2013, 11, 1, 0, 0),
 datetime.datetime(2013, 11, 4, 0, 0),
 datetime.datetime(2013, 11, 5, 0, 0),
 datetime.datetime(2013, 11, 6, 0, 0),
 datetime.datetime(2013, 11, 7, 0, 0),
 datetime.datetime(2013, 11, 8, 0, 0),
 datetime.datetime(2013, 11, 11, 0, 0),
 datetime.datetime(2013, 11, 28, 0, 0),
 datetime.datetime(2013, 12, 5, 0, 0),
 datetime.datetime(2013, 12, 6, 0, 0),
 datetime.datetime(2013, 12, 9, 0, 0),
 datetime.datetime(2013, 12, 10, 0, 0),
 datetime.datetime(2013, 12, 11, 0, 0),
 datetime.datetime(2013, 12, 12, 0, 0),
 datetime.datetime(2013, 12, 13, 0, 0),
 datetime.datetime(2013, 12, 16, 0, 0),
 datetime.datetime(2013, 12, 17, 0, 0),
 datetime.datetime(2013, 12, 18, 0, 0),
 datetime.datetime(2013, 12, 19, 0, 0),
 datetime.datetime(2013, 12, 20, 0, 0),
 datetime.datetime(2013, 12, 23, 0, 0),
 datetime.datetime(2013, 12, 24, 0, 0),
 datetime.datetime(2013, 12, 25, 0, 0),
 datetime.datetime(2013, 12, 26, 0, 0),
 datetime.datetime(2013, 12, 27, 0, 0),
 datetime.datetime(2013, 12, 30, 0, 0),
 datetime.datetime(2013, 12, 31, 0, 0),
 datetime.datetime(2014, 1, 2, 0, 0),
 datetime.datetime(2014, 1, 3, 0, 0),
 datetime.datetime(2014, 1, 6, 0, 0),
 datetime.datetime(2014, 1, 7, 0, 0),
 datetime.datetime(2014, 1, 8, 0, 0),
 datetime.datetime(2014, 1, 9, 0, 0),
 datetime.datetime(2014, 1, 10, 0, 0),
 datetime.datetime(2014, 1, 13, 0, 0),
 datetime.datetime(2014, 1, 14, 0, 0),
 datetime.datetime(2014, 1, 15, 0, 0),
 datetime.datetime(2014, 1, 16, 0, 0),
 datetime.datetime(2014, 1, 17, 0, 0),
 datetime.datetime(2014, 1, 20, 0, 0),
 datetime.datetime(2014, 1, 21, 0, 0),
 datetime.datetime(2014, 1, 22, 0, 0),
 datetime.datetime(2014, 1, 23, 0, 0),
 datetime.datetime(2014, 4, 2, 0, 0),
 datetime.datetime(2014, 5, 5, 0, 0),
 datetime.datetime(2014, 5, 6, 0, 0),
 datetime.datetime(2014, 5, 7, 0, 0),
 datetime.datetime(2014, 5, 8, 0, 0),
 datetime.datetime(2014, 5, 9, 0, 0),
 datetime.datetime(2014, 5, 12, 0, 0),
 datetime.datetime(2014, 5, 13, 0, 0),
 datetime.datetime(2014, 5, 14, 0, 0),
 datetime.datetime(2014, 5, 15, 0, 0),
 datetime.datetime(2014, 5, 16, 0, 0),
 datetime.datetime(2014, 5, 19, 0, 0),
 datetime.datetime(2014, 5, 20, 0, 0),
 datetime.datetime(2014, 5, 21, 0, 0),
 datetime.datetime(2014, 5, 22, 0, 0),
 datetime.datetime(2014, 5, 23, 0, 0),
 datetime.datetime(2014, 5, 26, 0, 0),
 datetime.datetime(2014, 5, 27, 0, 0),
 datetime.datetime(2014, 5, 28, 0, 0),
 datetime.datetime(2014, 5, 29, 0, 0),
 datetime.datetime(2014, 5, 30, 0, 0),
 datetime.datetime(2014, 6, 3, 0, 0),
 datetime.datetime(2014, 6, 4, 0, 0),
 datetime.datetime(2014, 6, 5, 0, 0),
 datetime.datetime(2014, 6, 6, 0, 0),
 datetime.datetime(2014, 6, 9, 0, 0),
 datetime.datetime(2014, 6, 10, 0, 0),
 datetime.datetime(2014, 6, 11, 0, 0),
 datetime.datetime(2014, 6, 12, 0, 0),
 datetime.datetime(2014, 6, 13, 0, 0),
 datetime.datetime(2014, 6, 16, 0, 0),
 datetime.datetime(2014, 6, 17, 0, 0),
 datetime.datetime(2014, 6, 18, 0, 0),
 datetime.datetime(2014, 6, 19, 0, 0),
 datetime.datetime(2014, 6, 20, 0, 0),
 datetime.datetime(2014, 6, 23, 0, 0),
 datetime.datetime(2014, 8, 26, 0, 0),
 datetime.datetime(2014, 8, 27, 0, 0),
 datetime.datetime(2014, 8, 28, 0, 0),
 datetime.datetime(2014, 8, 29, 0, 0),
 datetime.datetime(2014, 9, 1, 0, 0),
 datetime.datetime(2014, 9, 2, 0, 0),
 datetime.datetime(2014, 9, 3, 0, 0),
 datetime.datetime(2014, 9, 4, 0, 0),
 datetime.datetime(2014, 9, 18, 0, 0),
 datetime.datetime(2014, 9, 19, 0, 0),
 datetime.datetime(2014, 9, 22, 0, 0),
 datetime.datetime(2014, 9, 23, 0, 0),
 datetime.datetime(2014, 9, 24, 0, 0),
 datetime.datetime(2014, 9, 25, 0, 0),
 datetime.datetime(2014, 9, 26, 0, 0),
 datetime.datetime(2014, 9, 29, 0, 0),
 datetime.datetime(2014, 10, 14, 0, 0),
 datetime.datetime(2014, 10, 15, 0, 0),
 datetime.datetime(2014, 10, 16, 0, 0),
 datetime.datetime(2014, 10, 17, 0, 0),
 datetime.datetime(2014, 10, 20, 0, 0),
 datetime.datetime(2014, 10, 21, 0, 0),
 datetime.datetime(2014, 10, 22, 0, 0),
 datetime.datetime(2014, 10, 23, 0, 0),
 datetime.datetime(2014, 10, 24, 0, 0),
 datetime.datetime(2014, 10, 27, 0, 0),
 datetime.datetime(2014, 10, 28, 0, 0),
 datetime.datetime(2014, 10, 29, 0, 0),
 datetime.datetime(2014, 10, 30, 0, 0),
 datetime.datetime(2014, 10, 31, 0, 0),
 datetime.datetime(2014, 11, 3, 0, 0),
 datetime.datetime(2014, 11, 4, 0, 0),
 datetime.datetime(2014, 11, 5, 0, 0),
 datetime.datetime(2014, 11, 6, 0, 0),
 datetime.datetime(2014, 11, 7, 0, 0),
 datetime.datetime(2014, 11, 10, 0, 0),
 datetime.datetime(2014, 11, 11, 0, 0),
 datetime.datetime(2014, 11, 12, 0, 0),
 datetime.datetime(2014, 11, 13, 0, 0),
 datetime.datetime(2014, 11, 14, 0, 0),
 datetime.datetime(2014, 11, 17, 0, 0),
 datetime.datetime(2014, 11, 25, 0, 0),
 datetime.datetime(2014, 11, 26, 0, 0),
 datetime.datetime(2014, 11, 27, 0, 0),
 datetime.datetime(2014, 11, 28, 0, 0),
 datetime.datetime(2015, 1, 21, 0, 0),
 datetime.datetime(2015, 1, 22, 0, 0),
 datetime.datetime(2015, 1, 23, 0, 0),
 datetime.datetime(2015, 1, 26, 0, 0),
 datetime.datetime(2015, 1, 27, 0, 0),
 datetime.datetime(2015, 1, 28, 0, 0),
 datetime.datetime(2015, 1, 29, 0, 0),
 datetime.datetime(2015, 1, 30, 0, 0),
 datetime.datetime(2015, 2, 2, 0, 0),
 datetime.datetime(2015, 2, 3, 0, 0),
 datetime.datetime(2015, 2, 4, 0, 0),
 datetime.datetime(2015, 2, 5, 0, 0),
 datetime.datetime(2015, 2, 6, 0, 0),
 datetime.datetime(2015, 2, 9, 0, 0),
 datetime.datetime(2015, 2, 10, 0, 0),
 datetime.datetime(2015, 2, 11, 0, 0),
 datetime.datetime(2015, 2, 12, 0, 0),
 datetime.datetime(2015, 2, 13, 0, 0),
 datetime.datetime(2015, 6, 19, 0, 0),
 datetime.datetime(2015, 6, 23, 0, 0),
 datetime.datetime(2015, 6, 24, 0, 0),
 datetime.datetime(2015, 6, 25, 0, 0),
 datetime.datetime(2015, 6, 26, 0, 0),
 datetime.datetime(2015, 6, 29, 0, 0),
 datetime.datetime(2015, 6, 30, 0, 0),
 datetime.datetime(2015, 7, 1, 0, 0),
 datetime.datetime(2015, 7, 2, 0, 0),
 datetime.datetime(2015, 7, 3, 0, 0),
 datetime.datetime(2015, 7, 6, 0, 0),
 datetime.datetime(2015, 7, 7, 0, 0),
 datetime.datetime(2015, 7, 8, 0, 0),
 datetime.datetime(2015, 7, 9, 0, 0),
 datetime.datetime(2015, 7, 10, 0, 0),
 datetime.datetime(2015, 7, 13, 0, 0),
 datetime.datetime(2015, 7, 14, 0, 0),
 datetime.datetime(2015, 7, 15, 0, 0),
 datetime.datetime(2015, 7, 21, 0, 0),
 datetime.datetime(2015, 7, 22, 0, 0),
 datetime.datetime(2015, 7, 23, 0, 0),
 datetime.datetime(2015, 7, 24, 0, 0),
 datetime.datetime(2015, 7, 27, 0, 0),
 datetime.datetime(2015, 7, 28, 0, 0),
 datetime.datetime(2015, 7, 29, 0, 0),
 datetime.datetime(2015, 7, 30, 0, 0),
 datetime.datetime(2015, 7, 31, 0, 0),
 datetime.datetime(2015, 8, 3, 0, 0),
 datetime.datetime(2015, 8, 4, 0, 0),
 datetime.datetime(2015, 8, 5, 0, 0),
 datetime.datetime(2015, 8, 6, 0, 0),
 datetime.datetime(2015, 8, 7, 0, 0),
 datetime.datetime(2015, 8, 10, 0, 0),
 datetime.datetime(2015, 8, 11, 0, 0),
 datetime.datetime(2015, 8, 12, 0, 0),
 datetime.datetime(2015, 8, 13, 0, 0),
 datetime.datetime(2015, 8, 14, 0, 0),
 datetime.datetime(2015, 8, 17, 0, 0),
 datetime.datetime(2015, 8, 18, 0, 0),
 datetime.datetime(2015, 8, 19, 0, 0),
 datetime.datetime(2015, 8, 20, 0, 0),
 datetime.datetime(2015, 8, 21, 0, 0),
 datetime.datetime(2015, 8, 24, 0, 0),
 datetime.datetime(2015, 8, 25, 0, 0),
 datetime.datetime(2015, 8, 26, 0, 0),
 datetime.datetime(2015, 8, 27, 0, 0),
 datetime.datetime(2015, 8, 28, 0, 0),
 datetime.datetime(2015, 8, 31, 0, 0),
 datetime.datetime(2015, 9, 1, 0, 0),
 datetime.datetime(2015, 9, 2, 0, 0),
 datetime.datetime(2015, 9, 7, 0, 0),
 datetime.datetime(2015, 9, 8, 0, 0),
 datetime.datetime(2015, 9, 9, 0, 0),
 datetime.datetime(2015, 9, 10, 0, 0),
 datetime.datetime(2015, 9, 11, 0, 0),
 datetime.datetime(2015, 9, 14, 0, 0),
 datetime.datetime(2015, 9, 15, 0, 0),
 datetime.datetime(2015, 9, 16, 0, 0),
 datetime.datetime(2015, 9, 17, 0, 0),
 datetime.datetime(2015, 11, 30, 0, 0),
 datetime.datetime(2015, 12, 1, 0, 0),
 datetime.datetime(2015, 12, 2, 0, 0),
 datetime.datetime(2015, 12, 3, 0, 0),
 datetime.datetime(2015, 12, 4, 0, 0),
 datetime.datetime(2015, 12, 14, 0, 0),
 datetime.datetime(2015, 12, 15, 0, 0),
 datetime.datetime(2015, 12, 16, 0, 0),
 datetime.datetime(2015, 12, 17, 0, 0),
 datetime.datetime(2015, 12, 18, 0, 0),
 datetime.datetime(2016, 1, 7, 0, 0),
 datetime.datetime(2016, 1, 8, 0, 0),
 datetime.datetime(2016, 1, 11, 0, 0),
 datetime.datetime(2016, 1, 12, 0, 0),
 datetime.datetime(2016, 1, 13, 0, 0),
 datetime.datetime(2016, 1, 14, 0, 0),
 datetime.datetime(2016, 1, 15, 0, 0),
 datetime.datetime(2016, 1, 18, 0, 0),
 datetime.datetime(2016, 1, 19, 0, 0),
 datetime.datetime(2016, 1, 20, 0, 0),
 datetime.datetime(2016, 1, 21, 0, 0),
 datetime.datetime(2016, 1, 22, 0, 0),
 datetime.datetime(2016, 1, 25, 0, 0),
 datetime.datetime(2016, 1, 26, 0, 0),
 datetime.datetime(2016, 1, 27, 0, 0),
 datetime.datetime(2016, 1, 28, 0, 0),
 datetime.datetime(2016, 1, 29, 0, 0),
 datetime.datetime(2016, 2, 1, 0, 0),
 datetime.datetime(2016, 2, 2, 0, 0),
 datetime.datetime(2016, 2, 3, 0, 0),
 datetime.datetime(2016, 2, 4, 0, 0),
 datetime.datetime(2016, 2, 5, 0, 0),
 datetime.datetime(2016, 2, 15, 0, 0),
 datetime.datetime(2016, 2, 16, 0, 0),
 datetime.datetime(2016, 2, 17, 0, 0),
 datetime.datetime(2016, 2, 18, 0, 0),
 datetime.datetime(2016, 2, 19, 0, 0),
 datetime.datetime(2016, 8, 10, 0, 0),
 datetime.datetime(2016, 8, 22, 0, 0),
 datetime.datetime(2016, 8, 23, 0, 0),
 datetime.datetime(2016, 8, 24, 0, 0),
 datetime.datetime(2016, 8, 25, 0, 0),
 datetime.datetime(2016, 8, 26, 0, 0),
 datetime.datetime(2016, 8, 29, 0, 0),
 datetime.datetime(2016, 8, 30, 0, 0),
 datetime.datetime(2016, 8, 31, 0, 0),
 datetime.datetime(2016, 9, 1, 0, 0),
 datetime.datetime(2016, 9, 2, 0, 0),
 datetime.datetime(2016, 9, 5, 0, 0),
 datetime.datetime(2016, 9, 6, 0, 0),
 datetime.datetime(2016, 9, 7, 0, 0),
 datetime.datetime(2016, 9, 8, 0, 0),
 datetime.datetime(2016, 9, 9, 0, 0),
 datetime.datetime(2016, 9, 12, 0, 0),
 datetime.datetime(2016, 9, 13, 0, 0),
 datetime.datetime(2016, 9, 14, 0, 0),
 datetime.datetime(2016, 9, 19, 0, 0),
 datetime.datetime(2016, 9, 20, 0, 0),
 datetime.datetime(2016, 9, 21, 0, 0),
 datetime.datetime(2016, 9, 22, 0, 0),
 datetime.datetime(2016, 9, 23, 0, 0),
 datetime.datetime(2016, 9, 26, 0, 0),
 datetime.datetime(2016, 9, 27, 0, 0),
 datetime.datetime(2016, 9, 28, 0, 0),
 datetime.datetime(2016, 9, 29, 0, 0),
 datetime.datetime(2016, 9, 30, 0, 0),
 datetime.datetime(2016, 10, 10, 0, 0),
 datetime.datetime(2016, 10, 11, 0, 0),
 datetime.datetime(2016, 10, 12, 0, 0),
 datetime.datetime(2016, 10, 13, 0, 0),
 datetime.datetime(2016, 11, 22, 0, 0),
 datetime.datetime(2016, 11, 23, 0, 0),
 datetime.datetime(2016, 11, 24, 0, 0),
 datetime.datetime(2016, 11, 25, 0, 0),
 datetime.datetime(2017, 7, 10, 0, 0),
 datetime.datetime(2017, 7, 11, 0, 0),
 datetime.datetime(2017, 7, 12, 0, 0),
 datetime.datetime(2017, 7, 13, 0, 0),
 datetime.datetime(2017, 7, 14, 0, 0),
 datetime.datetime(2017, 7, 17, 0, 0),
 datetime.datetime(2017, 7, 18, 0, 0),
 datetime.datetime(2017, 7, 19, 0, 0),
 datetime.datetime(2017, 7, 20, 0, 0),
 datetime.datetime(2017, 7, 21, 0, 0),
 datetime.datetime(2017, 7, 24, 0, 0),
 datetime.datetime(2017, 9, 12, 0, 0),
 datetime.datetime(2017, 9, 13, 0, 0),
 datetime.datetime(2017, 9, 14, 0, 0),
 datetime.datetime(2017, 9, 15, 0, 0),
 datetime.datetime(2017, 9, 18, 0, 0),
 datetime.datetime(2017, 12, 1, 0, 0),
 datetime.datetime(2017, 12, 4, 0, 0),
 datetime.datetime(2017, 12, 5, 0, 0),
 datetime.datetime(2017, 12, 6, 0, 0),
 datetime.datetime(2017, 12, 7, 0, 0),
 datetime.datetime(2017, 12, 8, 0, 0),
 datetime.datetime(2017, 12, 11, 0, 0),
 datetime.datetime(2017, 12, 12, 0, 0),
 datetime.datetime(2017, 12, 13, 0, 0),
 datetime.datetime(2017, 12, 14, 0, 0),
 datetime.datetime(2018, 2, 6, 0, 0),
 datetime.datetime(2018, 2, 7, 0, 0),
 datetime.datetime(2018, 2, 8, 0, 0),
 datetime.datetime(2018, 2, 9, 0, 0),
 datetime.datetime(2018, 2, 12, 0, 0),
 datetime.datetime(2018, 2, 13, 0, 0),
 datetime.datetime(2018, 2, 14, 0, 0),
 datetime.datetime(2018, 2, 22, 0, 0),
 datetime.datetime(2018, 2, 23, 0, 0),
 datetime.datetime(2018, 2, 26, 0, 0),
 datetime.datetime(2018, 2, 27, 0, 0),
 datetime.datetime(2018, 2, 28, 0, 0),
 datetime.datetime(2018, 3, 1, 0, 0),
 datetime.datetime(2018, 3, 2, 0, 0),
 datetime.datetime(2018, 3, 5, 0, 0),
 datetime.datetime(2018, 3, 6, 0, 0),
 datetime.datetime(2018, 3, 7, 0, 0),
 datetime.datetime(2018, 3, 8, 0, 0),
 datetime.datetime(2018, 3, 9, 0, 0),
 datetime.datetime(2018, 3, 12, 0, 0),
 datetime.datetime(2018, 3, 13, 0, 0),
 datetime.datetime(2018, 3, 14, 0, 0),
 datetime.datetime(2018, 3, 15, 0, 0),
 datetime.datetime(2018, 3, 16, 0, 0),
 datetime.datetime(2018, 3, 29, 0, 0),
 datetime.datetime(2018, 3, 30, 0, 0),
 datetime.datetime(2018, 4, 2, 0, 0),
 datetime.datetime(2018, 4, 3, 0, 0),
 datetime.datetime(2018, 4, 4, 0, 0),
 datetime.datetime(2018, 4, 9, 0, 0),
 datetime.datetime(2018, 4, 10, 0, 0),
 datetime.datetime(2018, 4, 11, 0, 0),
 datetime.datetime(2018, 4, 12, 0, 0),
 datetime.datetime(2018, 4, 13, 0, 0),
 datetime.datetime(2018, 4, 16, 0, 0),
 datetime.datetime(2018, 4, 17, 0, 0),
 datetime.datetime(2018, 4, 18, 0, 0),
 datetime.datetime(2018, 4, 19, 0, 0),
 datetime.datetime(2018, 4, 20, 0, 0),
 datetime.datetime(2018, 4, 23, 0, 0),
 datetime.datetime(2018, 4, 24, 0, 0),
 datetime.datetime(2018, 4, 25, 0, 0),
 datetime.datetime(2018, 4, 26, 0, 0),
 datetime.datetime(2018, 4, 27, 0, 0),
 datetime.datetime(2018, 5, 2, 0, 0),
 datetime.datetime(2018, 5, 3, 0, 0),
 datetime.datetime(2018, 5, 4, 0, 0),
 datetime.datetime(2018, 5, 7, 0, 0),
 datetime.datetime(2018, 5, 8, 0, 0),
 datetime.datetime(2018, 5, 9, 0, 0),
 datetime.datetime(2018, 7, 2, 0, 0),
 datetime.datetime(2018, 7, 3, 0, 0),
 datetime.datetime(2018, 7, 4, 0, 0),
 datetime.datetime(2018, 7, 5, 0, 0),
 datetime.datetime(2018, 7, 6, 0, 0),
 datetime.datetime(2018, 7, 9, 0, 0),
 datetime.datetime(2018, 7, 10, 0, 0),
 datetime.datetime(2018, 7, 11, 0, 0),
 datetime.datetime(2018, 7, 12, 0, 0),
 datetime.datetime(2018, 7, 13, 0, 0),
 datetime.datetime(2018, 7, 16, 0, 0),
 datetime.datetime(2018, 7, 17, 0, 0),
 datetime.datetime(2018, 7, 18, 0, 0),
 datetime.datetime(2018, 7, 25, 0, 0),
 datetime.datetime(2018, 8, 3, 0, 0),
 datetime.datetime(2018, 8, 6, 0, 0),
 datetime.datetime(2018, 8, 7, 0, 0),
 datetime.datetime(2018, 8, 8, 0, 0),
 datetime.datetime(2018, 8, 9, 0, 0),
 datetime.datetime(2018, 8, 10, 0, 0),
 datetime.datetime(2018, 8, 13, 0, 0),
 datetime.datetime(2018, 8, 14, 0, 0),
 datetime.datetime(2018, 8, 15, 0, 0),
 datetime.datetime(2018, 8, 16, 0, 0),
 datetime.datetime(2018, 8, 17, 0, 0),
 datetime.datetime(2018, 8, 20, 0, 0),
 datetime.datetime(2018, 8, 21, 0, 0),
 datetime.datetime(2018, 8, 22, 0, 0),
 datetime.datetime(2018, 8, 23, 0, 0),
 datetime.datetime(2018, 8, 24, 0, 0),
 datetime.datetime(2018, 8, 27, 0, 0),
 datetime.datetime(2018, 8, 28, 0, 0),
 datetime.datetime(2018, 8, 29, 0, 0),
 datetime.datetime(2018, 8, 30, 0, 0),
 datetime.datetime(2018, 8, 31, 0, 0),
 datetime.datetime(2018, 9, 3, 0, 0),
 datetime.datetime(2018, 9, 4, 0, 0),
 datetime.datetime(2018, 9, 5, 0, 0),
 datetime.datetime(2018, 9, 6, 0, 0),
 datetime.datetime(2018, 9, 7, 0, 0),
 datetime.datetime(2018, 9, 10, 0, 0),
 datetime.datetime(2018, 9, 11, 0, 0),
 datetime.datetime(2018, 9, 12, 0, 0),
 datetime.datetime(2018, 9, 13, 0, 0),
 datetime.datetime(2018, 9, 14, 0, 0),
 datetime.datetime(2018, 9, 17, 0, 0),
 datetime.datetime(2018, 9, 18, 0, 0),
 datetime.datetime(2018, 9, 19, 0, 0),
 datetime.datetime(2018, 9, 20, 0, 0),
 datetime.datetime(2018, 10, 16, 0, 0),
 datetime.datetime(2018, 10, 17, 0, 0),
 datetime.datetime(2018, 10, 18, 0, 0),
 datetime.datetime(2018, 10, 19, 0, 0),
 datetime.datetime(2018, 10, 22, 0, 0),
 datetime.datetime(2018, 10, 23, 0, 0),
 datetime.datetime(2018, 10, 24, 0, 0),
 datetime.datetime(2018, 10, 25, 0, 0),
 datetime.datetime(2018, 10, 26, 0, 0),
 datetime.datetime(2018, 10, 29, 0, 0),
 datetime.datetime(2018, 10, 30, 0, 0),
 datetime.datetime(2018, 10, 31, 0, 0),
 datetime.datetime(2018, 11, 1, 0, 0),
 datetime.datetime(2018, 11, 2, 0, 0),
 datetime.datetime(2018, 11, 5, 0, 0),
 datetime.datetime(2018, 11, 6, 0, 0),
 datetime.datetime(2018, 11, 7, 0, 0),
 datetime.datetime(2018, 11, 8, 0, 0),
 datetime.datetime(2018, 11, 9, 0, 0),
 datetime.datetime(2018, 11, 12, 0, 0),
 datetime.datetime(2018, 11, 13, 0, 0),
 datetime.datetime(2018, 11, 14, 0, 0),
 datetime.datetime(2018, 11, 15, 0, 0),
 datetime.datetime(2018, 11, 16, 0, 0),
 datetime.datetime(2018, 11, 19, 0, 0),
 datetime.datetime(2018, 11, 20, 0, 0),
 datetime.datetime(2018, 11, 21, 0, 0),
 datetime.datetime(2018, 11, 22, 0, 0),
 datetime.datetime(2018, 11, 23, 0, 0),
 datetime.datetime(2018, 11, 26, 0, 0),
 datetime.datetime(2018, 11, 27, 0, 0),
 datetime.datetime(2018, 11, 28, 0, 0),
 datetime.datetime(2018, 11, 29, 0, 0),
 datetime.datetime(2018, 11, 30, 0, 0),
 datetime.datetime(2018, 12, 3, 0, 0),
 datetime.datetime(2018, 12, 26, 0, 0),
 datetime.datetime(2018, 12, 27, 0, 0),
 datetime.datetime(2018, 12, 28, 0, 0),
 datetime.datetime(2019, 1, 2, 0, 0)]

5 如果从2010年1月1日开始,初试资金为100000元,金叉尽量买入,死叉全部卖出,则到今天为止,炒股收益如何?

first_money = 100000
money = first_money
hold = 0 #持有多少股
sr1 = pd.Series(1, index=golden_cross)
sr2 = pd.Series(1, index=death_cross)
sr = sr1.append(sr2).sort_index()
 
 
for i in range(0, len(sr)):
    p = df['open'][sr.index[i]]
    if sr.iloc[i] == 1:
        #金叉
        buy = (money // (100 * p))
        hold += buy*100
        money -= buy*100*p
    else:
        money += hold * p
        hold = 0
         
p = df['open'][-1]
now_money = hold * p + money
 
print(now_money - first_money)
722502.9

你可能感兴趣的:(python量化之路)