diff --git a/.gitignore b/.gitignore index f7503e0..b251fd4 100644 --- a/.gitignore +++ b/.gitignore @@ -116,3 +116,4 @@ profile.pstats profile.txt bat.cmd /backup/ +/data/v4.1/*.csv diff --git a/README.md b/README.md index 13386a9..b2725e8 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,9 @@ -# 파이썬를 이용한 딥러닝/강화학습 주식투자 - 파이토치와 케라스를 활용한 인공지능 퀀트 투자 시스템 (개정2판) +- 추가 개선 사항은 [퀀티랩 프리미엄콘텐츠](https://contents.premium.naver.com/misoncorp/quantylab)에서 공유합니다. +- [퀀티랩 블로그 관련 포스트](http://blog.quantylab.com/pages/rltrader.html) + +--- -[퀀티랩 블로그 관련 포스트](http://blog.quantylab.com/pages/rltrader.html) +# 파이썬를 이용한 딥러닝/강화학습 주식투자 - 파이토치와 케라스를 활용한 인공지능 퀀트 투자 시스템 (개정2판) 강화학습은 스스로 학습하는 머신러닝 기법으로서 주식 데이터 학습에 잘 적용되는 기법입니다. 이 책은 파이썬을 이용한 강화학습 기반의 주식투자 시뮬레이션 프로그램을 개발하는 방법을 설명합니다. 이를 위해 이론과 코드 수준에서 상세한 설명을 덧붙였습니다. 이 책을 통해 딥러닝과 강화학습을 이해하고 이를 주식투자를 비롯한 다양한 도메인에서 활용할 수 있을 것입니다. @@ -112,6 +115,14 @@ v3, v4 학습데이터는 시장 데이터와 종목 데이터를 합하여 사 - `python -m cProfile -o profile.pstats main.py ...` - `python profile.py` +# Tips + +- Windows Power Shell에서 로그 Tail 하는 방법 + +``` +cat D:\dev\rltrader\output\train_000240_a2c_lstm\train_000240_a2c_lstm.log -Wait -Tail 100 +``` + # Troubleshooting ## TF 1.15에서 다음 에러가 나면 Python 3.6으로 맞춰준다. diff --git a/conf/data/v4.1/feature_list.txt b/conf/data/v4.1/feature_list.txt new file mode 100644 index 0000000..df0f1c3 --- /dev/null +++ b/conf/data/v4.1/feature_list.txt @@ -0,0 +1,463 @@ +diffratio +high_close_ratio +low_close_ratio +open_lastclose_ratio +volume_lastvolume_ratio +trans_price_exp +trans_price_exp_ma5 +close_ma5_ratio +close_ma10_ratio +close_ma20_ratio +close_ma60_ratio +close_ma120_ratio +volume_ma5_ratio +volume_ma10_ratio +volume_ma20_ratio +volume_ma60_ratio +volume_ma120_ratio +close_ubb_ratio +close_lbb_ratio +macd_signal_ratio +rsi +buy_strength_ma5_ratio +sell_strength_ma5_ratio +prevvalid_cnt +per +pbr +roe +roa +per_krx +pbr_krx +roe_krx +dyr_krx +marketcap +ind +ind_diff +ind_ma5 +ind_ma10 +ind_ma20 +ind_ma60 +ind_ma120 +inst +inst_diff +inst_ma5 +inst_ma10 +inst_ma20 +inst_ma60 +inst_ma120 +foreign +foreign_diff +foreign_ma5 +foreign_ma10 +foreign_ma20 +foreign_ma60 +foreign_ma120 +bal_rto +bal_rto_diff +bal_rto_ma10 +bal_rto_ma120 +bal_rto_ma20 +bal_rto_ma5 +bal_rto_ma60 +short_ratio +short_ratio_diff +short_ratio_ma10 +short_ratio_ma120 +short_ratio_ma20 +short_ratio_ma5 +short_ratio_ma60 +market_kospi_diffratio +market_kospi_ma5_ratio +market_kospi_ma20_ratio +market_kospi_ma60_ratio +market_kospi_ma120_ratio +market_kosdaq_diffratio +market_kosdaq_ma5_ratio +market_kosdaq_ma20_ratio +market_kosdaq_ma60_ratio +market_kosdaq_ma120_ratio +market_kospi_volume_diffratio +market_kospi_volume_ma5_ratio +market_kospi_volume_ma20_ratio +market_kospi_volume_ma60_ratio +market_kospi_volume_ma120_ratio +market_kosdaq_volume_diffratio +market_kosdaq_volume_ma5_ratio +market_kosdaq_volume_ma20_ratio +market_kosdaq_volume_ma60_ratio +market_kosdaq_volume_ma120_ratio +fmarket_dji_diffratio +fmarket_dji_ma5_ratio +fmarket_dji_ma20_ratio +fmarket_dji_ma60_ratio +fmarket_dji_ma120_ratio +fmarket_ni225_diffratio +fmarket_ni225_ma5_ratio +fmarket_ni225_ma20_ratio +fmarket_ni225_ma60_ratio +fmarket_ni225_ma120_ratio +fmarket_hsi_diffratio +fmarket_hsi_ma5_ratio +fmarket_hsi_ma20_ratio +fmarket_hsi_ma60_ratio +fmarket_hsi_ma120_ratio +fmarket_dji_volume_diffratio +fmarket_dji_volume_ma5_ratio +fmarket_dji_volume_ma20_ratio +fmarket_dji_volume_ma60_ratio +fmarket_dji_volume_ma120_ratio +fmarket_ni225_volume_diffratio +fmarket_ni225_volume_ma5_ratio +fmarket_ni225_volume_ma20_ratio +fmarket_ni225_volume_ma60_ratio +fmarket_ni225_volume_ma120_ratio +fmarket_hsi_volume_diffratio +fmarket_hsi_volume_ma5_ratio +fmarket_hsi_volume_ma20_ratio +fmarket_hsi_volume_ma60_ratio +fmarket_hsi_volume_ma120_ratio +bond_k3y_diffratio +bond_k3y_ma5_ratio +bond_k3y_ma20_ratio +bond_k3y_ma60_ratio +bond_k3y_ma120_ratio +bond_k3y_volume_diffratio +bond_k3y_volume_ma5_ratio +bond_k3y_volume_ma20_ratio +bond_k3y_volume_ma60_ratio +bond_k3y_volume_ma120_ratio +interestrates_base_diffratio +interestrates_base_ma5_ratio +interestrates_base_ma20_ratio +interestrates_base_ma60_ratio +interestrates_base_ma120_ratio +interestrates_base +interestrates_us_target_diffratio +interestrates_us_target_ma5_ratio +interestrates_us_target_ma20_ratio +interestrates_us_target_ma60_ratio +interestrates_us_target_ma120_ratio +interestrates_us_target +interestrates_us_10y_diffratio +interestrates_us_10y_ma5_ratio +interestrates_us_10y_ma20_ratio +interestrates_us_10y_ma60_ratio +interestrates_us_10y_ma120_ratio +interestrates_us_10y +interestrates_us_30y_diffratio +interestrates_us_30y_ma5_ratio +interestrates_us_30y_ma20_ratio +interestrates_us_30y_ma60_ratio +interestrates_us_30y_ma120_ratio +interestrates_us_30y +commodity_aluminum_diffratio +commodity_aluminum_ma5_ratio +commodity_aluminum_ma20_ratio +commodity_aluminum_ma60_ratio +commodity_aluminum_ma120_ratio +commodity_cocoa_diffratio +commodity_cocoa_ma5_ratio +commodity_cocoa_ma20_ratio +commodity_cocoa_ma60_ratio +commodity_cocoa_ma120_ratio +commodity_coffee_diffratio +commodity_coffee_ma5_ratio +commodity_coffee_ma20_ratio +commodity_coffee_ma60_ratio +commodity_coffee_ma120_ratio +commodity_copper_diffratio +commodity_copper_ma5_ratio +commodity_copper_ma20_ratio +commodity_copper_ma60_ratio +commodity_copper_ma120_ratio +commodity_corn_diffratio +commodity_corn_ma5_ratio +commodity_corn_ma20_ratio +commodity_corn_ma60_ratio +commodity_corn_ma120_ratio +commodity_cotton_diffratio +commodity_cotton_ma5_ratio +commodity_cotton_ma20_ratio +commodity_cotton_ma60_ratio +commodity_cotton_ma120_ratio +commodity_gold_domestic_diffratio +commodity_gold_domestic_ma5_ratio +commodity_gold_domestic_ma20_ratio +commodity_gold_domestic_ma60_ratio +commodity_gold_domestic_ma120_ratio +commodity_gold_world_diffratio +commodity_gold_world_ma5_ratio +commodity_gold_world_ma20_ratio +commodity_gold_world_ma60_ratio +commodity_gold_world_ma120_ratio +commodity_heating_oil_diffratio +commodity_heating_oil_ma5_ratio +commodity_heating_oil_ma20_ratio +commodity_heating_oil_ma60_ratio +commodity_heating_oil_ma120_ratio +commodity_iron_diffratio +commodity_iron_ma5_ratio +commodity_iron_ma20_ratio +commodity_iron_ma60_ratio +commodity_iron_ma120_ratio +commodity_lead_diffratio +commodity_lead_ma5_ratio +commodity_lead_ma20_ratio +commodity_lead_ma60_ratio +commodity_lead_ma120_ratio +commodity_lumber_diffratio +commodity_lumber_ma5_ratio +commodity_lumber_ma20_ratio +commodity_lumber_ma60_ratio +commodity_lumber_ma120_ratio +commodity_natural_gas_diffratio +commodity_natural_gas_ma5_ratio +commodity_natural_gas_ma20_ratio +commodity_natural_gas_ma60_ratio +commodity_natural_gas_ma120_ratio +commodity_nickel_diffratio +commodity_nickel_ma5_ratio +commodity_nickel_ma20_ratio +commodity_nickel_ma60_ratio +commodity_nickel_ma120_ratio +commodity_oil_diesel_diffratio +commodity_oil_diesel_ma5_ratio +commodity_oil_diesel_ma20_ratio +commodity_oil_diesel_ma60_ratio +commodity_oil_diesel_ma120_ratio +commodity_oil_gasoline_diffratio +commodity_oil_gasoline_ma5_ratio +commodity_oil_gasoline_ma20_ratio +commodity_oil_gasoline_ma60_ratio +commodity_oil_gasoline_ma120_ratio +commodity_oil_wti_diffratio +commodity_oil_wti_ma5_ratio +commodity_oil_wti_ma20_ratio +commodity_oil_wti_ma60_ratio +commodity_oil_wti_ma120_ratio +commodity_orange_juice_diffratio +commodity_orange_juice_ma5_ratio +commodity_orange_juice_ma20_ratio +commodity_orange_juice_ma60_ratio +commodity_orange_juice_ma120_ratio +commodity_palladium_diffratio +commodity_palladium_ma5_ratio +commodity_palladium_ma20_ratio +commodity_palladium_ma60_ratio +commodity_palladium_ma120_ratio +commodity_platinum_diffratio +commodity_platinum_ma5_ratio +commodity_platinum_ma20_ratio +commodity_platinum_ma60_ratio +commodity_platinum_ma120_ratio +commodity_rice_diffratio +commodity_rice_ma5_ratio +commodity_rice_ma20_ratio +commodity_rice_ma60_ratio +commodity_rice_ma120_ratio +commodity_silver_diffratio +commodity_silver_ma5_ratio +commodity_silver_ma20_ratio +commodity_silver_ma60_ratio +commodity_silver_ma120_ratio +commodity_soybean_diffratio +commodity_soybean_ma5_ratio +commodity_soybean_ma20_ratio +commodity_soybean_ma60_ratio +commodity_soybean_ma120_ratio +commodity_soybean_gourd_diffratio +commodity_soybean_gourd_ma5_ratio +commodity_soybean_gourd_ma20_ratio +commodity_soybean_gourd_ma60_ratio +commodity_soybean_gourd_ma120_ratio +commodity_soybean_milk_diffratio +commodity_soybean_milk_ma5_ratio +commodity_soybean_milk_ma20_ratio +commodity_soybean_milk_ma60_ratio +commodity_soybean_milk_ma120_ratio +commodity_sugar11_diffratio +commodity_sugar11_ma5_ratio +commodity_sugar11_ma20_ratio +commodity_sugar11_ma60_ratio +commodity_sugar11_ma120_ratio +commodity_tin_diffratio +commodity_tin_ma5_ratio +commodity_tin_ma20_ratio +commodity_tin_ma60_ratio +commodity_tin_ma120_ratio +commodity_wheat_diffratio +commodity_wheat_ma5_ratio +commodity_wheat_ma20_ratio +commodity_wheat_ma60_ratio +commodity_wheat_ma120_ratio +commodity_zinc_diffratio +commodity_zinc_ma5_ratio +commodity_zinc_ma20_ratio +commodity_zinc_ma60_ratio +commodity_zinc_ma120_ratio +gsci_diffratio +gsci_ma5_ratio +gsci_ma20_ratio +gsci_ma60_ratio +gsci_ma120_ratio +fx_usdkrw_diffratio +fx_usdkrw_ma5_ratio +fx_usdkrw_ma20_ratio +fx_usdkrw_ma60_ratio +fx_usdkrw_ma120_ratio +fx_eurkrw_diffratio +fx_eurkrw_ma5_ratio +fx_eurkrw_ma20_ratio +fx_eurkrw_ma60_ratio +fx_eurkrw_ma120_ratio +fx_jpykrw_diffratio +fx_jpykrw_ma5_ratio +fx_jpykrw_ma20_ratio +fx_jpykrw_ma60_ratio +fx_jpykrw_ma120_ratio +fx_cnykrw_diffratio +fx_cnykrw_ma5_ratio +fx_cnykrw_ma20_ratio +fx_cnykrw_ma60_ratio +fx_cnykrw_ma120_ratio +fx_hkdkrw_diffratio +fx_hkdkrw_ma5_ratio +fx_hkdkrw_ma20_ratio +fx_hkdkrw_ma60_ratio +fx_hkdkrw_ma120_ratio +dx_diffratio +dx_ma5_ratio +dx_ma20_ratio +dx_ma60_ratio +dx_ma120_ratio +dx_volume_diffratio +dx_volume_ma5_ratio +dx_volume_ma20_ratio +dx_volume_ma60_ratio +dx_volume_ma120_ratio +bdi_diffratio +bdi_ma5_ratio +bdi_ma20_ratio +bdi_ma60_ratio +bdi_ma120_ratio +sox_diffratio +sox_ma5_ratio +sox_ma20_ratio +sox_ma60_ratio +sox_ma120_ratio +vix_diffratio +vix_ma5_ratio +vix_ma20_ratio +vix_ma60_ratio +vix_ma120_ratio +msci_world_diffratio +msci_world_ma5_ratio +msci_world_ma20_ratio +msci_world_ma60_ratio +msci_world_ma120_ratio +msci_acwi_diffratio +msci_acwi_ma5_ratio +msci_acwi_ma20_ratio +msci_acwi_ma60_ratio +msci_acwi_ma120_ratio +msci_em_diffratio +msci_em_ma5_ratio +msci_em_ma20_ratio +msci_em_ma60_ratio +msci_em_ma120_ratio +msci_korea_diffratio +msci_korea_ma5_ratio +msci_korea_ma20_ratio +msci_korea_ma60_ratio +msci_korea_ma120_ratio +msci_usa_diffratio +msci_usa_ma5_ratio +msci_usa_ma20_ratio +msci_usa_ma60_ratio +msci_usa_ma120_ratio +msci_china_diffratio +msci_china_ma5_ratio +msci_china_ma20_ratio +msci_china_ma60_ratio +msci_china_ma120_ratio +msci_japan_diffratio +msci_japan_ma5_ratio +msci_japan_ma20_ratio +msci_japan_ma60_ratio +msci_japan_ma120_ratio +msci_hongkong_diffratio +msci_hongkong_ma5_ratio +msci_hongkong_ma20_ratio +msci_hongkong_ma60_ratio +msci_hongkong_ma120_ratio +msci_uk_diffratio +msci_uk_ma5_ratio +msci_uk_ma20_ratio +msci_uk_ma60_ratio +msci_uk_ma120_ratio +msci_france_diffratio +msci_france_ma5_ratio +msci_france_ma20_ratio +msci_france_ma60_ratio +msci_france_ma120_ratio +msci_germany_diffratio +msci_germany_ma5_ratio +msci_germany_ma20_ratio +msci_germany_ma60_ratio +msci_germany_ma120_ratio +price_index_cpi +price_index_ppi +price_index_cpi_us +price_index_ppi_us +current_account +current_account_goods +current_account_service +current_account_primary +current_account_transfer +current_account_trade +stockmarket_investor_ind +stockmarket_investor_ind_diffratio +stockmarket_investor_ind_ma5_ratio +stockmarket_investor_ind_ma20_ratio +stockmarket_investor_ind_ma60_ratio +stockmarket_investor_ind_ma120_ratio +stockmarket_investor_inst +stockmarket_investor_inst_diffratio +stockmarket_investor_inst_ma5_ratio +stockmarket_investor_inst_ma20_ratio +stockmarket_investor_inst_ma60_ratio +stockmarket_investor_inst_ma120_ratio +stockmarket_investor_foreign +stockmarket_investor_foreign_diffratio +stockmarket_investor_foreign_ma5_ratio +stockmarket_investor_foreign_ma20_ratio +stockmarket_investor_foreign_ma60_ratio +stockmarket_investor_foreign_ma120_ratio +price_index_cpi +price_index_ppi +price_index_cpi_us +price_index_ppi_us +current_account +current_account_goods +current_account_service +current_account_primary +current_account_transfer +current_account_trade +stockmarket_investor_ind +stockmarket_investor_ind_diffratio +stockmarket_investor_ind_ma5_ratio +stockmarket_investor_ind_ma20_ratio +stockmarket_investor_ind_ma60_ratio +stockmarket_investor_ind_ma120_ratio +stockmarket_investor_inst +stockmarket_investor_inst_diffratio +stockmarket_investor_inst_ma5_ratio +stockmarket_investor_inst_ma20_ratio +stockmarket_investor_inst_ma60_ratio +stockmarket_investor_inst_ma120_ratio +stockmarket_investor_foreign +stockmarket_investor_foreign_diffratio +stockmarket_investor_foreign_ma5_ratio +stockmarket_investor_foreign_ma20_ratio +stockmarket_investor_foreign_ma60_ratio +stockmarket_investor_foreign_ma120_ratio diff --git a/data/v4.2/taylor_us_20150101_20221211.csv b/data/v4.2/taylor_us_20150101_20221211.csv new file mode 100644 index 0000000..42af032 --- /dev/null +++ b/data/v4.2/taylor_us_20150101_20221211.csv @@ -0,0 +1,32 @@ +"date","taylor" +"20150101",1.7078307768550722 +"20150401",1.724433088893079 +"20150701",1.4462448762985962 +"20151001",1.0291966940521597 +"20160101",1.0295877340709223 +"20160401",1.2087607650353087 +"20160701",1.2579751231315932 +"20161001",2.101412866252205 +"20170101",3.009920860232667 +"20170401",2.4454630298296114 +"20170701",2.9764999782673605 +"20171001",3.495406372123368 +"20180101",3.7586487885746065 +"20180401",4.707793582205765 +"20180701",4.5762150504747146 +"20181001",4.073498291583118 +"20190101",3.7614520106414377 +"20190401",3.4030793343201604 +"20190701",3.5929197705263243 +"20191001",3.4456170494063585 +"20200101",2.6555462405685484 +"20200401",-3.127008823599276 +"20200701",1.0108701989034807 +"20201001",1.672590217099207 +"20210101",3.4834689757738686 +"20210401",7.065090260355881 +"20210701",8.176953131163982 +"20211001",10.406591234422619 +"20220101",11.200545412762523 +"20220401",11.916978625573226 +"20220701",11.170479869600562 diff --git a/data/v4.2/tips_20150101_20221211.csv b/data/v4.2/tips_20150101_20221211.csv new file mode 100644 index 0000000..a579a65 --- /dev/null +++ b/data/v4.2/tips_20150101_20221211.csv @@ -0,0 +1,2051 @@ +"date","value" +"20150101","" +"20150102",0.41 +"20150105",0.4 +"20150106",0.41 +"20150107",0.39 +"20150108",0.41 +"20150109",0.36 +"20150112",0.35 +"20150113",0.37 +"20150114",0.29 +"20150115",0.19 +"20150116",0.23 +"20150119","" +"20150120",0.23 +"20150121",0.26 +"20150122",0.29 +"20150123",0.21 +"20150126",0.22 +"20150127",0.17 +"20150128",0.12 +"20150129",0.15 +"20150130",0.03 +"20150202",0.03 +"20150203",0.09 +"20150204",0.1 +"20150205",0.13 +"20150206",0.24 +"20150209",0.25 +"20150210",0.31 +"20150211",0.32 +"20150212",0.33 +"20150213",0.34 +"20150216","" +"20150217",0.43 +"20150218",0.36 +"20150219",0.37 +"20150220",0.38 +"20150223",0.34 +"20150224",0.27 +"20150225",0.24 +"20150226",0.24 +"20150227",0.17 +"20150302",0.25 +"20150303",0.26 +"20150304",0.25 +"20150305",0.27 +"20150306",0.41 +"20150309",0.44 +"20150310",0.41 +"20150311",0.39 +"20150312",0.39 +"20150313",0.44 +"20150316",0.45 +"20150317",0.42 +"20150318",0.23 +"20150319",0.19 +"20150320",0.17 +"20150323",0.17 +"20150324",0.11 +"20150325",0.12 +"20150326",0.21 +"20150327",0.19 +"20150330",0.23 +"20150331",0.18 +"20150401",0.07 +"20150402",0.11 +"20150403",0.02 +"20150406",0.07 +"20150407",0.04 +"20150408",0.08 +"20150409",0.13 +"20150410",0.14 +"20150413",0.14 +"20150414",0.1 +"20150415",0.07 +"20150416",0.05 +"20150417",-0.02 +"20150420",0.01 +"20150421",0.06 +"20150422",0.12 +"20150423",0.07 +"20150424",0.04 +"20150427",0.03 +"20150428",0.11 +"20150429",0.14 +"20150430",0.11 +"20150501",0.18 +"20150504",0.24 +"20150505",0.25 +"20150506",0.34 +"20150507",0.3 +"20150508",0.28 +"20150511",0.4 +"20150512",0.4 +"20150513",0.41 +"20150514",0.36 +"20150515",0.31 +"20150518",0.37 +"20150519",0.42 +"20150520",0.38 +"20150521",0.35 +"20150522",0.34 +"20150525","" +"20150526",0.32 +"20150527",0.34 +"20150528",0.33 +"20150529",0.32 +"20150601",0.39 +"20150602",0.44 +"20150603",0.55 +"20150604",0.5 +"20150605",0.55 +"20150608",0.54 +"20150609",0.56 +"20150610",0.63 +"20150611",0.56 +"20150612",0.55 +"20150615",0.51 +"20150616",0.44 +"20150617",0.42 +"20150618",0.46 +"20150619",0.4 +"20150622",0.47 +"20150623",0.5 +"20150624",0.48 +"20150625",0.49 +"20150626",0.57 +"20150629",0.46 +"20150630",0.48 +"20150701",0.54 +"20150702",0.49 +"20150703","" +"20150706",0.43 +"20150707",0.4 +"20150708",0.39 +"20150709",0.47 +"20150710",0.55 +"20150713",0.58 +"20150714",0.56 +"20150715",0.52 +"20150716",0.52 +"20150717",0.51 +"20150720",0.56 +"20150721",0.53 +"20150722",0.53 +"20150723",0.49 +"20150724",0.51 +"20150727",0.5 +"20150728",0.51 +"20150729",0.52 +"20150730",0.51 +"20150731",0.46 +"20150803",0.46 +"20150804",0.52 +"20150805",0.58 +"20150806",0.56 +"20150807",0.52 +"20150810",0.55 +"20150811",0.49 +"20150812",0.52 +"20150813",0.57 +"20150814",0.58 +"20150817",0.58 +"20150818",0.62 +"20150819",0.55 +"20150820",0.53 +"20150821",0.52 +"20150824",0.52 +"20150825",0.59 +"20150826",0.65 +"20150827",0.6 +"20150828",0.58 +"20150831",0.58 +"20150901",0.6 +"20150902",0.64 +"20150903",0.64 +"20150904",0.62 +"20150907","" +"20150908",0.67 +"20150909",0.65 +"20150910",0.64 +"20150911",0.61 +"20150914",0.62 +"20150915",0.72 +"20150916",0.73 +"20150917",0.63 +"20150918",0.58 +"20150921",0.66 +"20150922",0.63 +"20150923",0.64 +"20150924",0.64 +"20150925",0.71 +"20150928",0.71 +"20150929",0.66 +"20150930",0.65 +"20151001",0.59 +"20151002",0.51 +"20151005",0.56 +"20151006",0.53 +"20151007",0.53 +"20151008",0.54 +"20151009",0.58 +"20151012","" +"20151013",0.54 +"20151014",0.5 +"20151015",0.54 +"20151016",0.56 +"20151019",0.59 +"20151020",0.6 +"20151021",0.59 +"20151022",0.57 +"20151023",0.58 +"20151026",0.59 +"20151027",0.57 +"20151028",0.63 +"20151029",0.67 +"20151030",0.63 +"20151102",0.65 +"20151103",0.65 +"20151104",0.68 +"20151105",0.71 +"20151106",0.75 +"20151109",0.76 +"20151110",0.77 +"20151111","" +"20151112",0.78 +"20151113",0.76 +"20151116",0.76 +"20151117",0.72 +"20151118",0.71 +"20151119",0.68 +"20151120",0.66 +"20151123",0.64 +"20151124",0.62 +"20151125",0.62 +"20151126","" +"20151127",0.62 +"20151130",0.62 +"20151201",0.58 +"20151202",0.62 +"20151203",0.72 +"20151204",0.68 +"20151207",0.67 +"20151208",0.68 +"20151209",0.69 +"20151210",0.73 +"20151211",0.67 +"20151214",0.78 +"20151215",0.8 +"20151216",0.84 +"20151217",0.77 +"20151218",0.73 +"20151221",0.75 +"20151222",0.78 +"20151223",0.76 +"20151224",0.73 +"20151225","" +"20151228",0.74 +"20151229",0.79 +"20151230",0.77 +"20151231",0.73 +"20160101","" +"20160104",0.69 +"20160105",0.69 +"20160106",0.65 +"20160107",0.66 +"20160108",0.65 +"20160111",0.72 +"20160112",0.69 +"20160113",0.65 +"20160114",0.67 +"20160115",0.67 +"20160118","" +"20160119",0.68 +"20160120",0.69 +"20160121",0.74 +"20160122",0.72 +"20160125",0.69 +"20160126",0.65 +"20160127",0.62 +"20160128",0.58 +"20160129",0.53 +"20160201",0.57 +"20160202",0.51 +"20160203",0.5 +"20160204",0.51 +"20160205",0.53 +"20160208",0.52 +"20160209",0.53 +"20160210",0.5 +"20160211",0.45 +"20160212",0.49 +"20160215","" +"20160216",0.53 +"20160217",0.53 +"20160218",0.51 +"20160219",0.5 +"20160222",0.46 +"20160223",0.42 +"20160224",0.39 +"20160225",0.32 +"20160226",0.35 +"20160229",0.32 +"20160301",0.35 +"20160302",0.33 +"20160303",0.3 +"20160304",0.37 +"20160307",0.43 +"20160308",0.37 +"20160309",0.39 +"20160310",0.45 +"20160311",0.44 +"20160314",0.45 +"20160315",0.47 +"20160316",0.36 +"20160317",0.34 +"20160318",0.27 +"20160321",0.28 +"20160322",0.31 +"20160323",0.3 +"20160324",0.34 +"20160325","" +"20160328",0.33 +"20160329",0.2 +"20160330",0.18 +"20160331",0.16 +"20160401",0.17 +"20160404",0.14 +"20160405",0.14 +"20160406",0.17 +"20160407",0.12 +"20160408",0.14 +"20160411",0.17 +"20160412",0.22 +"20160413",0.21 +"20160414",0.24 +"20160415",0.2 +"20160418",0.21 +"20160419",0.19 +"20160420",0.23 +"20160421",0.24 +"20160422",0.25 +"20160425",0.26 +"20160426",0.27 +"20160427",0.19 +"20160428",0.12 +"20160429",0.12 +"20160502",0.2 +"20160503",0.17 +"20160504",0.16 +"20160505",0.13 +"20160506",0.18 +"20160509",0.18 +"20160510",0.15 +"20160511",0.14 +"20160512",0.15 +"20160513",0.13 +"20160516",0.15 +"20160517",0.15 +"20160518",0.26 +"20160519",0.29 +"20160520",0.29 +"20160523",0.3 +"20160524",0.31 +"20160525",0.29 +"20160526",0.25 +"20160527",0.27 +"20160530","" +"20160531",0.3 +"20160601",0.31 +"20160602",0.27 +"20160603",0.19 +"20160606",0.19 +"20160607",0.15 +"20160608",0.12 +"20160609",0.12 +"20160610",0.12 +"20160613",0.15 +"20160614",0.17 +"20160615",0.13 +"20160616",0.15 +"20160617",0.2 +"20160620",0.24 +"20160621",0.28 +"20160622",0.25 +"20160623",0.24 +"20160624",0.15 +"20160627",0.12 +"20160628",0.09 +"20160629",0.1 +"20160630",0.09 +"20160701",0.03 +"20160704","" +"20160705",-0.03 +"20160706",-0.05 +"20160707",-0.03 +"20160708",-0.06 +"20160711",0.01 +"20160712",0.07 +"20160713",0.03 +"20160714",0.08 +"20160715",0.11 +"20160718",0.1 +"20160719",0.12 +"20160720",0.13 +"20160721",0.05 +"20160722",0.06 +"20160725",0.08 +"20160726",0.07 +"20160727",0.03 +"20160728",0.0 +"20160729",-0.03 +"20160801",0.05 +"20160802",0.11 +"20160803",0.09 +"20160804",0.04 +"20160805",0.09 +"20160808",0.08 +"20160809",0.06 +"20160810",0.06 +"20160811",0.1 +"20160812",0.07 +"20160815",0.1 +"20160816",0.13 +"20160817",0.09 +"20160818",0.06 +"20160819",0.1 +"20160822",0.08 +"20160823",0.07 +"20160824",0.08 +"20160825",0.09 +"20160826",0.15 +"20160829",0.11 +"20160830",0.11 +"20160831",0.11 +"20160901",0.12 +"20160902",0.13 +"20160905","" +"20160906",0.06 +"20160907",0.03 +"20160908",0.09 +"20160909",0.17 +"20160912",0.17 +"20160913",0.24 +"20160914",0.21 +"20160915",0.22 +"20160916",0.19 +"20160919",0.2 +"20160920",0.2 +"20160921",0.15 +"20160922",0.08 +"20160923",0.05 +"20160926",0.05 +"20160927",0.04 +"20160928",0.01 +"20160929",0.02 +"20160930",0.0 +"20161003",0.0 +"20161004",0.07 +"20161005",0.1 +"20161006",0.11 +"20161007",0.1 +"20161010","" +"20161011",0.13 +"20161012",0.15 +"20161013",0.12 +"20161014",0.13 +"20161017",0.09 +"20161018",0.09 +"20161019",0.08 +"20161020",0.08 +"20161021",0.07 +"20161024",0.11 +"20161025",0.07 +"20161026",0.08 +"20161027",0.13 +"20161028",0.13 +"20161031",0.11 +"20161101",0.11 +"20161102",0.11 +"20161103",0.14 +"20161104",0.11 +"20161107",0.12 +"20161108",0.15 +"20161109",0.25 +"20161110",0.27 +"20161111","" +"20161114",0.4 +"20161115",0.41 +"20161116",0.39 +"20161117",0.42 +"20161118",0.44 +"20161121",0.42 +"20161122",0.41 +"20161123",0.44 +"20161124","" +"20161125",0.47 +"20161128",0.47 +"20161129",0.44 +"20161130",0.43 +"20161201",0.48 +"20161202",0.49 +"20161205",0.45 +"20161206",0.44 +"20161207",0.42 +"20161208",0.45 +"20161209",0.51 +"20161212",0.51 +"20161213",0.53 +"20161214",0.6 +"20161215",0.7 +"20161216",0.74 +"20161219",0.68 +"20161220",0.67 +"20161221",0.64 +"20161222",0.6 +"20161223",0.58 +"20161226","" +"20161227",0.58 +"20161228",0.56 +"20161229",0.55 +"20161230",0.5 +"20170102","" +"20170103",0.47 +"20170104",0.47 +"20170105",0.42 +"20170106",0.46 +"20170109",0.43 +"20170110",0.43 +"20170111",0.39 +"20170112",0.38 +"20170113",0.41 +"20170116","" +"20170117",0.36 +"20170118",0.42 +"20170119",0.43 +"20170120",0.44 +"20170123",0.39 +"20170124",0.41 +"20170125",0.45 +"20170126",0.43 +"20170127",0.41 +"20170130",0.42 +"20170131",0.4 +"20170201",0.43 +"20170202",0.43 +"20170203",0.44 +"20170206",0.4 +"20170207",0.4 +"20170208",0.38 +"20170209",0.41 +"20170210",0.4 +"20170213",0.43 +"20170214",0.46 +"20170215",0.45 +"20170216",0.43 +"20170217",0.41 +"20170220","" +"20170221",0.4 +"20170222",0.38 +"20170223",0.35 +"20170224",0.31 +"20170227",0.35 +"20170228",0.34 +"20170301",0.43 +"20170302",0.48 +"20170303",0.45 +"20170306",0.48 +"20170307",0.49 +"20170308",0.56 +"20170309",0.6 +"20170310",0.57 +"20170313",0.61 +"20170314",0.61 +"20170315",0.5 +"20170316",0.51 +"20170317",0.49 +"20170320",0.47 +"20170321",0.45 +"20170322",0.43 +"20170323",0.46 +"20170324",0.42 +"20170327",0.41 +"20170328",0.45 +"20170329",0.41 +"20170330",0.46 +"20170331",0.43 +"20170403",0.39 +"20170404",0.4 +"20170405",0.37 +"20170406",0.39 +"20170407",0.44 +"20170410",0.44 +"20170411",0.41 +"20170412",0.38 +"20170413",0.32 +"20170414","" +"20170417",0.38 +"20170418",0.33 +"20170419",0.36 +"20170420",0.39 +"20170421",0.4 +"20170424",0.41 +"20170425",0.44 +"20170426",0.42 +"20170427",0.39 +"20170428",0.37 +"20170501",0.41 +"20170502",0.41 +"20170503",0.46 +"20170504",0.5 +"20170505",0.5 +"20170508",0.53 +"20170509",0.56 +"20170510",0.56 +"20170511",0.51 +"20170512",0.49 +"20170515",0.52 +"20170516",0.51 +"20170517",0.44 +"20170518",0.43 +"20170519",0.41 +"20170522",0.43 +"20170523",0.46 +"20170524",0.45 +"20170525",0.45 +"20170526",0.44 +"20170529","" +"20170530",0.4 +"20170531",0.4 +"20170601",0.4 +"20170602",0.36 +"20170605",0.39 +"20170606",0.37 +"20170607",0.4 +"20170608",0.41 +"20170609",0.43 +"20170612",0.46 +"20170613",0.46 +"20170614",0.44 +"20170615",0.49 +"20170616",0.49 +"20170619",0.52 +"20170620",0.5 +"20170621",0.5 +"20170622",0.46 +"20170623",0.45 +"20170626",0.43 +"20170627",0.5 +"20170628",0.49 +"20170629",0.55 +"20170630",0.58 +"20170703",0.6 +"20170704","" +"20170705",0.58 +"20170706",0.61 +"20170707",0.66 +"20170710",0.66 +"20170711",0.62 +"20170712",0.57 +"20170713",0.58 +"20170714",0.57 +"20170717",0.54 +"20170718",0.51 +"20170719",0.51 +"20170720",0.5 +"20170721",0.48 +"20170724",0.48 +"20170725",0.52 +"20170726",0.49 +"20170727",0.49 +"20170728",0.47 +"20170731",0.48 +"20170801",0.47 +"20170802",0.48 +"20170803",0.46 +"20170804",0.47 +"20170807",0.46 +"20170808",0.46 +"20170809",0.42 +"20170810",0.4 +"20170811",0.4 +"20170814",0.45 +"20170815",0.49 +"20170816",0.45 +"20170817",0.42 +"20170818",0.43 +"20170821",0.43 +"20170822",0.45 +"20170823",0.42 +"20170824",0.44 +"20170825",0.42 +"20170828",0.41 +"20170829",0.39 +"20170830",0.39 +"20170831",0.36 +"20170901",0.37 +"20170904","" +"20170905",0.3 +"20170906",0.32 +"20170907",0.26 +"20170908",0.25 +"20170911",0.31 +"20170912",0.33 +"20170913",0.35 +"20170914",0.35 +"20170915",0.35 +"20170918",0.36 +"20170919",0.37 +"20170920",0.43 +"20170921",0.44 +"20170922",0.42 +"20170925",0.38 +"20170926",0.4 +"20170927",0.44 +"20170928",0.44 +"20170929",0.49 +"20171002",0.51 +"20171003",0.49 +"20171004",0.48 +"20171005",0.49 +"20171006",0.5 +"20171009","" +"20171010",0.47 +"20171011",0.46 +"20171012",0.44 +"20171013",0.43 +"20171016",0.46 +"20171017",0.48 +"20171018",0.5 +"20171019",0.49 +"20171020",0.52 +"20171023",0.52 +"20171024",0.55 +"20171025",0.56 +"20171026",0.57 +"20171027",0.54 +"20171030",0.5 +"20171031",0.5 +"20171101",0.49 +"20171102",0.48 +"20171103",0.48 +"20171106",0.46 +"20171107",0.44 +"20171108",0.45 +"20171109",0.46 +"20171110",0.52 +"20171113",0.52 +"20171114",0.51 +"20171115",0.48 +"20171116",0.53 +"20171117",0.49 +"20171120",0.52 +"20171121",0.52 +"20171122",0.48 +"20171123","" +"20171124",0.5 +"20171127",0.49 +"20171128",0.5 +"20171129",0.53 +"20171130",0.56 +"20171201",0.51 +"20171204",0.5 +"20171205",0.5 +"20171206",0.47 +"20171207",0.5 +"20171208",0.5 +"20171211",0.51 +"20171212",0.51 +"20171213",0.48 +"20171214",0.48 +"20171215",0.47 +"20171218",0.5 +"20171219",0.55 +"20171220",0.57 +"20171221",0.55 +"20171222",0.54 +"20171225","" +"20171226",0.53 +"20171227",0.48 +"20171228",0.47 +"20171229",0.44 +"20180101","" +"20180102",0.46 +"20180103",0.46 +"20180104",0.45 +"20180105",0.46 +"20180108",0.47 +"20180109",0.52 +"20180110",0.52 +"20180111",0.54 +"20180112",0.54 +"20180115","" +"20180116",0.51 +"20180117",0.53 +"20180118",0.57 +"20180119",0.58 +"20180122",0.6 +"20180123",0.57 +"20180124",0.58 +"20180125",0.56 +"20180126",0.57 +"20180129",0.61 +"20180130",0.63 +"20180131",0.61 +"20180201",0.67 +"20180202",0.7 +"20180205",0.67 +"20180206",0.69 +"20180207",0.74 +"20180208",0.76 +"20180209",0.78 +"20180212",0.79 +"20180213",0.78 +"20180214",0.82 +"20180215",0.79 +"20180216",0.78 +"20180219","" +"20180220",0.78 +"20180221",0.82 +"20180222",0.81 +"20180223",0.76 +"20180226",0.73 +"20180227",0.77 +"20180228",0.75 +"20180301",0.71 +"20180302",0.74 +"20180305",0.75 +"20180306",0.76 +"20180307",0.76 +"20180308",0.75 +"20180309",0.78 +"20180312",0.77 +"20180313",0.75 +"20180314",0.74 +"20180315",0.74 +"20180316",0.77 +"20180319",0.77 +"20180320",0.81 +"20180321",0.8 +"20180322",0.75 +"20180323",0.75 +"20180326",0.77 +"20180327",0.71 +"20180328",0.72 +"20180329",0.69 +"20180330","" +"20180402",0.68 +"20180403",0.71 +"20180404",0.71 +"20180405",0.75 +"20180406",0.7 +"20180409",0.71 +"20180410",0.72 +"20180411",0.68 +"20180412",0.7 +"20180413",0.69 +"20180416",0.71 +"20180417",0.68 +"20180418",0.71 +"20180419",0.75 +"20180420",0.79 +"20180423",0.8 +"20180424",0.83 +"20180425",0.86 +"20180426",0.82 +"20180427",0.79 +"20180430",0.78 +"20180501",0.81 +"20180502",0.8 +"20180503",0.78 +"20180504",0.79 +"20180507",0.78 +"20180508",0.81 +"20180509",0.82 +"20180510",0.8 +"20180511",0.82 +"20180514",0.85 +"20180515",0.9 +"20180516",0.92 +"20180517",0.95 +"20180518",0.91 +"20180521",0.9 +"20180522",0.91 +"20180523",0.87 +"20180524",0.86 +"20180525",0.84 +"20180528","" +"20180529",0.73 +"20180530",0.78 +"20180531",0.76 +"20180601",0.8 +"20180604",0.82 +"20180605",0.79 +"20180606",0.83 +"20180607",0.8 +"20180608",0.82 +"20180611",0.83 +"20180612",0.83 +"20180613",0.86 +"20180614",0.82 +"20180615",0.81 +"20180618",0.8 +"20180619",0.77 +"20180620",0.81 +"20180621",0.79 +"20180622",0.78 +"20180625",0.77 +"20180626",0.76 +"20180627",0.72 +"20180628",0.74 +"20180629",0.74 +"20180702",0.73 +"20180703",0.71 +"20180704","" +"20180705",0.71 +"20180706",0.7 +"20180709",0.73 +"20180710",0.74 +"20180711",0.74 +"20180712",0.75 +"20180713",0.72 +"20180716",0.75 +"20180717",0.77 +"20180718",0.79 +"20180719",0.75 +"20180720",0.78 +"20180723",0.85 +"20180724",0.84 +"20180725",0.81 +"20180726",0.87 +"20180727",0.84 +"20180730",0.85 +"20180731",0.84 +"20180801",0.87 +"20180802",0.86 +"20180803",0.83 +"20180806",0.83 +"20180807",0.85 +"20180808",0.85 +"20180809",0.82 +"20180810",0.78 +"20180813",0.78 +"20180814",0.8 +"20180815",0.78 +"20180816",0.79 +"20180817",0.79 +"20180820",0.75 +"20180821",0.77 +"20180822",0.74 +"20180823",0.73 +"20180824",0.73 +"20180827",0.74 +"20180828",0.77 +"20180829",0.77 +"20180830",0.76 +"20180831",0.78 +"20180903","" +"20180904",0.8 +"20180905",0.81 +"20180906",0.8 +"20180907",0.84 +"20180910",0.84 +"20180911",0.86 +"20180912",0.85 +"20180913",0.87 +"20180914",0.89 +"20180917",0.89 +"20180918",0.92 +"20180919",0.93 +"20180920",0.92 +"20180921",0.92 +"20180924",0.92 +"20180925",0.94 +"20180926",0.92 +"20180927",0.91 +"20180928",0.91 +"20181001",0.95 +"20181002",0.93 +"20181003",0.99 +"20181004",1.03 +"20181005",1.07 +"20181008","" +"20181009",1.04 +"20181010",1.06 +"20181011",1.02 +"20181012",1.03 +"20181015",1.03 +"20181016",1.03 +"20181017",1.06 +"20181018",1.07 +"20181019",1.09 +"20181022",1.09 +"20181023",1.08 +"20181024",1.03 +"20181025",1.09 +"20181026",1.02 +"20181029",1.02 +"20181030",1.07 +"20181031",1.1 +"20181101",1.12 +"20181102",1.16 +"20181105",1.14 +"20181106",1.15 +"20181107",1.15 +"20181108",1.17 +"20181109",1.15 +"20181112","" +"20181113",1.12 +"20181114",1.12 +"20181115",1.11 +"20181116",1.06 +"20181119",1.07 +"20181120",1.09 +"20181121",1.09 +"20181122","" +"20181123",1.09 +"20181126",1.11 +"20181127",1.15 +"20181128",1.12 +"20181129",1.05 +"20181130",1.04 +"20181203",1.02 +"20181204",0.97 +"20181205","" +"20181206",0.97 +"20181207",0.96 +"20181210",0.99 +"20181211",1.06 +"20181212",1.08 +"20181213",1.08 +"20181214",1.07 +"20181217",1.05 +"20181218",1.01 +"20181219",0.97 +"20181220",1.03 +"20181221",1.02 +"20181224",0.99 +"20181225","" +"20181226",1.04 +"20181227",1.03 +"20181228",0.99 +"20181231",0.98 +"20190101","" +"20190102",0.96 +"20190103",0.88 +"20190104",0.91 +"20190107",0.92 +"20190108",0.91 +"20190109",0.91 +"20190110",0.93 +"20190111",0.88 +"20190114",0.9 +"20190115",0.91 +"20190116",0.91 +"20190117",0.96 +"20190118",0.96 +"20190121","" +"20190122",0.95 +"20190123",0.96 +"20190124",0.95 +"20190125",0.97 +"20190128",0.97 +"20190129",0.94 +"20190130",0.86 +"20190131",0.78 +"20190201",0.82 +"20190204",0.86 +"20190205",0.84 +"20190206",0.84 +"20190207",0.81 +"20190208",0.81 +"20190211",0.83 +"20190212",0.85 +"20190213",0.85 +"20190214",0.81 +"20190215",0.8 +"20190218","" +"20190219",0.78 +"20190220",0.76 +"20190221",0.78 +"20190222",0.74 +"20190225",0.75 +"20190226",0.72 +"20190227",0.76 +"20190228",0.78 +"20190301",0.8 +"20190304",0.78 +"20190305",0.79 +"20190306",0.78 +"20190307",0.74 +"20190308",0.72 +"20190311",0.73 +"20190312",0.71 +"20190313",0.69 +"20190314",0.69 +"20190315",0.65 +"20190318",0.64 +"20190319",0.66 +"20190320",0.58 +"20190321",0.58 +"20190322",0.54 +"20190325",0.55 +"20190326",0.55 +"20190327",0.55 +"20190328",0.56 +"20190329",0.53 +"20190401",0.59 +"20190402",0.58 +"20190403",0.61 +"20190404",0.61 +"20190405",0.6 +"20190408",0.61 +"20190409",0.6 +"20190410",0.54 +"20190411",0.57 +"20190412",0.61 +"20190415",0.61 +"20190416",0.64 +"20190417",0.65 +"20190418",0.62 +"20190419","" +"20190422",0.64 +"20190423",0.62 +"20190424",0.57 +"20190425",0.56 +"20190426",0.54 +"20190429",0.58 +"20190430",0.56 +"20190501",0.59 +"20190502",0.66 +"20190503",0.63 +"20190506",0.6 +"20190507",0.58 +"20190508",0.62 +"20190509",0.6 +"20190510",0.59 +"20190513",0.55 +"20190514",0.56 +"20190515",0.54 +"20190516",0.56 +"20190517",0.58 +"20190520",0.6 +"20190521",0.6 +"20190522",0.6 +"20190523",0.58 +"20190524",0.56 +"20190527","" +"20190528",0.53 +"20190529",0.5 +"20190530",0.48 +"20190531",0.4 +"20190603",0.34 +"20190604",0.38 +"20190605",0.37 +"20190606",0.39 +"20190607",0.35 +"20190610",0.42 +"20190611",0.43 +"20190612",0.42 +"20190613",0.42 +"20190614",0.46 +"20190617",0.48 +"20190618",0.42 +"20190619",0.36 +"20190620",0.27 +"20190621",0.34 +"20190624",0.31 +"20190625",0.33 +"20190626",0.35 +"20190627",0.33 +"20190628",0.31 +"20190701",0.34 +"20190702",0.33 +"20190703",0.31 +"20190704","" +"20190705",0.35 +"20190708",0.35 +"20190709",0.36 +"20190710",0.33 +"20190711",0.36 +"20190712",0.35 +"20190715",0.32 +"20190716",0.33 +"20190717",0.31 +"20190718",0.25 +"20190719",0.25 +"20190722",0.26 +"20190723",0.27 +"20190724",0.26 +"20190725",0.28 +"20190726",0.3 +"20190729",0.29 +"20190730",0.28 +"20190731",0.26 +"20190801",0.2 +"20190802",0.2 +"20190805",0.15 +"20190806",0.11 +"20190807",0.09 +"20190808",0.07 +"20190809",0.08 +"20190812",0.04 +"20190813",0.05 +"20190814",0.02 +"20190815",-0.02 +"20190816",0.01 +"20190819",0.04 +"20190820",0.02 +"20190821",0.05 +"20190822",0.07 +"20190823",-0.02 +"20190826",0.0 +"20190827",-0.06 +"20190828",-0.08 +"20190829",-0.09 +"20190830",-0.05 +"20190902","" +"20190903",-0.03 +"20190904",-0.04 +"20190905",0.01 +"20190906",0.01 +"20190909",0.06 +"20190910",0.12 +"20190911",0.15 +"20190912",0.16 +"20190913",0.23 +"20190916",0.17 +"20190917",0.15 +"20190918",0.21 +"20190919",0.18 +"20190920",0.13 +"20190923",0.11 +"20190924",0.06 +"20190925",0.13 +"20190926",0.13 +"20190927",0.16 +"20190930",0.15 +"20191001",0.13 +"20191002",0.1 +"20191003",0.06 +"20191004",0.02 +"20191007",0.05 +"20191008",0.06 +"20191009",0.1 +"20191010",0.15 +"20191011",0.2 +"20191014","" +"20191015",0.21 +"20191016",0.18 +"20191017",0.17 +"20191018",0.16 +"20191021",0.19 +"20191022",0.17 +"20191023",0.16 +"20191024",0.15 +"20191025",0.15 +"20191028",0.21 +"20191029",0.23 +"20191030",0.21 +"20191031",0.15 +"20191101",0.14 +"20191104",0.15 +"20191105",0.18 +"20191106",0.15 +"20191107",0.23 +"20191108",0.23 +"20191111","" +"20191112",0.22 +"20191113",0.22 +"20191114",0.2 +"20191115",0.21 +"20191118",0.18 +"20191119",0.16 +"20191120",0.13 +"20191121",0.14 +"20191122",0.15 +"20191125",0.14 +"20191126",0.12 +"20191127",0.14 +"20191128","" +"20191129",0.17 +"20191202",0.18 +"20191203",0.09 +"20191204",0.11 +"20191205",0.13 +"20191206",0.15 +"20191209",0.14 +"20191210",0.14 +"20191211",0.1 +"20191212",0.18 +"20191213",0.12 +"20191216",0.16 +"20191217",0.14 +"20191218",0.16 +"20191219",0.15 +"20191220",0.15 +"20191223",0.18 +"20191224",0.15 +"20191225","" +"20191226",0.16 +"20191227",0.15 +"20191230",0.15 +"20191231",0.15 +"20200101","" +"20200102",0.08 +"20200103",0.03 +"20200106",0.06 +"20200107",0.09 +"20200108",0.12 +"20200109",0.11 +"20200110",0.07 +"20200113",0.08 +"20200114",0.05 +"20200115",0.04 +"20200116",0.07 +"20200117",0.09 +"20200120","" +"20200121",0.04 +"20200122",0.05 +"20200123",0.04 +"20200124",0.02 +"20200127",-0.02 +"20200128",0.0 +"20200129",-0.04 +"20200130",-0.07 +"20200131",-0.14 +"20200203",-0.09 +"20200204",-0.03 +"20200205",0.0 +"20200206",-0.02 +"20200207",-0.07 +"20200210",-0.1 +"20200211",-0.06 +"20200212",-0.04 +"20200213",-0.06 +"20200214",-0.07 +"20200217","" +"20200218",-0.1 +"20200219",-0.09 +"20200220",-0.11 +"20200221",-0.15 +"20200224",-0.21 +"20200225",-0.2 +"20200226",-0.21 +"20200227",-0.23 +"20200228",-0.28 +"20200302",-0.31 +"20200303",-0.43 +"20200304",-0.44 +"20200305",-0.48 +"20200306",-0.57 +"20200309",-0.45 +"20200310",-0.24 +"20200311",-0.14 +"20200312",-0.04 +"20200313",0.04 +"20200316",0.0 +"20200317",0.39 +"20200318",0.55 +"20200319",0.62 +"20200320",0.17 +"20200323",-0.04 +"20200324",-0.13 +"20200325",-0.19 +"20200326",-0.24 +"20200327",-0.22 +"20200330",-0.25 +"20200331",-0.17 +"20200401",-0.29 +"20200402",-0.4 +"20200403",-0.46 +"20200406",-0.47 +"20200407",-0.42 +"20200408",-0.42 +"20200409",-0.5 +"20200410","" +"20200413",-0.5 +"20200414",-0.53 +"20200415",-0.56 +"20200416",-0.42 +"20200417",-0.36 +"20200420",-0.31 +"20200421",-0.38 +"20200422",-0.43 +"20200423",-0.44 +"20200424",-0.51 +"20200427",-0.5 +"20200428",-0.52 +"20200429",-0.51 +"20200430",-0.43 +"20200501",-0.42 +"20200504",-0.43 +"20200505",-0.44 +"20200506",-0.38 +"20200507",-0.45 +"20200508",-0.43 +"20200511",-0.4 +"20200512",-0.4 +"20200513",-0.43 +"20200514",-0.43 +"20200515",-0.45 +"20200518",-0.44 +"20200519",-0.45 +"20200520",-0.48 +"20200521",-0.46 +"20200522",-0.46 +"20200525","" +"20200526",-0.44 +"20200527",-0.46 +"20200528",-0.48 +"20200529",-0.5 +"20200601",-0.52 +"20200602",-0.5 +"20200603",-0.44 +"20200604",-0.4 +"20200605",-0.36 +"20200608",-0.4 +"20200609",-0.42 +"20200610",-0.52 +"20200611",-0.55 +"20200612",-0.5 +"20200615",-0.52 +"20200616",-0.52 +"20200617",-0.52 +"20200618",-0.57 +"20200619",-0.6 +"20200622",-0.63 +"20200623",-0.66 +"20200624",-0.64 +"20200625",-0.65 +"20200626",-0.68 +"20200629",-0.7 +"20200630",-0.68 +"20200701",-0.68 +"20200702",-0.73 +"20200703","" +"20200706",-0.76 +"20200707",-0.78 +"20200708",-0.75 +"20200709",-0.77 +"20200710",-0.76 +"20200713",-0.78 +"20200714",-0.78 +"20200715",-0.77 +"20200716",-0.79 +"20200717",-0.82 +"20200720",-0.84 +"20200721",-0.87 +"20200722",-0.88 +"20200723",-0.9 +"20200724",-0.92 +"20200727",-0.9 +"20200728",-0.92 +"20200729",-0.95 +"20200730",-0.97 +"20200731",-1.0 +"20200803",-1.02 +"20200804",-1.05 +"20200805",-1.06 +"20200806",-1.08 +"20200807",-1.04 +"20200810",-1.02 +"20200811",-0.99 +"20200812",-0.98 +"20200813",-0.96 +"20200814",-0.94 +"20200817",-0.97 +"20200818",-1.01 +"20200819",-0.99 +"20200820",-0.97 +"20200821",-1.0 +"20200824",-1.02 +"20200825",-1.01 +"20200826",-1.03 +"20200827",-0.99 +"20200828",-1.03 +"20200831",-1.08 +"20200901",-1.08 +"20200902",-1.07 +"20200903",-1.02 +"20200904",-0.98 +"20200907","" +"20200908",-0.99 +"20200909",-1.0 +"20200910",-1.01 +"20200911",-0.98 +"20200914",-0.97 +"20200915",-0.99 +"20200916",-0.99 +"20200917",-0.97 +"20200918",-0.97 +"20200921",-0.94 +"20200922",-0.94 +"20200923",-0.92 +"20200924",-0.91 +"20200925",-0.92 +"20200928",-0.94 +"20200929",-0.98 +"20200930",-0.94 +"20201001",-0.95 +"20201002",-0.94 +"20201005",-0.9 +"20201006",-0.9 +"20201007",-0.9 +"20201008",-0.94 +"20201009",-0.94 +"20201012","" +"20201013",-0.96 +"20201014",-0.96 +"20201015",-0.95 +"20201016",-0.95 +"20201019",-0.93 +"20201020",-0.91 +"20201021",-0.91 +"20201022",-0.89 +"20201023",-0.9 +"20201026",-0.91 +"20201027",-0.92 +"20201028",-0.91 +"20201029",-0.86 +"20201030",-0.82 +"20201102",-0.84 +"20201103",-0.82 +"20201104",-0.86 +"20201105",-0.87 +"20201106",-0.82 +"20201109",-0.77 +"20201110",-0.78 +"20201111","" +"20201112",-0.83 +"20201113",-0.83 +"20201116",-0.81 +"20201117",-0.83 +"20201118",-0.82 +"20201119",-0.84 +"20201120",-0.86 +"20201123",-0.85 +"20201124",-0.86 +"20201125",-0.87 +"20201126","" +"20201127",-0.91 +"20201130",-0.93 +"20201201",-0.89 +"20201202",-0.9 +"20201203",-0.94 +"20201204",-0.92 +"20201207",-0.94 +"20201208",-0.97 +"20201209",-0.96 +"20201210",-0.96 +"20201211",-0.97 +"20201214",-0.98 +"20201215",-0.99 +"20201216",-1.0 +"20201217",-1.0 +"20201218",-1.0 +"20201221",-1.0 +"20201222",-1.01 +"20201223",-1.01 +"20201224",-1.03 +"20201225","" +"20201228",-1.03 +"20201229",-1.02 +"20201230",-1.03 +"20201231",-1.06 +"20210101","" +"20210104",-1.08 +"20210105",-1.07 +"20210106",-1.02 +"20210107",-1.01 +"20210108",-0.93 +"20210111",-0.91 +"20210112",-0.93 +"20210113",-0.96 +"20210114",-0.94 +"20210115",-0.99 +"20210118","" +"20210119",-1.0 +"20210120",-1.02 +"20210121",-0.98 +"20210122",-0.99 +"20210125",-1.03 +"20210126",-1.03 +"20210127",-1.04 +"20210128",-1.06 +"20210129",-1.02 +"20210201",-1.02 +"20210202",-1.03 +"20210203",-1.04 +"20210204",-1.02 +"20210205",-1.02 +"20210208",-1.03 +"20210209",-1.04 +"20210210",-1.06 +"20210211",-1.04 +"20210212",-1.01 +"20210215","" +"20210216",-0.94 +"20210217",-0.92 +"20210218",-0.87 +"20210219",-0.8 +"20210222",-0.79 +"20210223",-0.79 +"20210224",-0.79 +"20210225",-0.6 +"20210226",-0.71 +"20210301",-0.71 +"20210302",-0.78 +"20210303",-0.74 +"20210304",-0.66 +"20210305",-0.66 +"20210308",-0.62 +"20210309",-0.66 +"20210310",-0.73 +"20210311",-0.74 +"20210312",-0.62 +"20210315",-0.65 +"20210316",-0.68 +"20210317",-0.67 +"20210318",-0.56 +"20210319",-0.57 +"20210322",-0.64 +"20210323",-0.66 +"20210324",-0.69 +"20210325",-0.69 +"20210326",-0.67 +"20210329",-0.63 +"20210330",-0.62 +"20210331",-0.63 +"20210401",-0.66 +"20210402",-0.64 +"20210405",-0.62 +"20210406",-0.65 +"20210407",-0.66 +"20210408",-0.69 +"20210409",-0.64 +"20210412",-0.64 +"20210413",-0.69 +"20210414",-0.69 +"20210415",-0.77 +"20210416",-0.77 +"20210419",-0.73 +"20210420",-0.74 +"20210421",-0.76 +"20210422",-0.76 +"20210423",-0.76 +"20210426",-0.78 +"20210427",-0.76 +"20210428",-0.78 +"20210429",-0.77 +"20210430",-0.76 +"20210503",-0.79 +"20210504",-0.81 +"20210505",-0.88 +"20210506",-0.87 +"20210507",-0.89 +"20210510",-0.91 +"20210511",-0.89 +"20210512",-0.85 +"20210513",-0.85 +"20210514",-0.88 +"20210517",-0.9 +"20210518",-0.88 +"20210519",-0.8 +"20210520",-0.78 +"20210521",-0.8 +"20210524",-0.83 +"20210525",-0.86 +"20210526",-0.82 +"20210527",-0.81 +"20210528",-0.84 +"20210531","" +"20210601",-0.84 +"20210602",-0.85 +"20210603",-0.79 +"20210604",-0.84 +"20210607",-0.82 +"20210608",-0.83 +"20210609",-0.82 +"20210610",-0.9 +"20210611",-0.85 +"20210614",-0.85 +"20210615",-0.87 +"20210616",-0.75 +"20210617",-0.75 +"20210618",-0.79 +"20210621",-0.75 +"20210622",-0.83 +"20210623",-0.84 +"20210624",-0.81 +"20210625",-0.8 +"20210628",-0.84 +"20210629",-0.83 +"20210630",-0.87 +"20210701",-0.87 +"20210702",-0.89 +"20210705","" +"20210706",-0.94 +"20210707",-0.95 +"20210708",-0.92 +"20210709",-0.91 +"20210712",-0.95 +"20210713",-0.94 +"20210714",-0.97 +"20210715",-1.01 +"20210716",-1.02 +"20210719",-1.05 +"20210720",-1.03 +"20210721",-0.98 +"20210722",-1.01 +"20210723",-1.05 +"20210726",-1.11 +"20210727",-1.13 +"20210728",-1.15 +"20210729",-1.15 +"20210730",-1.16 +"20210802",-1.17 +"20210803",-1.19 +"20210804",-1.16 +"20210805",-1.1 +"20210806",-1.06 +"20210809",-1.04 +"20210810",-1.04 +"20210811",-1.07 +"20210812",-1.05 +"20210813",-1.08 +"20210816",-1.1 +"20210817",-1.07 +"20210818",-1.05 +"20210819",-1.04 +"20210820",-1.01 +"20210823",-1.02 +"20210824",-1.01 +"20210825",-1.0 +"20210826",-0.99 +"20210827",-1.08 +"20210830",-1.08 +"20210831",-1.03 +"20210901",-1.03 +"20210902",-1.03 +"20210903",-1.01 +"20210906","" +"20210907",-0.98 +"20210908",-1.03 +"20210909",-1.08 +"20210910",-1.05 +"20210913",-1.04 +"20210914",-1.05 +"20210915",-1.04 +"20210916",-1.01 +"20210917",-0.96 +"20210920",-0.98 +"20210921",-0.96 +"20210922",-0.96 +"20210923",-0.9 +"20210924",-0.87 +"20210927",-0.87 +"20210928",-0.84 +"20210929",-0.82 +"20210930",-0.85 +"20211001",-0.9 +"20211004",-0.89 +"20211005",-0.91 +"20211006",-0.9 +"20211007",-0.88 +"20211008",-0.89 +"20211011","" +"20211012",-0.9 +"20211013",-0.96 +"20211014",-1.0 +"20211015",-0.97 +"20211018",-0.95 +"20211019",-0.89 +"20211020",-0.92 +"20211021",-0.96 +"20211022",-0.98 +"20211025",-1.02 +"20211026",-1.06 +"20211027",-1.11 +"20211028",-1.0 +"20211029",-0.96 +"20211101",-0.92 +"20211102",-0.95 +"20211103",-0.93 +"20211104",-1.03 +"20211105",-1.09 +"20211108",-1.11 +"20211109",-1.17 +"20211110",-1.14 +"20211111","" +"20211112",-1.15 +"20211115",-1.13 +"20211116",-1.1 +"20211117",-1.1 +"20211118",-1.14 +"20211119",-1.11 +"20211122",-0.98 +"20211123",-0.95 +"20211124",-0.97 +"20211125","" +"20211126",-1.07 +"20211129",-1.02 +"20211130",-1.07 +"20211201",-1.01 +"20211202",-1.03 +"20211203",-1.08 +"20211206",-1.01 +"20211207",-0.99 +"20211208",-1.0 +"20211209",-0.98 +"20211210",-0.96 +"20211213",-0.98 +"20211214",-0.93 +"20211215",-0.92 +"20211216",-0.98 +"20211217",-0.97 +"20211220",-0.96 +"20211221",-0.96 +"20211222",-1.01 +"20211223",-0.97 +"20211224","" +"20211227",-1.02 +"20211228",-1.01 +"20211229",-0.98 +"20211230",-1.06 +"20211231",-1.04 +"20220103",-0.97 +"20220104",-0.91 +"20220105",-0.82 +"20220106",-0.73 +"20220107",-0.72 +"20220110",-0.7 +"20220111",-0.79 +"20220112",-0.74 +"20220113",-0.73 +"20220114",-0.66 +"20220117","" +"20220118",-0.59 +"20220119",-0.57 +"20220120",-0.5 +"20220121",-0.59 +"20220124",-0.63 +"20220125",-0.63 +"20220126",-0.53 +"20220127",-0.59 +"20220128",-0.66 +"20220131",-0.65 +"20220201",-0.62 +"20220202",-0.63 +"20220203",-0.56 +"20220204",-0.48 +"20220207",-0.48 +"20220208",-0.46 +"20220209",-0.48 +"20220210",-0.42 +"20220211",-0.51 +"20220214",-0.5 +"20220215",-0.43 +"20220216",-0.43 +"20220217",-0.46 +"20220218",-0.49 +"20220221","" +"20220222",-0.51 +"20220223",-0.54 +"20220224",-0.59 +"20220225",-0.57 +"20220228",-0.79 +"20220301",-0.9 +"20220302",-0.85 +"20220303",-0.83 +"20220304",-0.93 +"20220307",-0.99 +"20220308",-1.04 +"20220309",-0.9 +"20220310",-0.88 +"20220311",-0.94 +"20220314",-0.79 +"20220315",-0.69 +"20220316",-0.61 +"20220317",-0.71 +"20220318",-0.72 +"20220321",-0.58 +"20220322",-0.53 +"20220323",-0.62 +"20220324",-0.58 +"20220325",-0.47 +"20220328",-0.49 +"20220329",-0.45 +"20220330",-0.51 +"20220331",-0.52 +"20220401",-0.41 +"20220404",-0.38 +"20220405",-0.3 +"20220406",-0.22 +"20220407",-0.16 +"20220408",-0.15 +"20220411",-0.12 +"20220412",-0.14 +"20220413",-0.1 +"20220414",-0.06 +"20220415","" +"20220418",-0.07 +"20220419",0.0 +"20220420",-0.07 +"20220421",-0.12 +"20220422",-0.08 +"20220425",-0.1 +"20220426",-0.08 +"20220427",-0.06 +"20220428",-0.12 +"20220429",0.01 +"20220502",0.18 +"20220503",0.14 +"20220504",0.07 +"20220505",0.18 +"20220506",0.26 +"20220509",0.3 +"20220510",0.34 +"20220511",0.21 +"20220512",0.25 +"20220513",0.24 +"20220516",0.2 +"20220517",0.27 +"20220518",0.17 +"20220519",0.25 +"20220520",0.23 +"20220523",0.26 +"20220524",0.21 +"20220525",0.19 +"20220526",0.13 +"20220527",0.11 +"20220530","" +"20220531",0.21 +"20220601",0.29 +"20220602",0.26 +"20220603",0.22 +"20220606",0.28 +"20220607",0.25 +"20220608",0.28 +"20220609",0.29 +"20220610",0.39 +"20220613",0.69 +"20220614",0.89 +"20220615",0.63 +"20220616",0.66 +"20220617",0.67 +"20220620","" +"20220621",0.7 +"20220622",0.62 +"20220623",0.59 +"20220624",0.57 +"20220627",0.65 +"20220628",0.72 +"20220629",0.74 +"20220630",0.65 +"20220701",0.54 +"20220704","" +"20220705",0.52 +"20220706",0.64 +"20220707",0.68 +"20220708",0.72 +"20220711",0.67 +"20220712",0.64 +"20220713",0.6 +"20220714",0.62 +"20220715",0.57 +"20220718",0.59 +"20220719",0.62 +"20220720",0.66 +"20220721",0.58 +"20220722",0.43 +"20220725",0.45 +"20220726",0.45 +"20220727",0.36 +"20220728",0.2 +"20220729",0.14 +"20220801",0.09 +"20220802",0.27 +"20220803",0.23 +"20220804",0.22 +"20220805",0.37 +"20220808",0.29 +"20220809",0.33 +"20220810",0.35 +"20220811",0.4 +"20220812",0.37 +"20220815",0.35 +"20220816",0.38 +"20220817",0.43 +"20220818",0.36 +"20220819",0.43 +"20220822",0.46 +"20220823",0.47 +"20220824",0.49 +"20220825",0.43 +"20220826",0.47 +"20220829",0.54 +"20220830",0.56 +"20220831",0.67 +"20220901",0.81 +"20220902",0.73 +"20220905","" +"20220906",0.85 +"20220907",0.82 +"20220908",0.88 +"20220909",0.91 +"20220912",0.95 +"20220913",0.98 +"20220914",0.95 +"20220915",1.02 +"20220916",1.07 +"20220919",1.15 +"20220920",1.17 +"20220921",1.13 +"20220922",1.29 +"20220923",1.32 +"20220926",1.56 +"20220927",1.64 +"20220928",1.39 +"20220929",1.57 +"20220930",1.68 +"20221003",1.43 +"20221004",1.38 +"20221005",1.54 +"20221006",1.61 +"20221007",1.62 +"20221010","" +"20221011",1.62 +"20221012",1.62 +"20221013",1.63 +"20221014",1.59 +"20221017",1.57 +"20221018",1.6 +"20221019",1.72 +"20221020",1.73 +"20221021",1.69 +"20221024",1.66 +"20221025",1.59 +"20221026",1.6 +"20221027",1.51 +"20221028",1.51 +"20221031",1.58 +"20221101",1.56 +"20221102",1.57 +"20221103",1.74 +"20221104",1.69 +"20221107",1.69 +"20221108",1.64 +"20221109",1.7 diff --git a/main.py b/main.py index fe09fea..9c30319 100644 --- a/main.py +++ b/main.py @@ -12,15 +12,15 @@ if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument('--mode', choices=['train', 'test', 'update', 'predict'], default='train') - parser.add_argument('--ver', choices=['v1', 'v2', 'v3', 'v4'], default='v2') + parser.add_argument('--ver', choices=['v1', 'v2', 'v3', 'v4', 'v4.1', 'v4.2'], default='v4.1') parser.add_argument('--name', default=utils.get_time_str()) parser.add_argument('--stock_code', nargs='+') - parser.add_argument('--rl_method', choices=['dqn', 'pg', 'ac', 'a2c', 'a3c', 'monkey']) + parser.add_argument('--rl_method', choices=['dqn', 'pg', 'ac', 'a2c', 'a3c', 'monkey'], default='a2c') parser.add_argument('--net', choices=['dnn', 'lstm', 'cnn', 'monkey'], default='dnn') parser.add_argument('--backend', choices=['pytorch', 'tensorflow', 'plaidml'], default='pytorch') parser.add_argument('--start_date', default='20200101') parser.add_argument('--end_date', default='20201231') - parser.add_argument('--lr', type=float, default=0.0001) + parser.add_argument('--lr', type=float, default=0.001) parser.add_argument('--discount_factor', type=float, default=0.7) parser.add_argument('--balance', type=int, default=100000000) args = parser.parse_args() @@ -32,7 +32,7 @@ value_network_name = f'{args.name}_{args.rl_method}_{args.net}_value.mdl' policy_network_name = f'{args.name}_{args.rl_method}_{args.net}_policy.mdl' start_epsilon = 1 if args.mode in ['train', 'update'] else 0 - num_epoches = 1000 if args.mode in ['train', 'update'] else 1 + num_epoches = 100 if args.mode in ['train', 'update'] else 1 num_steps = 5 if args.net in ['lstm', 'cnn'] else 1 # Backend 설정 diff --git a/requirements_common.txt b/requirements_common.txt index 2fe9b51..22ee241 100644 --- a/requirements_common.txt +++ b/requirements_common.txt @@ -3,3 +3,4 @@ pandas matplotlib mplfinance tqdm +sklearn diff --git a/requirements_tf1_cpu.txt b/requirements_tf1_cpu.txt index f7db0bf..42f13bf 100644 --- a/requirements_tf1_cpu.txt +++ b/requirements_tf1_cpu.txt @@ -1,2 +1,2 @@ -keras==2.2.4 +keras==2.13.1 tensorflow==1.15.2 diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..76b73e1 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,3 @@ +[metadata] +description-file=README.md +license_files=LICENSE diff --git a/setup.py b/setup.py index 96cb841..23bb485 100644 --- a/setup.py +++ b/setup.py @@ -2,10 +2,21 @@ setup( name='rltrader', - version='3.0', + version='3.2.1', description='Quantylab Reinforcement Learning for Stock Trading', author='Quantylab', author_email='quantylab@gmail.com', url='https://github.com/quantylab/rltrader', - packages=find_namespace_packages(include=['quantylab.*']), + packages=find_namespace_packages(where='src', include=['quantylab.*']), + package_dir={'': 'src'}, + install_requires=[ + 'numpy', + 'pandas', + 'matplotlib', + 'mplfinance', + 'tqdm', + 'sklearn', + 'tensorflow==2.7.0', + 'torch==1.10.1', + ] ) diff --git a/quantylab/rltrader/__init__.py b/src/quantylab/rltrader/__init__.py similarity index 100% rename from quantylab/rltrader/__init__.py rename to src/quantylab/rltrader/__init__.py diff --git a/quantylab/rltrader/agent.py b/src/quantylab/rltrader/agent.py similarity index 97% rename from quantylab/rltrader/agent.py rename to src/quantylab/rltrader/agent.py index 4b26ff2..5aa9c25 100644 --- a/quantylab/rltrader/agent.py +++ b/src/quantylab/rltrader/agent.py @@ -4,14 +4,14 @@ class Agent: # 에이전트 상태가 구성하는 값 개수 - # 주식 보유 비율, 현재 손익, 평균 매수 단가 대비 등락률 + # 주식 보유 비율, 손익률, 주당 매수 단가 대비 주가 등락률 STATE_DIM = 3 # 매매 수수료 및 세금 TRADING_CHARGE = 0.00015 # 거래 수수료 0.015% # TRADING_CHARGE = 0.00011 # 거래 수수료 0.011% # TRADING_CHARGE = 0 # 거래 수수료 미적용 - TRADING_TAX = 0.0025 # 거래세 0.25% + TRADING_TAX = 0.002 # 거래세 0.2% # TRADING_TAX = 0 # 거래세 미적용 # 행동 @@ -42,7 +42,7 @@ def __init__(self, environment, initial_balance, min_trading_price, max_trading_ # Agent 클래스의 상태 self.ratio_hold = 0 # 주식 보유 비율 - self.profitloss = 0 # 현재 손익 + self.profitloss = 0 # 손익률 self.avg_buy_price = 0 # 주당 매수 단가 def reset(self): diff --git a/quantylab/rltrader/data_manager.py b/src/quantylab/rltrader/data_manager.py similarity index 79% rename from quantylab/rltrader/data_manager.py rename to src/quantylab/rltrader/data_manager.py index fef28be..1aff4f9 100644 --- a/quantylab/rltrader/data_manager.py +++ b/src/quantylab/rltrader/data_manager.py @@ -124,6 +124,12 @@ 'msci_germany_diffratio', 'msci_germany_ma5_ratio', 'msci_germany_ma20_ratio', 'msci_germany_ma60_ratio', 'msci_germany_ma120_ratio', ] +COLUMNS_TRAINING_DATA_V4_1 = [] +with open(os.path.join(settings.BASE_DIR, 'conf', 'data', 'v4.1', 'feature_list.txt')) as f: + for line in f: + COLUMNS_TRAINING_DATA_V4_1.append(line.strip()) + + def preprocess(data, ver='v1'): windows = [5, 10, 20, 60, 120] for window in windows: @@ -174,9 +180,44 @@ def preprocess(data, ver='v1'): def load_data(code, date_from, date_to, ver='v2'): - if ver in ['v3', 'v4']: + if ver in ['v1', 'v1.1', 'v2']: + return load_data_v1_v2(code, date_from, date_to, ver) + elif ver in ['v3', 'v4']: return load_data_v3_v4(code, date_from, date_to, ver) + elif ver in ['v4.1', 'v4.2']: + stock_filename = '' + market_filename = '' + data_dir = os.path.join(settings.BASE_DIR, 'data', 'v4.1') + for filename in os.listdir(data_dir): + if code in filename: + stock_filename = filename + elif 'market' in filename: + market_filename = filename + + chart_data, training_data = load_data_v4_1( + os.path.join(data_dir, stock_filename), + os.path.join(data_dir, market_filename), + date_from, date_to + ) + if ver == 'v4.1': + return chart_data, training_data + + tips_filename = '' + taylor_us_filename = '' + data_dir = os.path.join(settings.BASE_DIR, 'data', 'v4.2') + for filename in os.listdir(data_dir): + if filename.startswith('tips'): + tips_filename = filename + if filename.startswith('taylor_us'): + taylor_us_filename = filename + return load_data_v4_2( + pd.concat([chart_data, training_data], axis=1), + os.path.join(data_dir, tips_filename), + os.path.join(data_dir, taylor_us_filename) + ) + +def load_data_v1_v2(code, date_from, date_to, ver): header = None if ver == 'v1' else 0 df = pd.read_csv( os.path.join(settings.BASE_DIR, 'data', ver, f'{code}.csv'), @@ -212,7 +253,7 @@ def load_data(code, date_from, date_to, ver='v2'): else: raise Exception('Invalid version.') - return chart_data, training_data + return chart_data, training_data.values def load_data_v3_v4(code, date_from, date_to, ver): @@ -243,18 +284,85 @@ def load_data_v3_v4(code, date_from, date_to, ver): # 날짜 오름차순 정렬 df = df.sort_values(by='date').reset_index(drop=True) + # NaN 처리 + df = df.fillna(method='ffill').fillna(method='bfill').reset_index(drop=True) + df = df.fillna(0) + # 기간 필터링 df['date'] = df['date'].str.replace('-', '') df = df[(df['date'] >= date_from) & (df['date'] <= date_to)] - df = df.fillna(method='ffill').reset_index(drop=True) + df = df.reset_index(drop=True) # 데이터 조정 - df.loc[:, ['per', 'pbr', 'roe']] = df[['per', 'pbr', 'roe']].apply(lambda x: x / 100) + if ver == 'v3': + df.loc[:, ['per', 'pbr', 'roe']] = df[['per', 'pbr', 'roe']].apply(lambda x: x / 100) # 차트 데이터 분리 chart_data = df[COLUMNS_CHART_DATA] # 학습 데이터 분리 - training_data = df[columns] + training_data = df[columns].values + + # 스케일링 + if ver == 'v4': + from sklearn.preprocessing import RobustScaler + from joblib import dump, load + scaler_path = os.path.join(settings.BASE_DIR, 'scalers', f'scaler_{ver}.joblib') + scaler = None + if not os.path.exists(scaler_path): + scaler = RobustScaler() + scaler.fit(training_data) + dump(scaler, scaler_path) + else: + scaler = load(scaler_path) + training_data = scaler.transform(training_data) return chart_data, training_data + + +def load_data_v4_1(stock_data_path, market_data_path, date_from, date_to): + df_stock = None + if stock_data_path.endswith('.csv'): + df_stock = pd.read_csv(stock_data_path, dtype={'date': str}) + elif stock_data_path.endswith('.json'): + import json + with open(stock_data_path) as f: + df_stock = pd.DataFrame(**json.load(f)) + df_market = None + if market_data_path.endswith('.csv'): + df_market = pd.read_csv(market_data_path, dtype={'date': str}) + elif market_data_path.endswith('.json'): + import json + with open(market_data_path) as f: + df_market = pd.DataFrame(**json.load(f)) + df = pd.merge(df_stock, df_market, on='date', how='left') + df = df[(df['date'] >= date_from) & (df['date'] <= date_to)] + df = df[COLUMNS_CHART_DATA + COLUMNS_TRAINING_DATA_V4_1] + df = df.fillna(method='ffill').fillna(method='bfill').reset_index(drop=True) + df = df.fillna(0) + return df[COLUMNS_CHART_DATA], df[COLUMNS_TRAINING_DATA_V4_1].values + + +def load_data_v4_2(df_v4_1, stock_data_path, market_data_path): + df_tips = None + if stock_data_path.endswith('.csv'): + df_tips = pd.read_csv(stock_data_path, dtype={'date': str}) + elif stock_data_path.endswith('.json'): + import json + with open(stock_data_path) as f: + df_tips = pd.DataFrame(**json.load(f)) + df_taylor_us = None + if market_data_path.endswith('.csv'): + df_taylor_us = pd.read_csv(market_data_path, dtype={'date': str}) + elif market_data_path.endswith('.json'): + import json + with open(market_data_path) as f: + df_taylor_us = pd.DataFrame(**json.load(f)) + df = pd.merge(df_v4_1, df_tips.rename(columns={'value': 'tips'}), on='date', how='left') + df = pd.merge(df, df_taylor_us.rename(columns={'taylor': 'taylor_us'}), on='date', how='left') + df[['tips', 'taylor_us']] = df[['tips', 'taylor_us']] / 100 + COLUMNS_TRAINING_DATA = COLUMNS_TRAINING_DATA_V4_1 + ['tips', 'taylor_us'] + df = df[COLUMNS_CHART_DATA + COLUMNS_TRAINING_DATA] + df = df.fillna(method='ffill').fillna(method='bfill').reset_index(drop=True) + df = df.fillna(0) + return df[COLUMNS_CHART_DATA], df[COLUMNS_TRAINING_DATA].values diff --git a/quantylab/rltrader/environment.py b/src/quantylab/rltrader/environment.py similarity index 100% rename from quantylab/rltrader/environment.py rename to src/quantylab/rltrader/environment.py diff --git a/quantylab/rltrader/learners.py b/src/quantylab/rltrader/learners.py similarity index 95% rename from quantylab/rltrader/learners.py rename to src/quantylab/rltrader/learners.py index 16addd8..d0534a4 100644 --- a/quantylab/rltrader/learners.py +++ b/src/quantylab/rltrader/learners.py @@ -29,7 +29,7 @@ def __init__(self, rl_method='rl', stock_code=None, discount_factor=0.9, num_epoches=1000, balance=100000000, start_epsilon=1, value_network=None, policy_network=None, - output_path='', reuse_models=True): + output_path='', reuse_models=True, gen_output=True): # 인자 확인 assert min_trading_price > 0 assert max_trading_price > 0 @@ -80,6 +80,7 @@ def __init__(self, rl_method='rl', stock_code=None, self.batch_size = 0 # 로그 등 출력 경로 self.output_path = output_path + self.gen_output = gen_output def init_value_network(self, shared_network=None, activation='linear', loss='mse'): if self.net == 'dnn': @@ -158,7 +159,7 @@ def build_sample(self): self.environment.observe() if len(self.training_data) > self.training_data_idx + 1: self.training_data_idx += 1 - self.sample = self.training_data.iloc[self.training_data_idx].tolist() + self.sample = self.training_data[self.training_data_idx].tolist() self.sample.extend(self.agent.get_states()) return self.sample return None @@ -221,12 +222,13 @@ def run(self, learning=True): self.visualizer.prepare(self.environment.chart_data, info) # 가시화 결과 저장할 폴더 준비 - self.epoch_summary_dir = os.path.join(self.output_path, f'epoch_summary_{self.stock_code}') - if not os.path.isdir(self.epoch_summary_dir): - os.makedirs(self.epoch_summary_dir) - else: - for f in os.listdir(self.epoch_summary_dir): - os.remove(os.path.join(self.epoch_summary_dir, f)) + if self.gen_output: + self.epoch_summary_dir = os.path.join(self.output_path, f'epoch_summary_{self.stock_code}') + if not os.path.isdir(self.epoch_summary_dir): + os.makedirs(self.epoch_summary_dir) + else: + for f in os.listdir(self.epoch_summary_dir): + os.remove(os.path.join(self.epoch_summary_dir, f)) # 학습에 대한 정보 초기화 max_portfolio_value = 0 @@ -308,8 +310,9 @@ def run(self, learning=True): f'Loss:{self.loss:.6f} ET:{elapsed_time_epoch:.4f}') # 에포크 관련 정보 가시화 - if self.num_epoches == 1 or (epoch + 1) % int(self.num_epoches / 10) == 0: - self.visualize(epoch_str, self.num_epoches, epsilon) + if self.gen_output: + if self.num_epoches == 1 or (epoch + 1) % max(int(self.num_epoches / 10), 1) == 0: + self.visualize(epoch_str, self.num_epoches, epsilon) # 학습 관련 정보 갱신 max_portfolio_value = max( @@ -355,16 +358,17 @@ def predict(self): pred_value = None pred_policy = None if self.value_network is not None: - pred_value = self.value_network.predict(list(q_sample)) + pred_value = self.value_network.predict(list(q_sample)).tolist() if self.policy_network is not None: - pred_policy = self.policy_network.predict(list(q_sample)) + pred_policy = self.policy_network.predict(list(q_sample)).tolist() # 신경망에 의한 행동 결정 - action, confidence, _ = self.agent.decide_action(pred_value, pred_policy, 0) - result.append((self.environment.observation[0], int(action), float(confidence))) + result.append((self.environment.observation[0], pred_value, pred_policy)) + + if self.gen_output: + with open(os.path.join(self.output_path, f'pred_{self.stock_code}.json'), 'w') as f: + print(json.dumps(result), file=f) - with open(os.path.join(self.output_path, f'pred_{self.stock_code}.json'), 'w') as f: - print(json.dumps(result), file=f) return result diff --git a/quantylab/rltrader/networks/__init__.py b/src/quantylab/rltrader/networks/__init__.py similarity index 82% rename from quantylab/rltrader/networks/__init__.py rename to src/quantylab/rltrader/networks/__init__.py index 90b57b1..39fbd56 100644 --- a/quantylab/rltrader/networks/__init__.py +++ b/src/quantylab/rltrader/networks/__init__.py @@ -1,8 +1,10 @@ import os if os.environ.get('RLTRADER_BACKEND', 'pytorch') == 'pytorch': + print('Enabling PyTorch...') from quantylab.rltrader.networks.networks_pytorch import Network, DNN, LSTMNetwork, CNN else: + print('Enabling TensorFlow...') from quantylab.rltrader.networks.networks_keras import Network, DNN, LSTMNetwork, CNN __all__ = [ diff --git a/quantylab/rltrader/networks/networks_keras.py b/src/quantylab/rltrader/networks/networks_keras.py similarity index 100% rename from quantylab/rltrader/networks/networks_keras.py rename to src/quantylab/rltrader/networks/networks_keras.py diff --git a/quantylab/rltrader/networks/networks_pytorch.py b/src/quantylab/rltrader/networks/networks_pytorch.py similarity index 100% rename from quantylab/rltrader/networks/networks_pytorch.py rename to src/quantylab/rltrader/networks/networks_pytorch.py diff --git a/quantylab/rltrader/settings.py b/src/quantylab/rltrader/settings.py similarity index 90% rename from quantylab/rltrader/settings.py rename to src/quantylab/rltrader/settings.py index 2008e18..682b688 100644 --- a/quantylab/rltrader/settings.py +++ b/src/quantylab/rltrader/settings.py @@ -9,7 +9,7 @@ # 경로 설정 BASE_DIR = os.environ.get('RLTRADER_BASE', - os.path.abspath(os.path.join(__file__, os.path.pardir, os.path.pardir, os.path.pardir))) + os.path.abspath(os.path.join(__file__, os.path.pardir, os.path.pardir, os.path.pardir, os.path.pardir))) # 로케일 설정 diff --git a/quantylab/rltrader/utils.py b/src/quantylab/rltrader/utils.py similarity index 100% rename from quantylab/rltrader/utils.py rename to src/quantylab/rltrader/utils.py diff --git a/quantylab/rltrader/visualizer.py b/src/quantylab/rltrader/visualizer.py similarity index 100% rename from quantylab/rltrader/visualizer.py rename to src/quantylab/rltrader/visualizer.py