From fed6924eecb1384a5b51338fec29a9c448b3acff Mon Sep 17 00:00:00 2001 From: Youbad Date: Mon, 15 Feb 2021 15:43:18 -0500 Subject: [PATCH 1/5] Fetching data across all directories! --- finrl/data/fetchdata.py | 54 ++++++++++++++++++++---------- notebooks/notebook_new_download.py | 40 +++++++++++++++++++++- 2 files changed, 76 insertions(+), 18 deletions(-) diff --git a/finrl/data/fetchdata.py b/finrl/data/fetchdata.py index e2cb7184d..407119117 100644 --- a/finrl/data/fetchdata.py +++ b/finrl/data/fetchdata.py @@ -34,6 +34,16 @@ class FetchData: def __init__(self, config: dict): self.config = config + self.data_list = [] + + def get_data(self): + for root, dirs, files in os.walk("./"): + for file in files: + if file.endswith(".json"): + file_json = os.path.join(root, file) + self.data_list.append(file_json) + return self.data_list + def fetch_data_stock(self) -> pd.DataFrame: """Fetches data from Yahoo API @@ -50,14 +60,21 @@ def fetch_data_stock(self) -> pd.DataFrame: exchange = "yahoo" datadir = f'{self.config["user_data_dir"]}/data/{exchange}' print(datadir) + data = self.get_data() timeframe = self.config["timeframe"] ticker_list = self.config["ticker_list"] # Download and save the data in a pandas DataFrame: data_df = pd.DataFrame() for i in ticker_list: - temp_df = pd.read_json(f'{os.getcwd()}/{datadir}/{i}.json') - temp_df["tic"] = i - data_df = data_df.append(temp_df) + for text in data: + if f"{datadir}" and f"{i}-{timeframe}" in text: + i_df = pd.read_json(text) + if not i_df.empty: + i_df["tic"] = i + data_df = data_df.append(temp_df) + else: + print(f"Stock {i} from {text} is Data Not Available...") + print(f"Stock {i} from {text} Fetched successfully...") # reset the index, we want to use numbers as index instead of dates data_df = data_df.reset_index() try: @@ -101,24 +118,27 @@ def fetch_data_crypto(self) -> pd.DataFrame: 7 columns: A date, open, high, low, close, volume and tick symbol for the specified stock ticker """ - - datadir = self.config['datadir'] - exchange = self.config["exchange"]["name"] - timeframe = self.config["timeframe"] + data = self.get_data() + if self.config.get("timeframes"): + timeframe = self.config["timeframes"] + else: + timeframe = self.config["timeframe"] # Check if regex found something and only return these results df = pd.DataFrame() for i in self.config["pairs"]: i = i.replace("/","_") - try: - i_df = pd.read_json(f'{os.getcwd()}/{datadir}/{i}-{timeframe}.json') - i_df["tic"] = i - i_df.columns = ["date", "open","high", "low", "close", "volume", "tic"] - i_df.date = i_df.date.apply(lambda d: datetime.fromtimestamp(d/1000)) - df = df.append(i_df) - print(f"coin {i} completed...") - except: - print(f'coin {i} not available') - pass + for text in data: + if f"{self.config['datadir']}" and f"{i}-{timeframe}" in text: + i_df = pd.read_json(text) + if not i_df.empty: + i_df["tic"] = i + i_df.columns = ["date", "open","high", "low", "close", "volume", "tic"] + i_df.date = i_df.date.apply(lambda d: datetime.fromtimestamp(d/1000)) + df = df.append(i_df) + else: + print(f"coin {i} from {text} is Empty...") + print(f"coin {i} from {text} completed...") + df = df.sort_values(by=['date','tic']).reset_index(drop=True) print(df.shape) return df diff --git a/notebooks/notebook_new_download.py b/notebooks/notebook_new_download.py index 6966a34c6..7c6f10cda 100644 --- a/notebooks/notebook_new_download.py +++ b/notebooks/notebook_new_download.py @@ -16,7 +16,11 @@ # ###### Pull Configuration File (using finrl/config/configuration.py) -config = Configuration.from_files(["config.json"]) +config = Configuration.from_files(["./notebooks/config.json"]) +data = FetchData(config).get_data() + +datafetch = FetchData(config).fetch_data_crypto() + ##### EXAMPLE ##### if directory path is kept none, default = user_data @@ -75,6 +79,40 @@ 'dataformat_ohlcv': None, 'dataformat_trades': None} start_download_cryptodata(ARGS_DOWNLOAD_DATA) + + + +data = FetchData(config).get_data() + +datafetch = FetchData(config).fetch_data_crypto() + + + + + + + + + + + + + + + + + + + + + + + + + + + + import pandas as pd import numpy as np From e86ba86b8c26a7a990743317b1c0f357fc4b18a2 Mon Sep 17 00:00:00 2001 From: Youbad Date: Wed, 17 Feb 2021 09:17:55 -0500 Subject: [PATCH 2/5] Fix Stocks exchanges --- finrl/exchange/exchange.py | 3 +- notebooks/notebook_new_download.py | 30 +--- notebooks/notebook_new_stocks.py | 273 +++++++++++++++++++++++++++++ 3 files changed, 278 insertions(+), 28 deletions(-) create mode 100644 notebooks/notebook_new_stocks.py diff --git a/finrl/exchange/exchange.py b/finrl/exchange/exchange.py index 842484160..c36848058 100755 --- a/finrl/exchange/exchange.py +++ b/finrl/exchange/exchange.py @@ -1247,7 +1247,8 @@ def get_exchange_bad_reason(exchange_name: str) -> str: def is_exchange_known_ccxt(exchange_name: str, ccxt_module: CcxtModuleType = None) -> bool: - return exchange_name in ccxt_exchanges(ccxt_module) + exchanges_confirmed = [ccxt_exchanges(ccxt_module), "yahoo"] + return exchange_name in exchanges_confirmed def is_exchange_officially_supported(exchange_name: str) -> bool: diff --git a/notebooks/notebook_new_download.py b/notebooks/notebook_new_download.py index 7c6f10cda..204d22528 100644 --- a/notebooks/notebook_new_download.py +++ b/notebooks/notebook_new_download.py @@ -88,31 +88,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - +################################################################### NOTEBOOK import pandas as pd import numpy as np @@ -149,7 +125,7 @@ os.makedirs("./" + config.RESULTS_DIR) -config = Configuration.from_files(["config.json"]) +config = Configuration.from_files(["./notebooks/config.json"]) df = FetchData(config).fetch_data_crypto() df.shape @@ -173,7 +149,7 @@ processed_full = processed_full.fillna(0) -processed_full.sort_values(['date','tic'],ignore_index=True).head(10) +processed_full.sort_values(['date','tic'],ignore_index=True).tail() train = data_split(processed_full, '2018-05-16','2020-05-16') trade = data_split(processed_full, '2020-05-17','2020-10-31') diff --git a/notebooks/notebook_new_stocks.py b/notebooks/notebook_new_stocks.py new file mode 100644 index 000000000..877777180 --- /dev/null +++ b/notebooks/notebook_new_stocks.py @@ -0,0 +1,273 @@ +from finrl.config.configuration import Configuration +from finrl.config.directory_operations import create_userdata_dir +from finrl.commands import start_download_cryptodata, start_download_stockdata, start_list_markets +from pathlib import Path +from finrl.data.fetchdata import FetchData +import pandas as pd +from finrl.config import TimeRange +from datetime import datetime, timedelta +import arrow +from finrl.tools.coin_search import * + +#### CREATE USER DATA DIRECTORY IN DESIGNATED PATH, IF NO NAME INDICATED DEFAULT TO user_data +####### create dir to false if only to check existence of directory + +# create_userdata_dir("./user_data",create_dir=True) + +##### EXAMPLE +##### if directory path is kept none, default = user_data +# create_userdata_dir("./finrl_testing", create_dir=True) + + + +# ###### Pull Configuration File (using finrl/config/configuration.py) +config = Configuration.from_files(["./notebooks/config.json"]) + + +################# Either input timerange or days for period of download +ARGS_DOWNLOAD_DATA = {'config': ['./notebooks/config.json'], 'datadir': None, + 'user_data_dir': None, 'days': None, 'timerange': "20000101-20210101", + 'timeframes': ['1d'], 'erase': False} + + +start_download_stockdata(ARGS_DOWNLOAD_DATA) + + + +# df = FetchData(config).fetch_data_stock() + +# print(df.head()) + +# ARGS_LIST_PAIRS = ["exchange": config["exchange"]["name"], "print_list", "list_pairs_print_json", "print_one_column", +# "print_csv", "base_currencies", "quote_currencies", "list_pairs_all"] + +ARGS_LIST_PAIRS = {"exchange":config["exchange"]["name"]} + +x = start_list_markets(ARGS_LIST_PAIRS, "BNB") + +coins = coinSearch("BNB") + +coins_to_json("./config.json", coins) + +ARGS_DOWNLOAD_DATA = {'config': ['config.json'], 'datadir': None, + 'user_data_dir': None, 'pairs': None, 'pairs_file': None, + 'days': 1000, 'timerange': None, + 'download_trades': False, 'exchange': 'binance', + 'timeframes': ['1d'], 'erase': False, + 'dataformat_ohlcv': None, 'dataformat_trades': None} + +start_download_cryptodata(ARGS_DOWNLOAD_DATA) + + + +data = FetchData(config).get_data() + +datafetch = FetchData(config).fetch_data_crypto() + + + +################################################################### NOTEBOOK + +import pandas as pd +import numpy as np +import matplotlib +import matplotlib.pyplot as plt +# matplotlib.use('Agg') +import datetime + +# %matplotlib inline +from finrl.config import config +from finrl.marketdata.yahoodownloader import YahooDownloader +from finrl.preprocessing.preprocessors import FeatureEngineer +from finrl.preprocessing.data import data_split +from finrl.env.env_stocktrading import StockTradingEnv +from finrl.model.models import DRLAgent +from finrl.trade.backtest import backtest_stats, backtest_plot, get_daily_return, get_baseline + +from pprint import pprint + +import sys +sys.path.append("../FinRL-Library") + +import itertools + + +import os +if not os.path.exists("./" + config.DATA_SAVE_DIR): + os.makedirs("./" + config.DATA_SAVE_DIR) +if not os.path.exists("./" + config.TRAINED_MODEL_DIR): + os.makedirs("./" + config.TRAINED_MODEL_DIR) +if not os.path.exists("./" + config.TENSORBOARD_LOG_DIR): + os.makedirs("./" + config.TENSORBOARD_LOG_DIR) +if not os.path.exists("./" + config.RESULTS_DIR): + os.makedirs("./" + config.RESULTS_DIR) + + +config = Configuration.from_files(["./notebooks/config.json"]) + +df = FetchData(config).fetch_data_crypto() +df.shape +df.sort_values(['date','tic'],ignore_index=True).head() + +fe = FeatureEngineer( + use_technical_indicator=True, + tech_indicator_list = config["TECHNICAL_INDICATORS_LIST"], + use_turbulence=False, + user_defined_feature = False) + +processed = fe.preprocess_data(df) + +list_ticker = processed["tic"].unique().tolist() +list_date = list(pd.date_range(processed['date'].min(),processed['date'].max()).astype(str)) +combination = list(itertools.product(list_date,list_ticker)) +processed["date"] = processed["date"].astype(str) +processed_full = pd.DataFrame(combination,columns=["date","tic"]).merge(processed,on=["date","tic"],how="left") +processed_full = processed_full[processed_full['date'].isin(processed['date'])] +processed_full = processed_full.sort_values(['date','tic']) + +processed_full = processed_full.fillna(0) + +processed_full.sort_values(['date','tic'],ignore_index=True).tail() + +train = data_split(processed_full, '2018-05-16','2020-05-16') +trade = data_split(processed_full, '2020-05-17','2020-10-31') +print(len(train)) +print(len(trade)) + +train.head() + +trade.head() + +config["TECHNICAL_INDICATORS_LIST"] + +stock_dimension = len(train.tic.unique()) +state_space = 1 + 2*stock_dimension + len(config["TECHNICAL_INDICATORS_LIST"])*stock_dimension +print(f"Stock Dimension: {stock_dimension}, State Space: {state_space}") + +env_kwargs = { + "hmax": 100, + "initial_amount": 1000000, + "buy_cost_pct": 0.001, + "sell_cost_pct": 0.001, + "state_space": state_space, + "stock_dim": stock_dimension, + "tech_indicator_list": config["TECHNICAL_INDICATORS_LIST"], + "action_space": stock_dimension, + "reward_scaling": 1e-4 + +} +e_train_gym = StockTradingEnv(df = train, **env_kwargs) + +env_train, _ = e_train_gym.get_sb_env() +print(type(env_train)) + +agent = DRLAgent(env = env_train) + +agent = DRLAgent(env = env_train) +model_a2c = agent.get_model("a2c") + +trained_a2c = agent.train_model(model=model_a2c, + tb_log_name='a2c', + total_timesteps=100000) + + +### Model 2: DDPG +agent = DRLAgent(env = env_train) +model_ddpg = agent.get_model("ddpg") + +trained_ddpg = agent.train_model(model=model_ddpg, + tb_log_name='ddpg', + total_timesteps=50000) + +### Model 3: PPO + +agent = DRLAgent(env = env_train) +PPO_PARAMS = { + "n_steps": 2048, + "ent_coef": 0.01, + "learning_rate": 0.00025, + "batch_size": 128, +} +model_ppo = agent.get_model("ppo",model_kwargs = PPO_PARAMS) + +trained_ppo = agent.train_model(model=model_ppo, + tb_log_name='ppo', + total_timesteps=100000) + +### Model 4: TD3 + +agent = DRLAgent(env = env_train) +TD3_PARAMS = {"batch_size": 100, + "buffer_size": 1000000, + "learning_rate": 0.001} + +model_td3 = agent.get_model("td3",model_kwargs = TD3_PARAMS) + +trained_td3 = agent.train_model(model=model_td3, + tb_log_name='td3', + total_timesteps=30000) + + + ### Model 5: SAC + +agent = DRLAgent(env = env_train) +SAC_PARAMS = { + "batch_size": 128, + "buffer_size": 1000000, + "learning_rate": 0.0001, + "learning_starts": 100, + "ent_coef": "auto_0.1", +} + +model_sac = agent.get_model("sac",model_kwargs = SAC_PARAMS) + +trained_sac = agent.train_model(model=model_sac, + tb_log_name='sac', + total_timesteps=80000) + +data_turbulence = processed_full[(processed_full.date<'2019-01-01') & (processed_full.date>='2009-01-01')] +insample_turbulence = data_turbulence.drop_duplicates(subset=['date']) + +insample_turbulence.turbulence.describe() + +turbulence_threshold = np.quantile(insample_turbulence.turbulence.values,1) + +turbulence_threshold + + +e_trade_gym = StockTradingEnv(df = trade, **env_kwargs) +# env_trade, obs_trade = e_trade_gym.get_sb_env() + +df_account_value, df_actions = DRLAgent.DRL_prediction( + model=model_ppo, + environment = e_trade_gym) + +df_account_value.shape + +df_account_value.head() +df_actions.head() + +print("==============Get Backtest Results===========") +now = datetime.datetime.now().strftime('%Y%m%d-%Hh%M') + +perf_stats_all = backtest_stats(account_value=df_account_value) +perf_stats_all = pd.DataFrame(perf_stats_all) +perf_stats_all.to_csv("./"+config.RESULTS_DIR+"/perf_stats_all_"+now+'.csv') + + +print("==============Compare to DJIA===========") +# %matplotlib inline +# S&P 500: ^GSPC +# Dow Jones Index: ^DJI +# NASDAQ 100: ^NDX +backtest_plot(df_account_value, config, + baseline_start = '2019-01-01', + baseline_end = '2021-01-01') + + +print("==============Get Baseline Stats===========") +baseline_df = get_baseline( + ticker="^DJI", start = '2019-01-01', + end = '2021-01-01') + +stats = backtest_stats(baseline_df, value_col_name = 'close') \ No newline at end of file From 02770e390651d6fc2ecbfa2fe296ead6f9a25662 Mon Sep 17 00:00:00 2001 From: Youbad Date: Thu, 18 Feb 2021 11:12:16 -0500 Subject: [PATCH 3/5] Fixed Minor Bugs for Data fetching. Notebooks --- finrl/data/fetchdata.py | 10 +- finrl/exchange/exchange.py | 4 +- notebooks/AI4Finance-Crypto-MultiStock.ipynb | 4926 +++++++++++++ notebooks/AI4Finance_Crypto_MultiCoin.ipynb | 6444 ++++++++++++++++++ notebooks/notebook_new_stocks.py | 7 + 5 files changed, 11384 insertions(+), 7 deletions(-) create mode 100644 notebooks/AI4Finance-Crypto-MultiStock.ipynb create mode 100644 notebooks/AI4Finance_Crypto_MultiCoin.ipynb diff --git a/finrl/data/fetchdata.py b/finrl/data/fetchdata.py index 407119117..d8d08fb5f 100644 --- a/finrl/data/fetchdata.py +++ b/finrl/data/fetchdata.py @@ -58,8 +58,6 @@ def fetch_data_stock(self) -> pd.DataFrame: for the specified stock ticker """ exchange = "yahoo" - datadir = f'{self.config["user_data_dir"]}/data/{exchange}' - print(datadir) data = self.get_data() timeframe = self.config["timeframe"] ticker_list = self.config["ticker_list"] @@ -67,16 +65,18 @@ def fetch_data_stock(self) -> pd.DataFrame: data_df = pd.DataFrame() for i in ticker_list: for text in data: - if f"{datadir}" and f"{i}-{timeframe}" in text: + if f"{exchange}" and f"{i}." in text: i_df = pd.read_json(text) if not i_df.empty: i_df["tic"] = i - data_df = data_df.append(temp_df) + i_df.columns = ["open","high", "low", "close", "volume", "tic"] + data_df = data_df.append(i_df) else: print(f"Stock {i} from {text} is Data Not Available...") - print(f"Stock {i} from {text} Fetched successfully...") + print(f"Stock {i} from {text} Fetched successfully...") # reset the index, we want to use numbers as index instead of dates data_df = data_df.reset_index() + print(data_df.columns) try: # convert the column names to standardized names data_df.columns = [ diff --git a/finrl/exchange/exchange.py b/finrl/exchange/exchange.py index c36848058..cb5be3410 100755 --- a/finrl/exchange/exchange.py +++ b/finrl/exchange/exchange.py @@ -1247,7 +1247,7 @@ def get_exchange_bad_reason(exchange_name: str) -> str: def is_exchange_known_ccxt(exchange_name: str, ccxt_module: CcxtModuleType = None) -> bool: - exchanges_confirmed = [ccxt_exchanges(ccxt_module), "yahoo"] + exchanges_confirmed = ccxt_exchanges(ccxt_module) + ["yahoo"] return exchange_name in exchanges_confirmed @@ -1266,7 +1266,7 @@ def available_exchanges(ccxt_module: CcxtModuleType = None) -> List[str]: """ Return exchanges available to the bot, i.e. non-bad exchanges in the ccxt list """ - exchanges = ccxt_exchanges(ccxt_module) + exchanges = ccxt_exchanges(ccxt_module) + ["yahoo"] return [x for x in exchanges if not is_exchange_bad(x)] diff --git a/notebooks/AI4Finance-Crypto-MultiStock.ipynb b/notebooks/AI4Finance-Crypto-MultiStock.ipynb new file mode 100644 index 000000000..7606f2169 --- /dev/null +++ b/notebooks/AI4Finance-Crypto-MultiStock.ipynb @@ -0,0 +1,4926 @@ +{ + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "colab": { + "name": "FINRL MULTISTOCK", + "provenance": [], + "collapsed_sections": [] + }, + "kernelspec": { + "name": "python3", + "display_name": "Python 3" + } + }, + "cells": [ + { + "cell_type": "code", + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "tPsJhsL1RFWi", + "outputId": "fa5b2378-5ba7-4528-c9c8-de637171733d" + }, + "source": [ + "!git clone https://github.com/Youbadawy/FinRL-Library.git" + ], + "execution_count": 1, + "outputs": [ + { + "output_type": "stream", + "text": [ + "fatal: destination path 'FinRL-Library' already exists and is not an empty directory.\n" + ], + "name": "stdout" + } + ] + }, + { + "cell_type": "code", + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "0PyGiqZ5Ph-A", + "outputId": "c0e1e386-ba04-40b2-95e3-5c1d10f09bc3" + }, + "source": [ + "%cd FinRL-Library/\r\n", + "!pip install -r requirements.txt" + ], + "execution_count": 2, + "outputs": [ + { + "output_type": "stream", + "text": [ + "/content/FinRL-Library\n", + "Requirement already satisfied: numpy in /usr/local/lib/python3.6/dist-packages (from -r requirements.txt (line 2)) (1.19.5)\n", + "Requirement already satisfied: pandas>=1.1.5 in /usr/local/lib/python3.6/dist-packages (from -r requirements.txt (line 3)) (1.1.5)\n", + "Requirement already satisfied: stockstats in /usr/local/lib/python3.6/dist-packages (from -r requirements.txt (line 4)) (0.3.2)\n", + "Requirement already satisfied: yfinance in /usr/local/lib/python3.6/dist-packages (from -r requirements.txt (line 5)) (0.1.55)\n", + "Requirement already satisfied: pyfolio in /usr/local/lib/python3.6/dist-packages (from -r requirements.txt (line 6)) (0.9.2)\n", + "Requirement already satisfied: matplotlib in /usr/local/lib/python3.6/dist-packages (from -r requirements.txt (line 10)) (3.2.2)\n", + "Requirement already satisfied: scikit-learn>=0.21.0 in /usr/local/lib/python3.6/dist-packages (from -r requirements.txt (line 13)) (0.22.2.post1)\n", + "Requirement already satisfied: gym>=0.17 in /usr/local/lib/python3.6/dist-packages (from -r requirements.txt (line 14)) (0.17.3)\n", + "Requirement already satisfied: stable-baselines3[extra] in /usr/local/lib/python3.6/dist-packages (from -r requirements.txt (line 15)) (0.10.0)\n", + "Requirement already satisfied: pytest in /usr/local/lib/python3.6/dist-packages (from -r requirements.txt (line 18)) (3.6.4)\n", + "Requirement already satisfied: setuptools>=41.4.0 in /usr/local/lib/python3.6/dist-packages (from -r requirements.txt (line 21)) (53.0.0)\n", + "Requirement already satisfied: wheel>=0.33.6 in /usr/local/lib/python3.6/dist-packages (from -r requirements.txt (line 22)) (0.36.2)\n", + "Requirement already satisfied: arrow in /usr/local/lib/python3.6/dist-packages (from -r requirements.txt (line 25)) (0.17.0)\n", + "Requirement already satisfied: python-rapidjson in /usr/local/lib/python3.6/dist-packages (from -r requirements.txt (line 26)) (1.0)\n", + "Requirement already satisfied: questionary in /usr/local/lib/python3.6/dist-packages (from -r requirements.txt (line 27)) (1.9.0)\n", + "Requirement already satisfied: sqlalchemy in /usr/local/lib/python3.6/dist-packages (from -r requirements.txt (line 28)) (1.3.23)\n", + "Requirement already satisfied: tabulate in /usr/local/lib/python3.6/dist-packages (from -r requirements.txt (line 29)) (0.8.7)\n", + "Requirement already satisfied: ccxt in /usr/local/lib/python3.6/dist-packages (from -r requirements.txt (line 32)) (1.41.97)\n", + "Requirement already satisfied: colorama in /usr/local/lib/python3.6/dist-packages (from -r requirements.txt (line 35)) (0.4.4)\n", + "Requirement already satisfied: tensorflow in /usr/local/lib/python3.6/dist-packages (from -r requirements.txt (line 38)) (2.4.1)\n", + "Requirement already satisfied: nest-asyncio in /usr/local/lib/python3.6/dist-packages (from -r requirements.txt (line 41)) (1.5.1)\n", + "Requirement already satisfied: python-dateutil>=2.7.3 in /usr/local/lib/python3.6/dist-packages (from pandas>=1.1.5->-r requirements.txt (line 3)) (2.8.1)\n", + "Requirement already satisfied: pytz>=2017.2 in /usr/local/lib/python3.6/dist-packages (from pandas>=1.1.5->-r requirements.txt (line 3)) (2018.9)\n", + "Requirement already satisfied: int-date>=0.1.7 in /usr/local/lib/python3.6/dist-packages (from stockstats->-r requirements.txt (line 4)) (0.1.8)\n", + "Requirement already satisfied: requests>=2.20 in /usr/local/lib/python3.6/dist-packages (from yfinance->-r requirements.txt (line 5)) (2.23.0)\n", + "Requirement already satisfied: lxml>=4.5.1 in /usr/local/lib/python3.6/dist-packages (from yfinance->-r requirements.txt (line 5)) (4.6.2)\n", + "Requirement already satisfied: multitasking>=0.0.7 in /usr/local/lib/python3.6/dist-packages (from yfinance->-r requirements.txt (line 5)) (0.0.9)\n", + "Requirement already satisfied: empyrical>=0.5.0 in /usr/local/lib/python3.6/dist-packages (from pyfolio->-r requirements.txt (line 6)) (0.5.5)\n", + "Requirement already satisfied: scipy>=0.14.0 in /usr/local/lib/python3.6/dist-packages (from pyfolio->-r requirements.txt (line 6)) (1.4.1)\n", + "Requirement already satisfied: ipython>=3.2.3 in /usr/local/lib/python3.6/dist-packages (from pyfolio->-r requirements.txt (line 6)) (7.16.1)\n", + "Requirement already satisfied: seaborn>=0.7.1 in /usr/local/lib/python3.6/dist-packages (from pyfolio->-r requirements.txt (line 6)) (0.11.1)\n", + "Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.6/dist-packages (from matplotlib->-r requirements.txt (line 10)) (1.3.1)\n", + "Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /usr/local/lib/python3.6/dist-packages (from matplotlib->-r requirements.txt (line 10)) (2.4.7)\n", + "Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.6/dist-packages (from matplotlib->-r requirements.txt (line 10)) (0.10.0)\n", + "Requirement already satisfied: joblib>=0.11 in /usr/local/lib/python3.6/dist-packages (from scikit-learn>=0.21.0->-r requirements.txt (line 13)) (1.0.0)\n", + "Requirement already satisfied: pyglet<=1.5.0,>=1.4.0 in /usr/local/lib/python3.6/dist-packages (from gym>=0.17->-r requirements.txt (line 14)) (1.5.0)\n", + "Requirement already satisfied: cloudpickle<1.7.0,>=1.2.0 in /usr/local/lib/python3.6/dist-packages (from gym>=0.17->-r requirements.txt (line 14)) (1.3.0)\n", + "Requirement already satisfied: torch>=1.4.0 in /usr/local/lib/python3.6/dist-packages (from stable-baselines3[extra]->-r requirements.txt (line 15)) (1.7.0+cu101)\n", + "Requirement already satisfied: atari-py~=0.2.0; extra == \"extra\" in /usr/local/lib/python3.6/dist-packages (from stable-baselines3[extra]->-r requirements.txt (line 15)) (0.2.6)\n", + "Requirement already satisfied: psutil; extra == \"extra\" in /usr/local/lib/python3.6/dist-packages (from stable-baselines3[extra]->-r requirements.txt (line 15)) (5.4.8)\n", + "Requirement already satisfied: opencv-python; extra == \"extra\" in /usr/local/lib/python3.6/dist-packages (from stable-baselines3[extra]->-r requirements.txt (line 15)) (4.1.2.30)\n", + "Requirement already satisfied: pillow; extra == \"extra\" in /usr/local/lib/python3.6/dist-packages (from stable-baselines3[extra]->-r requirements.txt (line 15)) (7.0.0)\n", + "Requirement already satisfied: tensorboard; extra == \"extra\" in /usr/local/lib/python3.6/dist-packages (from stable-baselines3[extra]->-r requirements.txt (line 15)) (2.4.1)\n", + "Requirement already satisfied: attrs>=17.4.0 in /usr/local/lib/python3.6/dist-packages (from pytest->-r requirements.txt (line 18)) (20.3.0)\n", + "Requirement already satisfied: pluggy<0.8,>=0.5 in /usr/local/lib/python3.6/dist-packages (from pytest->-r requirements.txt (line 18)) (0.7.1)\n", + "Requirement already satisfied: six>=1.10.0 in /usr/local/lib/python3.6/dist-packages (from pytest->-r requirements.txt (line 18)) (1.15.0)\n", + "Requirement already satisfied: atomicwrites>=1.0 in /usr/local/lib/python3.6/dist-packages (from pytest->-r requirements.txt (line 18)) (1.4.0)\n", + "Requirement already satisfied: more-itertools>=4.0.0 in /usr/local/lib/python3.6/dist-packages (from pytest->-r requirements.txt (line 18)) (8.7.0)\n", + "Requirement already satisfied: py>=1.5.0 in /usr/local/lib/python3.6/dist-packages (from pytest->-r requirements.txt (line 18)) (1.10.0)\n", + "Requirement already satisfied: prompt_toolkit<4.0,>=2.0 in /usr/local/lib/python3.6/dist-packages (from questionary->-r requirements.txt (line 27)) (3.0.16)\n", + "Requirement already satisfied: cryptography>=2.6.1 in /usr/local/lib/python3.6/dist-packages (from ccxt->-r requirements.txt (line 32)) (3.4.6)\n", + "Requirement already satisfied: aiohttp<3.8,>=3.7.2; python_version >= \"3.5.2\" in /usr/local/lib/python3.6/dist-packages (from ccxt->-r requirements.txt (line 32)) (3.7.3)\n", + "Requirement already satisfied: aiodns<2.1,>=1.1.1; python_version >= \"3.5.2\" in /usr/local/lib/python3.6/dist-packages (from ccxt->-r requirements.txt (line 32)) (2.0.0)\n", + "Requirement already satisfied: yarl==1.1.0; python_version >= \"3.5.2\" in /usr/local/lib/python3.6/dist-packages (from ccxt->-r requirements.txt (line 32)) (1.1.0)\n", + "Requirement already satisfied: certifi>=2018.1.18 in /usr/local/lib/python3.6/dist-packages (from ccxt->-r requirements.txt (line 32)) (2020.12.5)\n", + "Requirement already satisfied: grpcio~=1.32.0 in /usr/local/lib/python3.6/dist-packages (from tensorflow->-r requirements.txt (line 38)) (1.32.0)\n", + "Requirement already satisfied: wrapt~=1.12.1 in /usr/local/lib/python3.6/dist-packages (from tensorflow->-r requirements.txt (line 38)) (1.12.1)\n", + "Requirement already satisfied: keras-preprocessing~=1.1.2 in /usr/local/lib/python3.6/dist-packages (from tensorflow->-r requirements.txt (line 38)) (1.1.2)\n", + "Requirement already satisfied: opt-einsum~=3.3.0 in /usr/local/lib/python3.6/dist-packages (from tensorflow->-r requirements.txt (line 38)) (3.3.0)\n", + "Requirement already satisfied: astunparse~=1.6.3 in /usr/local/lib/python3.6/dist-packages (from tensorflow->-r requirements.txt (line 38)) (1.6.3)\n", + "Requirement already satisfied: termcolor~=1.1.0 in /usr/local/lib/python3.6/dist-packages (from tensorflow->-r requirements.txt (line 38)) (1.1.0)\n", + "Requirement already satisfied: typing-extensions~=3.7.4 in /usr/local/lib/python3.6/dist-packages (from tensorflow->-r requirements.txt (line 38)) (3.7.4.3)\n", + "Requirement already satisfied: tensorflow-estimator<2.5.0,>=2.4.0 in /usr/local/lib/python3.6/dist-packages (from tensorflow->-r requirements.txt (line 38)) (2.4.0)\n", + "Requirement already satisfied: gast==0.3.3 in /usr/local/lib/python3.6/dist-packages (from tensorflow->-r requirements.txt (line 38)) (0.3.3)\n", + "Requirement already satisfied: h5py~=2.10.0 in /usr/local/lib/python3.6/dist-packages (from tensorflow->-r requirements.txt (line 38)) (2.10.0)\n", + "Requirement already satisfied: flatbuffers~=1.12.0 in /usr/local/lib/python3.6/dist-packages (from tensorflow->-r requirements.txt (line 38)) (1.12)\n", + "Requirement already satisfied: protobuf>=3.9.2 in /usr/local/lib/python3.6/dist-packages (from tensorflow->-r requirements.txt (line 38)) (3.12.4)\n", + "Requirement already satisfied: google-pasta~=0.2 in /usr/local/lib/python3.6/dist-packages (from tensorflow->-r requirements.txt (line 38)) (0.2.0)\n", + "Requirement already satisfied: absl-py~=0.10 in /usr/local/lib/python3.6/dist-packages (from tensorflow->-r requirements.txt (line 38)) (0.10.0)\n", + "Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /usr/local/lib/python3.6/dist-packages (from requests>=2.20->yfinance->-r requirements.txt (line 5)) (1.24.3)\n", + "Requirement already satisfied: chardet<4,>=3.0.2 in /usr/local/lib/python3.6/dist-packages (from requests>=2.20->yfinance->-r requirements.txt (line 5)) (3.0.4)\n", + "Requirement already satisfied: idna<3,>=2.5 in /usr/local/lib/python3.6/dist-packages (from requests>=2.20->yfinance->-r requirements.txt (line 5)) (2.10)\n", + "Requirement already satisfied: pandas-datareader>=0.2 in /usr/local/lib/python3.6/dist-packages (from empyrical>=0.5.0->pyfolio->-r requirements.txt (line 6)) (0.9.0)\n", + "Requirement already satisfied: pygments in /usr/local/lib/python3.6/dist-packages (from ipython>=3.2.3->pyfolio->-r requirements.txt (line 6)) (2.6.1)\n", + "Requirement already satisfied: pickleshare in /usr/local/lib/python3.6/dist-packages (from ipython>=3.2.3->pyfolio->-r requirements.txt (line 6)) (0.7.5)\n", + "Requirement already satisfied: decorator in /usr/local/lib/python3.6/dist-packages (from ipython>=3.2.3->pyfolio->-r requirements.txt (line 6)) (4.4.2)\n", + "Requirement already satisfied: pexpect; sys_platform != \"win32\" in /usr/local/lib/python3.6/dist-packages (from ipython>=3.2.3->pyfolio->-r requirements.txt (line 6)) (4.8.0)\n", + "Requirement already satisfied: jedi>=0.10 in /usr/local/lib/python3.6/dist-packages (from ipython>=3.2.3->pyfolio->-r requirements.txt (line 6)) (0.18.0)\n", + "Requirement already satisfied: backcall in /usr/local/lib/python3.6/dist-packages (from ipython>=3.2.3->pyfolio->-r requirements.txt (line 6)) (0.2.0)\n", + "Requirement already satisfied: traitlets>=4.2 in /usr/local/lib/python3.6/dist-packages (from ipython>=3.2.3->pyfolio->-r requirements.txt (line 6)) (4.3.3)\n", + "Requirement already satisfied: future in /usr/local/lib/python3.6/dist-packages (from pyglet<=1.5.0,>=1.4.0->gym>=0.17->-r requirements.txt (line 14)) (0.16.0)\n", + "Requirement already satisfied: dataclasses in /usr/local/lib/python3.6/dist-packages (from torch>=1.4.0->stable-baselines3[extra]->-r requirements.txt (line 15)) (0.8)\n", + "Requirement already satisfied: markdown>=2.6.8 in /usr/local/lib/python3.6/dist-packages (from tensorboard; extra == \"extra\"->stable-baselines3[extra]->-r requirements.txt (line 15)) (3.3.3)\n", + "Requirement already satisfied: werkzeug>=0.11.15 in /usr/local/lib/python3.6/dist-packages (from tensorboard; extra == \"extra\"->stable-baselines3[extra]->-r requirements.txt (line 15)) (1.0.1)\n", + "Requirement already satisfied: tensorboard-plugin-wit>=1.6.0 in /usr/local/lib/python3.6/dist-packages (from tensorboard; extra == \"extra\"->stable-baselines3[extra]->-r requirements.txt (line 15)) (1.8.0)\n", + "Requirement already satisfied: google-auth<2,>=1.6.3 in /usr/local/lib/python3.6/dist-packages (from tensorboard; extra == \"extra\"->stable-baselines3[extra]->-r requirements.txt (line 15)) (1.25.0)\n", + "Requirement already satisfied: google-auth-oauthlib<0.5,>=0.4.1 in /usr/local/lib/python3.6/dist-packages (from tensorboard; extra == \"extra\"->stable-baselines3[extra]->-r requirements.txt (line 15)) (0.4.2)\n", + "Requirement already satisfied: wcwidth in /usr/local/lib/python3.6/dist-packages (from prompt_toolkit<4.0,>=2.0->questionary->-r requirements.txt (line 27)) (0.2.5)\n", + "Requirement already satisfied: cffi>=1.12 in /usr/local/lib/python3.6/dist-packages (from cryptography>=2.6.1->ccxt->-r requirements.txt (line 32)) (1.14.4)\n", + "Requirement already satisfied: idna-ssl>=1.0; python_version < \"3.7\" in /usr/local/lib/python3.6/dist-packages (from aiohttp<3.8,>=3.7.2; python_version >= \"3.5.2\"->ccxt->-r requirements.txt (line 32)) (1.1.0)\n", + "Requirement already satisfied: async-timeout<4.0,>=3.0 in /usr/local/lib/python3.6/dist-packages (from aiohttp<3.8,>=3.7.2; python_version >= \"3.5.2\"->ccxt->-r requirements.txt (line 32)) (3.0.1)\n", + "Requirement already satisfied: multidict<7.0,>=4.5 in /usr/local/lib/python3.6/dist-packages (from aiohttp<3.8,>=3.7.2; python_version >= \"3.5.2\"->ccxt->-r requirements.txt (line 32)) (5.1.0)\n", + "Requirement already satisfied: pycares>=3.0.0 in /usr/local/lib/python3.6/dist-packages (from aiodns<2.1,>=1.1.1; python_version >= \"3.5.2\"->ccxt->-r requirements.txt (line 32)) (3.1.1)\n", + "Requirement already satisfied: typing; python_version < \"3.7\" in /usr/local/lib/python3.6/dist-packages (from aiodns<2.1,>=1.1.1; python_version >= \"3.5.2\"->ccxt->-r requirements.txt (line 32)) (3.7.4.3)\n", + "Requirement already satisfied: ptyprocess>=0.5 in /usr/local/lib/python3.6/dist-packages (from pexpect; sys_platform != \"win32\"->ipython>=3.2.3->pyfolio->-r requirements.txt (line 6)) (0.7.0)\n", + "Requirement already satisfied: parso<0.9.0,>=0.8.0 in /usr/local/lib/python3.6/dist-packages (from jedi>=0.10->ipython>=3.2.3->pyfolio->-r requirements.txt (line 6)) (0.8.1)\n", + "Requirement already satisfied: ipython-genutils in /usr/local/lib/python3.6/dist-packages (from traitlets>=4.2->ipython>=3.2.3->pyfolio->-r requirements.txt (line 6)) (0.2.0)\n", + "Requirement already satisfied: importlib-metadata; python_version < \"3.8\" in /usr/local/lib/python3.6/dist-packages (from markdown>=2.6.8->tensorboard; extra == \"extra\"->stable-baselines3[extra]->-r requirements.txt (line 15)) (3.4.0)\n", + "Requirement already satisfied: rsa<5,>=3.1.4; python_version >= \"3.6\" in /usr/local/lib/python3.6/dist-packages (from google-auth<2,>=1.6.3->tensorboard; extra == \"extra\"->stable-baselines3[extra]->-r requirements.txt (line 15)) (4.7)\n", + "Requirement already satisfied: pyasn1-modules>=0.2.1 in /usr/local/lib/python3.6/dist-packages (from google-auth<2,>=1.6.3->tensorboard; extra == \"extra\"->stable-baselines3[extra]->-r requirements.txt (line 15)) (0.2.8)\n", + "Requirement already satisfied: cachetools<5.0,>=2.0.0 in /usr/local/lib/python3.6/dist-packages (from google-auth<2,>=1.6.3->tensorboard; extra == \"extra\"->stable-baselines3[extra]->-r requirements.txt (line 15)) (4.2.1)\n", + "Requirement already satisfied: requests-oauthlib>=0.7.0 in /usr/local/lib/python3.6/dist-packages (from google-auth-oauthlib<0.5,>=0.4.1->tensorboard; extra == \"extra\"->stable-baselines3[extra]->-r requirements.txt (line 15)) (1.3.0)\n", + "Requirement already satisfied: pycparser in /usr/local/lib/python3.6/dist-packages (from cffi>=1.12->cryptography>=2.6.1->ccxt->-r requirements.txt (line 32)) (2.20)\n", + "Requirement already satisfied: zipp>=0.5 in /usr/local/lib/python3.6/dist-packages (from importlib-metadata; python_version < \"3.8\"->markdown>=2.6.8->tensorboard; extra == \"extra\"->stable-baselines3[extra]->-r requirements.txt (line 15)) (3.4.0)\n", + "Requirement already satisfied: pyasn1>=0.1.3 in /usr/local/lib/python3.6/dist-packages (from rsa<5,>=3.1.4; python_version >= \"3.6\"->google-auth<2,>=1.6.3->tensorboard; extra == \"extra\"->stable-baselines3[extra]->-r requirements.txt (line 15)) (0.4.8)\n", + "Requirement already satisfied: oauthlib>=3.0.0 in /usr/local/lib/python3.6/dist-packages (from requests-oauthlib>=0.7.0->google-auth-oauthlib<0.5,>=0.4.1->tensorboard; extra == \"extra\"->stable-baselines3[extra]->-r requirements.txt (line 15)) (3.1.0)\n" + ], + "name": "stdout" + } + ] + }, + { + "cell_type": "code", + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "YOi7SNtgRbRx", + "outputId": "f4a58f7e-50fe-4acb-c74f-017d07b985a8" + }, + "source": [ + "!pip install -U ipython\r\n", + "# !pip install colorama" + ], + "execution_count": 3, + "outputs": [ + { + "output_type": "stream", + "text": [ + "Requirement already up-to-date: ipython in /usr/local/lib/python3.6/dist-packages (7.16.1)\n", + "Requirement already satisfied, skipping upgrade: jedi>=0.10 in /usr/local/lib/python3.6/dist-packages (from ipython) (0.18.0)\n", + "Requirement already satisfied, skipping upgrade: traitlets>=4.2 in /usr/local/lib/python3.6/dist-packages (from ipython) (4.3.3)\n", + "Requirement already satisfied, skipping upgrade: decorator in /usr/local/lib/python3.6/dist-packages (from ipython) (4.4.2)\n", + "Requirement already satisfied, skipping upgrade: backcall in /usr/local/lib/python3.6/dist-packages (from ipython) (0.2.0)\n", + "Requirement already satisfied, skipping upgrade: pickleshare in /usr/local/lib/python3.6/dist-packages (from ipython) (0.7.5)\n", + "Requirement already satisfied, skipping upgrade: prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0 in /usr/local/lib/python3.6/dist-packages (from ipython) (3.0.16)\n", + "Requirement already satisfied, skipping upgrade: pexpect; sys_platform != \"win32\" in /usr/local/lib/python3.6/dist-packages (from ipython) (4.8.0)\n", + "Requirement already satisfied, skipping upgrade: setuptools>=18.5 in /usr/local/lib/python3.6/dist-packages (from ipython) (53.0.0)\n", + "Requirement already satisfied, skipping upgrade: pygments in /usr/local/lib/python3.6/dist-packages (from ipython) (2.6.1)\n", + "Requirement already satisfied, skipping upgrade: parso<0.9.0,>=0.8.0 in /usr/local/lib/python3.6/dist-packages (from jedi>=0.10->ipython) (0.8.1)\n", + "Requirement already satisfied, skipping upgrade: six in /usr/local/lib/python3.6/dist-packages (from traitlets>=4.2->ipython) (1.15.0)\n", + "Requirement already satisfied, skipping upgrade: ipython-genutils in /usr/local/lib/python3.6/dist-packages (from traitlets>=4.2->ipython) (0.2.0)\n", + "Requirement already satisfied, skipping upgrade: wcwidth in /usr/local/lib/python3.6/dist-packages (from prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0->ipython) (0.2.5)\n", + "Requirement already satisfied, skipping upgrade: ptyprocess>=0.5 in /usr/local/lib/python3.6/dist-packages (from pexpect; sys_platform != \"win32\"->ipython) (0.7.0)\n" + ], + "name": "stdout" + } + ] + }, + { + "cell_type": "code", + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "fDVBL-cDVWEP", + "outputId": "9abe0d4d-1c54-484c-ec4f-1507f7590134" + }, + "source": [ + "%cd FinRL-Library/" + ], + "execution_count": 4, + "outputs": [ + { + "output_type": "stream", + "text": [ + "[Errno 2] No such file or directory: 'FinRL-Library/'\n", + "/content/FinRL-Library\n" + ], + "name": "stdout" + } + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "7gc1cGFZLfKG" + }, + "source": [ + "import nest_asyncio\r\n", + "nest_asyncio.apply()" + ], + "execution_count": 5, + "outputs": [] + }, + { + "cell_type": "code", + "metadata": { + "id": "KTJUn-J9Ps0W", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "04c35fcf-66ac-4d57-800d-77101516b061" + }, + "source": [ + "import pandas as pd\r\n", + "import numpy as np\r\n", + "import matplotlib\r\n", + "import matplotlib.pyplot as plt\r\n", + "# matplotlib.use('Agg')\r\n", + "import datetime\r\n", + "\r\n", + "%matplotlib inline\r\n", + "from finrl.config import config\r\n", + "from finrl.marketdata.yahoodownloader import YahooDownloader\r\n", + "from finrl.preprocessing.preprocessors import FeatureEngineer\r\n", + "from finrl.preprocessing.data import data_split\r\n", + "from finrl.env.env_stocktrading import StockTradingEnv\r\n", + "from finrl.model.models import DRLAgent\r\n", + "from finrl.trade.backtest import backtest_stats, backtest_plot, get_daily_return, get_baseline\r\n", + "\r\n", + "from pprint import pprint\r\n", + "\r\n", + "import sys\r\n", + "sys.path.append(\"../FinRL-Library\")\r\n", + "\r\n", + "import itertools" + ], + "execution_count": 6, + "outputs": [ + { + "output_type": "stream", + "text": [ + "/usr/local/lib/python3.6/dist-packages/pyfolio/pos.py:28: UserWarning: Module \"zipline.assets\" not found; mutltipliers will not be applied to position notionals.\n", + " ' to position notionals.'\n" + ], + "name": "stderr" + } + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "kWqK7-ryPwhQ" + }, + "source": [ + "import os\r\n", + "if not os.path.exists(\"./\" + config.DATA_SAVE_DIR):\r\n", + " os.makedirs(\"./\" + config.DATA_SAVE_DIR)\r\n", + "if not os.path.exists(\"./\" + config.TRAINED_MODEL_DIR):\r\n", + " os.makedirs(\"./\" + config.TRAINED_MODEL_DIR)\r\n", + "if not os.path.exists(\"./\" + config.TENSORBOARD_LOG_DIR):\r\n", + " os.makedirs(\"./\" + config.TENSORBOARD_LOG_DIR)\r\n", + "if not os.path.exists(\"./\" + config.RESULTS_DIR):\r\n", + " os.makedirs(\"./\" + config.RESULTS_DIR)" + ], + "execution_count": 7, + "outputs": [] + }, + { + "cell_type": "code", + "metadata": { + "id": "afDyaoplPzed" + }, + "source": [ + "from finrl.config.configuration import Configuration\r\n", + "from finrl.config.directory_operations import create_userdata_dir\r\n", + "from finrl.commands import start_download_cryptodata, start_download_stockdata" + ], + "execution_count": 8, + "outputs": [] + }, + { + "cell_type": "code", + "metadata": { + "id": "p6UBynHyQtvV" + }, + "source": [ + "#### CREATE USER DATA DIRECTORY IN DESIGNATED PATH, IF NO NAME INDICATED DEFAULT TO user_data\r\n", + "####### create dir to false if only to check existence of directory\r\n", + "create_userdata_dir(\"./user_data\",create_dir=True)\r\n", + "\r\n", + "\r\n", + "# ###### Pull Configuration File (using finrl/config/configuration.py)\r\n", + "config = Configuration.from_files([\"./notebooks/config.json\"])" + ], + "execution_count": 9, + "outputs": [] + }, + { + "cell_type": "code", + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "BPgYq0RVY0jG", + "outputId": "5124607f-fce8-4a93-ca6f-fdd62fa726ad" + }, + "source": [ + "from finrl.config import setup_utils_configuration\r\n", + "from finrl.state import RunMode\r\n", + "\r\n", + "ARGS_DOWNLOAD_DATA = {'config': ['./notebooks/config.json'], 'datadir': None, \r\n", + " 'user_data_dir': None, 'pairs': None, 'pairs_file': None, \r\n", + " 'days': 365, 'timerange': None, \r\n", + " 'download_trades': False, 'exchange': 'yahoo', \r\n", + " 'timeframes': '5m', 'erase': False, \r\n", + " 'dataformat_ohlcv': None, 'dataformat_trades': None}\r\n", + "\r\n", + "### Adds to config ARGS stats for further use through config\r\n", + "\r\n", + "config = setup_utils_configuration(ARGS_DOWNLOAD_DATA, RunMode.UTIL_EXCHANGE)\r\n", + "print(config.get(\"timeframes\"))" + ], + "execution_count": 10, + "outputs": [ + { + "output_type": "stream", + "text": [ + "5m\n" + ], + "name": "stdout" + } + ] + }, + { + "cell_type": "code", + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "e6NIg980UTPg", + "outputId": "6aecfd50-fc28-44fe-fb0e-9e0a82aeecd7" + }, + "source": [ + "from finrl.tools.coin_search import *\r\n", + "\r\n", + "tickers = [\"FUBO\", \"JMIA\", \"AMZN\", \"APPN\", \"LUV\", \"IBIO\", \"BB\",\"TSLA\", \"BABA\", \"GOOG\", \"RLLCF\", \"NIO\", \"RIOT\", \"BNGO\", \"MVIS\", \"IDEX\", \"NOK\", \"PLTR\", \"TSNP\", \"CCIV\", \"JNJ\", \"JPM\", \"MA\", \"PG\", \"BAC\", \"PFE\", \"UPS\", \"WFC\", \"SNOW\", \"USB\", \"INTC\", \"EA\", \"AMD\", \"NDA\", \"PYPL\" ]\r\n", + "len(tickers)\r\n", + "\r\n", + "stocks_to_json(\"./notebooks/config.json\", tickers)\r\n", + "config = Configuration.from_files([\"./notebooks/config.json\"])\r\n", + "print(config)" + ], + "execution_count": 11, + "outputs": [ + { + "output_type": "stream", + "text": [ + "{'max_open_trades': 10, 'stake_currency': 'BTC', 'stake_amount': 0.1, 'tradable_balance_ratio': 0.99, 'fiat_display_currency': 'USD', 'timeframe': '1d', 'dry_run': True, 'exchange': {'name': 'yahoo', 'key': '', 'secret': '', 'ccxt_config': {'enableRateLimit': True}, 'ccxt_async_config': {'enableRateLimit': True, 'rateLimit': 200}, 'pair_whitelist': ['MBL/BNB', 'SC/BNB', 'WIN/BNB', 'IOST/BNB', 'BTT/BNB', 'HOT/BNB', 'COS/BNB', 'STMX/BNB', 'BNBDOWN/USDT', 'RSR/BNB', 'TROY/BNB', 'VET/BNB', 'MITH/BNB', 'ONE/BNB', 'VTHO/BNB', 'TRX/BNB', 'ANKR/BNB', 'MFT/BNB', 'SAND/BNB', 'IQ/BNB', 'WRX/BNB', 'XLM/BNB', 'CELR/BNB', 'FET/BNB', 'IOTA/BNB', 'ZIL/BNB', 'OGN/BNB', 'HBAR/BNB', 'COTI/BNB', 'STX/BNB', 'PERL/BNB', 'FTT/BNB', 'ONT/BNB', 'FIO/BNB', 'HARD/BNB', 'XRP/BNB', 'DIA/BNB', 'RVN/BNB', 'CTSI/BNB', 'SWRV/BNB', 'ARPA/BNB', 'CTK/BNB', 'CHZ/BNB', 'KAVA/BNB', 'ANT/BNB', 'DGB/BNB', 'FTM/BNB', 'JST/BNB', 'NEAR/BNB', 'MATIC/BNB'], 'pair_blacklist': []}, 'ticker_list': ['FUBO', 'JMIA', 'AMZN', 'APPN', 'LUV', 'IBIO', 'BB', 'TSLA', 'BABA', 'GOOG', 'RLLCF', 'NIO', 'RIOT', 'BNGO', 'MVIS', 'IDEX', 'NOK', 'PLTR', 'TSNP', 'CCIV', 'JNJ', 'JPM', 'MA', 'PG', 'BAC', 'PFE', 'UPS', 'WFC', 'SNOW', 'USB', 'INTC', 'EA', 'AMD', 'NDA', 'PYPL'], 'pairlists': [{'method': 'StaticPairList'}], 'telegram': {'enabled': True, 'token': '', 'chat_id': ''}, 'api_server': {'enabled': False, 'listen_ip_address': '127.0.0.1', 'listen_port': 8080, 'verbosity': 'info', 'jwt_secret_key': 'somethingrandom', 'CORS_origins': [], 'username': '', 'password': ''}, 'dataformat_ohlcv': 'json', 'dataformat_trades': 'jsongz', 'user_data_dir': PosixPath('user_data'), 'TECHNICAL_INDICATORS_LIST': ['macd', 'boll_ub', 'boll_lb', 'rsi_30', 'cci_30', 'dx_30', 'close_30_sma', 'close_60_sma'], 'internals': {}, 'ask_strategy': {}, 'original_config': {'max_open_trades': 10, 'stake_currency': 'BTC', 'stake_amount': 0.1, 'tradable_balance_ratio': 0.99, 'fiat_display_currency': 'USD', 'timeframe': '1d', 'dry_run': True, 'exchange': {'name': 'yahoo', 'key': '', 'secret': '', 'ccxt_config': {'enableRateLimit': True}, 'ccxt_async_config': {'enableRateLimit': True, 'rateLimit': 200}, 'pair_whitelist': ['MBL/BNB', 'SC/BNB', 'WIN/BNB', 'IOST/BNB', 'BTT/BNB', 'HOT/BNB', 'COS/BNB', 'STMX/BNB', 'BNBDOWN/USDT', 'RSR/BNB', 'TROY/BNB', 'VET/BNB', 'MITH/BNB', 'ONE/BNB', 'VTHO/BNB', 'TRX/BNB', 'ANKR/BNB', 'MFT/BNB', 'SAND/BNB', 'IQ/BNB', 'WRX/BNB', 'XLM/BNB', 'CELR/BNB', 'FET/BNB', 'IOTA/BNB', 'ZIL/BNB', 'OGN/BNB', 'HBAR/BNB', 'COTI/BNB', 'STX/BNB', 'PERL/BNB', 'FTT/BNB', 'ONT/BNB', 'FIO/BNB', 'HARD/BNB', 'XRP/BNB', 'DIA/BNB', 'RVN/BNB', 'CTSI/BNB', 'SWRV/BNB', 'ARPA/BNB', 'CTK/BNB', 'CHZ/BNB', 'KAVA/BNB', 'ANT/BNB', 'DGB/BNB', 'FTM/BNB', 'JST/BNB', 'NEAR/BNB', 'MATIC/BNB'], 'pair_blacklist': []}, 'ticker_list': ['FUBO', 'JMIA', 'AMZN', 'APPN', 'LUV', 'IBIO', 'BB', 'TSLA', 'BABA', 'GOOG', 'RLLCF', 'NIO', 'RIOT', 'BNGO', 'MVIS', 'IDEX', 'NOK', 'PLTR', 'TSNP', 'CCIV', 'JNJ', 'JPM', 'MA', 'PG', 'BAC', 'PFE', 'UPS', 'WFC', 'SNOW', 'USB', 'INTC', 'EA', 'AMD', 'NDA', 'PYPL'], 'pairlists': [{'method': 'StaticPairList'}], 'telegram': {'enabled': True, 'token': '', 'chat_id': ''}, 'api_server': {'enabled': False, 'listen_ip_address': '127.0.0.1', 'listen_port': 8080, 'verbosity': 'info', 'jwt_secret_key': 'somethingrandom', 'CORS_origins': [], 'username': '', 'password': ''}, 'dataformat_ohlcv': 'json', 'dataformat_trades': 'jsongz', 'user_data_dir': './user_data/', 'TECHNICAL_INDICATORS_LIST': ['macd', 'boll_ub', 'boll_lb', 'rsi_30', 'cci_30', 'dx_30', 'close_30_sma', 'close_60_sma'], 'internals': {}, 'ask_strategy': {}}, 'verbosity': 0, 'runmode': , 'datadir': PosixPath('user_data/data/yahoo'), 'exportfilename': PosixPath('user_data/backtest_results'), 'pairs': ['MBL/BNB', 'SC/BNB', 'WIN/BNB', 'IOST/BNB', 'BTT/BNB', 'HOT/BNB', 'COS/BNB', 'STMX/BNB', 'BNBDOWN/USDT', 'RSR/BNB', 'TROY/BNB', 'VET/BNB', 'MITH/BNB', 'ONE/BNB', 'VTHO/BNB', 'TRX/BNB', 'ANKR/BNB', 'MFT/BNB', 'SAND/BNB', 'IQ/BNB', 'WRX/BNB', 'XLM/BNB', 'CELR/BNB', 'FET/BNB', 'IOTA/BNB', 'ZIL/BNB', 'OGN/BNB', 'HBAR/BNB', 'COTI/BNB', 'STX/BNB', 'PERL/BNB', 'FTT/BNB', 'ONT/BNB', 'FIO/BNB', 'HARD/BNB', 'XRP/BNB', 'DIA/BNB', 'RVN/BNB', 'CTSI/BNB', 'SWRV/BNB', 'ARPA/BNB', 'CTK/BNB', 'CHZ/BNB', 'KAVA/BNB', 'ANT/BNB', 'DGB/BNB', 'FTM/BNB', 'JST/BNB', 'NEAR/BNB', 'MATIC/BNB']}\n" + ], + "name": "stdout" + } + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "6HDb_jaLVkZ7", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "db55c0b9-d428-4d51-ec55-30ea73504f6a" + }, + "source": [ + "ARGS_DOWNLOAD_DATA = {'config': ['./notebooks/config.json'], 'datadir': None, \r\n", + " 'user_data_dir': None, 'days': None, 'timerange': \"20020101-20210101\",\r\n", + " 'timeframes': ['1d'], 'erase': False}\r\n", + "\r\n", + "\r\n", + "start_download_stockdata(ARGS_DOWNLOAD_DATA)" + ], + "execution_count": 12, + "outputs": [ + { + "output_type": "stream", + "text": [ + "[*********************100%***********************] 1 of 1 completed\n", + "[*********************100%***********************] 1 of 1 completed\n", + "[*********************100%***********************] 1 of 1 completed\n", + "[*********************100%***********************] 1 of 1 completed\n", + "[*********************100%***********************] 1 of 1 completed\n", + "[*********************100%***********************] 1 of 1 completed\n", + "[*********************100%***********************] 1 of 1 completed\n", + "[*********************100%***********************] 1 of 1 completed\n", + "[*********************100%***********************] 1 of 1 completed\n", + "[*********************100%***********************] 1 of 1 completed\n", + "[*********************100%***********************] 1 of 1 completed\n", + "[*********************100%***********************] 1 of 1 completed\n", + "[*********************100%***********************] 1 of 1 completed\n", + "[*********************100%***********************] 1 of 1 completed\n", + "[*********************100%***********************] 1 of 1 completed\n", + "[*********************100%***********************] 1 of 1 completed\n", + "[*********************100%***********************] 1 of 1 completed\n", + "[*********************100%***********************] 1 of 1 completed\n", + "[*********************100%***********************] 1 of 1 completed\n", + "[*********************100%***********************] 1 of 1 completed\n", + "[*********************100%***********************] 1 of 1 completed\n", + "[*********************100%***********************] 1 of 1 completed\n", + "[*********************100%***********************] 1 of 1 completed\n", + "[*********************100%***********************] 1 of 1 completed\n", + "[*********************100%***********************] 1 of 1 completed\n", + "[*********************100%***********************] 1 of 1 completed\n", + "[*********************100%***********************] 1 of 1 completed\n", + "[*********************100%***********************] 1 of 1 completed\n", + "[*********************100%***********************] 1 of 1 completed\n", + "[*********************100%***********************] 1 of 1 completed\n", + "[*********************100%***********************] 1 of 1 completed\n", + "[*********************100%***********************] 1 of 1 completed\n", + "[*********************100%***********************] 1 of 1 completed\n", + "[*********************100%***********************] 1 of 1 completed\n", + "[*********************100%***********************] 1 of 1 completed\n" + ], + "name": "stdout" + } + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "BRSgP8Ohfw4J" + }, + "source": [ + "from finrl.data.fetchdata import FetchData\r\n", + "import pandas as pd\r\n", + "from finrl.config import TimeRange" + ], + "execution_count": 13, + "outputs": [] + }, + { + "cell_type": "code", + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "j_YbCR9_aYiY", + "outputId": "b7535b05-07b7-4558-9af4-704c9ba2dd1c" + }, + "source": [ + "df = FetchData(config).fetch_data_stock()\r\n", + "print(df.head)" + ], + "execution_count": 14, + "outputs": [ + { + "output_type": "stream", + "text": [ + "Stock FUBO from ./user_data/data/yahoo/FUBO.json Fetched successfully...\n", + "Stock JMIA from ./user_data/data/yahoo/JMIA.json Fetched successfully...\n", + "Stock AMZN from ./user_data/data/yahoo/AMZN.json Fetched successfully...\n", + "Stock APPN from ./user_data/data/yahoo/APPN.json Fetched successfully...\n", + "Stock LUV from ./user_data/data/yahoo/LUV.json Fetched successfully...\n", + "Stock IBIO from ./user_data/data/yahoo/IBIO.json Fetched successfully...\n", + "Stock BB from ./user_data/data/yahoo/BB.json Fetched successfully...\n", + "Stock TSLA from ./user_data/data/yahoo/TSLA.json Fetched successfully...\n", + "Stock BABA from ./user_data/data/yahoo/BABA.json Fetched successfully...\n", + "Stock GOOG from ./user_data/data/yahoo/GOOG.json Fetched successfully...\n", + "Stock RLLCF from ./user_data/data/yahoo/RLLCF.json Fetched successfully...\n", + "Stock NIO from ./user_data/data/yahoo/NIO.json Fetched successfully...\n", + "Stock RIOT from ./user_data/data/yahoo/RIOT.json Fetched successfully...\n", + "Stock BNGO from ./user_data/data/yahoo/BNGO.json Fetched successfully...\n", + "Stock MVIS from ./user_data/data/yahoo/MVIS.json Fetched successfully...\n", + "Stock IDEX from ./user_data/data/yahoo/IDEX.json Fetched successfully...\n", + "Stock NOK from ./user_data/data/yahoo/NOK.json Fetched successfully...\n", + "Stock PLTR from ./user_data/data/yahoo/PLTR.json Fetched successfully...\n", + "Stock TSNP from ./user_data/data/yahoo/TSNP.json Fetched successfully...\n", + "Stock CCIV from ./user_data/data/yahoo/CCIV.json Fetched successfully...\n", + "Stock JNJ from ./user_data/data/yahoo/JNJ.json Fetched successfully...\n", + "Stock JPM from ./user_data/data/yahoo/JPM.json Fetched successfully...\n", + "Stock MA from ./user_data/data/yahoo/MA.json Fetched successfully...\n", + "Stock PG from ./user_data/data/yahoo/PG.json Fetched successfully...\n", + "Stock BAC from ./user_data/data/yahoo/BAC.json Fetched successfully...\n", + "Stock PFE from ./user_data/data/yahoo/PFE.json Fetched successfully...\n", + "Stock UPS from ./user_data/data/yahoo/UPS.json Fetched successfully...\n", + "Stock WFC from ./user_data/data/yahoo/WFC.json Fetched successfully...\n", + "Stock SNOW from ./user_data/data/yahoo/SNOW.json Fetched successfully...\n", + "Stock USB from ./user_data/data/yahoo/USB.json Fetched successfully...\n", + "Stock INTC from ./user_data/data/yahoo/INTC.json Fetched successfully...\n", + "Stock EA from ./user_data/data/yahoo/EA.json Fetched successfully...\n", + "Stock AMD from ./user_data/data/yahoo/AMD.json Fetched successfully...\n", + "Stock NDA from ./user_data/data/yahoo/NDA.json Fetched successfully...\n", + "Stock PYPL from ./user_data/data/yahoo/PYPL.json Fetched successfully...\n", + "Index(['index', 'open', 'high', 'low', 'close', 'volume', 'tic'], dtype='object')\n", + "Shape of DataFrame: (107764, 8)\n", + " date open high low close volume tic day\n", + "0 2002-01-02 16.280001 16.410000 15.950 16.389999 4475400 AMD 2\n", + "1 2002-01-02 10.930000 11.000000 10.480 10.960000 6519600 AMZN 2\n", + "2 2002-01-02 31.155001 31.549999 31.055 19.802853 8669200 BAC 2\n", + "3 2002-01-02 3.955000 4.098333 3.915 4.083333 5870400 BB 2\n", + "4 2002-01-02 30.245001 30.370001 29.805 30.019999 5836200 EA 2\n", + "\n" + ], + "name": "stdout" + } + ] + }, + { + "cell_type": "code", + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 206 + }, + "id": "KGBpYLlBwPN1", + "outputId": "6031bb29-afaa-4d11-adf2-972913bd3e7d" + }, + "source": [ + "df.head()" + ], + "execution_count": 15, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
dateopenhighlowclosevolumeticday
02002-01-0216.28000116.41000015.95016.3899994475400AMD2
12002-01-0210.93000011.00000010.48010.9600006519600AMZN2
22002-01-0231.15500131.54999931.05519.8028538669200BAC2
32002-01-023.9550004.0983333.9154.0833335870400BB2
42002-01-0230.24500130.37000129.80530.0199995836200EA2
\n", + "
" + ], + "text/plain": [ + " date open high low close volume tic day\n", + "0 2002-01-02 16.280001 16.410000 15.950 16.389999 4475400 AMD 2\n", + "1 2002-01-02 10.930000 11.000000 10.480 10.960000 6519600 AMZN 2\n", + "2 2002-01-02 31.155001 31.549999 31.055 19.802853 8669200 BAC 2\n", + "3 2002-01-02 3.955000 4.098333 3.915 4.083333 5870400 BB 2\n", + "4 2002-01-02 30.245001 30.370001 29.805 30.019999 5836200 EA 2" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 15 + } + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "TUn5EJuqhCaW", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "4dd75888-5ce9-4330-b665-ff999b5e6059" + }, + "source": [ + "df.sort_values(['date','tic'],ignore_index=True).head()\r\n", + "\r\n", + "fe = FeatureEngineer(\r\n", + " use_technical_indicator=True,\r\n", + " tech_indicator_list = config[\"TECHNICAL_INDICATORS_LIST\"],\r\n", + " use_turbulence=False,\r\n", + " user_defined_feature = False)\r\n", + "\r\n", + "processed = fe.preprocess_data(df)\r\n", + "processed.columns" + ], + "execution_count": 16, + "outputs": [ + { + "output_type": "stream", + "text": [ + "Successfully added technical indicators\n" + ], + "name": "stdout" + }, + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "Index(['date', 'open', 'high', 'low', 'close', 'volume', 'tic', 'day', 'macd',\n", + " 'boll_ub', 'boll_lb', 'rsi_30', 'cci_30', 'dx_30', 'close_30_sma',\n", + " 'close_60_sma'],\n", + " dtype='object')" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 16 + } + ] + }, + { + "cell_type": "code", + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "ztp-RmbQilsM", + "outputId": "e38262c0-5c58-49e0-cea9-5edfef8ee7d8" + }, + "source": [ + "print(processed.head())\r\n", + "processed.shape" + ], + "execution_count": 17, + "outputs": [ + { + "output_type": "stream", + "text": [ + " date open high ... dx_30 close_30_sma close_60_sma\n", + "0 2002-01-02 16.280001 16.410000 ... 100.0 16.389999 16.389999\n", + "1 2002-01-02 10.930000 11.000000 ... 100.0 17.880000 17.880000\n", + "2 2002-01-02 31.155001 31.549999 ... 100.0 18.586667 18.586667\n", + "3 2002-01-02 3.955000 4.098333 ... 100.0 18.935000 18.935000\n", + "4 2002-01-02 30.245001 30.370001 ... 100.0 19.128000 19.128000\n", + "\n", + "[5 rows x 16 columns]\n" + ], + "name": "stdout" + }, + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "(107764, 16)" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 17 + } + ] + }, + { + "cell_type": "code", + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "tDt2xirSfhmv", + "outputId": "4f3a13b1-b52c-499d-acf2-ced70b10051a" + }, + "source": [ + "print(processed.tail())\r\n", + "processed.shape" + ], + "execution_count": 18, + "outputs": [ + { + "output_type": "stream", + "text": [ + " date open high ... dx_30 close_30_sma close_60_sma\n", + "107759 2020-12-31 699.989990 718.719971 ... 100.0 0.000455 0.000455\n", + "107760 2020-12-31 0.173000 0.173900 ... 100.0 0.000458 0.000458\n", + "107761 2020-12-31 166.789993 168.479996 ... 100.0 0.000462 0.000462\n", + "107762 2020-12-31 46.130001 46.660000 ... 100.0 0.000464 0.000464\n", + "107763 2020-12-31 29.750000 30.240000 ... 100.0 0.000467 0.000467\n", + "\n", + "[5 rows x 16 columns]\n" + ], + "name": "stdout" + }, + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "(107764, 16)" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 18 + } + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "CyLPP3t7i3gU", + "colab": { + "base_uri": "https://localhost:8080/" + }, + "outputId": "d1a14b40-6a1b-4266-c740-da7c67724bad" + }, + "source": [ + "list_ticker = processed[\"tic\"].unique().tolist()\r\n", + "list_date = list(pd.date_range(processed['date'].min(),processed['date'].max(), freq=\"1d\").astype(str))\r\n", + "combination = list(itertools.product(list_date,list_ticker))\r\n", + "list_date" + ], + "execution_count": 24, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "['2002-01-02',\n", + " '2002-01-03',\n", + " '2002-01-04',\n", + " '2002-01-05',\n", + " '2002-01-06',\n", + " '2002-01-07',\n", + " '2002-01-08',\n", + " '2002-01-09',\n", + " '2002-01-10',\n", + " '2002-01-11',\n", + " '2002-01-12',\n", + " '2002-01-13',\n", + " '2002-01-14',\n", + " '2002-01-15',\n", + " '2002-01-16',\n", + " '2002-01-17',\n", + " '2002-01-18',\n", + " '2002-01-19',\n", + " '2002-01-20',\n", + " '2002-01-21',\n", + " '2002-01-22',\n", + " '2002-01-23',\n", + " '2002-01-24',\n", + " '2002-01-25',\n", + " '2002-01-26',\n", + " '2002-01-27',\n", + " '2002-01-28',\n", + " '2002-01-29',\n", + " '2002-01-30',\n", + " '2002-01-31',\n", + " '2002-02-01',\n", + " '2002-02-02',\n", + " '2002-02-03',\n", + " '2002-02-04',\n", + " '2002-02-05',\n", + " '2002-02-06',\n", + " '2002-02-07',\n", + " '2002-02-08',\n", + " '2002-02-09',\n", + " '2002-02-10',\n", + " '2002-02-11',\n", + " '2002-02-12',\n", + " '2002-02-13',\n", + " '2002-02-14',\n", + " '2002-02-15',\n", + " '2002-02-16',\n", + " '2002-02-17',\n", + " '2002-02-18',\n", + " '2002-02-19',\n", + " '2002-02-20',\n", + " '2002-02-21',\n", + " '2002-02-22',\n", + " '2002-02-23',\n", + " '2002-02-24',\n", + " '2002-02-25',\n", + " '2002-02-26',\n", + " '2002-02-27',\n", + " '2002-02-28',\n", + " '2002-03-01',\n", + " '2002-03-02',\n", + " '2002-03-03',\n", + " '2002-03-04',\n", + " '2002-03-05',\n", + " '2002-03-06',\n", + " '2002-03-07',\n", + " '2002-03-08',\n", + " '2002-03-09',\n", + " '2002-03-10',\n", + " '2002-03-11',\n", + " '2002-03-12',\n", + " '2002-03-13',\n", + " '2002-03-14',\n", + " '2002-03-15',\n", + " '2002-03-16',\n", + " '2002-03-17',\n", + " '2002-03-18',\n", + " '2002-03-19',\n", + " '2002-03-20',\n", + " '2002-03-21',\n", + " '2002-03-22',\n", + " '2002-03-23',\n", + " '2002-03-24',\n", + " '2002-03-25',\n", + " '2002-03-26',\n", + " '2002-03-27',\n", + " '2002-03-28',\n", + " '2002-03-29',\n", + " '2002-03-30',\n", + " '2002-03-31',\n", + " '2002-04-01',\n", + " '2002-04-02',\n", + " '2002-04-03',\n", + " '2002-04-04',\n", + " '2002-04-05',\n", + " '2002-04-06',\n", + " '2002-04-07',\n", + " '2002-04-08',\n", + " '2002-04-09',\n", + " '2002-04-10',\n", + " '2002-04-11',\n", + " '2002-04-12',\n", + " '2002-04-13',\n", + " '2002-04-14',\n", + " '2002-04-15',\n", + " '2002-04-16',\n", + " '2002-04-17',\n", + " '2002-04-18',\n", + " '2002-04-19',\n", + " '2002-04-20',\n", + " '2002-04-21',\n", + " '2002-04-22',\n", + " '2002-04-23',\n", + " '2002-04-24',\n", + " '2002-04-25',\n", + " '2002-04-26',\n", + " '2002-04-27',\n", + " '2002-04-28',\n", + " '2002-04-29',\n", + " '2002-04-30',\n", + " '2002-05-01',\n", + " '2002-05-02',\n", + " '2002-05-03',\n", + " '2002-05-04',\n", + " '2002-05-05',\n", + " '2002-05-06',\n", + " '2002-05-07',\n", + " '2002-05-08',\n", + " '2002-05-09',\n", + " '2002-05-10',\n", + " '2002-05-11',\n", + " '2002-05-12',\n", + " '2002-05-13',\n", + " '2002-05-14',\n", + " '2002-05-15',\n", + " '2002-05-16',\n", + " '2002-05-17',\n", + " '2002-05-18',\n", + " '2002-05-19',\n", + " '2002-05-20',\n", + " '2002-05-21',\n", + " '2002-05-22',\n", + " '2002-05-23',\n", + " '2002-05-24',\n", + " '2002-05-25',\n", + " '2002-05-26',\n", + " '2002-05-27',\n", + " '2002-05-28',\n", + " '2002-05-29',\n", + " '2002-05-30',\n", + " '2002-05-31',\n", + " '2002-06-01',\n", + " '2002-06-02',\n", + " '2002-06-03',\n", + " '2002-06-04',\n", + " '2002-06-05',\n", + " '2002-06-06',\n", + " '2002-06-07',\n", + " '2002-06-08',\n", + " '2002-06-09',\n", + " '2002-06-10',\n", + " '2002-06-11',\n", + " '2002-06-12',\n", + " '2002-06-13',\n", + " '2002-06-14',\n", + " '2002-06-15',\n", + " '2002-06-16',\n", + " '2002-06-17',\n", + " '2002-06-18',\n", + " '2002-06-19',\n", + " '2002-06-20',\n", + " '2002-06-21',\n", + " '2002-06-22',\n", + " '2002-06-23',\n", + " '2002-06-24',\n", + " '2002-06-25',\n", + " '2002-06-26',\n", + " '2002-06-27',\n", + " '2002-06-28',\n", + " '2002-06-29',\n", + " '2002-06-30',\n", + " '2002-07-01',\n", + " '2002-07-02',\n", + " '2002-07-03',\n", + " '2002-07-04',\n", + " '2002-07-05',\n", + " '2002-07-06',\n", + " '2002-07-07',\n", + " '2002-07-08',\n", + " '2002-07-09',\n", + " '2002-07-10',\n", + " '2002-07-11',\n", + " '2002-07-12',\n", + " '2002-07-13',\n", + " '2002-07-14',\n", + " '2002-07-15',\n", + " '2002-07-16',\n", + " '2002-07-17',\n", + " '2002-07-18',\n", + " '2002-07-19',\n", + " '2002-07-20',\n", + " '2002-07-21',\n", + " '2002-07-22',\n", + " '2002-07-23',\n", + " '2002-07-24',\n", + " '2002-07-25',\n", + " '2002-07-26',\n", + " '2002-07-27',\n", + " '2002-07-28',\n", + " '2002-07-29',\n", + " '2002-07-30',\n", + " '2002-07-31',\n", + " '2002-08-01',\n", + " '2002-08-02',\n", + " '2002-08-03',\n", + " '2002-08-04',\n", + " '2002-08-05',\n", + " '2002-08-06',\n", + " '2002-08-07',\n", + " '2002-08-08',\n", + " '2002-08-09',\n", + " '2002-08-10',\n", + " '2002-08-11',\n", + " '2002-08-12',\n", + " '2002-08-13',\n", + " '2002-08-14',\n", + " '2002-08-15',\n", + " '2002-08-16',\n", + " '2002-08-17',\n", + " '2002-08-18',\n", + " '2002-08-19',\n", + " '2002-08-20',\n", + " '2002-08-21',\n", + " '2002-08-22',\n", + " '2002-08-23',\n", + " '2002-08-24',\n", + " '2002-08-25',\n", + " '2002-08-26',\n", + " '2002-08-27',\n", + " '2002-08-28',\n", + " '2002-08-29',\n", + " '2002-08-30',\n", + " '2002-08-31',\n", + " '2002-09-01',\n", + " '2002-09-02',\n", + " '2002-09-03',\n", + " '2002-09-04',\n", + " '2002-09-05',\n", + " '2002-09-06',\n", + " '2002-09-07',\n", + " '2002-09-08',\n", + " '2002-09-09',\n", + " '2002-09-10',\n", + " '2002-09-11',\n", + " '2002-09-12',\n", + " '2002-09-13',\n", + " '2002-09-14',\n", + " '2002-09-15',\n", + " '2002-09-16',\n", + " '2002-09-17',\n", + " '2002-09-18',\n", + " '2002-09-19',\n", + " '2002-09-20',\n", + " '2002-09-21',\n", + " '2002-09-22',\n", + " '2002-09-23',\n", + " '2002-09-24',\n", + " '2002-09-25',\n", + " '2002-09-26',\n", + " '2002-09-27',\n", + " '2002-09-28',\n", + " '2002-09-29',\n", + " '2002-09-30',\n", + " '2002-10-01',\n", + " '2002-10-02',\n", + " '2002-10-03',\n", + " '2002-10-04',\n", + " '2002-10-05',\n", + " '2002-10-06',\n", + " '2002-10-07',\n", + " '2002-10-08',\n", + " '2002-10-09',\n", + " '2002-10-10',\n", + " '2002-10-11',\n", + " '2002-10-12',\n", + " '2002-10-13',\n", + " '2002-10-14',\n", + " '2002-10-15',\n", + " '2002-10-16',\n", + " '2002-10-17',\n", + " '2002-10-18',\n", + " '2002-10-19',\n", + " '2002-10-20',\n", + " '2002-10-21',\n", + " '2002-10-22',\n", + " '2002-10-23',\n", + " '2002-10-24',\n", + " '2002-10-25',\n", + " '2002-10-26',\n", + " '2002-10-27',\n", + " '2002-10-28',\n", + " '2002-10-29',\n", + " '2002-10-30',\n", + " '2002-10-31',\n", + " '2002-11-01',\n", + " '2002-11-02',\n", + " '2002-11-03',\n", + " '2002-11-04',\n", + " '2002-11-05',\n", + " '2002-11-06',\n", + " '2002-11-07',\n", + " '2002-11-08',\n", + " '2002-11-09',\n", + " '2002-11-10',\n", + " '2002-11-11',\n", + " '2002-11-12',\n", + " '2002-11-13',\n", + " '2002-11-14',\n", + " '2002-11-15',\n", + " '2002-11-16',\n", + " '2002-11-17',\n", + " '2002-11-18',\n", + " '2002-11-19',\n", + " '2002-11-20',\n", + " '2002-11-21',\n", + " '2002-11-22',\n", + " '2002-11-23',\n", + " '2002-11-24',\n", + " '2002-11-25',\n", + " '2002-11-26',\n", + " '2002-11-27',\n", + " '2002-11-28',\n", + " '2002-11-29',\n", + " '2002-11-30',\n", + " '2002-12-01',\n", + " '2002-12-02',\n", + " '2002-12-03',\n", + " '2002-12-04',\n", + " '2002-12-05',\n", + " '2002-12-06',\n", + " '2002-12-07',\n", + " '2002-12-08',\n", + " '2002-12-09',\n", + " '2002-12-10',\n", + " '2002-12-11',\n", + " '2002-12-12',\n", + " '2002-12-13',\n", + " '2002-12-14',\n", + " '2002-12-15',\n", + " '2002-12-16',\n", + " '2002-12-17',\n", + " '2002-12-18',\n", + " '2002-12-19',\n", + " '2002-12-20',\n", + " '2002-12-21',\n", + " '2002-12-22',\n", + " '2002-12-23',\n", + " '2002-12-24',\n", + " '2002-12-25',\n", + " '2002-12-26',\n", + " '2002-12-27',\n", + " '2002-12-28',\n", + " '2002-12-29',\n", + " '2002-12-30',\n", + " '2002-12-31',\n", + " '2003-01-01',\n", + " '2003-01-02',\n", + " '2003-01-03',\n", + " '2003-01-04',\n", + " '2003-01-05',\n", + " '2003-01-06',\n", + " '2003-01-07',\n", + " '2003-01-08',\n", + " '2003-01-09',\n", + " '2003-01-10',\n", + " '2003-01-11',\n", + " '2003-01-12',\n", + " '2003-01-13',\n", + " '2003-01-14',\n", + " '2003-01-15',\n", + " '2003-01-16',\n", + " '2003-01-17',\n", + " '2003-01-18',\n", + " '2003-01-19',\n", + " '2003-01-20',\n", + " '2003-01-21',\n", + " '2003-01-22',\n", + " '2003-01-23',\n", + " '2003-01-24',\n", + " '2003-01-25',\n", + " '2003-01-26',\n", + " '2003-01-27',\n", + " '2003-01-28',\n", + " '2003-01-29',\n", + " '2003-01-30',\n", + " '2003-01-31',\n", + " '2003-02-01',\n", + " '2003-02-02',\n", + " '2003-02-03',\n", + " '2003-02-04',\n", + " '2003-02-05',\n", + " '2003-02-06',\n", + " '2003-02-07',\n", + " '2003-02-08',\n", + " '2003-02-09',\n", + " '2003-02-10',\n", + " '2003-02-11',\n", + " '2003-02-12',\n", + " '2003-02-13',\n", + " '2003-02-14',\n", + " '2003-02-15',\n", + " '2003-02-16',\n", + " '2003-02-17',\n", + " '2003-02-18',\n", + " '2003-02-19',\n", + " '2003-02-20',\n", + " '2003-02-21',\n", + " '2003-02-22',\n", + " '2003-02-23',\n", + " '2003-02-24',\n", + " '2003-02-25',\n", + " '2003-02-26',\n", + " '2003-02-27',\n", + " '2003-02-28',\n", + " '2003-03-01',\n", + " '2003-03-02',\n", + " '2003-03-03',\n", + " '2003-03-04',\n", + " '2003-03-05',\n", + " '2003-03-06',\n", + " '2003-03-07',\n", + " '2003-03-08',\n", + " '2003-03-09',\n", + " '2003-03-10',\n", + " '2003-03-11',\n", + " '2003-03-12',\n", + " '2003-03-13',\n", + " '2003-03-14',\n", + " '2003-03-15',\n", + " '2003-03-16',\n", + " '2003-03-17',\n", + " '2003-03-18',\n", + " '2003-03-19',\n", + " '2003-03-20',\n", + " '2003-03-21',\n", + " '2003-03-22',\n", + " '2003-03-23',\n", + " '2003-03-24',\n", + " '2003-03-25',\n", + " '2003-03-26',\n", + " '2003-03-27',\n", + " '2003-03-28',\n", + " '2003-03-29',\n", + " '2003-03-30',\n", + " '2003-03-31',\n", + " '2003-04-01',\n", + " '2003-04-02',\n", + " '2003-04-03',\n", + " '2003-04-04',\n", + " '2003-04-05',\n", + " '2003-04-06',\n", + " '2003-04-07',\n", + " '2003-04-08',\n", + " '2003-04-09',\n", + " '2003-04-10',\n", + " '2003-04-11',\n", + " '2003-04-12',\n", + " '2003-04-13',\n", + " '2003-04-14',\n", + " '2003-04-15',\n", + " '2003-04-16',\n", + " '2003-04-17',\n", + " '2003-04-18',\n", + " '2003-04-19',\n", + " '2003-04-20',\n", + " '2003-04-21',\n", + " '2003-04-22',\n", + " '2003-04-23',\n", + " '2003-04-24',\n", + " '2003-04-25',\n", + " '2003-04-26',\n", + " '2003-04-27',\n", + " '2003-04-28',\n", + " '2003-04-29',\n", + " '2003-04-30',\n", + " '2003-05-01',\n", + " '2003-05-02',\n", + " '2003-05-03',\n", + " '2003-05-04',\n", + " '2003-05-05',\n", + " '2003-05-06',\n", + " '2003-05-07',\n", + " '2003-05-08',\n", + " '2003-05-09',\n", + " '2003-05-10',\n", + " '2003-05-11',\n", + " '2003-05-12',\n", + " '2003-05-13',\n", + " '2003-05-14',\n", + " '2003-05-15',\n", + " '2003-05-16',\n", + " '2003-05-17',\n", + " '2003-05-18',\n", + " '2003-05-19',\n", + " '2003-05-20',\n", + " '2003-05-21',\n", + " '2003-05-22',\n", + " '2003-05-23',\n", + " '2003-05-24',\n", + " '2003-05-25',\n", + " '2003-05-26',\n", + " '2003-05-27',\n", + " '2003-05-28',\n", + " '2003-05-29',\n", + " '2003-05-30',\n", + " '2003-05-31',\n", + " '2003-06-01',\n", + " '2003-06-02',\n", + " '2003-06-03',\n", + " '2003-06-04',\n", + " '2003-06-05',\n", + " '2003-06-06',\n", + " '2003-06-07',\n", + " '2003-06-08',\n", + " '2003-06-09',\n", + " '2003-06-10',\n", + " '2003-06-11',\n", + " '2003-06-12',\n", + " '2003-06-13',\n", + " '2003-06-14',\n", + " '2003-06-15',\n", + " '2003-06-16',\n", + " '2003-06-17',\n", + " '2003-06-18',\n", + " '2003-06-19',\n", + " '2003-06-20',\n", + " '2003-06-21',\n", + " '2003-06-22',\n", + " '2003-06-23',\n", + " '2003-06-24',\n", + " '2003-06-25',\n", + " '2003-06-26',\n", + " '2003-06-27',\n", + " '2003-06-28',\n", + " '2003-06-29',\n", + " '2003-06-30',\n", + " '2003-07-01',\n", + " '2003-07-02',\n", + " '2003-07-03',\n", + " '2003-07-04',\n", + " '2003-07-05',\n", + " '2003-07-06',\n", + " '2003-07-07',\n", + " '2003-07-08',\n", + " '2003-07-09',\n", + " '2003-07-10',\n", + " '2003-07-11',\n", + " '2003-07-12',\n", + " '2003-07-13',\n", + " '2003-07-14',\n", + " '2003-07-15',\n", + " '2003-07-16',\n", + " '2003-07-17',\n", + " '2003-07-18',\n", + " '2003-07-19',\n", + " '2003-07-20',\n", + " '2003-07-21',\n", + " '2003-07-22',\n", + " '2003-07-23',\n", + " '2003-07-24',\n", + " '2003-07-25',\n", + " '2003-07-26',\n", + " '2003-07-27',\n", + " '2003-07-28',\n", + " '2003-07-29',\n", + " '2003-07-30',\n", + " '2003-07-31',\n", + " '2003-08-01',\n", + " '2003-08-02',\n", + " '2003-08-03',\n", + " '2003-08-04',\n", + " '2003-08-05',\n", + " '2003-08-06',\n", + " '2003-08-07',\n", + " '2003-08-08',\n", + " '2003-08-09',\n", + " '2003-08-10',\n", + " '2003-08-11',\n", + " '2003-08-12',\n", + " '2003-08-13',\n", + " '2003-08-14',\n", + " '2003-08-15',\n", + " '2003-08-16',\n", + " '2003-08-17',\n", + " '2003-08-18',\n", + " '2003-08-19',\n", + " '2003-08-20',\n", + " '2003-08-21',\n", + " '2003-08-22',\n", + " '2003-08-23',\n", + " '2003-08-24',\n", + " '2003-08-25',\n", + " '2003-08-26',\n", + " '2003-08-27',\n", + " '2003-08-28',\n", + " '2003-08-29',\n", + " '2003-08-30',\n", + " '2003-08-31',\n", + " '2003-09-01',\n", + " '2003-09-02',\n", + " '2003-09-03',\n", + " '2003-09-04',\n", + " '2003-09-05',\n", + " '2003-09-06',\n", + " '2003-09-07',\n", + " '2003-09-08',\n", + " '2003-09-09',\n", + " '2003-09-10',\n", + " '2003-09-11',\n", + " '2003-09-12',\n", + " '2003-09-13',\n", + " '2003-09-14',\n", + " '2003-09-15',\n", + " '2003-09-16',\n", + " '2003-09-17',\n", + " '2003-09-18',\n", + " '2003-09-19',\n", + " '2003-09-20',\n", + " '2003-09-21',\n", + " '2003-09-22',\n", + " '2003-09-23',\n", + " '2003-09-24',\n", + " '2003-09-25',\n", + " '2003-09-26',\n", + " '2003-09-27',\n", + " '2003-09-28',\n", + " '2003-09-29',\n", + " '2003-09-30',\n", + " '2003-10-01',\n", + " '2003-10-02',\n", + " '2003-10-03',\n", + " '2003-10-04',\n", + " '2003-10-05',\n", + " '2003-10-06',\n", + " '2003-10-07',\n", + " '2003-10-08',\n", + " '2003-10-09',\n", + " '2003-10-10',\n", + " '2003-10-11',\n", + " '2003-10-12',\n", + " '2003-10-13',\n", + " '2003-10-14',\n", + " '2003-10-15',\n", + " '2003-10-16',\n", + " '2003-10-17',\n", + " '2003-10-18',\n", + " '2003-10-19',\n", + " '2003-10-20',\n", + " '2003-10-21',\n", + " '2003-10-22',\n", + " '2003-10-23',\n", + " '2003-10-24',\n", + " '2003-10-25',\n", + " '2003-10-26',\n", + " '2003-10-27',\n", + " '2003-10-28',\n", + " '2003-10-29',\n", + " '2003-10-30',\n", + " '2003-10-31',\n", + " '2003-11-01',\n", + " '2003-11-02',\n", + " '2003-11-03',\n", + " '2003-11-04',\n", + " '2003-11-05',\n", + " '2003-11-06',\n", + " '2003-11-07',\n", + " '2003-11-08',\n", + " '2003-11-09',\n", + " '2003-11-10',\n", + " '2003-11-11',\n", + " '2003-11-12',\n", + " '2003-11-13',\n", + " '2003-11-14',\n", + " '2003-11-15',\n", + " '2003-11-16',\n", + " '2003-11-17',\n", + " '2003-11-18',\n", + " '2003-11-19',\n", + " '2003-11-20',\n", + " '2003-11-21',\n", + " '2003-11-22',\n", + " '2003-11-23',\n", + " '2003-11-24',\n", + " '2003-11-25',\n", + " '2003-11-26',\n", + " '2003-11-27',\n", + " '2003-11-28',\n", + " '2003-11-29',\n", + " '2003-11-30',\n", + " '2003-12-01',\n", + " '2003-12-02',\n", + " '2003-12-03',\n", + " '2003-12-04',\n", + " '2003-12-05',\n", + " '2003-12-06',\n", + " '2003-12-07',\n", + " '2003-12-08',\n", + " '2003-12-09',\n", + " '2003-12-10',\n", + " '2003-12-11',\n", + " '2003-12-12',\n", + " '2003-12-13',\n", + " '2003-12-14',\n", + " '2003-12-15',\n", + " '2003-12-16',\n", + " '2003-12-17',\n", + " '2003-12-18',\n", + " '2003-12-19',\n", + " '2003-12-20',\n", + " '2003-12-21',\n", + " '2003-12-22',\n", + " '2003-12-23',\n", + " '2003-12-24',\n", + " '2003-12-25',\n", + " '2003-12-26',\n", + " '2003-12-27',\n", + " '2003-12-28',\n", + " '2003-12-29',\n", + " '2003-12-30',\n", + " '2003-12-31',\n", + " '2004-01-01',\n", + " '2004-01-02',\n", + " '2004-01-03',\n", + " '2004-01-04',\n", + " '2004-01-05',\n", + " '2004-01-06',\n", + " '2004-01-07',\n", + " '2004-01-08',\n", + " '2004-01-09',\n", + " '2004-01-10',\n", + " '2004-01-11',\n", + " '2004-01-12',\n", + " '2004-01-13',\n", + " '2004-01-14',\n", + " '2004-01-15',\n", + " '2004-01-16',\n", + " '2004-01-17',\n", + " '2004-01-18',\n", + " '2004-01-19',\n", + " '2004-01-20',\n", + " '2004-01-21',\n", + " '2004-01-22',\n", + " '2004-01-23',\n", + " '2004-01-24',\n", + " '2004-01-25',\n", + " '2004-01-26',\n", + " '2004-01-27',\n", + " '2004-01-28',\n", + " '2004-01-29',\n", + " '2004-01-30',\n", + " '2004-01-31',\n", + " '2004-02-01',\n", + " '2004-02-02',\n", + " '2004-02-03',\n", + " '2004-02-04',\n", + " '2004-02-05',\n", + " '2004-02-06',\n", + " '2004-02-07',\n", + " '2004-02-08',\n", + " '2004-02-09',\n", + " '2004-02-10',\n", + " '2004-02-11',\n", + " '2004-02-12',\n", + " '2004-02-13',\n", + " '2004-02-14',\n", + " '2004-02-15',\n", + " '2004-02-16',\n", + " '2004-02-17',\n", + " '2004-02-18',\n", + " '2004-02-19',\n", + " '2004-02-20',\n", + " '2004-02-21',\n", + " '2004-02-22',\n", + " '2004-02-23',\n", + " '2004-02-24',\n", + " '2004-02-25',\n", + " '2004-02-26',\n", + " '2004-02-27',\n", + " '2004-02-28',\n", + " '2004-02-29',\n", + " '2004-03-01',\n", + " '2004-03-02',\n", + " '2004-03-03',\n", + " '2004-03-04',\n", + " '2004-03-05',\n", + " '2004-03-06',\n", + " '2004-03-07',\n", + " '2004-03-08',\n", + " '2004-03-09',\n", + " '2004-03-10',\n", + " '2004-03-11',\n", + " '2004-03-12',\n", + " '2004-03-13',\n", + " '2004-03-14',\n", + " '2004-03-15',\n", + " '2004-03-16',\n", + " '2004-03-17',\n", + " '2004-03-18',\n", + " '2004-03-19',\n", + " '2004-03-20',\n", + " '2004-03-21',\n", + " '2004-03-22',\n", + " '2004-03-23',\n", + " '2004-03-24',\n", + " '2004-03-25',\n", + " '2004-03-26',\n", + " '2004-03-27',\n", + " '2004-03-28',\n", + " '2004-03-29',\n", + " '2004-03-30',\n", + " '2004-03-31',\n", + " '2004-04-01',\n", + " '2004-04-02',\n", + " '2004-04-03',\n", + " '2004-04-04',\n", + " '2004-04-05',\n", + " '2004-04-06',\n", + " '2004-04-07',\n", + " '2004-04-08',\n", + " '2004-04-09',\n", + " '2004-04-10',\n", + " '2004-04-11',\n", + " '2004-04-12',\n", + " '2004-04-13',\n", + " '2004-04-14',\n", + " '2004-04-15',\n", + " '2004-04-16',\n", + " '2004-04-17',\n", + " '2004-04-18',\n", + " '2004-04-19',\n", + " '2004-04-20',\n", + " '2004-04-21',\n", + " '2004-04-22',\n", + " '2004-04-23',\n", + " '2004-04-24',\n", + " '2004-04-25',\n", + " '2004-04-26',\n", + " '2004-04-27',\n", + " '2004-04-28',\n", + " '2004-04-29',\n", + " '2004-04-30',\n", + " '2004-05-01',\n", + " '2004-05-02',\n", + " '2004-05-03',\n", + " '2004-05-04',\n", + " '2004-05-05',\n", + " '2004-05-06',\n", + " '2004-05-07',\n", + " '2004-05-08',\n", + " '2004-05-09',\n", + " '2004-05-10',\n", + " '2004-05-11',\n", + " '2004-05-12',\n", + " '2004-05-13',\n", + " '2004-05-14',\n", + " '2004-05-15',\n", + " '2004-05-16',\n", + " '2004-05-17',\n", + " '2004-05-18',\n", + " '2004-05-19',\n", + " '2004-05-20',\n", + " '2004-05-21',\n", + " '2004-05-22',\n", + " '2004-05-23',\n", + " '2004-05-24',\n", + " '2004-05-25',\n", + " '2004-05-26',\n", + " '2004-05-27',\n", + " '2004-05-28',\n", + " '2004-05-29',\n", + " '2004-05-30',\n", + " '2004-05-31',\n", + " '2004-06-01',\n", + " '2004-06-02',\n", + " '2004-06-03',\n", + " '2004-06-04',\n", + " '2004-06-05',\n", + " '2004-06-06',\n", + " '2004-06-07',\n", + " '2004-06-08',\n", + " '2004-06-09',\n", + " '2004-06-10',\n", + " '2004-06-11',\n", + " '2004-06-12',\n", + " '2004-06-13',\n", + " '2004-06-14',\n", + " '2004-06-15',\n", + " '2004-06-16',\n", + " '2004-06-17',\n", + " '2004-06-18',\n", + " '2004-06-19',\n", + " '2004-06-20',\n", + " '2004-06-21',\n", + " '2004-06-22',\n", + " '2004-06-23',\n", + " '2004-06-24',\n", + " '2004-06-25',\n", + " '2004-06-26',\n", + " '2004-06-27',\n", + " '2004-06-28',\n", + " '2004-06-29',\n", + " '2004-06-30',\n", + " '2004-07-01',\n", + " '2004-07-02',\n", + " '2004-07-03',\n", + " '2004-07-04',\n", + " '2004-07-05',\n", + " '2004-07-06',\n", + " '2004-07-07',\n", + " '2004-07-08',\n", + " '2004-07-09',\n", + " '2004-07-10',\n", + " '2004-07-11',\n", + " '2004-07-12',\n", + " '2004-07-13',\n", + " '2004-07-14',\n", + " '2004-07-15',\n", + " '2004-07-16',\n", + " '2004-07-17',\n", + " '2004-07-18',\n", + " '2004-07-19',\n", + " '2004-07-20',\n", + " '2004-07-21',\n", + " '2004-07-22',\n", + " '2004-07-23',\n", + " '2004-07-24',\n", + " '2004-07-25',\n", + " '2004-07-26',\n", + " '2004-07-27',\n", + " '2004-07-28',\n", + " '2004-07-29',\n", + " '2004-07-30',\n", + " '2004-07-31',\n", + " '2004-08-01',\n", + " '2004-08-02',\n", + " '2004-08-03',\n", + " '2004-08-04',\n", + " '2004-08-05',\n", + " '2004-08-06',\n", + " '2004-08-07',\n", + " '2004-08-08',\n", + " '2004-08-09',\n", + " '2004-08-10',\n", + " '2004-08-11',\n", + " '2004-08-12',\n", + " '2004-08-13',\n", + " '2004-08-14',\n", + " '2004-08-15',\n", + " '2004-08-16',\n", + " '2004-08-17',\n", + " '2004-08-18',\n", + " '2004-08-19',\n", + " '2004-08-20',\n", + " '2004-08-21',\n", + " '2004-08-22',\n", + " '2004-08-23',\n", + " '2004-08-24',\n", + " '2004-08-25',\n", + " '2004-08-26',\n", + " '2004-08-27',\n", + " '2004-08-28',\n", + " '2004-08-29',\n", + " '2004-08-30',\n", + " '2004-08-31',\n", + " '2004-09-01',\n", + " '2004-09-02',\n", + " '2004-09-03',\n", + " '2004-09-04',\n", + " '2004-09-05',\n", + " '2004-09-06',\n", + " '2004-09-07',\n", + " '2004-09-08',\n", + " '2004-09-09',\n", + " '2004-09-10',\n", + " '2004-09-11',\n", + " '2004-09-12',\n", + " '2004-09-13',\n", + " '2004-09-14',\n", + " '2004-09-15',\n", + " '2004-09-16',\n", + " '2004-09-17',\n", + " '2004-09-18',\n", + " '2004-09-19',\n", + " '2004-09-20',\n", + " '2004-09-21',\n", + " '2004-09-22',\n", + " '2004-09-23',\n", + " '2004-09-24',\n", + " '2004-09-25',\n", + " '2004-09-26',\n", + " '2004-09-27',\n", + " ...]" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 24 + } + ] + }, + { + "cell_type": "code", + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 363 + }, + "id": "Tqf8X7rSjAiA", + "outputId": "7f2ce03b-3bc8-41cf-c2a3-6547364925e8" + }, + "source": [ + "processed[\"date\"] = processed[\"date\"].astype(str)\r\n", + "processed_full = pd.DataFrame(combination,columns=[\"date\",\"tic\"]).merge(processed,on=[\"date\",\"tic\"],how=\"left\")\r\n", + "processed_full = processed_full[processed_full['date'].isin(processed['date'])]\r\n", + "processed_full = processed_full.fillna(0)\r\n", + "processed_full.sort_values(['date','tic'],ignore_index=True).head(10)" + ], + "execution_count": 25, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
dateticopenhighlowclosevolumedaymacdboll_ubboll_lbrsi_30cci_30dx_30close_30_smaclose_60_sma
02002-01-02AMD16.28000116.41000015.95016.3899994475400.02.00.00000022.09435913.665642100.00000066.666667100.016.38999916.389999
12002-01-02AMZN10.93000011.00000010.48010.9600006519600.02.00.06685922.09435913.665642100.00000066.666667100.017.88000017.880000
22002-01-02APPN0.0000000.0000000.0000.0000000.00.00.0000000.0000000.0000000.0000000.0000000.00.0000000.000000
32002-01-02BABA0.0000000.0000000.0000.0000000.00.00.0000000.0000000.0000000.0000000.0000000.00.0000000.000000
42002-01-02BAC31.15500131.54999931.05519.8028538669200.02.00.10472822.44321214.730121100.00000080.580876100.018.58666718.586667
52002-01-02BB3.9550004.0983333.9154.0833335870400.02.00.11866322.37835215.49164899.41410373.717080100.018.93500018.935000
62002-01-02BNGO0.0000000.0000000.0000.0000000.00.00.0000000.0000000.0000000.0000000.0000000.00.0000000.000000
72002-01-02CCIV0.0000000.0000000.0000.0000000.00.00.0000000.0000000.0000000.0000000.0000000.00.0000000.000000
82002-01-02EA30.24500130.37000129.80530.0199995836200.02.00.12055322.23242916.02357097.06100954.372966100.019.12800019.128000
92002-01-02FUBO0.0000000.0000000.0000.0000000.00.00.0000000.0000000.0000000.0000000.0000000.00.0000000.000000
\n", + "
" + ], + "text/plain": [ + " date tic open ... dx_30 close_30_sma close_60_sma\n", + "0 2002-01-02 AMD 16.280001 ... 100.0 16.389999 16.389999\n", + "1 2002-01-02 AMZN 10.930000 ... 100.0 17.880000 17.880000\n", + "2 2002-01-02 APPN 0.000000 ... 0.0 0.000000 0.000000\n", + "3 2002-01-02 BABA 0.000000 ... 0.0 0.000000 0.000000\n", + "4 2002-01-02 BAC 31.155001 ... 100.0 18.586667 18.586667\n", + "5 2002-01-02 BB 3.955000 ... 100.0 18.935000 18.935000\n", + "6 2002-01-02 BNGO 0.000000 ... 0.0 0.000000 0.000000\n", + "7 2002-01-02 CCIV 0.000000 ... 0.0 0.000000 0.000000\n", + "8 2002-01-02 EA 30.245001 ... 100.0 19.128000 19.128000\n", + "9 2002-01-02 FUBO 0.000000 ... 0.0 0.000000 0.000000\n", + "\n", + "[10 rows x 16 columns]" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 25 + } + ] + }, + { + "cell_type": "code", + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 206 + }, + "id": "e2zDnAijjDmw", + "outputId": "a3f62cad-a118-4707-cc68-e5c4eb2aef56" + }, + "source": [ + "processed_full.head(5)" + ], + "execution_count": 26, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
dateticopenhighlowclosevolumedaymacdboll_ubboll_lbrsi_30cci_30dx_30close_30_smaclose_60_sma
02002-01-02AMD16.28000116.41000015.95016.3899994475400.02.00.00000022.09435913.665642100.00000066.666667100.016.38999916.389999
12002-01-02AMZN10.93000011.00000010.48010.9600006519600.02.00.06685922.09435913.665642100.00000066.666667100.017.88000017.880000
22002-01-02BAC31.15500131.54999931.05519.8028538669200.02.00.10472822.44321214.730121100.00000080.580876100.018.58666718.586667
32002-01-02BB3.9550004.0983333.9154.0833335870400.02.00.11866322.37835215.49164899.41410373.717080100.018.93500018.935000
42002-01-02EA30.24500130.37000129.80530.0199995836200.02.00.12055322.23242916.02357097.06100954.372966100.019.12800019.128000
\n", + "
" + ], + "text/plain": [ + " date tic open ... dx_30 close_30_sma close_60_sma\n", + "0 2002-01-02 AMD 16.280001 ... 100.0 16.389999 16.389999\n", + "1 2002-01-02 AMZN 10.930000 ... 100.0 17.880000 17.880000\n", + "2 2002-01-02 BAC 31.155001 ... 100.0 18.586667 18.586667\n", + "3 2002-01-02 BB 3.955000 ... 100.0 18.935000 18.935000\n", + "4 2002-01-02 EA 30.245001 ... 100.0 19.128000 19.128000\n", + "\n", + "[5 rows x 16 columns]" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 26 + } + ] + }, + { + "cell_type": "code", + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 206 + }, + "id": "EGmzTrtfjF5_", + "outputId": "7790fe62-9843-429e-cdb1-b62ea624ee79" + }, + "source": [ + "processed_full.tail()" + ], + "execution_count": 27, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
dateticopenhighlowclosevolumedaymacdboll_ubboll_lbrsi_30cci_30dx_30close_30_smaclose_60_sma
2428602020-12-31JMIA42.50000042.59999839.83599940.3499988581900.03.02.259679e+0030.17758423.32341663.81312669.39465643.24549624.27033317.431833
2428612020-12-31SNOW299.700012301.561005280.730011281.3999945313800.03.0-5.673874e-060.0005630.00035739.972449-83.333333100.0000000.0004600.000460
2428622020-12-31CCIV10.07000010.07000010.01000010.0100001266200.03.02.972614e+0032.16811116.80088965.54700867.07619240.75163120.91866715.987037
2428632020-12-31PLTR24.62999924.71999923.52000023.54999939922500.03.0-2.301788e-070.0005650.00040250.847458200.000000100.0000000.0004830.000483
2428642020-12-31RLLCF0.0004000.0005000.0004000.0005008751800.03.0-2.966120e-060.0005670.00036751.29612912.500000100.0000000.0004670.000467
\n", + "
" + ], + "text/plain": [ + " date tic open ... dx_30 close_30_sma close_60_sma\n", + "242860 2020-12-31 JMIA 42.500000 ... 43.245496 24.270333 17.431833\n", + "242861 2020-12-31 SNOW 299.700012 ... 100.000000 0.000460 0.000460\n", + "242862 2020-12-31 CCIV 10.070000 ... 40.751631 20.918667 15.987037\n", + "242863 2020-12-31 PLTR 24.629999 ... 100.000000 0.000483 0.000483\n", + "242864 2020-12-31 RLLCF 0.000400 ... 100.000000 0.000467 0.000467\n", + "\n", + "[5 rows x 16 columns]" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 27 + } + ] + }, + { + "cell_type": "code", + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "Q5Xg1GTz6-yW", + "outputId": "d36a2fa2-8149-4664-c7f3-83c9cba735cf" + }, + "source": [ + "#### DATA SPLIT TRAIN TRADE RATIO 70/30\r\n", + "\r\n", + "trade_len = int(len(processed_full)*0.7)\r\n", + "train_len = int(len(processed_full)*0.3+1)\r\n", + "total = trade_len+train_len\r\n", + "print(f'trade length:{trade_len}, train length: {train_len}, for total len of {total} of {len(processed_full)}')" + ], + "execution_count": 29, + "outputs": [ + { + "output_type": "stream", + "text": [ + "trade length:117207, train length: 50233, for total len of 167440 of 167440\n" + ], + "name": "stdout" + } + ] + }, + { + "cell_type": "code", + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "u5cgLBBO8C6_", + "outputId": "15d2d8bc-1feb-4aeb-91d1-eb6b52cf0916" + }, + "source": [ + "processed_full.date.factorize()[0]" + ], + "execution_count": 30, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "array([ 0, 0, 0, ..., 4783, 4783, 4783])" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 30 + } + ] + }, + { + "cell_type": "code", + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "rYIlHNSoJQXX", + "outputId": "9678d967-bac1-47e3-ade7-d20e71ae4a8b" + }, + "source": [ + "train = data_split(processed_full, processed_full.date.min(),processed_full.date.loc[trade_len])\r\n", + "trade = data_split(processed_full, processed_full.date.loc[trade_len],processed_full.date.max())\r\n", + "print(len(train))\r\n", + "print(len(trade))" + ], + "execution_count": 31, + "outputs": [ + { + "output_type": "stream", + "text": [ + "80815\n", + "86590\n" + ], + "name": "stdout" + } + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "GPGqBNwKkT6i" + }, + "source": [ + "# processed_imputed = processed_full[processed_full.columns[processed_full.isna().any().tolist()]]\r\n", + "\r\n", + "# processed_imputed = processed_imputed.replace([np.inf, -np.inf], np.nan)" + ], + "execution_count": 32, + "outputs": [] + }, + { + "cell_type": "code", + "metadata": { + "id": "STkGrzDl0bdx" + }, + "source": [ + "# from sklearn.impute import KNNImputer\r\n", + "\r\n", + "# imputer = KNNImputer(n_neighbors=1)\r\n", + "# imputed = imputer.fit_transform(processed_imputed)\r\n", + "\r\n", + "# df_knn = pd.DataFrame(imputed, columns=processed_imputed.columns.tolist())\r\n", + "\r\n", + "# for i in processed_imputed.columns.tolist():\r\n", + "# processed_imputed[i] = df_knn[i]" + ], + "execution_count": 33, + "outputs": [] + }, + { + "cell_type": "code", + "metadata": { + "id": "jiFq3gXR6KFO" + }, + "source": [ + "# print(processed_imputed.isna().any())" + ], + "execution_count": 34, + "outputs": [] + }, + { + "cell_type": "code", + "metadata": { + "id": "0VEDSZuF61if" + }, + "source": [ + "# processed_imputed.head()" + ], + "execution_count": 35, + "outputs": [] + }, + { + "cell_type": "code", + "metadata": { + "id": "SM9gFk8Z638E" + }, + "source": [ + "# processed_imputed.tail()" + ], + "execution_count": 36, + "outputs": [] + }, + { + "cell_type": "code", + "metadata": { + "id": "bWk2rpWKii5K" + }, + "source": [ + "# from sklearn.model_selection import train_test_split \r\n", + "# X = processed_imputed.astype(float).to_numpy()\r\n", + "# train, trade = train_test_split(X, test_size=0.33, shuffle=False)\r\n", + "# train = pd.DataFrame(train)\r\n", + "# trade = pd.DataFrame(trade)\r\n", + "# print(train.shape)\r\n", + "# print(trade.shape)\r\n", + "# # train = data_split(processed_full, '2018-05-16','2020-05-16')\r\n", + "# # trade = data_split(processed_full, '2020-05-17','2021-02-10')" + ], + "execution_count": 37, + "outputs": [] + }, + { + "cell_type": "code", + "metadata": { + "id": "ORu4o8-yDzgp" + }, + "source": [ + "# processed_full.date.head()" + ], + "execution_count": 38, + "outputs": [] + }, + { + "cell_type": "code", + "metadata": { + "id": "Nwe8UeDXAtmT" + }, + "source": [ + "# train[[\"date\",\"tic\"]] = processed_full[[\"date\",\"tic\"]].iloc[:len(train),:]\r\n", + "# train.columns = processed_full.columns\r\n", + "# train = train.sort_values([\"date\", \"tic\"], ignore_index=True)\r\n", + "# train.index = train.date.factorize()[0]\r\n", + "# trade[[\"date\",\"tic\"]] = processed_full[[\"date\",\"tic\"]].iloc[:len(trade),:]\r\n", + "# trade.columns = processed_full.columns\r\n", + "# trade = trade.sort_values([\"date\", \"tic\"], ignore_index=True)\r\n", + "# trade.index = trade.date.factorize()[0]" + ], + "execution_count": 39, + "outputs": [] + }, + { + "cell_type": "code", + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 206 + }, + "id": "M0ULGxgc__uk", + "outputId": "e6ce6386-f37c-4830-c69e-8f6aecac2bca" + }, + "source": [ + "train.head()" + ], + "execution_count": 40, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
dateticopenhighlowclosevolumedaymacdboll_ubboll_lbrsi_30cci_30dx_30close_30_smaclose_60_sma
02002-01-02AMD16.28000116.41000015.95016.3899994475400.02.00.00000022.09435913.665642100.066.666667100.016.38999916.389999
02002-01-02AMZN10.93000011.00000010.48010.9600006519600.02.00.06685922.09435913.665642100.066.666667100.017.88000017.880000
02002-01-02APPN0.0000000.0000000.0000.0000000.00.00.0000000.0000000.0000000.00.0000000.00.0000000.000000
02002-01-02BABA0.0000000.0000000.0000.0000000.00.00.0000000.0000000.0000000.00.0000000.00.0000000.000000
02002-01-02BAC31.15500131.54999931.05519.8028538669200.02.00.10472822.44321214.730121100.080.580876100.018.58666718.586667
\n", + "
" + ], + "text/plain": [ + " date tic open ... dx_30 close_30_sma close_60_sma\n", + "0 2002-01-02 AMD 16.280001 ... 100.0 16.389999 16.389999\n", + "0 2002-01-02 AMZN 10.930000 ... 100.0 17.880000 17.880000\n", + "0 2002-01-02 APPN 0.000000 ... 0.0 0.000000 0.000000\n", + "0 2002-01-02 BABA 0.000000 ... 0.0 0.000000 0.000000\n", + "0 2002-01-02 BAC 31.155001 ... 100.0 18.586667 18.586667\n", + "\n", + "[5 rows x 16 columns]" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 40 + } + ] + }, + { + "cell_type": "code", + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 206 + }, + "id": "NZmYW7__ABby", + "outputId": "5d4bd2b7-ad18-4398-86eb-a56b6ce7bceb" + }, + "source": [ + "trade.head()" + ], + "execution_count": 41, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
dateticopenhighlowclosevolumedaymacdboll_ubboll_lbrsi_30cci_30dx_30close_30_smaclose_60_sma
02011-03-04AMD9.3300009.399.1500009.23000023059400.04.0-0.61693438.32378635.25221540.648284-214.10752251.18854637.26933437.849333
02011-03-04AMZN172.619995172.75169.509995171.6699984924300.04.0-0.83256138.81937134.32462937.871162-319.57920559.11187637.09600037.705333
02011-03-04APPN0.0000000.000.0000000.0000000.00.00.0000000.0000000.0000000.0000000.0000000.0000000.0000000.000000
02011-03-04BABA0.0000000.000.0000000.0000000.00.00.0000000.0000000.0000000.0000000.0000000.0000000.0000000.000000
02011-03-04BAC14.30000014.3113.98000012.403003146184700.04.0-0.86437738.84569034.05831042.914434-173.16665021.24325736.98400037.592000
\n", + "
" + ], + "text/plain": [ + " date tic open ... dx_30 close_30_sma close_60_sma\n", + "0 2011-03-04 AMD 9.330000 ... 51.188546 37.269334 37.849333\n", + "0 2011-03-04 AMZN 172.619995 ... 59.111876 37.096000 37.705333\n", + "0 2011-03-04 APPN 0.000000 ... 0.000000 0.000000 0.000000\n", + "0 2011-03-04 BABA 0.000000 ... 0.000000 0.000000 0.000000\n", + "0 2011-03-04 BAC 14.300000 ... 21.243257 36.984000 37.592000\n", + "\n", + "[5 rows x 16 columns]" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 41 + } + ] + }, + { + "cell_type": "code", + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "xMwZJEmnB_4D", + "outputId": "043bf30e-01e5-4994-9343-344539e8782a" + }, + "source": [ + "train.info()" + ], + "execution_count": 42, + "outputs": [ + { + "output_type": "stream", + "text": [ + "\n", + "Int64Index: 80815 entries, 0 to 2308\n", + "Data columns (total 16 columns):\n", + " # Column Non-Null Count Dtype \n", + "--- ------ -------------- ----- \n", + " 0 date 80815 non-null object \n", + " 1 tic 80815 non-null object \n", + " 2 open 80815 non-null float64\n", + " 3 high 80815 non-null float64\n", + " 4 low 80815 non-null float64\n", + " 5 close 80815 non-null float64\n", + " 6 volume 80815 non-null float64\n", + " 7 day 80815 non-null float64\n", + " 8 macd 80815 non-null float64\n", + " 9 boll_ub 80815 non-null float64\n", + " 10 boll_lb 80815 non-null float64\n", + " 11 rsi_30 80815 non-null float64\n", + " 12 cci_30 80815 non-null float64\n", + " 13 dx_30 80815 non-null float64\n", + " 14 close_30_sma 80815 non-null float64\n", + " 15 close_60_sma 80815 non-null float64\n", + "dtypes: float64(14), object(2)\n", + "memory usage: 10.5+ MB\n" + ], + "name": "stdout" + } + ] + }, + { + "cell_type": "code", + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "8ceHuwSUC6xW", + "outputId": "e422b265-ffa0-4fbf-a1e6-11c377394656" + }, + "source": [ + "len(train.tic.unique())" + ], + "execution_count": 43, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "35" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 43 + } + ] + }, + { + "cell_type": "code", + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "nKWnrUetC_YE", + "outputId": "260a7401-f7af-4ad5-dd7a-73cfb410305d" + }, + "source": [ + "config[\"TECHNICAL_INDICATORS_LIST\"]" + ], + "execution_count": 44, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "['macd',\n", + " 'boll_ub',\n", + " 'boll_lb',\n", + " 'rsi_30',\n", + " 'cci_30',\n", + " 'dx_30',\n", + " 'close_30_sma',\n", + " 'close_60_sma']" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 44 + } + ] + }, + { + "cell_type": "code", + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "Sc4Yix3G0U2g", + "outputId": "f02b74e6-eb29-4325-8c6e-7412f64d5539" + }, + "source": [ + "stock_dimension = len(train.tic.unique())\r\n", + "state_space = 1 + 2*stock_dimension + len(config[\"TECHNICAL_INDICATORS_LIST\"])*stock_dimension\r\n", + "print(f\"Stock Dimension: {stock_dimension}, State Space: {state_space}\")\r\n", + "\r\n", + "env_kwargs = {\r\n", + " \"hmax\": 100, \r\n", + " \"initial_amount\": 1000000, \r\n", + " \"buy_cost_pct\": 0.001,\r\n", + " \"sell_cost_pct\": 0.001,\r\n", + " \"state_space\": state_space, \r\n", + " \"stock_dim\": stock_dimension, \r\n", + " \"tech_indicator_list\": config[\"TECHNICAL_INDICATORS_LIST\"], \r\n", + " \"action_space\": stock_dimension, \r\n", + " \"reward_scaling\": 1e-4\r\n", + " \r\n", + "}\r\n", + "e_train_gym = StockTradingEnv(df = train, **env_kwargs)" + ], + "execution_count": 45, + "outputs": [ + { + "output_type": "stream", + "text": [ + "Stock Dimension: 35, State Space: 351\n" + ], + "name": "stdout" + } + ] + }, + { + "cell_type": "code", + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "yRzxB84E_pR0", + "outputId": "9b3fd8ce-02aa-4207-da5f-4c158f387350" + }, + "source": [ + "env_train, _ = e_train_gym.get_sb_env()\r\n", + "print(type(env_train))" + ], + "execution_count": 46, + "outputs": [ + { + "output_type": "stream", + "text": [ + "\n" + ], + "name": "stdout" + } + ] + }, + { + "cell_type": "code", + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "8V-ppne7Cv2T", + "outputId": "c5c82c25-8462-4c24-d7ab-1771d4daf35a" + }, + "source": [ + "agent = DRLAgent(env = env_train)\r\n", + "PPO_PARAMS = {\r\n", + " \"n_steps\": 2048,\r\n", + " \"ent_coef\": 0.01,\r\n", + " \"learning_rate\": 0.00025,\r\n", + " \"batch_size\": 128,\r\n", + "}\r\n", + "model_ppo = agent.get_model(\"ppo\",model_kwargs = PPO_PARAMS)\r\n" + ], + "execution_count": 47, + "outputs": [ + { + "output_type": "stream", + "text": [ + "{'n_steps': 2048, 'ent_coef': 0.01, 'learning_rate': 0.00025, 'batch_size': 128}\n", + "Using cpu device\n" + ], + "name": "stdout" + } + ] + }, + { + "cell_type": "code", + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "2m48yLBrJ3in", + "outputId": "b5b95a27-ab1c-4bff-c9f1-8958699904d1" + }, + "source": [ + "trained_ppo = agent.train_model(model=model_ppo, \r\n", + " tb_log_name='ppo',\r\n", + " total_timesteps=100000)" + ], + "execution_count": 48, + "outputs": [ + { + "output_type": "stream", + "text": [ + "Logging to tensorboard_log/ppo/ppo_1\n", + "-----------------------------\n", + "| time/ | |\n", + "| fps | 69 |\n", + "| iterations | 1 |\n", + "| time_elapsed | 29 |\n", + "| total_timesteps | 2048 |\n", + "-----------------------------\n", + "----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 2e+06 |\n", + "| total_cost | 9.14e+04 |\n", + "| total_reward | 1e+06 |\n", + "| total_reward_pct | 100 |\n", + "| total_trades | 43218 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 2 |\n", + "| time_elapsed | 54 |\n", + "| total_timesteps | 4096 |\n", + "| train/ | |\n", + "| approx_kl | 0.01594159 |\n", + "| clip_fraction | 0.177 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -49.7 |\n", + "| explained_variance | -142 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | 21.9 |\n", + "| n_updates | 10 |\n", + "| policy_gradient_loss | -0.0158 |\n", + "| std | 1 |\n", + "| value_loss | 36.2 |\n", + "----------------------------------------\n", + "------------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1.82e+06 |\n", + "| total_cost | 9.4e+04 |\n", + "| total_reward | 8.2e+05 |\n", + "| total_reward_pct | 82 |\n", + "| total_trades | 43415 |\n", + "| time/ | |\n", + "| fps | 75 |\n", + "| iterations | 3 |\n", + "| time_elapsed | 81 |\n", + "| total_timesteps | 6144 |\n", + "| train/ | |\n", + "| approx_kl | 0.0055880044 |\n", + "| clip_fraction | 0.169 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -49.7 |\n", + "| explained_variance | -41.6 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | 9.66 |\n", + "| n_updates | 20 |\n", + "| policy_gradient_loss | -0.0183 |\n", + "| std | 1 |\n", + "| value_loss | 28.3 |\n", + "------------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 2e+06 |\n", + "| total_cost | 9.03e+04 |\n", + "| total_reward | 9.99e+05 |\n", + "| total_reward_pct | 99.9 |\n", + "| total_trades | 43315 |\n", + "| time/ | |\n", + "| fps | 77 |\n", + "| iterations | 4 |\n", + "| time_elapsed | 105 |\n", + "| total_timesteps | 8192 |\n", + "| train/ | |\n", + "| approx_kl | 0.012000978 |\n", + "| clip_fraction | 0.207 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -49.7 |\n", + "| explained_variance | -92.6 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | 6.02 |\n", + "| n_updates | 30 |\n", + "| policy_gradient_loss | -0.0187 |\n", + "| std | 1 |\n", + "| value_loss | 19.1 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1.65e+06 |\n", + "| total_cost | 8.97e+04 |\n", + "| total_reward | 6.52e+05 |\n", + "| total_reward_pct | 65.2 |\n", + "| total_trades | 42896 |\n", + "| time/ | |\n", + "| fps | 78 |\n", + "| iterations | 5 |\n", + "| time_elapsed | 130 |\n", + "| total_timesteps | 10240 |\n", + "| train/ | |\n", + "| approx_kl | 0.019123992 |\n", + "| clip_fraction | 0.216 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -49.8 |\n", + "| explained_variance | -82.5 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | 10.2 |\n", + "| n_updates | 40 |\n", + "| policy_gradient_loss | -0.0126 |\n", + "| std | 1 |\n", + "| value_loss | 26.7 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1.46e+06 |\n", + "| total_cost | 8.89e+04 |\n", + "| total_reward | 4.6e+05 |\n", + "| total_reward_pct | 46 |\n", + "| total_trades | 43018 |\n", + "| time/ | |\n", + "| fps | 79 |\n", + "| iterations | 6 |\n", + "| time_elapsed | 154 |\n", + "| total_timesteps | 12288 |\n", + "| train/ | |\n", + "| approx_kl | 0.025846407 |\n", + "| clip_fraction | 0.233 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -49.8 |\n", + "| explained_variance | -15.3 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | 8.15 |\n", + "| n_updates | 50 |\n", + "| policy_gradient_loss | -0.0103 |\n", + "| std | 1.01 |\n", + "| value_loss | 19.3 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1.5e+06 |\n", + "| total_cost | 8.68e+04 |\n", + "| total_reward | 5.03e+05 |\n", + "| total_reward_pct | 50.3 |\n", + "| total_trades | 43063 |\n", + "| time/ | |\n", + "| fps | 79 |\n", + "| iterations | 7 |\n", + "| time_elapsed | 180 |\n", + "| total_timesteps | 14336 |\n", + "| train/ | |\n", + "| approx_kl | 0.021719215 |\n", + "| clip_fraction | 0.248 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -49.9 |\n", + "| explained_variance | -24.1 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | 6.65 |\n", + "| n_updates | 60 |\n", + "| policy_gradient_loss | -0.0216 |\n", + "| std | 1.01 |\n", + "| value_loss | 15.9 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1.5e+06 |\n", + "| total_cost | 9.13e+04 |\n", + "| total_reward | 5.05e+05 |\n", + "| total_reward_pct | 50.5 |\n", + "| total_trades | 43135 |\n", + "| time/ | |\n", + "| fps | 80 |\n", + "| iterations | 8 |\n", + "| time_elapsed | 204 |\n", + "| total_timesteps | 16384 |\n", + "| train/ | |\n", + "| approx_kl | 0.019587167 |\n", + "| clip_fraction | 0.256 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -49.9 |\n", + "| explained_variance | -38.9 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | 6.9 |\n", + "| n_updates | 70 |\n", + "| policy_gradient_loss | -0.021 |\n", + "| std | 1.01 |\n", + "| value_loss | 19.6 |\n", + "-----------------------------------------\n", + "---------------------------------------\n", + "| time/ | |\n", + "| fps | 79 |\n", + "| iterations | 9 |\n", + "| time_elapsed | 231 |\n", + "| total_timesteps | 18432 |\n", + "| train/ | |\n", + "| approx_kl | 0.0271631 |\n", + "| clip_fraction | 0.285 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -50.1 |\n", + "| explained_variance | -48.3 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | 9.18 |\n", + "| n_updates | 80 |\n", + "| policy_gradient_loss | -0.0184 |\n", + "| std | 1.01 |\n", + "| value_loss | 19.2 |\n", + "---------------------------------------\n", + "----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1.42e+06 |\n", + "| total_cost | 9.11e+04 |\n", + "| total_reward | 4.19e+05 |\n", + "| total_reward_pct | 41.9 |\n", + "| total_trades | 43244 |\n", + "| time/ | |\n", + "| fps | 80 |\n", + "| iterations | 10 |\n", + "| time_elapsed | 255 |\n", + "| total_timesteps | 20480 |\n", + "| train/ | |\n", + "| approx_kl | 0.03162948 |\n", + "| clip_fraction | 0.185 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -50.2 |\n", + "| explained_variance | -65.9 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | 18.1 |\n", + "| n_updates | 90 |\n", + "| policy_gradient_loss | -0.0125 |\n", + "| std | 1.02 |\n", + "| value_loss | 42.5 |\n", + "----------------------------------------\n", + "day: 2308, episode: 10\n", + "begin_total_asset: 1000000.00\n", + "end_total_asset: 1359876.04\n", + "total_reward: 359876.04\n", + "total_cost: 88361.90\n", + "total_trades: 42983\n", + "Sharpe: 0.259\n", + "=================================\n", + "----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1.36e+06 |\n", + "| total_cost | 8.84e+04 |\n", + "| total_reward | 3.6e+05 |\n", + "| total_reward_pct | 36 |\n", + "| total_trades | 42983 |\n", + "| time/ | |\n", + "| fps | 79 |\n", + "| iterations | 11 |\n", + "| time_elapsed | 283 |\n", + "| total_timesteps | 22528 |\n", + "| train/ | |\n", + "| approx_kl | 0.03807656 |\n", + "| clip_fraction | 0.349 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -50.3 |\n", + "| explained_variance | -92.9 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | 9.69 |\n", + "| n_updates | 100 |\n", + "| policy_gradient_loss | -0.0221 |\n", + "| std | 1.02 |\n", + "| value_loss | 17.4 |\n", + "----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1.43e+06 |\n", + "| total_cost | 9.15e+04 |\n", + "| total_reward | 4.27e+05 |\n", + "| total_reward_pct | 42.7 |\n", + "| total_trades | 42810 |\n", + "| time/ | |\n", + "| fps | 79 |\n", + "| iterations | 12 |\n", + "| time_elapsed | 307 |\n", + "| total_timesteps | 24576 |\n", + "| train/ | |\n", + "| approx_kl | 0.041855328 |\n", + "| clip_fraction | 0.303 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -50.4 |\n", + "| explained_variance | -242 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | 12.3 |\n", + "| n_updates | 110 |\n", + "| policy_gradient_loss | -0.0256 |\n", + "| std | 1.02 |\n", + "| value_loss | 17.2 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 2.22e+06 |\n", + "| total_cost | 8.74e+04 |\n", + "| total_reward | 1.22e+06 |\n", + "| total_reward_pct | 122 |\n", + "| total_trades | 42568 |\n", + "| time/ | |\n", + "| fps | 79 |\n", + "| iterations | 13 |\n", + "| time_elapsed | 333 |\n", + "| total_timesteps | 26624 |\n", + "| train/ | |\n", + "| approx_kl | 0.023986679 |\n", + "| clip_fraction | 0.246 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -50.4 |\n", + "| explained_variance | -110 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | 8.08 |\n", + "| n_updates | 120 |\n", + "| policy_gradient_loss | -0.0243 |\n", + "| std | 1.02 |\n", + "| value_loss | 25.9 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1.79e+06 |\n", + "| total_cost | 8.9e+04 |\n", + "| total_reward | 7.92e+05 |\n", + "| total_reward_pct | 79.2 |\n", + "| total_trades | 42731 |\n", + "| time/ | |\n", + "| fps | 80 |\n", + "| iterations | 14 |\n", + "| time_elapsed | 356 |\n", + "| total_timesteps | 28672 |\n", + "| train/ | |\n", + "| approx_kl | 0.012990342 |\n", + "| clip_fraction | 0.131 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -50.5 |\n", + "| explained_variance | -105 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | 57.4 |\n", + "| n_updates | 130 |\n", + "| policy_gradient_loss | -0.0132 |\n", + "| std | 1.03 |\n", + "| value_loss | 93.5 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1.83e+06 |\n", + "| total_cost | 9.22e+04 |\n", + "| total_reward | 8.28e+05 |\n", + "| total_reward_pct | 82.8 |\n", + "| total_trades | 42924 |\n", + "| time/ | |\n", + "| fps | 80 |\n", + "| iterations | 15 |\n", + "| time_elapsed | 382 |\n", + "| total_timesteps | 30720 |\n", + "| train/ | |\n", + "| approx_kl | 0.023586601 |\n", + "| clip_fraction | 0.215 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -50.6 |\n", + "| explained_variance | -117 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | 34.2 |\n", + "| n_updates | 140 |\n", + "| policy_gradient_loss | -0.0149 |\n", + "| std | 1.03 |\n", + "| value_loss | 69.8 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1.92e+06 |\n", + "| total_cost | 8.95e+04 |\n", + "| total_reward | 9.25e+05 |\n", + "| total_reward_pct | 92.5 |\n", + "| total_trades | 42303 |\n", + "| time/ | |\n", + "| fps | 80 |\n", + "| iterations | 16 |\n", + "| time_elapsed | 408 |\n", + "| total_timesteps | 32768 |\n", + "| train/ | |\n", + "| approx_kl | 0.027212258 |\n", + "| clip_fraction | 0.21 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -50.6 |\n", + "| explained_variance | -50.6 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | 38.1 |\n", + "| n_updates | 150 |\n", + "| policy_gradient_loss | -0.0165 |\n", + "| std | 1.03 |\n", + "| value_loss | 59.6 |\n", + "-----------------------------------------\n", + "----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1.27e+06 |\n", + "| total_cost | 8.69e+04 |\n", + "| total_reward | 2.71e+05 |\n", + "| total_reward_pct | 27.1 |\n", + "| total_trades | 42350 |\n", + "| time/ | |\n", + "| fps | 79 |\n", + "| iterations | 17 |\n", + "| time_elapsed | 435 |\n", + "| total_timesteps | 34816 |\n", + "| train/ | |\n", + "| approx_kl | 0.02051995 |\n", + "| clip_fraction | 0.173 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -50.7 |\n", + "| explained_variance | -61.2 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | 29.5 |\n", + "| n_updates | 160 |\n", + "| policy_gradient_loss | -0.0149 |\n", + "| std | 1.03 |\n", + "| value_loss | 69.6 |\n", + "----------------------------------------\n", + "-----------------------------------------\n", + "| time/ | |\n", + "| fps | 80 |\n", + "| iterations | 18 |\n", + "| time_elapsed | 460 |\n", + "| total_timesteps | 36864 |\n", + "| train/ | |\n", + "| approx_kl | 0.025750712 |\n", + "| clip_fraction | 0.202 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -50.7 |\n", + "| explained_variance | -27.4 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | 8.35 |\n", + "| n_updates | 170 |\n", + "| policy_gradient_loss | -0.00629 |\n", + "| std | 1.03 |\n", + "| value_loss | 21.5 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1.75e+06 |\n", + "| total_cost | 8.96e+04 |\n", + "| total_reward | 7.51e+05 |\n", + "| total_reward_pct | 75.1 |\n", + "| total_trades | 42715 |\n", + "| time/ | |\n", + "| fps | 79 |\n", + "| iterations | 19 |\n", + "| time_elapsed | 486 |\n", + "| total_timesteps | 38912 |\n", + "| train/ | |\n", + "| approx_kl | 0.020108072 |\n", + "| clip_fraction | 0.217 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -50.7 |\n", + "| explained_variance | -19.8 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | 34 |\n", + "| n_updates | 180 |\n", + "| policy_gradient_loss | -0.00684 |\n", + "| std | 1.03 |\n", + "| value_loss | 48.6 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1.24e+06 |\n", + "| total_cost | 8.82e+04 |\n", + "| total_reward | 2.43e+05 |\n", + "| total_reward_pct | 24.3 |\n", + "| total_trades | 42429 |\n", + "| time/ | |\n", + "| fps | 79 |\n", + "| iterations | 20 |\n", + "| time_elapsed | 512 |\n", + "| total_timesteps | 40960 |\n", + "| train/ | |\n", + "| approx_kl | 0.018824426 |\n", + "| clip_fraction | 0.189 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -50.8 |\n", + "| explained_variance | -28.1 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | 13.3 |\n", + "| n_updates | 190 |\n", + "| policy_gradient_loss | -0.0157 |\n", + "| std | 1.03 |\n", + "| value_loss | 23.5 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1.63e+06 |\n", + "| total_cost | 8.87e+04 |\n", + "| total_reward | 6.33e+05 |\n", + "| total_reward_pct | 63.3 |\n", + "| total_trades | 42210 |\n", + "| time/ | |\n", + "| fps | 79 |\n", + "| iterations | 21 |\n", + "| time_elapsed | 538 |\n", + "| total_timesteps | 43008 |\n", + "| train/ | |\n", + "| approx_kl | 0.020618912 |\n", + "| clip_fraction | 0.226 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -50.8 |\n", + "| explained_variance | -35.3 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | 8.25 |\n", + "| n_updates | 200 |\n", + "| policy_gradient_loss | -0.0181 |\n", + "| std | 1.03 |\n", + "| value_loss | 29.2 |\n", + "-----------------------------------------\n", + "day: 2308, episode: 20\n", + "begin_total_asset: 1000000.00\n", + "end_total_asset: 1583110.09\n", + "total_reward: 583110.09\n", + "total_cost: 87481.13\n", + "total_trades: 42224\n", + "Sharpe: 0.327\n", + "=================================\n", + "----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1.58e+06 |\n", + "| total_cost | 8.75e+04 |\n", + "| total_reward | 5.83e+05 |\n", + "| total_reward_pct | 58.3 |\n", + "| total_trades | 42224 |\n", + "| time/ | |\n", + "| fps | 80 |\n", + "| iterations | 22 |\n", + "| time_elapsed | 561 |\n", + "| total_timesteps | 45056 |\n", + "| train/ | |\n", + "| approx_kl | 0.03995288 |\n", + "| clip_fraction | 0.29 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -50.9 |\n", + "| explained_variance | -21.7 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | 6.07 |\n", + "| n_updates | 210 |\n", + "| policy_gradient_loss | -0.0176 |\n", + "| std | 1.04 |\n", + "| value_loss | 18.3 |\n", + "----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1.74e+06 |\n", + "| total_cost | 8.85e+04 |\n", + "| total_reward | 7.4e+05 |\n", + "| total_reward_pct | 74 |\n", + "| total_trades | 42244 |\n", + "| time/ | |\n", + "| fps | 80 |\n", + "| iterations | 23 |\n", + "| time_elapsed | 588 |\n", + "| total_timesteps | 47104 |\n", + "| train/ | |\n", + "| approx_kl | 0.018830087 |\n", + "| clip_fraction | 0.249 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -50.9 |\n", + "| explained_variance | -36.6 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | 22.4 |\n", + "| n_updates | 220 |\n", + "| policy_gradient_loss | -0.0172 |\n", + "| std | 1.04 |\n", + "| value_loss | 47.7 |\n", + "-----------------------------------------\n", + "----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1.66e+06 |\n", + "| total_cost | 8.91e+04 |\n", + "| total_reward | 6.58e+05 |\n", + "| total_reward_pct | 65.8 |\n", + "| total_trades | 42586 |\n", + "| time/ | |\n", + "| fps | 80 |\n", + "| iterations | 24 |\n", + "| time_elapsed | 612 |\n", + "| total_timesteps | 49152 |\n", + "| train/ | |\n", + "| approx_kl | 0.02004576 |\n", + "| clip_fraction | 0.219 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -51 |\n", + "| explained_variance | -85.1 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | 23.6 |\n", + "| n_updates | 230 |\n", + "| policy_gradient_loss | -0.0135 |\n", + "| std | 1.04 |\n", + "| value_loss | 58.8 |\n", + "----------------------------------------\n", + "----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1.63e+06 |\n", + "| total_cost | 8.25e+04 |\n", + "| total_reward | 6.33e+05 |\n", + "| total_reward_pct | 63.3 |\n", + "| total_trades | 42049 |\n", + "| time/ | |\n", + "| fps | 80 |\n", + "| iterations | 25 |\n", + "| time_elapsed | 638 |\n", + "| total_timesteps | 51200 |\n", + "| train/ | |\n", + "| approx_kl | 0.03873992 |\n", + "| clip_fraction | 0.309 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -51.1 |\n", + "| explained_variance | -43.6 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | 18.8 |\n", + "| n_updates | 240 |\n", + "| policy_gradient_loss | -0.0154 |\n", + "| std | 1.04 |\n", + "| value_loss | 36.3 |\n", + "----------------------------------------\n", + "----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 2.24e+06 |\n", + "| total_cost | 7.95e+04 |\n", + "| total_reward | 1.24e+06 |\n", + "| total_reward_pct | 124 |\n", + "| total_trades | 41694 |\n", + "| time/ | |\n", + "| fps | 80 |\n", + "| iterations | 26 |\n", + "| time_elapsed | 663 |\n", + "| total_timesteps | 53248 |\n", + "| train/ | |\n", + "| approx_kl | 0.02412937 |\n", + "| clip_fraction | 0.249 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -51.1 |\n", + "| explained_variance | -33.5 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | 9.2 |\n", + "| n_updates | 250 |\n", + "| policy_gradient_loss | -0.0212 |\n", + "| std | 1.04 |\n", + "| value_loss | 26.4 |\n", + "----------------------------------------\n", + "-----------------------------------------\n", + "| time/ | |\n", + "| fps | 80 |\n", + "| iterations | 27 |\n", + "| time_elapsed | 690 |\n", + "| total_timesteps | 55296 |\n", + "| train/ | |\n", + "| approx_kl | 0.012512511 |\n", + "| clip_fraction | 0.127 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -51.1 |\n", + "| explained_variance | -54.7 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | 23.6 |\n", + "| n_updates | 260 |\n", + "| policy_gradient_loss | -0.016 |\n", + "| std | 1.04 |\n", + "| value_loss | 41.6 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 2.03e+06 |\n", + "| total_cost | 8.3e+04 |\n", + "| total_reward | 1.03e+06 |\n", + "| total_reward_pct | 103 |\n", + "| total_trades | 42056 |\n", + "| time/ | |\n", + "| fps | 80 |\n", + "| iterations | 28 |\n", + "| time_elapsed | 713 |\n", + "| total_timesteps | 57344 |\n", + "| train/ | |\n", + "| approx_kl | 0.022838697 |\n", + "| clip_fraction | 0.19 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -51.1 |\n", + "| explained_variance | -36.2 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | 15.3 |\n", + "| n_updates | 270 |\n", + "| policy_gradient_loss | -0.0154 |\n", + "| std | 1.04 |\n", + "| value_loss | 37.4 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 2.82e+06 |\n", + "| total_cost | 7.76e+04 |\n", + "| total_reward | 1.82e+06 |\n", + "| total_reward_pct | 182 |\n", + "| total_trades | 41555 |\n", + "| time/ | |\n", + "| fps | 80 |\n", + "| iterations | 29 |\n", + "| time_elapsed | 739 |\n", + "| total_timesteps | 59392 |\n", + "| train/ | |\n", + "| approx_kl | 0.022339614 |\n", + "| clip_fraction | 0.231 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -51.2 |\n", + "| explained_variance | -44.2 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | 18 |\n", + "| n_updates | 280 |\n", + "| policy_gradient_loss | -0.0144 |\n", + "| std | 1.05 |\n", + "| value_loss | 37.9 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 2.88e+06 |\n", + "| total_cost | 7.38e+04 |\n", + "| total_reward | 1.88e+06 |\n", + "| total_reward_pct | 188 |\n", + "| total_trades | 40777 |\n", + "| time/ | |\n", + "| fps | 80 |\n", + "| iterations | 30 |\n", + "| time_elapsed | 764 |\n", + "| total_timesteps | 61440 |\n", + "| train/ | |\n", + "| approx_kl | 0.030154837 |\n", + "| clip_fraction | 0.237 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -51.3 |\n", + "| explained_variance | -53.1 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | 14.5 |\n", + "| n_updates | 290 |\n", + "| policy_gradient_loss | -0.0253 |\n", + "| std | 1.05 |\n", + "| value_loss | 40.6 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 2.18e+06 |\n", + "| total_cost | 7.84e+04 |\n", + "| total_reward | 1.18e+06 |\n", + "| total_reward_pct | 118 |\n", + "| total_trades | 41430 |\n", + "| time/ | |\n", + "| fps | 80 |\n", + "| iterations | 31 |\n", + "| time_elapsed | 790 |\n", + "| total_timesteps | 63488 |\n", + "| train/ | |\n", + "| approx_kl | 0.022953508 |\n", + "| clip_fraction | 0.163 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -51.4 |\n", + "| explained_variance | -30.3 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | 18.5 |\n", + "| n_updates | 300 |\n", + "| policy_gradient_loss | -0.0146 |\n", + "| std | 1.05 |\n", + "| value_loss | 52.6 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1.69e+06 |\n", + "| total_cost | 8.18e+04 |\n", + "| total_reward | 6.87e+05 |\n", + "| total_reward_pct | 68.7 |\n", + "| total_trades | 41839 |\n", + "| time/ | |\n", + "| fps | 80 |\n", + "| iterations | 32 |\n", + "| time_elapsed | 813 |\n", + "| total_timesteps | 65536 |\n", + "| train/ | |\n", + "| approx_kl | 0.022601608 |\n", + "| clip_fraction | 0.205 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -51.4 |\n", + "| explained_variance | -17.9 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | 18.8 |\n", + "| n_updates | 310 |\n", + "| policy_gradient_loss | -0.0131 |\n", + "| std | 1.05 |\n", + "| value_loss | 36.5 |\n", + "-----------------------------------------\n", + "day: 2308, episode: 30\n", + "begin_total_asset: 1000000.00\n", + "end_total_asset: 1702644.28\n", + "total_reward: 702644.28\n", + "total_cost: 80602.05\n", + "total_trades: 41477\n", + "Sharpe: 0.347\n", + "=================================\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1.7e+06 |\n", + "| total_cost | 8.06e+04 |\n", + "| total_reward | 7.03e+05 |\n", + "| total_reward_pct | 70.3 |\n", + "| total_trades | 41477 |\n", + "| time/ | |\n", + "| fps | 80 |\n", + "| iterations | 33 |\n", + "| time_elapsed | 840 |\n", + "| total_timesteps | 67584 |\n", + "| train/ | |\n", + "| approx_kl | 0.028778909 |\n", + "| clip_fraction | 0.255 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -51.4 |\n", + "| explained_variance | -29.2 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | 25.5 |\n", + "| n_updates | 320 |\n", + "| policy_gradient_loss | -0.0129 |\n", + "| std | 1.05 |\n", + "| value_loss | 45.2 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1.75e+06 |\n", + "| total_cost | 8.03e+04 |\n", + "| total_reward | 7.45e+05 |\n", + "| total_reward_pct | 74.5 |\n", + "| total_trades | 41634 |\n", + "| time/ | |\n", + "| fps | 80 |\n", + "| iterations | 34 |\n", + "| time_elapsed | 865 |\n", + "| total_timesteps | 69632 |\n", + "| train/ | |\n", + "| approx_kl | 0.035688892 |\n", + "| clip_fraction | 0.27 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -51.5 |\n", + "| explained_variance | -34.8 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | 20.6 |\n", + "| n_updates | 330 |\n", + "| policy_gradient_loss | -0.0118 |\n", + "| std | 1.06 |\n", + "| value_loss | 50.1 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1.68e+06 |\n", + "| total_cost | 7.72e+04 |\n", + "| total_reward | 6.8e+05 |\n", + "| total_reward_pct | 68 |\n", + "| total_trades | 41576 |\n", + "| time/ | |\n", + "| fps | 80 |\n", + "| iterations | 35 |\n", + "| time_elapsed | 891 |\n", + "| total_timesteps | 71680 |\n", + "| train/ | |\n", + "| approx_kl | 0.025845073 |\n", + "| clip_fraction | 0.221 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -51.6 |\n", + "| explained_variance | -71.5 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | 25.2 |\n", + "| n_updates | 340 |\n", + "| policy_gradient_loss | -0.0095 |\n", + "| std | 1.06 |\n", + "| value_loss | 54 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| time/ | |\n", + "| fps | 80 |\n", + "| iterations | 36 |\n", + "| time_elapsed | 918 |\n", + "| total_timesteps | 73728 |\n", + "| train/ | |\n", + "| approx_kl | 0.034015812 |\n", + "| clip_fraction | 0.249 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -51.6 |\n", + "| explained_variance | -16.8 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | 13.5 |\n", + "| n_updates | 350 |\n", + "| policy_gradient_loss | -0.0145 |\n", + "| std | 1.06 |\n", + "| value_loss | 35.2 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1.4e+06 |\n", + "| total_cost | 7.61e+04 |\n", + "| total_reward | 4.05e+05 |\n", + "| total_reward_pct | 40.5 |\n", + "| total_trades | 40842 |\n", + "| time/ | |\n", + "| fps | 79 |\n", + "| iterations | 37 |\n", + "| time_elapsed | 948 |\n", + "| total_timesteps | 75776 |\n", + "| train/ | |\n", + "| approx_kl | 0.029893762 |\n", + "| clip_fraction | 0.322 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -51.6 |\n", + "| explained_variance | -42.6 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | 61.2 |\n", + "| n_updates | 360 |\n", + "| policy_gradient_loss | -0.0116 |\n", + "| std | 1.06 |\n", + "| value_loss | 61.5 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1.65e+06 |\n", + "| total_cost | 8.04e+04 |\n", + "| total_reward | 6.47e+05 |\n", + "| total_reward_pct | 64.7 |\n", + "| total_trades | 41406 |\n", + "| time/ | |\n", + "| fps | 80 |\n", + "| iterations | 38 |\n", + "| time_elapsed | 972 |\n", + "| total_timesteps | 77824 |\n", + "| train/ | |\n", + "| approx_kl | 0.027846923 |\n", + "| clip_fraction | 0.257 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -51.7 |\n", + "| explained_variance | -41.6 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | 26.7 |\n", + "| n_updates | 370 |\n", + "| policy_gradient_loss | -0.0195 |\n", + "| std | 1.06 |\n", + "| value_loss | 78.6 |\n", + "-----------------------------------------\n", + "----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 2.76e+06 |\n", + "| total_cost | 8.98e+04 |\n", + "| total_reward | 1.76e+06 |\n", + "| total_reward_pct | 176 |\n", + "| total_trades | 41651 |\n", + "| time/ | |\n", + "| fps | 79 |\n", + "| iterations | 39 |\n", + "| time_elapsed | 1000 |\n", + "| total_timesteps | 79872 |\n", + "| train/ | |\n", + "| approx_kl | 0.03487286 |\n", + "| clip_fraction | 0.309 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -51.8 |\n", + "| explained_variance | -27.4 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | 35 |\n", + "| n_updates | 380 |\n", + "| policy_gradient_loss | -0.0126 |\n", + "| std | 1.06 |\n", + "| value_loss | 70.2 |\n", + "----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 2.97e+06 |\n", + "| total_cost | 7.51e+04 |\n", + "| total_reward | 1.97e+06 |\n", + "| total_reward_pct | 197 |\n", + "| total_trades | 40856 |\n", + "| time/ | |\n", + "| fps | 79 |\n", + "| iterations | 40 |\n", + "| time_elapsed | 1026 |\n", + "| total_timesteps | 81920 |\n", + "| train/ | |\n", + "| approx_kl | 0.029021034 |\n", + "| clip_fraction | 0.295 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -51.9 |\n", + "| explained_variance | -32.7 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | 64.6 |\n", + "| n_updates | 390 |\n", + "| policy_gradient_loss | -0.0162 |\n", + "| std | 1.07 |\n", + "| value_loss | 101 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1.97e+06 |\n", + "| total_cost | 7.44e+04 |\n", + "| total_reward | 9.73e+05 |\n", + "| total_reward_pct | 97.3 |\n", + "| total_trades | 41156 |\n", + "| time/ | |\n", + "| fps | 79 |\n", + "| iterations | 41 |\n", + "| time_elapsed | 1051 |\n", + "| total_timesteps | 83968 |\n", + "| train/ | |\n", + "| approx_kl | 0.032283723 |\n", + "| clip_fraction | 0.271 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -51.9 |\n", + "| explained_variance | -46.8 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | 49.3 |\n", + "| n_updates | 400 |\n", + "| policy_gradient_loss | -0.0104 |\n", + "| std | 1.07 |\n", + "| value_loss | 97.9 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 2.9e+06 |\n", + "| total_cost | 7.98e+04 |\n", + "| total_reward | 1.9e+06 |\n", + "| total_reward_pct | 190 |\n", + "| total_trades | 41465 |\n", + "| time/ | |\n", + "| fps | 79 |\n", + "| iterations | 42 |\n", + "| time_elapsed | 1076 |\n", + "| total_timesteps | 86016 |\n", + "| train/ | |\n", + "| approx_kl | 0.030471701 |\n", + "| clip_fraction | 0.241 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -52 |\n", + "| explained_variance | -12.3 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | 20.7 |\n", + "| n_updates | 410 |\n", + "| policy_gradient_loss | -0.00995 |\n", + "| std | 1.07 |\n", + "| value_loss | 51.5 |\n", + "-----------------------------------------\n", + "----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 2.44e+06 |\n", + "| total_cost | 7.82e+04 |\n", + "| total_reward | 1.44e+06 |\n", + "| total_reward_pct | 144 |\n", + "| total_trades | 41365 |\n", + "| time/ | |\n", + "| fps | 79 |\n", + "| iterations | 43 |\n", + "| time_elapsed | 1102 |\n", + "| total_timesteps | 88064 |\n", + "| train/ | |\n", + "| approx_kl | 0.03336552 |\n", + "| clip_fraction | 0.272 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -52 |\n", + "| explained_variance | -48.3 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | 39.5 |\n", + "| n_updates | 420 |\n", + "| policy_gradient_loss | -0.0061 |\n", + "| std | 1.07 |\n", + "| value_loss | 114 |\n", + "----------------------------------------\n", + "day: 2308, episode: 40\n", + "begin_total_asset: 1000000.00\n", + "end_total_asset: 1745352.23\n", + "total_reward: 745352.23\n", + "total_cost: 73852.81\n", + "total_trades: 40824\n", + "Sharpe: 0.352\n", + "=================================\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1.75e+06 |\n", + "| total_cost | 7.39e+04 |\n", + "| total_reward | 7.45e+05 |\n", + "| total_reward_pct | 74.5 |\n", + "| total_trades | 40824 |\n", + "| time/ | |\n", + "| fps | 79 |\n", + "| iterations | 44 |\n", + "| time_elapsed | 1127 |\n", + "| total_timesteps | 90112 |\n", + "| train/ | |\n", + "| approx_kl | 0.023738183 |\n", + "| clip_fraction | 0.25 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -52.1 |\n", + "| explained_variance | -23 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | 31.4 |\n", + "| n_updates | 430 |\n", + "| policy_gradient_loss | -0.00529 |\n", + "| std | 1.07 |\n", + "| value_loss | 79.5 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| time/ | |\n", + "| fps | 79 |\n", + "| iterations | 45 |\n", + "| time_elapsed | 1153 |\n", + "| total_timesteps | 92160 |\n", + "| train/ | |\n", + "| approx_kl | 0.032453045 |\n", + "| clip_fraction | 0.199 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -52.1 |\n", + "| explained_variance | -15.2 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | 23.9 |\n", + "| n_updates | 440 |\n", + "| policy_gradient_loss | -0.0109 |\n", + "| std | 1.07 |\n", + "| value_loss | 61.4 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1.54e+06 |\n", + "| total_cost | 7.5e+04 |\n", + "| total_reward | 5.37e+05 |\n", + "| total_reward_pct | 53.7 |\n", + "| total_trades | 41226 |\n", + "| time/ | |\n", + "| fps | 79 |\n", + "| iterations | 46 |\n", + "| time_elapsed | 1178 |\n", + "| total_timesteps | 94208 |\n", + "| train/ | |\n", + "| approx_kl | 0.032882337 |\n", + "| clip_fraction | 0.21 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -52.1 |\n", + "| explained_variance | -11.5 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | 32.6 |\n", + "| n_updates | 450 |\n", + "| policy_gradient_loss | -0.00955 |\n", + "| std | 1.07 |\n", + "| value_loss | 49.2 |\n", + "-----------------------------------------\n", + "----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1.58e+06 |\n", + "| total_cost | 7.57e+04 |\n", + "| total_reward | 5.84e+05 |\n", + "| total_reward_pct | 58.4 |\n", + "| total_trades | 41203 |\n", + "| time/ | |\n", + "| fps | 80 |\n", + "| iterations | 47 |\n", + "| time_elapsed | 1201 |\n", + "| total_timesteps | 96256 |\n", + "| train/ | |\n", + "| approx_kl | 0.03841925 |\n", + "| clip_fraction | 0.262 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -52.2 |\n", + "| explained_variance | -13.7 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | 12.4 |\n", + "| n_updates | 460 |\n", + "| policy_gradient_loss | -0.00789 |\n", + "| std | 1.07 |\n", + "| value_loss | 40.7 |\n", + "----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 2.54e+06 |\n", + "| total_cost | 7.64e+04 |\n", + "| total_reward | 1.54e+06 |\n", + "| total_reward_pct | 154 |\n", + "| total_trades | 41274 |\n", + "| time/ | |\n", + "| fps | 80 |\n", + "| iterations | 48 |\n", + "| time_elapsed | 1226 |\n", + "| total_timesteps | 98304 |\n", + "| train/ | |\n", + "| approx_kl | 0.058272086 |\n", + "| clip_fraction | 0.329 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -52.2 |\n", + "| explained_variance | -15.5 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | 14.6 |\n", + "| n_updates | 470 |\n", + "| policy_gradient_loss | -0.0154 |\n", + "| std | 1.08 |\n", + "| value_loss | 41.3 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 2.97e+06 |\n", + "| total_cost | 7.88e+04 |\n", + "| total_reward | 1.97e+06 |\n", + "| total_reward_pct | 197 |\n", + "| total_trades | 41279 |\n", + "| time/ | |\n", + "| fps | 80 |\n", + "| iterations | 49 |\n", + "| time_elapsed | 1249 |\n", + "| total_timesteps | 100352 |\n", + "| train/ | |\n", + "| approx_kl | 0.034218818 |\n", + "| clip_fraction | 0.243 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -52.3 |\n", + "| explained_variance | -21.2 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | 23.2 |\n", + "| n_updates | 480 |\n", + "| policy_gradient_loss | -0.0102 |\n", + "| std | 1.08 |\n", + "| value_loss | 58.5 |\n", + "-----------------------------------------\n" + ], + "name": "stdout" + } + ] + }, + { + "cell_type": "code", + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "QjrKBLwEJ3Ip", + "outputId": "3288e1d3-c322-49d7-be1c-ff952b0ee085" + }, + "source": [ + "e_trade_gym = StockTradingEnv(df = trade, **env_kwargs)\r\n", + "# env_trade, obs_trade = e_trade_gym.get_sb_env()\r\n", + "\r\n", + "df_account_value, df_actions = DRLAgent.DRL_prediction(\r\n", + " model=model_ppo, \r\n", + " environment = e_trade_gym)" + ], + "execution_count": 49, + "outputs": [ + { + "output_type": "stream", + "text": [ + "hit end!\n" + ], + "name": "stdout" + } + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "gtl4aN1_KH62" + }, + "source": [ + "df_account_value.shape" + ], + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 206 + }, + "id": "aQ8dU9GfKJ9q", + "outputId": "a72d03e8-6676-4e1e-8dae-13446ea9604a" + }, + "source": [ + "df_account_value.head()" + ], + "execution_count": 54, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
dateaccount_value
02011-03-041000000.000000
12011-03-07998922.483783
22011-03-08998821.804815
32011-03-09998883.704559
42011-03-10997188.392592
\n", + "
" + ], + "text/plain": [ + " date account_value\n", + "0 2011-03-04 1000000.000000\n", + "1 2011-03-07 998922.483783\n", + "2 2011-03-08 998821.804815\n", + "3 2011-03-09 998883.704559\n", + "4 2011-03-10 997188.392592" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 54 + } + ] + }, + { + "cell_type": "code", + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 226 + }, + "id": "W5GysFd_KNCi", + "outputId": "ccc7209e-1a36-436c-ca55-2764f8a594ff" + }, + "source": [ + "df_actions.head()" + ], + "execution_count": 52, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
AMDAMZNAPPNBABABACBBBNGOCCIVEAFUBOGOOGIBIOIDEXINTCJMIAJNJJPMLUVMAMVISNDANIONOKPFEPGPLTRPYPLRIOTRLLCFSNOWTSLATSNPUPSUSBWFC
010010000000030100100100570000947400100000000001005800
1-93-210002200450-100-4-100-570781863-47100380-12970000000339800
2-781000-2200-4805243000-7100153-36100064-5900000061008020
30-14000600010001005710014025-4592-508654061-38200000-659453724
41005500100-6000-30100-100100-140-23-73-380100-270-100971000000010010015-2176
\n", + "
" + ], + "text/plain": [ + " AMD AMZN APPN BABA BAC BB BNGO ... RLLCF SNOW TSLA TSNP UPS USB WFC\n", + "0 100 100 0 0 0 0 0 ... 0 0 0 100 58 0 0\n", + "1 -93 -21 0 0 0 22 0 ... 0 0 0 33 98 0 0\n", + "2 -7 81 0 0 0 -22 0 ... 0 0 6 100 8 0 20\n", + "3 0 -14 0 0 0 60 0 ... 0 0 -6 59 45 37 24\n", + "4 100 55 0 0 100 -60 0 ... 0 0 100 100 15 -21 76\n", + "\n", + "[5 rows x 35 columns]" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 52 + } + ] + }, + { + "cell_type": "code", + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "BlL6jdA8KPMj", + "outputId": "2452b13b-6ee2-443f-954a-54d9a45cf5d2" + }, + "source": [ + "print(\"==============Get Backtest Results===========\")\r\n", + "now = datetime.datetime.now().strftime('%Y%m%d-%Hh%M')\r\n", + "\r\n", + "perf_stats_all = backtest_stats(account_value=df_account_value)\r\n", + "perf_stats_all = pd.DataFrame(perf_stats_all)\r\n", + "# perf_stats_all.to_csv(\"./\"+config.RESULTS_DIR+\"/perf_stats_all_\"+now+'.csv')" + ], + "execution_count": 53, + "outputs": [ + { + "output_type": "stream", + "text": [ + "==============Get Backtest Results===========\n", + "Annual return 0.200379\n", + "Cumulative returns 5.007643\n", + "Annual volatility 0.190000\n", + "Sharpe ratio 1.057203\n", + "Calmar ratio 0.668336\n", + "Stability 0.979071\n", + "Max drawdown -0.299817\n", + "Omega ratio 1.218583\n", + "Sortino ratio 1.502597\n", + "Skew NaN\n", + "Kurtosis NaN\n", + "Tail ratio 0.967800\n", + "Daily value at risk -0.023141\n", + "dtype: float64\n", + "==============Get Backtest Results===========\n", + "Annual return 0.200379\n", + "Cumulative returns 5.007643\n", + "Annual volatility 0.190000\n", + "Sharpe ratio 1.057203\n", + "Calmar ratio 0.668336\n", + "Stability 0.979071\n", + "Max drawdown -0.299817\n", + "Omega ratio 1.218583\n", + "Sortino ratio 1.502597\n", + "Skew NaN\n", + "Kurtosis NaN\n", + "Tail ratio 0.967800\n", + "Daily value at risk -0.023141\n", + "dtype: float64\n" + ], + "name": "stdout" + } + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "wZMIq0bgF7TO" + }, + "source": [ + "" + ] + } + ] +} \ No newline at end of file diff --git a/notebooks/AI4Finance_Crypto_MultiCoin.ipynb b/notebooks/AI4Finance_Crypto_MultiCoin.ipynb new file mode 100644 index 000000000..69a84e479 --- /dev/null +++ b/notebooks/AI4Finance_Crypto_MultiCoin.ipynb @@ -0,0 +1,6444 @@ +{ + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "colab": { + "name": "AI4Finance-Crypto-MultiCoin.ipynb", + "provenance": [] + }, + "kernelspec": { + "display_name": "Python 3", + "name": "python3" + } + }, + "cells": [ + { + "cell_type": "code", + "metadata": { + "id": "tPsJhsL1RFWi" + }, + "source": [ + "!git clone https://github.com/AI4Finance-LLC/FinRL-Library.git" + ], + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "metadata": { + "id": "0PyGiqZ5Ph-A" + }, + "source": [ + "%cd FinRL-Library/\r\n", + "!pip install -r requirements.txt" + ], + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "metadata": { + "id": "YOi7SNtgRbRx" + }, + "source": [ + "!pip install -U ipython\r\n", + "# !pip install colorama" + ], + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "fDVBL-cDVWEP", + "outputId": "c107d6b5-de2d-4159-df38-7c96fa0a4707" + }, + "source": [ + "%cd FinRL-Library/" + ], + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "text": [ + "/content/FinRL-Library\n" + ], + "name": "stdout" + } + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "7gc1cGFZLfKG" + }, + "source": [ + "import nest_asyncio\r\n", + "nest_asyncio.apply()" + ], + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "KTJUn-J9Ps0W", + "outputId": "39d2d0bb-a3f3-4ee5-d24c-563b27bc0401" + }, + "source": [ + "import pandas as pd\r\n", + "import numpy as np\r\n", + "import matplotlib\r\n", + "import matplotlib.pyplot as plt\r\n", + "# matplotlib.use('Agg')\r\n", + "import datetime\r\n", + "\r\n", + "%matplotlib inline\r\n", + "from finrl.config import config\r\n", + "from finrl.marketdata.yahoodownloader import YahooDownloader\r\n", + "from finrl.preprocessing.preprocessors import FeatureEngineer\r\n", + "from finrl.preprocessing.data import data_split\r\n", + "from finrl.env.env_stocktrading import StockTradingEnv\r\n", + "from finrl.model.models import DRLAgent\r\n", + "from finrl.trade.backtest import backtest_stats, backtest_plot, get_daily_return, get_baseline\r\n", + "\r\n", + "from pprint import pprint\r\n", + "\r\n", + "import sys\r\n", + "sys.path.append(\"../FinRL-Library\")\r\n", + "\r\n", + "import itertools" + ], + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "text": [ + "/usr/local/lib/python3.6/dist-packages/pyfolio/pos.py:28: UserWarning: Module \"zipline.assets\" not found; mutltipliers will not be applied to position notionals.\n", + " ' to position notionals.'\n" + ], + "name": "stderr" + } + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "kWqK7-ryPwhQ" + }, + "source": [ + "import os\r\n", + "if not os.path.exists(\"./\" + config.DATA_SAVE_DIR):\r\n", + " os.makedirs(\"./\" + config.DATA_SAVE_DIR)\r\n", + "if not os.path.exists(\"./\" + config.TRAINED_MODEL_DIR):\r\n", + " os.makedirs(\"./\" + config.TRAINED_MODEL_DIR)\r\n", + "if not os.path.exists(\"./\" + config.TENSORBOARD_LOG_DIR):\r\n", + " os.makedirs(\"./\" + config.TENSORBOARD_LOG_DIR)\r\n", + "if not os.path.exists(\"./\" + config.RESULTS_DIR):\r\n", + " os.makedirs(\"./\" + config.RESULTS_DIR)" + ], + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "metadata": { + "id": "afDyaoplPzed" + }, + "source": [ + "from finrl.config.configuration import Configuration\r\n", + "from finrl.config.directory_operations import create_userdata_dir\r\n", + "from finrl.commands import start_download_cryptodata, start_download_stockdata" + ], + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "metadata": { + "id": "p6UBynHyQtvV" + }, + "source": [ + "#### CREATE USER DATA DIRECTORY IN DESIGNATED PATH, IF NO NAME INDICATED DEFAULT TO user_data\r\n", + "####### create dir to false if only to check existence of directory\r\n", + "create_userdata_dir(\"./user_data\",create_dir=True)\r\n", + "\r\n", + "\r\n", + "# ###### Pull Configuration File (using finrl/config/configuration.py)\r\n", + "config = Configuration.from_files([\"./notebooks/config.json\"])" + ], + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "metadata": { + "id": "1uBWhaUFwMfl" + }, + "source": [ + "config.get(\"exchange\").get(\"pair_whitelist\")" + ], + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "metadata": { + "id": "jFrVhFlrbO-n" + }, + "source": [ + "from finrl.commands import start_download_cryptodata, start_download_stockdata, start_list_markets\r\n", + "\r\n", + "#ARGS_LIST_PAIRS = [\"exchange\", \"print_list\", \"list_pairs_print_json\", \"print_one_column\",\r\n", + "# \"print_csv\", \"base_currencies\", \"quote_currencies\", \"list_pairs_all\"]\r\n", + "\r\n", + "# ARGS_LIST_PAIRS = {\"exchange\":config.get(\"exchange\").get(\"name\"), \"quote_currencies\":\"BNB\"}\r\n", + "ARGS_LIST_PAIRS = {\"exchange\":config.get(\"exchange\").get(\"name\")}\r\n", + "\r\n", + "x = start_list_markets(ARGS_LIST_PAIRS)\r\n" + ], + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "6LyiTwxBeQam", + "outputId": "4289fe0f-7d55-4ace-888b-c33d64cdac7c" + }, + "source": [ + "from finrl.tools.coin_search import *\r\n", + "import json\r\n", + "#Search top Selling Coins based on Volume\r\n", + "coins = coinSearch(\"BTC\", top=100)\r\n", + "print(coins)\r\n", + "#Add them to config file Pair_whitelist\r\n", + "coins_to_json(\"./notebooks/config.json\", coins)\r\n", + "\r\n", + "# reintialize config\r\n", + "config = Configuration.from_files([\"./notebooks/config.json\"])\r\n", + "\r\n", + "#make sure the pairs are equal...\r\n", + "print(config[\"exchange\"][\"pair_whitelist\"])" + ], + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "text": [ + "['DREP/BTC', 'STMX/BTC', 'TROY/BTC', 'SC/BTC', 'CKB/BTC', 'TRX/BTC', 'PHB/BTC', 'IOST/BTC', 'CELR/BTC', 'XVG/BTC', 'ONE/BTC', 'TCT/BTC', 'IOTX/BTC', 'COS/BTC', 'CHZ/BTC', 'VET/BTC', 'MITH/BTC', 'DOGE/BTC', 'SNGLS/BTC', 'OST/BTC', 'REEF/BTC', 'TNB/BTC', 'RVN/BTC', 'NBS/BTC', 'GTO/BTC', 'ARPA/BTC', 'QKC/BTC', 'CND/BTC', 'WPR/BTC', 'MTH/BTC', 'YOYOW/BTC', 'SNM/BTC', 'CDT/BTC', 'FUN/BTC', 'AKRO/BTC', 'STPT/BTC', 'JST/BTC', 'DGB/BTC', 'DOCK/BTC', 'VITE/BTC', 'ZIL/BTC', 'FOR/BTC', 'MATIC/BTC', 'ANKR/BTC', 'BLZ/BTC', 'DATA/BTC', 'RSR/BTC', 'STEEM/BTC', 'GO/BTC', 'MDT/BTC', 'HBAR/BTC', 'PERL/BTC', 'TFUEL/BTC', 'ONT/BTC', 'AMB/BTC', 'DUSK/BTC', 'ROSE/BTC', 'REQ/BTC', 'CTSI/BTC', 'BTCDOWN/USDT', 'IRIS/BTC', 'BTS/BTC', 'POA/BTC', 'NKN/BTC', 'COTI/BTC', 'CTXC/BTC', 'AERGO/BTC', 'APPC/BTC', 'EOS/BTC', 'XLM/BTC', 'NAS/BTC', 'CHR/BTC', 'AUDIO/BTC', 'RCN/BTC', 'QSP/BTC', 'CRV/BTC', 'XEM/BTC', 'SAND/BTC', 'BAT/BTC', 'SKL/BTC', 'QLC/BTC', 'FIO/BTC', 'BRD/BTC', 'MTL/BTC', 'SNT/BTC', 'DLT/BTC', 'ADA/BTC', 'OGN/BTC', 'POLY/BTC', 'WTC/BTC', 'SUSD/BTC', 'BCPT/BTC', 'STX/BTC', 'FLM/BTC', 'LOOM/BTC', 'ENJ/BTC', 'PIVX/BTC', 'STORJ/BTC', 'CELO/BTC', 'AGI/BTC']\n", + "['DREP/BTC', 'STMX/BTC', 'TROY/BTC', 'SC/BTC', 'CKB/BTC', 'TRX/BTC', 'PHB/BTC', 'IOST/BTC', 'CELR/BTC', 'XVG/BTC', 'ONE/BTC', 'TCT/BTC', 'IOTX/BTC', 'COS/BTC', 'CHZ/BTC', 'VET/BTC', 'MITH/BTC', 'DOGE/BTC', 'SNGLS/BTC', 'OST/BTC', 'REEF/BTC', 'TNB/BTC', 'RVN/BTC', 'NBS/BTC', 'GTO/BTC', 'ARPA/BTC', 'QKC/BTC', 'CND/BTC', 'WPR/BTC', 'MTH/BTC', 'YOYOW/BTC', 'SNM/BTC', 'CDT/BTC', 'FUN/BTC', 'AKRO/BTC', 'STPT/BTC', 'JST/BTC', 'DGB/BTC', 'DOCK/BTC', 'VITE/BTC', 'ZIL/BTC', 'FOR/BTC', 'MATIC/BTC', 'ANKR/BTC', 'BLZ/BTC', 'DATA/BTC', 'RSR/BTC', 'STEEM/BTC', 'GO/BTC', 'MDT/BTC', 'HBAR/BTC', 'PERL/BTC', 'TFUEL/BTC', 'ONT/BTC', 'AMB/BTC', 'DUSK/BTC', 'ROSE/BTC', 'REQ/BTC', 'CTSI/BTC', 'BTCDOWN/USDT', 'IRIS/BTC', 'BTS/BTC', 'POA/BTC', 'NKN/BTC', 'COTI/BTC', 'CTXC/BTC', 'AERGO/BTC', 'APPC/BTC', 'EOS/BTC', 'XLM/BTC', 'NAS/BTC', 'CHR/BTC', 'AUDIO/BTC', 'RCN/BTC', 'QSP/BTC', 'CRV/BTC', 'XEM/BTC', 'SAND/BTC', 'BAT/BTC', 'SKL/BTC', 'QLC/BTC', 'FIO/BTC', 'BRD/BTC', 'MTL/BTC', 'SNT/BTC', 'DLT/BTC', 'ADA/BTC', 'OGN/BTC', 'POLY/BTC', 'WTC/BTC', 'SUSD/BTC', 'BCPT/BTC', 'STX/BTC', 'FLM/BTC', 'LOOM/BTC', 'ENJ/BTC', 'PIVX/BTC', 'STORJ/BTC', 'CELO/BTC', 'AGI/BTC']\n" + ], + "name": "stdout" + } + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "6HDb_jaLVkZ7" + }, + "source": [ + "ARGS_DOWNLOAD_DATA = {'config': ['./notebooks/config.json'], 'datadir': None, \r\n", + " 'user_data_dir': None, 'pairs': None, 'pairs_file': None, \r\n", + " 'days': 1825, 'timerange': None, \r\n", + " 'download_trades': False, 'exchange': 'binance', \r\n", + " 'timeframes': ['1d'], 'erase': False, \r\n", + " 'dataformat_ohlcv': None, 'dataformat_trades': None}\r\n", + "\r\n", + "# ######## downloads data to our local data repository as dictated by our config, or we could overide it using 'datadir'\r\n", + "start_download_cryptodata(ARGS_DOWNLOAD_DATA)" + ], + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "zz9bv_oybcGW", + "outputId": "7d1ac655-c7a0-4c86-c887-64466d9489f3" + }, + "source": [ + "from finrl.config import setup_utils_configuration\r\n", + "from finrl.state import RunMode\r\n", + "\r\n", + "ARGS_DOWNLOAD_DATA = {'config': ['./notebooks/config.json'], 'datadir': None, \r\n", + " 'user_data_dir': None, 'pairs': None, 'pairs_file': None, \r\n", + " 'days': 1825, 'timerange': None, \r\n", + " 'download_trades': False, 'exchange': 'binance', \r\n", + " 'timeframes': '1d', 'erase': False, \r\n", + " 'dataformat_ohlcv': None, 'dataformat_trades': None}\r\n", + "\r\n", + "### Adds to config ARGS stats for further use through config\r\n", + "\r\n", + "config = setup_utils_configuration(ARGS_DOWNLOAD_DATA, RunMode.UTIL_EXCHANGE)\r\n", + "print(config.get(\"timeframes\"))" + ], + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "text": [ + "1d\n" + ], + "name": "stdout" + } + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "BRSgP8Ohfw4J" + }, + "source": [ + "from finrl.data.fetchdata import FetchData\r\n", + "import pandas as pd\r\n", + "from finrl.config import TimeRange" + ], + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "metadata": { + "id": "j_YbCR9_aYiY" + }, + "source": [ + "df = FetchData(config).fetch_data_crypto()\r\n", + "df" + ], + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "metadata": { + "id": "KGBpYLlBwPN1" + }, + "source": [ + "df.head()" + ], + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "TUn5EJuqhCaW", + "outputId": "1e2547d3-cb9b-4ce8-c73e-6a45e8d0b964" + }, + "source": [ + "fe = FeatureEngineer(\r\n", + " use_technical_indicator=True,\r\n", + " tech_indicator_list = config[\"TECHNICAL_INDICATORS_LIST\"],\r\n", + " use_turbulence=False,\r\n", + " user_defined_feature = False)\r\n", + "\r\n", + "processed = fe.preprocess_data(df)\r\n", + "processed.columns" + ], + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "text": [ + "Successfully added technical indicators\n" + ], + "name": "stdout" + }, + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "Index(['date', 'open', 'high', 'low', 'close', 'volume', 'tic', 'macd',\n", + " 'boll_ub', 'boll_lb', 'rsi_30', 'cci_30', 'dx_30', 'close_30_sma',\n", + " 'close_60_sma'],\n", + " dtype='object')" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 17 + } + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "aAueMvl-d7nn" + }, + "source": [ + "##### SAVING processed DF for future use or in case COLAB shuts down\r\n", + "\r\n", + "from datetime import date\r\n", + "processed.to_pickle(\"processed_btc_full_\"+str(date.today()))\r\n", + "processed.to_csv(\"processed_btc_full_csv_\"+str(date.today()))" + ], + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "ztp-RmbQilsM", + "outputId": "600ccd61-0ab7-44a7-a0e2-8ade95e4160d" + }, + "source": [ + "print(processed.head())\r\n", + "processed.shape" + ], + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "text": [ + " date open high ... dx_30 close_30_sma close_60_sma\n", + "0 2020-01-16 4.200000e-07 6.400000e-07 ... 100.0 4.700000e-07 4.700000e-07\n", + "1 2020-01-17 4.700000e-07 5.200000e-07 ... 100.0 4.100000e-07 4.100000e-07\n", + "2 2020-01-18 3.600000e-07 3.800000e-07 ... 100.0 3.833333e-07 3.833333e-07\n", + "3 2020-01-19 3.300000e-07 3.400000e-07 ... 100.0 3.625000e-07 3.625000e-07\n", + "4 2020-01-20 2.900000e-07 3.100000e-07 ... 100.0 3.460000e-07 3.460000e-07\n", + "\n", + "[5 rows x 15 columns]\n" + ], + "name": "stdout" + }, + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "(74850, 15)" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 19 + } + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "CyLPP3t7i3gU" + }, + "source": [ + "list_ticker = processed[\"tic\"].unique().tolist()\r\n", + "list_date = list(pd.date_range(processed['date'].min(),processed['date'].max(), freq=\"1d\").astype(str))\r\n", + "combination = list(itertools.product(list_date,list_ticker))\r\n", + "list_date" + ], + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "metadata": { + "id": "Tqf8X7rSjAiA" + }, + "source": [ + "processed[\"date\"] = processed[\"date\"].astype(str)\r\n", + "processed_full = pd.DataFrame(combination,columns=[\"date\",\"tic\"]).merge(processed,on=[\"date\",\"tic\"],how=\"left\")\r\n", + "processed_full = processed_full[processed_full['date'].isin(processed['date'])]\r\n", + "# processed_full = processed_full.dropna()\r\n", + "processed_full = processed_full.fillna(0)\r\n", + "processed_full = processed_full.reset_index(drop=True)\r\n", + "processed_full.sort_values(['date','tic'],ignore_index=True)\r\n", + "processed_full.date = pd.to_datetime(processed_full.date)\r\n", + "processed_full[\"day\"] = processed_full[\"date\"].dt.dayofweek" + ], + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 206 + }, + "id": "e2zDnAijjDmw", + "outputId": "b4e207ea-d8fd-4fd2-f7dd-90c71bb3cf7d" + }, + "source": [ + "processed_full.head(5)" + ], + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
dateticopenhighlowclosevolumemacdboll_ubboll_lbrsi_30cci_30dx_30close_30_smaclose_60_smaday
02017-08-27DREP_BTC0.00.00.00.00.00.00.00.00.00.00.00.00.06
12017-08-27STMX_BTC0.00.00.00.00.00.00.00.00.00.00.00.00.06
22017-08-27TROY_BTC0.00.00.00.00.00.00.00.00.00.00.00.00.06
32017-08-27SC_BTC0.00.00.00.00.00.00.00.00.00.00.00.00.06
42017-08-27CKB_BTC0.00.00.00.00.00.00.00.00.00.00.00.00.06
\n", + "
" + ], + "text/plain": [ + " date tic open high ... dx_30 close_30_sma close_60_sma day\n", + "0 2017-08-27 DREP_BTC 0.0 0.0 ... 0.0 0.0 0.0 6\n", + "1 2017-08-27 STMX_BTC 0.0 0.0 ... 0.0 0.0 0.0 6\n", + "2 2017-08-27 TROY_BTC 0.0 0.0 ... 0.0 0.0 0.0 6\n", + "3 2017-08-27 SC_BTC 0.0 0.0 ... 0.0 0.0 0.0 6\n", + "4 2017-08-27 CKB_BTC 0.0 0.0 ... 0.0 0.0 0.0 6\n", + "\n", + "[5 rows x 16 columns]" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 32 + } + ] + }, + { + "cell_type": "code", + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 206 + }, + "id": "EGmzTrtfjF5_", + "outputId": "1f46071c-4e1f-4a4f-be05-8e404de590fe" + }, + "source": [ + "processed_full.tail()" + ], + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
dateticopenhighlowclosevolumemacdboll_ubboll_lbrsi_30cci_30dx_30close_30_smaclose_60_smaday
1270952021-02-17ENJ_BTC0.0000110.0000110.0000100.00001113893935.02.369494e-081.049207e-067.617934e-0752.020103150.16579847.9892789.020000e-079.078333e-072
1270962021-02-17PIVX_BTC0.0000140.0000170.0000130.0000162119250.0-2.938339e-081.729947e-061.592053e-0628.651403-64.0186926.4605731.750000e-061.750000e-062
1270972021-02-17STORJ_BTC0.0000160.0000160.0000140.0000153600209.02.369494e-081.049207e-067.617934e-0752.020103150.16579847.9892789.020000e-079.078333e-072
1270982021-02-17CELO_BTC0.0000930.0001080.0000850.0000921715704.9-1.143647e-092.754664e-072.085336e-0742.0780855.7067602.6606422.326667e-072.486364e-072
1270992021-02-17AGI_BTC0.0000040.0000040.0000030.00000421452822.0-2.590028e-082.703575e-071.526425e-0737.855863-82.60524231.7272922.356667e-072.771667e-072
\n", + "
" + ], + "text/plain": [ + " date tic open ... close_30_sma close_60_sma day\n", + "127095 2021-02-17 ENJ_BTC 0.000011 ... 9.020000e-07 9.078333e-07 2\n", + "127096 2021-02-17 PIVX_BTC 0.000014 ... 1.750000e-06 1.750000e-06 2\n", + "127097 2021-02-17 STORJ_BTC 0.000016 ... 9.020000e-07 9.078333e-07 2\n", + "127098 2021-02-17 CELO_BTC 0.000093 ... 2.326667e-07 2.486364e-07 2\n", + "127099 2021-02-17 AGI_BTC 0.000004 ... 2.356667e-07 2.771667e-07 2\n", + "\n", + "[5 rows x 16 columns]" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 33 + } + ] + }, + { + "cell_type": "code", + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "IrF2ODTMiIQF", + "outputId": "ba52284c-176e-4f38-d6ab-ce29959ccf53" + }, + "source": [ + "processed_full.isna().any()" + ], + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "date False\n", + "tic False\n", + "open False\n", + "high False\n", + "low False\n", + "close False\n", + "volume False\n", + "macd False\n", + "boll_ub False\n", + "boll_lb False\n", + "rsi_30 False\n", + "cci_30 False\n", + "dx_30 False\n", + "close_30_sma False\n", + "close_60_sma False\n", + "day False\n", + "dtype: bool" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 34 + } + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "Q5Xg1GTz6-yW" + }, + "source": [ + "#### DATA SPLIT TRAIN TRADE RATIO 70/30\r\n", + "\r\n", + "trade_len = int(len(processed_full)*0.7)\r\n", + "train_len = int(len(processed_full)*0.3+1)\r\n", + "total = trade_len+train_len" + ], + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "rYIlHNSoJQXX", + "outputId": "3b7b0d3d-c277-4ae2-dc3e-addb94aaa428" + }, + "source": [ + "train = data_split(processed_full, processed_full.date.min(),processed_full.date.loc[trade_len])\r\n", + "trade = data_split(processed_full, processed_full.date.loc[trade_len],processed_full.date.max())\r\n", + "print(len(train))\r\n", + "print(len(trade))\r\n", + "print(f'trade length:{trade_len}, train length: {train_len}, for total len of {total} of {len(processed_full)}')\r\n" + ], + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "text": [ + "88900\n", + "38100\n", + "trade length:88970, train length: 38131, for total len of 127101 of 127100\n" + ], + "name": "stdout" + } + ] + }, + { + "cell_type": "code", + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 444 + }, + "id": "h_tItxOmwq8i", + "outputId": "a91aa8e9-43fc-4e48-a4c1-5c4a01021fd8" + }, + "source": [ + "train" + ], + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
dateticopenhighlowclosevolumemacdboll_ubboll_lbrsi_30cci_30dx_30close_30_smaclose_60_smaday
02017-08-27ADA_BTC0.000000e+000.000000e+000.000000e+000.000000e+000.00.000000e+000.000000e+000.000000e+000.0000000.0000000.0000000.000000e+000.000000e+006
02017-08-27AERGO_BTC0.000000e+000.000000e+000.000000e+000.000000e+000.00.000000e+000.000000e+000.000000e+000.0000000.0000000.0000000.000000e+000.000000e+006
02017-08-27AGI_BTC0.000000e+000.000000e+000.000000e+000.000000e+000.00.000000e+000.000000e+000.000000e+000.0000000.0000000.0000000.000000e+000.000000e+006
02017-08-27AKRO_BTC0.000000e+000.000000e+000.000000e+000.000000e+000.00.000000e+000.000000e+000.000000e+000.0000000.0000000.0000000.000000e+000.000000e+006
02017-08-27AMB_BTC0.000000e+000.000000e+000.000000e+000.000000e+000.00.000000e+000.000000e+000.000000e+000.0000000.0000000.0000000.000000e+000.000000e+006
...................................................
8882020-02-01XEM_BTC4.820000e-065.430000e-064.790000e-065.280000e-0658116266.0-3.852414e-081.107707e-068.272934e-0731.996931-174.62464534.7435369.903333e-071.009697e-065
8882020-02-01XLM_BTC6.480000e-066.690000e-066.460000e-066.630000e-0638325484.0-1.053946e-093.504154e-072.565846e-0745.041296127.19298224.7501032.990000e-073.798333e-075
8882020-02-01XVG_BTC4.000000e-074.300000e-074.000000e-074.300000e-0796854241.02.154301e-084.629778e-073.110222e-0753.95730352.55431627.9955133.863333e-073.368333e-075
8882020-02-01YOYOW_BTC1.140000e-061.170000e-061.130000e-061.160000e-064106977.01.967765e-083.888191e-072.101809e-0755.429784220.53571456.6509062.943333e-073.028333e-075
8882020-02-01ZIL_BTC6.300000e-076.600000e-076.200000e-076.400000e-07100985031.0-9.164700e-089.570526e-074.729474e-0730.274453-98.12964425.2906058.046667e-078.997917e-075
\n", + "

88900 rows × 16 columns

\n", + "
" + ], + "text/plain": [ + " date tic open ... close_30_sma close_60_sma day\n", + "0 2017-08-27 ADA_BTC 0.000000e+00 ... 0.000000e+00 0.000000e+00 6\n", + "0 2017-08-27 AERGO_BTC 0.000000e+00 ... 0.000000e+00 0.000000e+00 6\n", + "0 2017-08-27 AGI_BTC 0.000000e+00 ... 0.000000e+00 0.000000e+00 6\n", + "0 2017-08-27 AKRO_BTC 0.000000e+00 ... 0.000000e+00 0.000000e+00 6\n", + "0 2017-08-27 AMB_BTC 0.000000e+00 ... 0.000000e+00 0.000000e+00 6\n", + ".. ... ... ... ... ... ... ...\n", + "888 2020-02-01 XEM_BTC 4.820000e-06 ... 9.903333e-07 1.009697e-06 5\n", + "888 2020-02-01 XLM_BTC 6.480000e-06 ... 2.990000e-07 3.798333e-07 5\n", + "888 2020-02-01 XVG_BTC 4.000000e-07 ... 3.863333e-07 3.368333e-07 5\n", + "888 2020-02-01 YOYOW_BTC 1.140000e-06 ... 2.943333e-07 3.028333e-07 5\n", + "888 2020-02-01 ZIL_BTC 6.300000e-07 ... 8.046667e-07 8.997917e-07 5\n", + "\n", + "[88900 rows x 16 columns]" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 37 + } + ] + }, + { + "cell_type": "code", + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "8ceHuwSUC6xW", + "outputId": "14c449cf-5660-4a20-e1e3-45604fa2de0b" + }, + "source": [ + "len(train.tic.unique())" + ], + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "100" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 38 + } + ] + }, + { + "cell_type": "code", + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "nKWnrUetC_YE", + "outputId": "f462d197-b53c-4e9f-df97-f8391eeaa69a" + }, + "source": [ + "config[\"TECHNICAL_INDICATORS_LIST\"]\r\n", + "len(config[\"TECHNICAL_INDICATORS_LIST\"])" + ], + "execution_count": null, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "8" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 39 + } + ] + }, + { + "cell_type": "code", + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "Sc4Yix3G0U2g", + "outputId": "3fc55f7e-09ee-48ac-f84d-daa0c9498fd4" + }, + "source": [ + "stock_dimension = len(train.tic.unique())\r\n", + "state_space = 1 + 2*stock_dimension + len(config[\"TECHNICAL_INDICATORS_LIST\"])*stock_dimension\r\n", + "print(f\"Stock Dimension: {stock_dimension}, State Space: {state_space}\")\r\n", + "\r\n", + "env_kwargs = {\r\n", + " \"hmax\": 100, \r\n", + " \"initial_amount\": 1000000, \r\n", + " \"buy_cost_pct\": 0.001,\r\n", + " \"sell_cost_pct\": 0.001,\r\n", + " \"state_space\": state_space, \r\n", + " \"stock_dim\": stock_dimension, \r\n", + " \"tech_indicator_list\": config[\"TECHNICAL_INDICATORS_LIST\"], \r\n", + " \"action_space\": stock_dimension, \r\n", + " \"reward_scaling\": 1e-4\r\n", + "}\r\n", + "e_train_gym = StockTradingEnv(df = train, **env_kwargs)" + ], + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "text": [ + "Stock Dimension: 100, State Space: 1001\n" + ], + "name": "stdout" + } + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "yRzxB84E_pR0" + }, + "source": [ + "env_train, _ = e_train_gym.get_sb_env()\r\n", + "# print(type(env_train))\r\n", + "# print(dir(env_train))\r\n", + "# print(dir(env_train.observation_space))\r\n", + "# print(env_train.observation_space.low.shape)" + ], + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "8V-ppne7Cv2T", + "outputId": "6e69e3b0-51d5-42e0-ea1d-72c0595463a0" + }, + "source": [ + "agent = DRLAgent(env = env_train)\r\n", + "PPO_PARAMS = {\r\n", + " \"n_steps\": 2048,\r\n", + " \"ent_coef\": 0.01,\r\n", + " \"learning_rate\": 0.00025,\r\n", + " \"batch_size\": 1000,\r\n", + "}\r\n", + "model_ppo = agent.get_model(\"ppo\",model_kwargs = PPO_PARAMS)\r\n" + ], + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "text": [ + "{'n_steps': 2048, 'ent_coef': 0.01, 'learning_rate': 0.00025, 'batch_size': 1000}\n", + "Using cpu device\n" + ], + "name": "stdout" + } + ] + }, + { + "cell_type": "code", + "metadata": { + "colab": { + "background_save": true, + "base_uri": "https://localhost:8080/" + }, + "id": "-XOu77eQeP5Q", + "outputId": "36ba5658-d0cb-429e-9adb-8ff2f5db50ce" + }, + "source": [ + "trained_ppo = agent.train_model(model=model_ppo, \r\n", + " tb_log_name='ppo',\r\n", + " total_timesteps=1000000)" + ], + "execution_count": null, + "outputs": [ + { + "output_type": "stream", + "text": [ + "\u001b[1;30;43mStreaming output truncated to the last 5000 lines.\u001b[0m\n", + "| loss | -1.91 |\n", + "| n_updates | 3020 |\n", + "| policy_gradient_loss | -0.0169 |\n", + "| std | 1.58 |\n", + "| value_loss | 1.25e-05 |\n", + "-----------------------------------------\n", + "day: 888, episode: 700\n", + "begin_total_asset: 1000000.00\n", + "end_total_asset: 999991.80\n", + "total_reward: -8.20\n", + "total_cost: 0.16\n", + "total_trades: 38908\n", + "Sharpe: -1.303\n", + "=================================\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.171 |\n", + "| total_reward | -12.9 |\n", + "| total_reward_pct | -0.00129 |\n", + "| total_trades | 39304 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 304 |\n", + "| time_elapsed | 8408 |\n", + "| total_timesteps | 622592 |\n", + "| train/ | |\n", + "| approx_kl | 0.015756082 |\n", + "| clip_fraction | 0.216 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -187 |\n", + "| explained_variance | -2.24e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.88 |\n", + "| n_updates | 3030 |\n", + "| policy_gradient_loss | -0.0153 |\n", + "| std | 1.58 |\n", + "| value_loss | 4.4e-06 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.173 |\n", + "| total_reward | -10.9 |\n", + "| total_reward_pct | -0.00109 |\n", + "| total_trades | 39235 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 305 |\n", + "| time_elapsed | 8435 |\n", + "| total_timesteps | 624640 |\n", + "| train/ | |\n", + "| approx_kl | 0.018547704 |\n", + "| clip_fraction | 0.187 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -187 |\n", + "| explained_variance | -1.19e+12 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.85 |\n", + "| n_updates | 3040 |\n", + "| policy_gradient_loss | -0.0116 |\n", + "| std | 1.58 |\n", + "| value_loss | 1.06e-05 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.169 |\n", + "| total_reward | -11.3 |\n", + "| total_reward_pct | -0.00113 |\n", + "| total_trades | 39539 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 306 |\n", + "| time_elapsed | 8462 |\n", + "| total_timesteps | 626688 |\n", + "| train/ | |\n", + "| approx_kl | 0.027287185 |\n", + "| clip_fraction | 0.183 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -188 |\n", + "| explained_variance | -2.51e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.91 |\n", + "| n_updates | 3050 |\n", + "| policy_gradient_loss | -0.0163 |\n", + "| std | 1.58 |\n", + "| value_loss | 1.42e-05 |\n", + "-----------------------------------------\n", + "------------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.168 |\n", + "| total_reward | -9.2 |\n", + "| total_reward_pct | -0.00092 |\n", + "| total_trades | 39347 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 307 |\n", + "| time_elapsed | 8489 |\n", + "| total_timesteps | 628736 |\n", + "| train/ | |\n", + "| approx_kl | 0.0015266681 |\n", + "| clip_fraction | 0.185 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -188 |\n", + "| explained_variance | -9.61e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.91 |\n", + "| n_updates | 3060 |\n", + "| policy_gradient_loss | -0.0171 |\n", + "| std | 1.58 |\n", + "| value_loss | 1.77e-06 |\n", + "------------------------------------------\n", + "day: 888, episode: 710\n", + "begin_total_asset: 1000000.00\n", + "end_total_asset: 999992.16\n", + "total_reward: -7.84\n", + "total_cost: 0.16\n", + "total_trades: 39279\n", + "Sharpe: -1.261\n", + "=================================\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.164 |\n", + "| total_reward | -7.84 |\n", + "| total_reward_pct | -0.000784 |\n", + "| total_trades | 39279 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 308 |\n", + "| time_elapsed | 8516 |\n", + "| total_timesteps | 630784 |\n", + "| train/ | |\n", + "| approx_kl | 0.015780011 |\n", + "| clip_fraction | 0.168 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -188 |\n", + "| explained_variance | -1.97e+12 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.87 |\n", + "| n_updates | 3070 |\n", + "| policy_gradient_loss | -0.0133 |\n", + "| std | 1.59 |\n", + "| value_loss | 9.47e-07 |\n", + "-----------------------------------------\n", + "----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.167 |\n", + "| total_reward | -9.76 |\n", + "| total_reward_pct | -0.000976 |\n", + "| total_trades | 39313 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 309 |\n", + "| time_elapsed | 8543 |\n", + "| total_timesteps | 632832 |\n", + "| train/ | |\n", + "| approx_kl | 0.03344636 |\n", + "| clip_fraction | 0.163 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -188 |\n", + "| explained_variance | -1.7e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.93 |\n", + "| n_updates | 3080 |\n", + "| policy_gradient_loss | -0.0148 |\n", + "| std | 1.59 |\n", + "| value_loss | 1.17e-06 |\n", + "----------------------------------------\n", + "----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.163 |\n", + "| total_reward | -8.74 |\n", + "| total_reward_pct | -0.000874 |\n", + "| total_trades | 39141 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 310 |\n", + "| time_elapsed | 8570 |\n", + "| total_timesteps | 634880 |\n", + "| train/ | |\n", + "| approx_kl | 0.03148233 |\n", + "| clip_fraction | 0.15 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -188 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.93 |\n", + "| n_updates | 3090 |\n", + "| policy_gradient_loss | -0.0149 |\n", + "| std | 1.59 |\n", + "| value_loss | 2.57e-07 |\n", + "----------------------------------------\n", + "-------------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.158 |\n", + "| total_reward | -7.81 |\n", + "| total_reward_pct | -0.000781 |\n", + "| total_trades | 39116 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 311 |\n", + "| time_elapsed | 8597 |\n", + "| total_timesteps | 636928 |\n", + "| train/ | |\n", + "| approx_kl | -0.0037291714 |\n", + "| clip_fraction | 0.201 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -188 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.87 |\n", + "| n_updates | 3100 |\n", + "| policy_gradient_loss | -0.0229 |\n", + "| std | 1.59 |\n", + "| value_loss | 4.78e-08 |\n", + "-------------------------------------------\n", + "----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.165 |\n", + "| total_reward | -6.78 |\n", + "| total_reward_pct | -0.000678 |\n", + "| total_trades | 39326 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 312 |\n", + "| time_elapsed | 8624 |\n", + "| total_timesteps | 638976 |\n", + "| train/ | |\n", + "| approx_kl | 0.04012691 |\n", + "| clip_fraction | 0.187 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -188 |\n", + "| explained_variance | -5.84e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.92 |\n", + "| n_updates | 3110 |\n", + "| policy_gradient_loss | -0.0209 |\n", + "| std | 1.59 |\n", + "| value_loss | 7.09e-09 |\n", + "----------------------------------------\n", + "day: 888, episode: 720\n", + "begin_total_asset: 1000000.00\n", + "end_total_asset: 999991.74\n", + "total_reward: -8.26\n", + "total_cost: 0.16\n", + "total_trades: 39060\n", + "Sharpe: -1.281\n", + "=================================\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.165 |\n", + "| total_reward | -8.7 |\n", + "| total_reward_pct | -0.00087 |\n", + "| total_trades | 39181 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 313 |\n", + "| time_elapsed | 8651 |\n", + "| total_timesteps | 641024 |\n", + "| train/ | |\n", + "| approx_kl | 0.027232863 |\n", + "| clip_fraction | 0.19 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -188 |\n", + "| explained_variance | -5.61e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.91 |\n", + "| n_updates | 3120 |\n", + "| policy_gradient_loss | -0.0206 |\n", + "| std | 1.6 |\n", + "| value_loss | 2.85e-09 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.166 |\n", + "| total_reward | -7.07 |\n", + "| total_reward_pct | -0.000707 |\n", + "| total_trades | 39140 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 314 |\n", + "| time_elapsed | 8678 |\n", + "| total_timesteps | 643072 |\n", + "| train/ | |\n", + "| approx_kl | 0.038591266 |\n", + "| clip_fraction | 0.167 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -189 |\n", + "| explained_variance | -1.7e+12 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.91 |\n", + "| n_updates | 3130 |\n", + "| policy_gradient_loss | -0.0154 |\n", + "| std | 1.6 |\n", + "| value_loss | 2.98e-09 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.162 |\n", + "| total_reward | -7.46 |\n", + "| total_reward_pct | -0.000746 |\n", + "| total_trades | 39257 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 315 |\n", + "| time_elapsed | 8704 |\n", + "| total_timesteps | 645120 |\n", + "| train/ | |\n", + "| approx_kl | 0.022554852 |\n", + "| clip_fraction | 0.172 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -189 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.9 |\n", + "| n_updates | 3140 |\n", + "| policy_gradient_loss | -0.0184 |\n", + "| std | 1.6 |\n", + "| value_loss | 2.29e-09 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.161 |\n", + "| total_reward | -7.33 |\n", + "| total_reward_pct | -0.000733 |\n", + "| total_trades | 38921 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 316 |\n", + "| time_elapsed | 8731 |\n", + "| total_timesteps | 647168 |\n", + "| train/ | |\n", + "| approx_kl | 0.017104207 |\n", + "| clip_fraction | 0.17 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -189 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.89 |\n", + "| n_updates | 3150 |\n", + "| policy_gradient_loss | -0.017 |\n", + "| std | 1.6 |\n", + "| value_loss | 1.86e-09 |\n", + "-----------------------------------------\n", + "day: 888, episode: 730\n", + "begin_total_asset: 1000000.00\n", + "end_total_asset: 999991.78\n", + "total_reward: -8.22\n", + "total_cost: 0.17\n", + "total_trades: 39029\n", + "Sharpe: -1.092\n", + "=================================\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.165 |\n", + "| total_reward | -7.06 |\n", + "| total_reward_pct | -0.000706 |\n", + "| total_trades | 39159 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 317 |\n", + "| time_elapsed | 8758 |\n", + "| total_timesteps | 649216 |\n", + "| train/ | |\n", + "| approx_kl | 0.007840375 |\n", + "| clip_fraction | 0.172 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -189 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.91 |\n", + "| n_updates | 3160 |\n", + "| policy_gradient_loss | -0.0155 |\n", + "| std | 1.61 |\n", + "| value_loss | 2.1e-09 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.17 |\n", + "| total_reward | -8.27 |\n", + "| total_reward_pct | -0.000827 |\n", + "| total_trades | 39033 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 318 |\n", + "| time_elapsed | 8785 |\n", + "| total_timesteps | 651264 |\n", + "| train/ | |\n", + "| approx_kl | 0.027598552 |\n", + "| clip_fraction | 0.184 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -189 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.9 |\n", + "| n_updates | 3170 |\n", + "| policy_gradient_loss | -0.0181 |\n", + "| std | 1.61 |\n", + "| value_loss | 2.1e-09 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.165 |\n", + "| total_reward | -9.14 |\n", + "| total_reward_pct | -0.000914 |\n", + "| total_trades | 39023 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 319 |\n", + "| time_elapsed | 8812 |\n", + "| total_timesteps | 653312 |\n", + "| train/ | |\n", + "| approx_kl | 0.025414601 |\n", + "| clip_fraction | 0.179 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -189 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.88 |\n", + "| n_updates | 3180 |\n", + "| policy_gradient_loss | -0.0189 |\n", + "| std | 1.61 |\n", + "| value_loss | 1.83e-09 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.168 |\n", + "| total_reward | -9.13 |\n", + "| total_reward_pct | -0.000913 |\n", + "| total_trades | 39020 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 320 |\n", + "| time_elapsed | 8839 |\n", + "| total_timesteps | 655360 |\n", + "| train/ | |\n", + "| approx_kl | 0.008562529 |\n", + "| clip_fraction | 0.16 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -189 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.89 |\n", + "| n_updates | 3190 |\n", + "| policy_gradient_loss | -0.0162 |\n", + "| std | 1.61 |\n", + "| value_loss | 2.14e-09 |\n", + "-----------------------------------------\n", + "day: 888, episode: 740\n", + "begin_total_asset: 1000000.00\n", + "end_total_asset: 999991.02\n", + "total_reward: -8.98\n", + "total_cost: 0.16\n", + "total_trades: 38860\n", + "Sharpe: -1.178\n", + "=================================\n", + "----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.165 |\n", + "| total_reward | -8.98 |\n", + "| total_reward_pct | -0.000898 |\n", + "| total_trades | 38860 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 321 |\n", + "| time_elapsed | 8865 |\n", + "| total_timesteps | 657408 |\n", + "| train/ | |\n", + "| approx_kl | 0.00938166 |\n", + "| clip_fraction | 0.187 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -189 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.93 |\n", + "| n_updates | 3200 |\n", + "| policy_gradient_loss | -0.0221 |\n", + "| std | 1.61 |\n", + "| value_loss | 2.43e-09 |\n", + "----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.167 |\n", + "| total_reward | -7.95 |\n", + "| total_reward_pct | -0.000795 |\n", + "| total_trades | 39081 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 322 |\n", + "| time_elapsed | 8892 |\n", + "| total_timesteps | 659456 |\n", + "| train/ | |\n", + "| approx_kl | 0.018283008 |\n", + "| clip_fraction | 0.189 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -190 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.92 |\n", + "| n_updates | 3210 |\n", + "| policy_gradient_loss | -0.0208 |\n", + "| std | 1.62 |\n", + "| value_loss | 2.68e-09 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.17 |\n", + "| total_reward | -9.57 |\n", + "| total_reward_pct | -0.000957 |\n", + "| total_trades | 38934 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 323 |\n", + "| time_elapsed | 8919 |\n", + "| total_timesteps | 661504 |\n", + "| train/ | |\n", + "| approx_kl | 0.027254522 |\n", + "| clip_fraction | 0.19 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -190 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.92 |\n", + "| n_updates | 3220 |\n", + "| policy_gradient_loss | -0.0196 |\n", + "| std | 1.62 |\n", + "| value_loss | 4.79e-09 |\n", + "-----------------------------------------\n", + "----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.163 |\n", + "| total_reward | -8.11 |\n", + "| total_reward_pct | -0.000811 |\n", + "| total_trades | 38951 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 324 |\n", + "| time_elapsed | 8946 |\n", + "| total_timesteps | 663552 |\n", + "| train/ | |\n", + "| approx_kl | 0.02415277 |\n", + "| clip_fraction | 0.18 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -190 |\n", + "| explained_variance | -3.38e+12 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.96 |\n", + "| n_updates | 3230 |\n", + "| policy_gradient_loss | -0.0199 |\n", + "| std | 1.62 |\n", + "| value_loss | 1.55e-08 |\n", + "----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.164 |\n", + "| total_reward | -8.14 |\n", + "| total_reward_pct | -0.000814 |\n", + "| total_trades | 38816 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 325 |\n", + "| time_elapsed | 8972 |\n", + "| total_timesteps | 665600 |\n", + "| train/ | |\n", + "| approx_kl | 0.012451343 |\n", + "| clip_fraction | 0.193 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -190 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.97 |\n", + "| n_updates | 3240 |\n", + "| policy_gradient_loss | -0.0228 |\n", + "| std | 1.62 |\n", + "| value_loss | 8.05e-08 |\n", + "-----------------------------------------\n", + "day: 888, episode: 750\n", + "begin_total_asset: 1000000.00\n", + "end_total_asset: 999991.15\n", + "total_reward: -8.85\n", + "total_cost: 0.17\n", + "total_trades: 39173\n", + "Sharpe: -1.112\n", + "=================================\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.167 |\n", + "| total_reward | -8.57 |\n", + "| total_reward_pct | -0.000857 |\n", + "| total_trades | 38854 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 326 |\n", + "| time_elapsed | 8999 |\n", + "| total_timesteps | 667648 |\n", + "| train/ | |\n", + "| approx_kl | 0.030656183 |\n", + "| clip_fraction | 0.179 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -190 |\n", + "| explained_variance | -4.41e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.89 |\n", + "| n_updates | 3250 |\n", + "| policy_gradient_loss | -0.019 |\n", + "| std | 1.62 |\n", + "| value_loss | 1.24e-06 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.157 |\n", + "| total_reward | -8.91 |\n", + "| total_reward_pct | -0.000891 |\n", + "| total_trades | 39140 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 327 |\n", + "| time_elapsed | 9026 |\n", + "| total_timesteps | 669696 |\n", + "| train/ | |\n", + "| approx_kl | 0.017755004 |\n", + "| clip_fraction | 0.188 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -190 |\n", + "| explained_variance | -7.36e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.95 |\n", + "| n_updates | 3260 |\n", + "| policy_gradient_loss | -0.0189 |\n", + "| std | 1.63 |\n", + "| value_loss | 8.2e-06 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.159 |\n", + "| total_reward | -6.42 |\n", + "| total_reward_pct | -0.000642 |\n", + "| total_trades | 38748 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 328 |\n", + "| time_elapsed | 9054 |\n", + "| total_timesteps | 671744 |\n", + "| train/ | |\n", + "| approx_kl | 0.032886785 |\n", + "| clip_fraction | 0.174 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -190 |\n", + "| explained_variance | -1.87e+12 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.92 |\n", + "| n_updates | 3270 |\n", + "| policy_gradient_loss | -0.0155 |\n", + "| std | 1.63 |\n", + "| value_loss | 5.14e-08 |\n", + "-----------------------------------------\n", + "----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.166 |\n", + "| total_reward | -7.14 |\n", + "| total_reward_pct | -0.000714 |\n", + "| total_trades | 39156 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 329 |\n", + "| time_elapsed | 9081 |\n", + "| total_timesteps | 673792 |\n", + "| train/ | |\n", + "| approx_kl | 0.01692321 |\n", + "| clip_fraction | 0.178 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -191 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.87 |\n", + "| n_updates | 3280 |\n", + "| policy_gradient_loss | -0.0157 |\n", + "| std | 1.63 |\n", + "| value_loss | 9.27e-07 |\n", + "----------------------------------------\n", + "day: 888, episode: 760\n", + "begin_total_asset: 1000000.00\n", + "end_total_asset: 999992.81\n", + "total_reward: -7.19\n", + "total_cost: 0.16\n", + "total_trades: 39075\n", + "Sharpe: -1.136\n", + "=================================\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.167 |\n", + "| total_reward | -9.57 |\n", + "| total_reward_pct | -0.000957 |\n", + "| total_trades | 38978 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 330 |\n", + "| time_elapsed | 9108 |\n", + "| total_timesteps | 675840 |\n", + "| train/ | |\n", + "| approx_kl | 0.020509785 |\n", + "| clip_fraction | 0.189 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -191 |\n", + "| explained_variance | -5.03e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.93 |\n", + "| n_updates | 3290 |\n", + "| policy_gradient_loss | -0.0174 |\n", + "| std | 1.63 |\n", + "| value_loss | 2.35e-07 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.162 |\n", + "| total_reward | -8.39 |\n", + "| total_reward_pct | -0.000839 |\n", + "| total_trades | 39088 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 331 |\n", + "| time_elapsed | 9135 |\n", + "| total_timesteps | 677888 |\n", + "| train/ | |\n", + "| approx_kl | 0.043102283 |\n", + "| clip_fraction | 0.203 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -191 |\n", + "| explained_variance | -1.34e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.93 |\n", + "| n_updates | 3300 |\n", + "| policy_gradient_loss | -0.0185 |\n", + "| std | 1.64 |\n", + "| value_loss | 5.33e-06 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.169 |\n", + "| total_reward | -7.09 |\n", + "| total_reward_pct | -0.000709 |\n", + "| total_trades | 39166 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 332 |\n", + "| time_elapsed | 9162 |\n", + "| total_timesteps | 679936 |\n", + "| train/ | |\n", + "| approx_kl | 0.033239473 |\n", + "| clip_fraction | 0.203 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -191 |\n", + "| explained_variance | -8.36e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.91 |\n", + "| n_updates | 3310 |\n", + "| policy_gradient_loss | -0.0171 |\n", + "| std | 1.64 |\n", + "| value_loss | 2e-06 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.159 |\n", + "| total_reward | -9.17 |\n", + "| total_reward_pct | -0.000917 |\n", + "| total_trades | 38985 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 333 |\n", + "| time_elapsed | 9189 |\n", + "| total_timesteps | 681984 |\n", + "| train/ | |\n", + "| approx_kl | 0.027892487 |\n", + "| clip_fraction | 0.213 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -191 |\n", + "| explained_variance | -7.1e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.96 |\n", + "| n_updates | 3320 |\n", + "| policy_gradient_loss | -0.0172 |\n", + "| std | 1.64 |\n", + "| value_loss | 3.41e-05 |\n", + "-----------------------------------------\n", + "day: 888, episode: 770\n", + "begin_total_asset: 1000000.00\n", + "end_total_asset: 999991.83\n", + "total_reward: -8.17\n", + "total_cost: 0.16\n", + "total_trades: 38974\n", + "Sharpe: -1.208\n", + "=================================\n", + "----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.162 |\n", + "| total_reward | -8.17 |\n", + "| total_reward_pct | -0.000817 |\n", + "| total_trades | 38974 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 334 |\n", + "| time_elapsed | 9217 |\n", + "| total_timesteps | 684032 |\n", + "| train/ | |\n", + "| approx_kl | 0.02594055 |\n", + "| clip_fraction | 0.237 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -191 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.95 |\n", + "| n_updates | 3330 |\n", + "| policy_gradient_loss | -0.0213 |\n", + "| std | 1.64 |\n", + "| value_loss | 0.000862 |\n", + "----------------------------------------\n", + "---------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.165 |\n", + "| total_reward | -10.8 |\n", + "| total_reward_pct | -0.00108 |\n", + "| total_trades | 38795 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 335 |\n", + "| time_elapsed | 9244 |\n", + "| total_timesteps | 686080 |\n", + "| train/ | |\n", + "| approx_kl | 0.0509443 |\n", + "| clip_fraction | 0.193 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -191 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.91 |\n", + "| n_updates | 3340 |\n", + "| policy_gradient_loss | -0.0145 |\n", + "| std | 1.64 |\n", + "| value_loss | 0.00117 |\n", + "---------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.158 |\n", + "| total_reward | -9.77 |\n", + "| total_reward_pct | -0.000977 |\n", + "| total_trades | 38975 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 336 |\n", + "| time_elapsed | 9271 |\n", + "| total_timesteps | 688128 |\n", + "| train/ | |\n", + "| approx_kl | 0.031888533 |\n", + "| clip_fraction | 0.184 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -192 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.95 |\n", + "| n_updates | 3350 |\n", + "| policy_gradient_loss | -0.0154 |\n", + "| std | 1.65 |\n", + "| value_loss | 9.58e-05 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.163 |\n", + "| total_reward | -9.01 |\n", + "| total_reward_pct | -0.000901 |\n", + "| total_trades | 39016 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 337 |\n", + "| time_elapsed | 9298 |\n", + "| total_timesteps | 690176 |\n", + "| train/ | |\n", + "| approx_kl | 0.028200796 |\n", + "| clip_fraction | 0.227 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -192 |\n", + "| explained_variance | -1.81e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.97 |\n", + "| n_updates | 3360 |\n", + "| policy_gradient_loss | -0.0173 |\n", + "| std | 1.65 |\n", + "| value_loss | 6.67e-05 |\n", + "-----------------------------------------\n", + "----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.158 |\n", + "| total_reward | -11.2 |\n", + "| total_reward_pct | -0.00112 |\n", + "| total_trades | 39153 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 338 |\n", + "| time_elapsed | 9325 |\n", + "| total_timesteps | 692224 |\n", + "| train/ | |\n", + "| approx_kl | 0.04343605 |\n", + "| clip_fraction | 0.21 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -192 |\n", + "| explained_variance | -3.34e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.92 |\n", + "| n_updates | 3370 |\n", + "| policy_gradient_loss | -0.0143 |\n", + "| std | 1.65 |\n", + "| value_loss | 3.43e-05 |\n", + "----------------------------------------\n", + "day: 888, episode: 780\n", + "begin_total_asset: 1000000.00\n", + "end_total_asset: 999988.74\n", + "total_reward: -11.26\n", + "total_cost: 0.16\n", + "total_trades: 39229\n", + "Sharpe: -1.443\n", + "=================================\n", + "---------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.164 |\n", + "| total_reward | -11.2 |\n", + "| total_reward_pct | -0.00112 |\n", + "| total_trades | 39106 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 339 |\n", + "| time_elapsed | 9352 |\n", + "| total_timesteps | 694272 |\n", + "| train/ | |\n", + "| approx_kl | 0.0243537 |\n", + "| clip_fraction | 0.19 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -192 |\n", + "| explained_variance | -2.6e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.94 |\n", + "| n_updates | 3380 |\n", + "| policy_gradient_loss | -0.0146 |\n", + "| std | 1.65 |\n", + "| value_loss | 2.46e-05 |\n", + "---------------------------------------\n", + "---------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.16 |\n", + "| total_reward | -10.9 |\n", + "| total_reward_pct | -0.00109 |\n", + "| total_trades | 38906 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 340 |\n", + "| time_elapsed | 9380 |\n", + "| total_timesteps | 696320 |\n", + "| train/ | |\n", + "| approx_kl | 0.032437 |\n", + "| clip_fraction | 0.205 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -192 |\n", + "| explained_variance | -1.87e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.94 |\n", + "| n_updates | 3390 |\n", + "| policy_gradient_loss | -0.0168 |\n", + "| std | 1.66 |\n", + "| value_loss | 1.79e-05 |\n", + "---------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.158 |\n", + "| total_reward | -12.6 |\n", + "| total_reward_pct | -0.00126 |\n", + "| total_trades | 38950 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 341 |\n", + "| time_elapsed | 9407 |\n", + "| total_timesteps | 698368 |\n", + "| train/ | |\n", + "| approx_kl | 0.038250145 |\n", + "| clip_fraction | 0.194 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -192 |\n", + "| explained_variance | -7.95e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.95 |\n", + "| n_updates | 3400 |\n", + "| policy_gradient_loss | -0.0194 |\n", + "| std | 1.66 |\n", + "| value_loss | 1.97e-05 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.151 |\n", + "| total_reward | -11.2 |\n", + "| total_reward_pct | -0.00112 |\n", + "| total_trades | 38989 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 342 |\n", + "| time_elapsed | 9434 |\n", + "| total_timesteps | 700416 |\n", + "| train/ | |\n", + "| approx_kl | 0.026694143 |\n", + "| clip_fraction | 0.194 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -192 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.99 |\n", + "| n_updates | 3410 |\n", + "| policy_gradient_loss | -0.018 |\n", + "| std | 1.66 |\n", + "| value_loss | 1.3e-05 |\n", + "-----------------------------------------\n", + "day: 888, episode: 790\n", + "begin_total_asset: 1000000.00\n", + "end_total_asset: 999987.47\n", + "total_reward: -12.53\n", + "total_cost: 0.16\n", + "total_trades: 38927\n", + "Sharpe: -1.346\n", + "=================================\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.16 |\n", + "| total_reward | -13.7 |\n", + "| total_reward_pct | -0.00137 |\n", + "| total_trades | 39005 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 343 |\n", + "| time_elapsed | 9462 |\n", + "| total_timesteps | 702464 |\n", + "| train/ | |\n", + "| approx_kl | 0.024386168 |\n", + "| clip_fraction | 0.177 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -193 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.95 |\n", + "| n_updates | 3420 |\n", + "| policy_gradient_loss | -0.0135 |\n", + "| std | 1.66 |\n", + "| value_loss | 7.45e-06 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.16 |\n", + "| total_reward | -12.7 |\n", + "| total_reward_pct | -0.00127 |\n", + "| total_trades | 38841 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 344 |\n", + "| time_elapsed | 9489 |\n", + "| total_timesteps | 704512 |\n", + "| train/ | |\n", + "| approx_kl | 0.037932277 |\n", + "| clip_fraction | 0.219 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -193 |\n", + "| explained_variance | -3.45e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.98 |\n", + "| n_updates | 3430 |\n", + "| policy_gradient_loss | -0.0174 |\n", + "| std | 1.67 |\n", + "| value_loss | 7.88e-06 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.159 |\n", + "| total_reward | -11.7 |\n", + "| total_reward_pct | -0.00117 |\n", + "| total_trades | 39070 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 345 |\n", + "| time_elapsed | 9516 |\n", + "| total_timesteps | 706560 |\n", + "| train/ | |\n", + "| approx_kl | 0.036220606 |\n", + "| clip_fraction | 0.218 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -193 |\n", + "| explained_variance | -6.9e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.96 |\n", + "| n_updates | 3440 |\n", + "| policy_gradient_loss | -0.0197 |\n", + "| std | 1.67 |\n", + "| value_loss | 4.84e-06 |\n", + "-----------------------------------------\n", + "----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.158 |\n", + "| total_reward | -10 |\n", + "| total_reward_pct | -0.001 |\n", + "| total_trades | 39140 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 346 |\n", + "| time_elapsed | 9543 |\n", + "| total_timesteps | 708608 |\n", + "| train/ | |\n", + "| approx_kl | 0.02556584 |\n", + "| clip_fraction | 0.2 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -193 |\n", + "| explained_variance | -4.65e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.99 |\n", + "| n_updates | 3450 |\n", + "| policy_gradient_loss | -0.0176 |\n", + "| std | 1.67 |\n", + "| value_loss | 4.75e-06 |\n", + "----------------------------------------\n", + "day: 888, episode: 800\n", + "begin_total_asset: 1000000.00\n", + "end_total_asset: 999988.65\n", + "total_reward: -11.35\n", + "total_cost: 0.16\n", + "total_trades: 39089\n", + "Sharpe: -1.516\n", + "=================================\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.159 |\n", + "| total_reward | -11.3 |\n", + "| total_reward_pct | -0.00113 |\n", + "| total_trades | 39089 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 347 |\n", + "| time_elapsed | 9570 |\n", + "| total_timesteps | 710656 |\n", + "| train/ | |\n", + "| approx_kl | 0.026394663 |\n", + "| clip_fraction | 0.215 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -193 |\n", + "| explained_variance | -3.92e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.96 |\n", + "| n_updates | 3460 |\n", + "| policy_gradient_loss | -0.0193 |\n", + "| std | 1.68 |\n", + "| value_loss | 4.29e-06 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.156 |\n", + "| total_reward | -10.9 |\n", + "| total_reward_pct | -0.00109 |\n", + "| total_trades | 38887 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 348 |\n", + "| time_elapsed | 9597 |\n", + "| total_timesteps | 712704 |\n", + "| train/ | |\n", + "| approx_kl | 0.018657511 |\n", + "| clip_fraction | 0.215 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -193 |\n", + "| explained_variance | -1.11e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.97 |\n", + "| n_updates | 3470 |\n", + "| policy_gradient_loss | -0.0162 |\n", + "| std | 1.68 |\n", + "| value_loss | 3.45e-06 |\n", + "-----------------------------------------\n", + "----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.16 |\n", + "| total_reward | -10.6 |\n", + "| total_reward_pct | -0.00106 |\n", + "| total_trades | 39058 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 349 |\n", + "| time_elapsed | 9625 |\n", + "| total_timesteps | 714752 |\n", + "| train/ | |\n", + "| approx_kl | 0.05130279 |\n", + "| clip_fraction | 0.228 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -194 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.91 |\n", + "| n_updates | 3480 |\n", + "| policy_gradient_loss | -0.0127 |\n", + "| std | 1.68 |\n", + "| value_loss | 7.49e-06 |\n", + "----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.158 |\n", + "| total_reward | -11.1 |\n", + "| total_reward_pct | -0.00111 |\n", + "| total_trades | 39139 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 350 |\n", + "| time_elapsed | 9652 |\n", + "| total_timesteps | 716800 |\n", + "| train/ | |\n", + "| approx_kl | 0.028930882 |\n", + "| clip_fraction | 0.194 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -194 |\n", + "| explained_variance | -2.03e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.97 |\n", + "| n_updates | 3490 |\n", + "| policy_gradient_loss | -0.0155 |\n", + "| std | 1.68 |\n", + "| value_loss | 8.97e-06 |\n", + "-----------------------------------------\n", + "----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.16 |\n", + "| total_reward | -12.9 |\n", + "| total_reward_pct | -0.00129 |\n", + "| total_trades | 39117 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 351 |\n", + "| time_elapsed | 9679 |\n", + "| total_timesteps | 718848 |\n", + "| train/ | |\n", + "| approx_kl | 0.03137033 |\n", + "| clip_fraction | 0.24 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -194 |\n", + "| explained_variance | -5.26e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.97 |\n", + "| n_updates | 3500 |\n", + "| policy_gradient_loss | -0.0189 |\n", + "| std | 1.69 |\n", + "| value_loss | 5.81e-06 |\n", + "----------------------------------------\n", + "day: 888, episode: 810\n", + "begin_total_asset: 1000000.00\n", + "end_total_asset: 999988.06\n", + "total_reward: -11.94\n", + "total_cost: 0.16\n", + "total_trades: 39021\n", + "Sharpe: -1.486\n", + "=================================\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.16 |\n", + "| total_reward | -12.2 |\n", + "| total_reward_pct | -0.00122 |\n", + "| total_trades | 39296 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 352 |\n", + "| time_elapsed | 9707 |\n", + "| total_timesteps | 720896 |\n", + "| train/ | |\n", + "| approx_kl | 0.009107692 |\n", + "| clip_fraction | 0.224 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -194 |\n", + "| explained_variance | -1.94e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.94 |\n", + "| n_updates | 3510 |\n", + "| policy_gradient_loss | -0.0185 |\n", + "| std | 1.69 |\n", + "| value_loss | 3.22e-06 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.158 |\n", + "| total_reward | -9.55 |\n", + "| total_reward_pct | -0.000955 |\n", + "| total_trades | 39287 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 353 |\n", + "| time_elapsed | 9734 |\n", + "| total_timesteps | 722944 |\n", + "| train/ | |\n", + "| approx_kl | -0.00349035 |\n", + "| clip_fraction | 0.227 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -194 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.99 |\n", + "| n_updates | 3520 |\n", + "| policy_gradient_loss | -0.019 |\n", + "| std | 1.69 |\n", + "| value_loss | 4.76e-06 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.158 |\n", + "| total_reward | -10.1 |\n", + "| total_reward_pct | -0.00101 |\n", + "| total_trades | 39129 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 354 |\n", + "| time_elapsed | 9761 |\n", + "| total_timesteps | 724992 |\n", + "| train/ | |\n", + "| approx_kl | 0.019415496 |\n", + "| clip_fraction | 0.188 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -194 |\n", + "| explained_variance | -1.96e+12 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.97 |\n", + "| n_updates | 3530 |\n", + "| policy_gradient_loss | -0.0177 |\n", + "| std | 1.7 |\n", + "| value_loss | 4.99e-06 |\n", + "-----------------------------------------\n", + "---------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.167 |\n", + "| total_reward | -10.7 |\n", + "| total_reward_pct | -0.00107 |\n", + "| total_trades | 39228 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 355 |\n", + "| time_elapsed | 9789 |\n", + "| total_timesteps | 727040 |\n", + "| train/ | |\n", + "| approx_kl | 0.0310374 |\n", + "| clip_fraction | 0.177 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -195 |\n", + "| explained_variance | -1.28e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.99 |\n", + "| n_updates | 3540 |\n", + "| policy_gradient_loss | -0.0121 |\n", + "| std | 1.7 |\n", + "| value_loss | 6.78e-07 |\n", + "---------------------------------------\n", + "day: 888, episode: 820\n", + "begin_total_asset: 1000000.00\n", + "end_total_asset: 999991.05\n", + "total_reward: -8.95\n", + "total_cost: 0.16\n", + "total_trades: 39236\n", + "Sharpe: -1.232\n", + "=================================\n", + "----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.162 |\n", + "| total_reward | -9.73 |\n", + "| total_reward_pct | -0.000973 |\n", + "| total_trades | 39218 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 356 |\n", + "| time_elapsed | 9816 |\n", + "| total_timesteps | 729088 |\n", + "| train/ | |\n", + "| approx_kl | 0.03151853 |\n", + "| clip_fraction | 0.213 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -195 |\n", + "| explained_variance | -2.15e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.96 |\n", + "| n_updates | 3550 |\n", + "| policy_gradient_loss | -0.0147 |\n", + "| std | 1.7 |\n", + "| value_loss | 5.82e-08 |\n", + "----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.16 |\n", + "| total_reward | -11.7 |\n", + "| total_reward_pct | -0.00117 |\n", + "| total_trades | 38916 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 357 |\n", + "| time_elapsed | 9844 |\n", + "| total_timesteps | 731136 |\n", + "| train/ | |\n", + "| approx_kl | 0.019986277 |\n", + "| clip_fraction | 0.215 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -195 |\n", + "| explained_variance | -1.3e+12 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.95 |\n", + "| n_updates | 3560 |\n", + "| policy_gradient_loss | -0.0178 |\n", + "| std | 1.7 |\n", + "| value_loss | 7.27e-08 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.163 |\n", + "| total_reward | -10.9 |\n", + "| total_reward_pct | -0.00109 |\n", + "| total_trades | 38961 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 358 |\n", + "| time_elapsed | 9871 |\n", + "| total_timesteps | 733184 |\n", + "| train/ | |\n", + "| approx_kl | 0.027507463 |\n", + "| clip_fraction | 0.18 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -195 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.97 |\n", + "| n_updates | 3570 |\n", + "| policy_gradient_loss | -0.0171 |\n", + "| std | 1.7 |\n", + "| value_loss | 7.58e-08 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.165 |\n", + "| total_reward | -11.9 |\n", + "| total_reward_pct | -0.00119 |\n", + "| total_trades | 39205 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 359 |\n", + "| time_elapsed | 9898 |\n", + "| total_timesteps | 735232 |\n", + "| train/ | |\n", + "| approx_kl | 0.025306389 |\n", + "| clip_fraction | 0.194 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -195 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.99 |\n", + "| n_updates | 3580 |\n", + "| policy_gradient_loss | -0.0172 |\n", + "| std | 1.71 |\n", + "| value_loss | 1.39e-08 |\n", + "-----------------------------------------\n", + "day: 888, episode: 830\n", + "begin_total_asset: 1000000.00\n", + "end_total_asset: 999988.98\n", + "total_reward: -11.02\n", + "total_cost: 0.16\n", + "total_trades: 39122\n", + "Sharpe: -1.447\n", + "=================================\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.162 |\n", + "| total_reward | -11 |\n", + "| total_reward_pct | -0.0011 |\n", + "| total_trades | 39122 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 360 |\n", + "| time_elapsed | 9925 |\n", + "| total_timesteps | 737280 |\n", + "| train/ | |\n", + "| approx_kl | 0.027599394 |\n", + "| clip_fraction | 0.19 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -195 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.01 |\n", + "| n_updates | 3590 |\n", + "| policy_gradient_loss | -0.019 |\n", + "| std | 1.71 |\n", + "| value_loss | 4.1e-09 |\n", + "-----------------------------------------\n", + "----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.163 |\n", + "| total_reward | -11.2 |\n", + "| total_reward_pct | -0.00112 |\n", + "| total_trades | 39181 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 361 |\n", + "| time_elapsed | 9953 |\n", + "| total_timesteps | 739328 |\n", + "| train/ | |\n", + "| approx_kl | 0.02660917 |\n", + "| clip_fraction | 0.195 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -195 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.94 |\n", + "| n_updates | 3600 |\n", + "| policy_gradient_loss | -0.0156 |\n", + "| std | 1.71 |\n", + "| value_loss | 3.22e-09 |\n", + "----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.157 |\n", + "| total_reward | -9.63 |\n", + "| total_reward_pct | -0.000963 |\n", + "| total_trades | 38870 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 362 |\n", + "| time_elapsed | 9980 |\n", + "| total_timesteps | 741376 |\n", + "| train/ | |\n", + "| approx_kl | 0.027372064 |\n", + "| clip_fraction | 0.208 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -195 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2 |\n", + "| n_updates | 3610 |\n", + "| policy_gradient_loss | -0.0231 |\n", + "| std | 1.71 |\n", + "| value_loss | 2.71e-09 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.156 |\n", + "| total_reward | -9.52 |\n", + "| total_reward_pct | -0.000952 |\n", + "| total_trades | 38972 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 363 |\n", + "| time_elapsed | 10007 |\n", + "| total_timesteps | 743424 |\n", + "| train/ | |\n", + "| approx_kl | 0.030951023 |\n", + "| clip_fraction | 0.176 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -196 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.03 |\n", + "| n_updates | 3620 |\n", + "| policy_gradient_loss | -0.0179 |\n", + "| std | 1.71 |\n", + "| value_loss | 2.62e-09 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.161 |\n", + "| total_reward | -10.3 |\n", + "| total_reward_pct | -0.00103 |\n", + "| total_trades | 39239 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 364 |\n", + "| time_elapsed | 10035 |\n", + "| total_timesteps | 745472 |\n", + "| train/ | |\n", + "| approx_kl | 0.016737726 |\n", + "| clip_fraction | 0.186 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -196 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.97 |\n", + "| n_updates | 3630 |\n", + "| policy_gradient_loss | -0.0184 |\n", + "| std | 1.72 |\n", + "| value_loss | 2.32e-09 |\n", + "-----------------------------------------\n", + "day: 888, episode: 840\n", + "begin_total_asset: 1000000.00\n", + "end_total_asset: 999986.44\n", + "total_reward: -13.56\n", + "total_cost: 0.16\n", + "total_trades: 39144\n", + "Sharpe: -1.438\n", + "=================================\n", + "----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.153 |\n", + "| total_reward | -10.5 |\n", + "| total_reward_pct | -0.00105 |\n", + "| total_trades | 38918 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 365 |\n", + "| time_elapsed | 10063 |\n", + "| total_timesteps | 747520 |\n", + "| train/ | |\n", + "| approx_kl | 0.03384235 |\n", + "| clip_fraction | 0.182 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -196 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.96 |\n", + "| n_updates | 3640 |\n", + "| policy_gradient_loss | -0.021 |\n", + "| std | 1.72 |\n", + "| value_loss | 3.21e-09 |\n", + "----------------------------------------\n", + "----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.164 |\n", + "| total_reward | -12.1 |\n", + "| total_reward_pct | -0.00121 |\n", + "| total_trades | 38938 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 366 |\n", + "| time_elapsed | 10090 |\n", + "| total_timesteps | 749568 |\n", + "| train/ | |\n", + "| approx_kl | 0.03497644 |\n", + "| clip_fraction | 0.177 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -196 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.97 |\n", + "| n_updates | 3650 |\n", + "| policy_gradient_loss | -0.0172 |\n", + "| std | 1.72 |\n", + "| value_loss | 2.72e-09 |\n", + "----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.15 |\n", + "| total_reward | -9.45 |\n", + "| total_reward_pct | -0.000945 |\n", + "| total_trades | 38945 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 367 |\n", + "| time_elapsed | 10117 |\n", + "| total_timesteps | 751616 |\n", + "| train/ | |\n", + "| approx_kl | 0.021814467 |\n", + "| clip_fraction | 0.178 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -196 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.98 |\n", + "| n_updates | 3660 |\n", + "| policy_gradient_loss | -0.0201 |\n", + "| std | 1.72 |\n", + "| value_loss | 2.69e-09 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.156 |\n", + "| total_reward | -10.4 |\n", + "| total_reward_pct | -0.00104 |\n", + "| total_trades | 38920 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 368 |\n", + "| time_elapsed | 10144 |\n", + "| total_timesteps | 753664 |\n", + "| train/ | |\n", + "| approx_kl | 0.028445056 |\n", + "| clip_fraction | 0.178 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -196 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.03 |\n", + "| n_updates | 3670 |\n", + "| policy_gradient_loss | -0.02 |\n", + "| std | 1.72 |\n", + "| value_loss | 2.51e-09 |\n", + "-----------------------------------------\n", + "day: 888, episode: 850\n", + "begin_total_asset: 1000000.00\n", + "end_total_asset: 999991.00\n", + "total_reward: -9.00\n", + "total_cost: 0.15\n", + "total_trades: 38910\n", + "Sharpe: -1.235\n", + "=================================\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.157 |\n", + "| total_reward | -11 |\n", + "| total_reward_pct | -0.0011 |\n", + "| total_trades | 39013 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 369 |\n", + "| time_elapsed | 10172 |\n", + "| total_timesteps | 755712 |\n", + "| train/ | |\n", + "| approx_kl | 0.032812368 |\n", + "| clip_fraction | 0.166 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -196 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.97 |\n", + "| n_updates | 3680 |\n", + "| policy_gradient_loss | -0.0162 |\n", + "| std | 1.73 |\n", + "| value_loss | 2.73e-09 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.152 |\n", + "| total_reward | -9.6 |\n", + "| total_reward_pct | -0.00096 |\n", + "| total_trades | 38957 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 370 |\n", + "| time_elapsed | 10199 |\n", + "| total_timesteps | 757760 |\n", + "| train/ | |\n", + "| approx_kl | 0.015129033 |\n", + "| clip_fraction | 0.155 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -196 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2 |\n", + "| n_updates | 3690 |\n", + "| policy_gradient_loss | -0.0164 |\n", + "| std | 1.73 |\n", + "| value_loss | 2.24e-09 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.158 |\n", + "| total_reward | -11.6 |\n", + "| total_reward_pct | -0.00116 |\n", + "| total_trades | 39076 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 371 |\n", + "| time_elapsed | 10226 |\n", + "| total_timesteps | 759808 |\n", + "| train/ | |\n", + "| approx_kl | 0.023234194 |\n", + "| clip_fraction | 0.205 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -196 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.01 |\n", + "| n_updates | 3700 |\n", + "| policy_gradient_loss | -0.024 |\n", + "| std | 1.73 |\n", + "| value_loss | 2.5e-09 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.159 |\n", + "| total_reward | -12 |\n", + "| total_reward_pct | -0.0012 |\n", + "| total_trades | 39090 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 372 |\n", + "| time_elapsed | 10253 |\n", + "| total_timesteps | 761856 |\n", + "| train/ | |\n", + "| approx_kl | 0.019770809 |\n", + "| clip_fraction | 0.171 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -197 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.96 |\n", + "| n_updates | 3710 |\n", + "| policy_gradient_loss | -0.0175 |\n", + "| std | 1.73 |\n", + "| value_loss | 2.71e-09 |\n", + "-----------------------------------------\n", + "day: 888, episode: 860\n", + "begin_total_asset: 1000000.00\n", + "end_total_asset: 999989.43\n", + "total_reward: -10.57\n", + "total_cost: 0.16\n", + "total_trades: 39094\n", + "Sharpe: -1.368\n", + "=================================\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.159 |\n", + "| total_reward | -10.6 |\n", + "| total_reward_pct | -0.00106 |\n", + "| total_trades | 39094 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 373 |\n", + "| time_elapsed | 10280 |\n", + "| total_timesteps | 763904 |\n", + "| train/ | |\n", + "| approx_kl | 0.023822403 |\n", + "| clip_fraction | 0.167 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -197 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.98 |\n", + "| n_updates | 3720 |\n", + "| policy_gradient_loss | -0.0154 |\n", + "| std | 1.73 |\n", + "| value_loss | 2.55e-09 |\n", + "-----------------------------------------\n", + "------------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.16 |\n", + "| total_reward | -14.1 |\n", + "| total_reward_pct | -0.00141 |\n", + "| total_trades | 39214 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 374 |\n", + "| time_elapsed | 10307 |\n", + "| total_timesteps | 765952 |\n", + "| train/ | |\n", + "| approx_kl | 0.0022615578 |\n", + "| clip_fraction | 0.185 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -197 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.98 |\n", + "| n_updates | 3730 |\n", + "| policy_gradient_loss | -0.0196 |\n", + "| std | 1.74 |\n", + "| value_loss | 2.74e-09 |\n", + "------------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.156 |\n", + "| total_reward | -10.7 |\n", + "| total_reward_pct | -0.00107 |\n", + "| total_trades | 39077 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 375 |\n", + "| time_elapsed | 10335 |\n", + "| total_timesteps | 768000 |\n", + "| train/ | |\n", + "| approx_kl | 0.028479263 |\n", + "| clip_fraction | 0.185 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -197 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.01 |\n", + "| n_updates | 3740 |\n", + "| policy_gradient_loss | -0.0192 |\n", + "| std | 1.74 |\n", + "| value_loss | 5.33e-09 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.156 |\n", + "| total_reward | -10.3 |\n", + "| total_reward_pct | -0.00103 |\n", + "| total_trades | 38781 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 376 |\n", + "| time_elapsed | 10362 |\n", + "| total_timesteps | 770048 |\n", + "| train/ | |\n", + "| approx_kl | 0.008925993 |\n", + "| clip_fraction | 0.181 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -197 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.03 |\n", + "| n_updates | 3750 |\n", + "| policy_gradient_loss | -0.02 |\n", + "| std | 1.74 |\n", + "| value_loss | 1.53e-08 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.157 |\n", + "| total_reward | -11.3 |\n", + "| total_reward_pct | -0.00113 |\n", + "| total_trades | 38919 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 377 |\n", + "| time_elapsed | 10389 |\n", + "| total_timesteps | 772096 |\n", + "| train/ | |\n", + "| approx_kl | 0.010865818 |\n", + "| clip_fraction | 0.199 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -197 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.98 |\n", + "| n_updates | 3760 |\n", + "| policy_gradient_loss | -0.0193 |\n", + "| std | 1.74 |\n", + "| value_loss | 1.83e-07 |\n", + "-----------------------------------------\n", + "day: 888, episode: 870\n", + "begin_total_asset: 1000000.00\n", + "end_total_asset: 999988.15\n", + "total_reward: -11.85\n", + "total_cost: 0.16\n", + "total_trades: 39000\n", + "Sharpe: -1.397\n", + "=================================\n", + "----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.156 |\n", + "| total_reward | -9.6 |\n", + "| total_reward_pct | -0.00096 |\n", + "| total_trades | 39004 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 378 |\n", + "| time_elapsed | 10416 |\n", + "| total_timesteps | 774144 |\n", + "| train/ | |\n", + "| approx_kl | 0.02581507 |\n", + "| clip_fraction | 0.168 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -197 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.94 |\n", + "| n_updates | 3770 |\n", + "| policy_gradient_loss | -0.0149 |\n", + "| std | 1.75 |\n", + "| value_loss | 6.65e-06 |\n", + "----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.154 |\n", + "| total_reward | -12.1 |\n", + "| total_reward_pct | -0.00121 |\n", + "| total_trades | 38922 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 379 |\n", + "| time_elapsed | 10444 |\n", + "| total_timesteps | 776192 |\n", + "| train/ | |\n", + "| approx_kl | 0.047333043 |\n", + "| clip_fraction | 0.189 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -198 |\n", + "| explained_variance | -5.17e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.01 |\n", + "| n_updates | 3780 |\n", + "| policy_gradient_loss | -0.0172 |\n", + "| std | 1.75 |\n", + "| value_loss | 3.91e-05 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.155 |\n", + "| total_reward | -9.61 |\n", + "| total_reward_pct | -0.000961 |\n", + "| total_trades | 39146 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 380 |\n", + "| time_elapsed | 10471 |\n", + "| total_timesteps | 778240 |\n", + "| train/ | |\n", + "| approx_kl | 0.029071689 |\n", + "| clip_fraction | 0.195 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -198 |\n", + "| explained_variance | -1.23e+12 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.02 |\n", + "| n_updates | 3790 |\n", + "| policy_gradient_loss | -0.019 |\n", + "| std | 1.75 |\n", + "| value_loss | 4.41e-05 |\n", + "-----------------------------------------\n", + "----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.156 |\n", + "| total_reward | -10.8 |\n", + "| total_reward_pct | -0.00108 |\n", + "| total_trades | 39139 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 381 |\n", + "| time_elapsed | 10497 |\n", + "| total_timesteps | 780288 |\n", + "| train/ | |\n", + "| approx_kl | 0.04372563 |\n", + "| clip_fraction | 0.179 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -198 |\n", + "| explained_variance | -1.49e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.01 |\n", + "| n_updates | 3800 |\n", + "| policy_gradient_loss | -0.0155 |\n", + "| std | 1.76 |\n", + "| value_loss | 3.08e-05 |\n", + "----------------------------------------\n", + "day: 888, episode: 880\n", + "begin_total_asset: 1000000.00\n", + "end_total_asset: 999990.47\n", + "total_reward: -9.53\n", + "total_cost: 0.15\n", + "total_trades: 39165\n", + "Sharpe: -1.219\n", + "=================================\n", + "------------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.154 |\n", + "| total_reward | -10.9 |\n", + "| total_reward_pct | -0.00109 |\n", + "| total_trades | 39199 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 382 |\n", + "| time_elapsed | 10524 |\n", + "| total_timesteps | 782336 |\n", + "| train/ | |\n", + "| approx_kl | 0.0072470307 |\n", + "| clip_fraction | 0.194 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -198 |\n", + "| explained_variance | -5.09e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.01 |\n", + "| n_updates | 3810 |\n", + "| policy_gradient_loss | -0.0195 |\n", + "| std | 1.76 |\n", + "| value_loss | 0.000394 |\n", + "------------------------------------------\n", + "----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.161 |\n", + "| total_reward | -10.2 |\n", + "| total_reward_pct | -0.00102 |\n", + "| total_trades | 39106 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 383 |\n", + "| time_elapsed | 10551 |\n", + "| total_timesteps | 784384 |\n", + "| train/ | |\n", + "| approx_kl | 0.03162041 |\n", + "| clip_fraction | 0.193 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -198 |\n", + "| explained_variance | -1.71e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.03 |\n", + "| n_updates | 3820 |\n", + "| policy_gradient_loss | -0.0173 |\n", + "| std | 1.76 |\n", + "| value_loss | 0.000724 |\n", + "----------------------------------------\n", + "----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.153 |\n", + "| total_reward | -10.5 |\n", + "| total_reward_pct | -0.00105 |\n", + "| total_trades | 39058 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 384 |\n", + "| time_elapsed | 10578 |\n", + "| total_timesteps | 786432 |\n", + "| train/ | |\n", + "| approx_kl | 0.04205137 |\n", + "| clip_fraction | 0.172 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -198 |\n", + "| explained_variance | -8.36e+10 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2 |\n", + "| n_updates | 3830 |\n", + "| policy_gradient_loss | -0.0173 |\n", + "| std | 1.77 |\n", + "| value_loss | 0.000324 |\n", + "----------------------------------------\n", + "----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.154 |\n", + "| total_reward | -12.3 |\n", + "| total_reward_pct | -0.00123 |\n", + "| total_trades | 39055 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 385 |\n", + "| time_elapsed | 10605 |\n", + "| total_timesteps | 788480 |\n", + "| train/ | |\n", + "| approx_kl | 0.02192598 |\n", + "| clip_fraction | 0.209 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -199 |\n", + "| explained_variance | -2.4e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.96 |\n", + "| n_updates | 3840 |\n", + "| policy_gradient_loss | -0.0147 |\n", + "| std | 1.77 |\n", + "| value_loss | 0.000108 |\n", + "----------------------------------------\n", + "day: 888, episode: 890\n", + "begin_total_asset: 1000000.00\n", + "end_total_asset: 999989.72\n", + "total_reward: -10.28\n", + "total_cost: 0.15\n", + "total_trades: 39159\n", + "Sharpe: -1.308\n", + "=================================\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.15 |\n", + "| total_reward | -10.3 |\n", + "| total_reward_pct | -0.00103 |\n", + "| total_trades | 39159 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 386 |\n", + "| time_elapsed | 10633 |\n", + "| total_timesteps | 790528 |\n", + "| train/ | |\n", + "| approx_kl | 0.020575972 |\n", + "| clip_fraction | 0.215 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -199 |\n", + "| explained_variance | -6.97e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.01 |\n", + "| n_updates | 3850 |\n", + "| policy_gradient_loss | -0.0175 |\n", + "| std | 1.77 |\n", + "| value_loss | 7.13e-05 |\n", + "-----------------------------------------\n", + "----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.153 |\n", + "| total_reward | -11.5 |\n", + "| total_reward_pct | -0.00115 |\n", + "| total_trades | 39158 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 387 |\n", + "| time_elapsed | 10660 |\n", + "| total_timesteps | 792576 |\n", + "| train/ | |\n", + "| approx_kl | 0.01843707 |\n", + "| clip_fraction | 0.206 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -199 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.03 |\n", + "| n_updates | 3860 |\n", + "| policy_gradient_loss | -0.0171 |\n", + "| std | 1.78 |\n", + "| value_loss | 6.77e-05 |\n", + "----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.157 |\n", + "| total_reward | -12.2 |\n", + "| total_reward_pct | -0.00122 |\n", + "| total_trades | 39308 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 388 |\n", + "| time_elapsed | 10687 |\n", + "| total_timesteps | 794624 |\n", + "| train/ | |\n", + "| approx_kl | 0.024386005 |\n", + "| clip_fraction | 0.212 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -199 |\n", + "| explained_variance | -1.66e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.03 |\n", + "| n_updates | 3870 |\n", + "| policy_gradient_loss | -0.0175 |\n", + "| std | 1.78 |\n", + "| value_loss | 4.11e-05 |\n", + "-----------------------------------------\n", + "----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.154 |\n", + "| total_reward | -11 |\n", + "| total_reward_pct | -0.0011 |\n", + "| total_trades | 39362 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 389 |\n", + "| time_elapsed | 10714 |\n", + "| total_timesteps | 796672 |\n", + "| train/ | |\n", + "| approx_kl | 0.02403603 |\n", + "| clip_fraction | 0.217 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -199 |\n", + "| explained_variance | -2.67e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.05 |\n", + "| n_updates | 3880 |\n", + "| policy_gradient_loss | -0.0179 |\n", + "| std | 1.78 |\n", + "| value_loss | 2.85e-05 |\n", + "----------------------------------------\n", + "----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.153 |\n", + "| total_reward | -11 |\n", + "| total_reward_pct | -0.0011 |\n", + "| total_trades | 39322 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 390 |\n", + "| time_elapsed | 10741 |\n", + "| total_timesteps | 798720 |\n", + "| train/ | |\n", + "| approx_kl | 0.03614287 |\n", + "| clip_fraction | 0.269 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -200 |\n", + "| explained_variance | -2.75e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.04 |\n", + "| n_updates | 3890 |\n", + "| policy_gradient_loss | -0.0211 |\n", + "| std | 1.79 |\n", + "| value_loss | 2.7e-05 |\n", + "----------------------------------------\n", + "day: 888, episode: 900\n", + "begin_total_asset: 1000000.00\n", + "end_total_asset: 999988.60\n", + "total_reward: -11.40\n", + "total_cost: 0.15\n", + "total_trades: 39318\n", + "Sharpe: -1.214\n", + "=================================\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.154 |\n", + "| total_reward | -12.6 |\n", + "| total_reward_pct | -0.00126 |\n", + "| total_trades | 39229 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 391 |\n", + "| time_elapsed | 10768 |\n", + "| total_timesteps | 800768 |\n", + "| train/ | |\n", + "| approx_kl | 0.022796465 |\n", + "| clip_fraction | 0.229 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -200 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2 |\n", + "| n_updates | 3900 |\n", + "| policy_gradient_loss | -0.0202 |\n", + "| std | 1.79 |\n", + "| value_loss | 1.51e-05 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.155 |\n", + "| total_reward | -12.4 |\n", + "| total_reward_pct | -0.00124 |\n", + "| total_trades | 39565 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 392 |\n", + "| time_elapsed | 10795 |\n", + "| total_timesteps | 802816 |\n", + "| train/ | |\n", + "| approx_kl | 0.032305937 |\n", + "| clip_fraction | 0.212 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -200 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.04 |\n", + "| n_updates | 3910 |\n", + "| policy_gradient_loss | -0.0178 |\n", + "| std | 1.79 |\n", + "| value_loss | 1.21e-05 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.161 |\n", + "| total_reward | -9.38 |\n", + "| total_reward_pct | -0.000938 |\n", + "| total_trades | 39537 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 393 |\n", + "| time_elapsed | 10822 |\n", + "| total_timesteps | 804864 |\n", + "| train/ | |\n", + "| approx_kl | 0.020728357 |\n", + "| clip_fraction | 0.208 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -200 |\n", + "| explained_variance | -3.09e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.03 |\n", + "| n_updates | 3920 |\n", + "| policy_gradient_loss | -0.0194 |\n", + "| std | 1.79 |\n", + "| value_loss | 1.3e-05 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.161 |\n", + "| total_reward | -12.6 |\n", + "| total_reward_pct | -0.00126 |\n", + "| total_trades | 39425 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 394 |\n", + "| time_elapsed | 10849 |\n", + "| total_timesteps | 806912 |\n", + "| train/ | |\n", + "| approx_kl | 0.010652519 |\n", + "| clip_fraction | 0.195 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -200 |\n", + "| explained_variance | -4.43e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.03 |\n", + "| n_updates | 3930 |\n", + "| policy_gradient_loss | -0.0192 |\n", + "| std | 1.8 |\n", + "| value_loss | 7.52e-06 |\n", + "-----------------------------------------\n", + "day: 888, episode: 910\n", + "begin_total_asset: 1000000.00\n", + "end_total_asset: 999987.48\n", + "total_reward: -12.52\n", + "total_cost: 0.16\n", + "total_trades: 39470\n", + "Sharpe: -1.352\n", + "=================================\n", + "----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.159 |\n", + "| total_reward | -12.5 |\n", + "| total_reward_pct | -0.00125 |\n", + "| total_trades | 39470 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 395 |\n", + "| time_elapsed | 10876 |\n", + "| total_timesteps | 808960 |\n", + "| train/ | |\n", + "| approx_kl | 0.03471731 |\n", + "| clip_fraction | 0.229 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -200 |\n", + "| explained_variance | -9.05e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.03 |\n", + "| n_updates | 3940 |\n", + "| policy_gradient_loss | -0.0168 |\n", + "| std | 1.8 |\n", + "| value_loss | 6.05e-06 |\n", + "----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.161 |\n", + "| total_reward | -11.2 |\n", + "| total_reward_pct | -0.00112 |\n", + "| total_trades | 39635 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 396 |\n", + "| time_elapsed | 10903 |\n", + "| total_timesteps | 811008 |\n", + "| train/ | |\n", + "| approx_kl | 0.020472579 |\n", + "| clip_fraction | 0.224 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -201 |\n", + "| explained_variance | -1.02e+12 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.02 |\n", + "| n_updates | 3950 |\n", + "| policy_gradient_loss | -0.0153 |\n", + "| std | 1.8 |\n", + "| value_loss | 3.76e-06 |\n", + "-----------------------------------------\n", + "----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.154 |\n", + "| total_reward | -9.73 |\n", + "| total_reward_pct | -0.000973 |\n", + "| total_trades | 39341 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 397 |\n", + "| time_elapsed | 10930 |\n", + "| total_timesteps | 813056 |\n", + "| train/ | |\n", + "| approx_kl | 0.02167766 |\n", + "| clip_fraction | 0.207 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -201 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2 |\n", + "| n_updates | 3960 |\n", + "| policy_gradient_loss | -0.0169 |\n", + "| std | 1.81 |\n", + "| value_loss | 2.67e-06 |\n", + "----------------------------------------\n", + "----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.152 |\n", + "| total_reward | -10 |\n", + "| total_reward_pct | -0.001 |\n", + "| total_trades | 39355 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 398 |\n", + "| time_elapsed | 10958 |\n", + "| total_timesteps | 815104 |\n", + "| train/ | |\n", + "| approx_kl | 0.02397961 |\n", + "| clip_fraction | 0.187 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -201 |\n", + "| explained_variance | -2.81e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.03 |\n", + "| n_updates | 3970 |\n", + "| policy_gradient_loss | -0.0164 |\n", + "| std | 1.81 |\n", + "| value_loss | 2.05e-06 |\n", + "----------------------------------------\n", + "day: 888, episode: 920\n", + "begin_total_asset: 1000000.00\n", + "end_total_asset: 999988.80\n", + "total_reward: -11.20\n", + "total_cost: 0.15\n", + "total_trades: 39454\n", + "Sharpe: -1.326\n", + "=================================\n", + "------------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.15 |\n", + "| total_reward | -11.2 |\n", + "| total_reward_pct | -0.00112 |\n", + "| total_trades | 39454 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 399 |\n", + "| time_elapsed | 10984 |\n", + "| total_timesteps | 817152 |\n", + "| train/ | |\n", + "| approx_kl | 0.0120703345 |\n", + "| clip_fraction | 0.149 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -201 |\n", + "| explained_variance | -5.99e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.02 |\n", + "| n_updates | 3980 |\n", + "| policy_gradient_loss | -0.0159 |\n", + "| std | 1.81 |\n", + "| value_loss | 8.27e-08 |\n", + "------------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.153 |\n", + "| total_reward | -10.9 |\n", + "| total_reward_pct | -0.00109 |\n", + "| total_trades | 39404 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 400 |\n", + "| time_elapsed | 11011 |\n", + "| total_timesteps | 819200 |\n", + "| train/ | |\n", + "| approx_kl | 0.026942408 |\n", + "| clip_fraction | 0.185 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -201 |\n", + "| explained_variance | -2.57e+12 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.06 |\n", + "| n_updates | 3990 |\n", + "| policy_gradient_loss | -0.02 |\n", + "| std | 1.82 |\n", + "| value_loss | 1.22e-08 |\n", + "-----------------------------------------\n", + "---------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.153 |\n", + "| total_reward | -10.1 |\n", + "| total_reward_pct | -0.00101 |\n", + "| total_trades | 39516 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 401 |\n", + "| time_elapsed | 11038 |\n", + "| total_timesteps | 821248 |\n", + "| train/ | |\n", + "| approx_kl | 0.0221911 |\n", + "| clip_fraction | 0.174 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -201 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.07 |\n", + "| n_updates | 4000 |\n", + "| policy_gradient_loss | -0.0205 |\n", + "| std | 1.82 |\n", + "| value_loss | 9.76e-09 |\n", + "---------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.149 |\n", + "| total_reward | -11.5 |\n", + "| total_reward_pct | -0.00115 |\n", + "| total_trades | 39392 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 402 |\n", + "| time_elapsed | 11065 |\n", + "| total_timesteps | 823296 |\n", + "| train/ | |\n", + "| approx_kl | 0.027473932 |\n", + "| clip_fraction | 0.169 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -202 |\n", + "| explained_variance | -4.45e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -1.99 |\n", + "| n_updates | 4010 |\n", + "| policy_gradient_loss | -0.0156 |\n", + "| std | 1.82 |\n", + "| value_loss | 7.51e-09 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.149 |\n", + "| total_reward | -10.5 |\n", + "| total_reward_pct | -0.00105 |\n", + "| total_trades | 39170 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 403 |\n", + "| time_elapsed | 11092 |\n", + "| total_timesteps | 825344 |\n", + "| train/ | |\n", + "| approx_kl | 0.017895691 |\n", + "| clip_fraction | 0.19 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -202 |\n", + "| explained_variance | -4.49e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.03 |\n", + "| n_updates | 4020 |\n", + "| policy_gradient_loss | -0.0189 |\n", + "| std | 1.82 |\n", + "| value_loss | 8.03e-09 |\n", + "-----------------------------------------\n", + "day: 888, episode: 930\n", + "begin_total_asset: 1000000.00\n", + "end_total_asset: 999988.90\n", + "total_reward: -11.10\n", + "total_cost: 0.15\n", + "total_trades: 39294\n", + "Sharpe: -1.341\n", + "=================================\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.146 |\n", + "| total_reward | -9.67 |\n", + "| total_reward_pct | -0.000967 |\n", + "| total_trades | 39250 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 404 |\n", + "| time_elapsed | 11119 |\n", + "| total_timesteps | 827392 |\n", + "| train/ | |\n", + "| approx_kl | 0.013904025 |\n", + "| clip_fraction | 0.157 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -202 |\n", + "| explained_variance | -5.63e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.03 |\n", + "| n_updates | 4030 |\n", + "| policy_gradient_loss | -0.0172 |\n", + "| std | 1.83 |\n", + "| value_loss | 7.09e-09 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.154 |\n", + "| total_reward | -9.55 |\n", + "| total_reward_pct | -0.000955 |\n", + "| total_trades | 39329 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 405 |\n", + "| time_elapsed | 11146 |\n", + "| total_timesteps | 829440 |\n", + "| train/ | |\n", + "| approx_kl | 0.020906538 |\n", + "| clip_fraction | 0.2 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -202 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.04 |\n", + "| n_updates | 4040 |\n", + "| policy_gradient_loss | -0.0207 |\n", + "| std | 1.83 |\n", + "| value_loss | 5.49e-09 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.15 |\n", + "| total_reward | -9.17 |\n", + "| total_reward_pct | -0.000917 |\n", + "| total_trades | 39517 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 406 |\n", + "| time_elapsed | 11173 |\n", + "| total_timesteps | 831488 |\n", + "| train/ | |\n", + "| approx_kl | 0.029486045 |\n", + "| clip_fraction | 0.177 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -202 |\n", + "| explained_variance | -1.21e+12 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.02 |\n", + "| n_updates | 4050 |\n", + "| policy_gradient_loss | -0.0178 |\n", + "| std | 1.83 |\n", + "| value_loss | 4.85e-09 |\n", + "-----------------------------------------\n", + "------------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.152 |\n", + "| total_reward | -10.6 |\n", + "| total_reward_pct | -0.00106 |\n", + "| total_trades | 39421 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 407 |\n", + "| time_elapsed | 11200 |\n", + "| total_timesteps | 833536 |\n", + "| train/ | |\n", + "| approx_kl | 0.0151585825 |\n", + "| clip_fraction | 0.177 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -202 |\n", + "| explained_variance | -8.33e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.03 |\n", + "| n_updates | 4060 |\n", + "| policy_gradient_loss | -0.0203 |\n", + "| std | 1.83 |\n", + "| value_loss | 3.21e-09 |\n", + "------------------------------------------\n", + "day: 888, episode: 940\n", + "begin_total_asset: 1000000.00\n", + "end_total_asset: 999989.36\n", + "total_reward: -10.64\n", + "total_cost: 0.15\n", + "total_trades: 39183\n", + "Sharpe: -1.363\n", + "=================================\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.146 |\n", + "| total_reward | -10.6 |\n", + "| total_reward_pct | -0.00106 |\n", + "| total_trades | 39183 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 408 |\n", + "| time_elapsed | 11227 |\n", + "| total_timesteps | 835584 |\n", + "| train/ | |\n", + "| approx_kl | 0.031367093 |\n", + "| clip_fraction | 0.196 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -202 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.02 |\n", + "| n_updates | 4070 |\n", + "| policy_gradient_loss | -0.0211 |\n", + "| std | 1.84 |\n", + "| value_loss | 3.12e-09 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.15 |\n", + "| total_reward | -11.9 |\n", + "| total_reward_pct | -0.00119 |\n", + "| total_trades | 39567 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 409 |\n", + "| time_elapsed | 11254 |\n", + "| total_timesteps | 837632 |\n", + "| train/ | |\n", + "| approx_kl | 0.013169815 |\n", + "| clip_fraction | 0.2 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -202 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.08 |\n", + "| n_updates | 4080 |\n", + "| policy_gradient_loss | -0.0214 |\n", + "| std | 1.84 |\n", + "| value_loss | 2.85e-09 |\n", + "-----------------------------------------\n", + "----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.15 |\n", + "| total_reward | -10.5 |\n", + "| total_reward_pct | -0.00105 |\n", + "| total_trades | 39411 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 410 |\n", + "| time_elapsed | 11281 |\n", + "| total_timesteps | 839680 |\n", + "| train/ | |\n", + "| approx_kl | 0.03218897 |\n", + "| clip_fraction | 0.21 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -203 |\n", + "| explained_variance | -3.54e+12 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.07 |\n", + "| n_updates | 4090 |\n", + "| policy_gradient_loss | -0.0218 |\n", + "| std | 1.84 |\n", + "| value_loss | 3.24e-09 |\n", + "----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.157 |\n", + "| total_reward | -11 |\n", + "| total_reward_pct | -0.0011 |\n", + "| total_trades | 39203 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 411 |\n", + "| time_elapsed | 11308 |\n", + "| total_timesteps | 841728 |\n", + "| train/ | |\n", + "| approx_kl | 0.035989754 |\n", + "| clip_fraction | 0.215 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -203 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.03 |\n", + "| n_updates | 4100 |\n", + "| policy_gradient_loss | -0.0216 |\n", + "| std | 1.84 |\n", + "| value_loss | 2.72e-09 |\n", + "-----------------------------------------\n", + "day: 888, episode: 950\n", + "begin_total_asset: 1000000.00\n", + "end_total_asset: 999989.02\n", + "total_reward: -10.98\n", + "total_cost: 0.15\n", + "total_trades: 39335\n", + "Sharpe: -1.405\n", + "=================================\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.15 |\n", + "| total_reward | -11 |\n", + "| total_reward_pct | -0.0011 |\n", + "| total_trades | 39335 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 412 |\n", + "| time_elapsed | 11335 |\n", + "| total_timesteps | 843776 |\n", + "| train/ | |\n", + "| approx_kl | 0.014233437 |\n", + "| clip_fraction | 0.156 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -203 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.07 |\n", + "| n_updates | 4110 |\n", + "| policy_gradient_loss | -0.0141 |\n", + "| std | 1.84 |\n", + "| value_loss | 3.41e-09 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.145 |\n", + "| total_reward | -12.4 |\n", + "| total_reward_pct | -0.00124 |\n", + "| total_trades | 39136 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 413 |\n", + "| time_elapsed | 11362 |\n", + "| total_timesteps | 845824 |\n", + "| train/ | |\n", + "| approx_kl | 0.025862841 |\n", + "| clip_fraction | 0.174 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -203 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.07 |\n", + "| n_updates | 4120 |\n", + "| policy_gradient_loss | -0.0224 |\n", + "| std | 1.85 |\n", + "| value_loss | 2.63e-09 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.154 |\n", + "| total_reward | -11 |\n", + "| total_reward_pct | -0.0011 |\n", + "| total_trades | 39285 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 414 |\n", + "| time_elapsed | 11389 |\n", + "| total_timesteps | 847872 |\n", + "| train/ | |\n", + "| approx_kl | 0.021910353 |\n", + "| clip_fraction | 0.19 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -203 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.06 |\n", + "| n_updates | 4130 |\n", + "| policy_gradient_loss | -0.0185 |\n", + "| std | 1.85 |\n", + "| value_loss | 2.88e-09 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.147 |\n", + "| total_reward | -10.8 |\n", + "| total_reward_pct | -0.00108 |\n", + "| total_trades | 39080 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 415 |\n", + "| time_elapsed | 11416 |\n", + "| total_timesteps | 849920 |\n", + "| train/ | |\n", + "| approx_kl | 0.010151172 |\n", + "| clip_fraction | 0.208 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -203 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.05 |\n", + "| n_updates | 4140 |\n", + "| policy_gradient_loss | -0.0213 |\n", + "| std | 1.85 |\n", + "| value_loss | 2.85e-09 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.148 |\n", + "| total_reward | -10.3 |\n", + "| total_reward_pct | -0.00103 |\n", + "| total_trades | 39207 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 416 |\n", + "| time_elapsed | 11443 |\n", + "| total_timesteps | 851968 |\n", + "| train/ | |\n", + "| approx_kl | 0.008002169 |\n", + "| clip_fraction | 0.177 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -203 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.03 |\n", + "| n_updates | 4150 |\n", + "| policy_gradient_loss | -0.0167 |\n", + "| std | 1.85 |\n", + "| value_loss | 2.44e-09 |\n", + "-----------------------------------------\n", + "day: 888, episode: 960\n", + "begin_total_asset: 1000000.00\n", + "end_total_asset: 999989.49\n", + "total_reward: -10.51\n", + "total_cost: 0.15\n", + "total_trades: 39005\n", + "Sharpe: -1.368\n", + "=================================\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.15 |\n", + "| total_reward | -8.5 |\n", + "| total_reward_pct | -0.00085 |\n", + "| total_trades | 39293 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 417 |\n", + "| time_elapsed | 11470 |\n", + "| total_timesteps | 854016 |\n", + "| train/ | |\n", + "| approx_kl | 0.012712584 |\n", + "| clip_fraction | 0.193 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -203 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.04 |\n", + "| n_updates | 4160 |\n", + "| policy_gradient_loss | -0.0199 |\n", + "| std | 1.86 |\n", + "| value_loss | 2.39e-09 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.151 |\n", + "| total_reward | -8.93 |\n", + "| total_reward_pct | -0.000893 |\n", + "| total_trades | 39254 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 418 |\n", + "| time_elapsed | 11497 |\n", + "| total_timesteps | 856064 |\n", + "| train/ | |\n", + "| approx_kl | 0.016112706 |\n", + "| clip_fraction | 0.177 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -204 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.05 |\n", + "| n_updates | 4170 |\n", + "| policy_gradient_loss | -0.0219 |\n", + "| std | 1.86 |\n", + "| value_loss | 2.37e-09 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.15 |\n", + "| total_reward | -10.5 |\n", + "| total_reward_pct | -0.00105 |\n", + "| total_trades | 39205 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 419 |\n", + "| time_elapsed | 11524 |\n", + "| total_timesteps | 858112 |\n", + "| train/ | |\n", + "| approx_kl | 0.027471555 |\n", + "| clip_fraction | 0.177 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -204 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.09 |\n", + "| n_updates | 4180 |\n", + "| policy_gradient_loss | -0.018 |\n", + "| std | 1.86 |\n", + "| value_loss | 2.43e-09 |\n", + "-----------------------------------------\n", + "----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.149 |\n", + "| total_reward | -11.7 |\n", + "| total_reward_pct | -0.00117 |\n", + "| total_trades | 39374 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 420 |\n", + "| time_elapsed | 11551 |\n", + "| total_timesteps | 860160 |\n", + "| train/ | |\n", + "| approx_kl | 0.01020901 |\n", + "| clip_fraction | 0.195 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -204 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.09 |\n", + "| n_updates | 4190 |\n", + "| policy_gradient_loss | -0.0224 |\n", + "| std | 1.86 |\n", + "| value_loss | 2.11e-09 |\n", + "----------------------------------------\n", + "day: 888, episode: 970\n", + "begin_total_asset: 1000000.00\n", + "end_total_asset: 999989.95\n", + "total_reward: -10.05\n", + "total_cost: 0.15\n", + "total_trades: 39241\n", + "Sharpe: -1.303\n", + "=================================\n", + "----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.148 |\n", + "| total_reward | -10.1 |\n", + "| total_reward_pct | -0.00101 |\n", + "| total_trades | 39241 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 421 |\n", + "| time_elapsed | 11578 |\n", + "| total_timesteps | 862208 |\n", + "| train/ | |\n", + "| approx_kl | 0.02413316 |\n", + "| clip_fraction | 0.188 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -204 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.04 |\n", + "| n_updates | 4200 |\n", + "| policy_gradient_loss | -0.0213 |\n", + "| std | 1.86 |\n", + "| value_loss | 2.85e-09 |\n", + "----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.15 |\n", + "| total_reward | -11.9 |\n", + "| total_reward_pct | -0.00119 |\n", + "| total_trades | 39387 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 422 |\n", + "| time_elapsed | 11605 |\n", + "| total_timesteps | 864256 |\n", + "| train/ | |\n", + "| approx_kl | 0.012216568 |\n", + "| clip_fraction | 0.151 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -204 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.05 |\n", + "| n_updates | 4210 |\n", + "| policy_gradient_loss | -0.019 |\n", + "| std | 1.86 |\n", + "| value_loss | 3.41e-09 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.153 |\n", + "| total_reward | -9.72 |\n", + "| total_reward_pct | -0.000972 |\n", + "| total_trades | 39279 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 423 |\n", + "| time_elapsed | 11632 |\n", + "| total_timesteps | 866304 |\n", + "| train/ | |\n", + "| approx_kl | 0.028423777 |\n", + "| clip_fraction | 0.175 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -204 |\n", + "| explained_variance | -3.31e+12 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.07 |\n", + "| n_updates | 4220 |\n", + "| policy_gradient_loss | -0.0166 |\n", + "| std | 1.87 |\n", + "| value_loss | 7.79e-09 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.153 |\n", + "| total_reward | -8.86 |\n", + "| total_reward_pct | -0.000886 |\n", + "| total_trades | 39308 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 424 |\n", + "| time_elapsed | 11659 |\n", + "| total_timesteps | 868352 |\n", + "| train/ | |\n", + "| approx_kl | 0.035595994 |\n", + "| clip_fraction | 0.163 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -204 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.09 |\n", + "| n_updates | 4230 |\n", + "| policy_gradient_loss | -0.0179 |\n", + "| std | 1.87 |\n", + "| value_loss | 7.38e-08 |\n", + "-----------------------------------------\n", + "day: 888, episode: 980\n", + "begin_total_asset: 1000000.00\n", + "end_total_asset: 999991.20\n", + "total_reward: -8.80\n", + "total_cost: 0.16\n", + "total_trades: 39404\n", + "Sharpe: -1.251\n", + "=================================\n", + "----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.157 |\n", + "| total_reward | -8.8 |\n", + "| total_reward_pct | -0.00088 |\n", + "| total_trades | 39404 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 425 |\n", + "| time_elapsed | 11686 |\n", + "| total_timesteps | 870400 |\n", + "| train/ | |\n", + "| approx_kl | 0.04814911 |\n", + "| clip_fraction | 0.18 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -204 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.07 |\n", + "| n_updates | 4240 |\n", + "| policy_gradient_loss | -0.0195 |\n", + "| std | 1.87 |\n", + "| value_loss | 1.19e-06 |\n", + "----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.157 |\n", + "| total_reward | -10.5 |\n", + "| total_reward_pct | -0.00105 |\n", + "| total_trades | 39296 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 426 |\n", + "| time_elapsed | 11713 |\n", + "| total_timesteps | 872448 |\n", + "| train/ | |\n", + "| approx_kl | 0.012300114 |\n", + "| clip_fraction | 0.212 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -204 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.04 |\n", + "| n_updates | 4250 |\n", + "| policy_gradient_loss | -0.0162 |\n", + "| std | 1.87 |\n", + "| value_loss | 1.44e-05 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.151 |\n", + "| total_reward | -10.9 |\n", + "| total_reward_pct | -0.00109 |\n", + "| total_trades | 39152 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 427 |\n", + "| time_elapsed | 11740 |\n", + "| total_timesteps | 874496 |\n", + "| train/ | |\n", + "| approx_kl | 0.029178271 |\n", + "| clip_fraction | 0.188 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -205 |\n", + "| explained_variance | -2.03e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.04 |\n", + "| n_updates | 4260 |\n", + "| policy_gradient_loss | -0.0136 |\n", + "| std | 1.88 |\n", + "| value_loss | 3.89e-05 |\n", + "-----------------------------------------\n", + "--------------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.152 |\n", + "| total_reward | -11.3 |\n", + "| total_reward_pct | -0.00113 |\n", + "| total_trades | 39302 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 428 |\n", + "| time_elapsed | 11767 |\n", + "| total_timesteps | 876544 |\n", + "| train/ | |\n", + "| approx_kl | -0.00056513894 |\n", + "| clip_fraction | 0.211 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -205 |\n", + "| explained_variance | -2.99e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.08 |\n", + "| n_updates | 4270 |\n", + "| policy_gradient_loss | -0.0173 |\n", + "| std | 1.88 |\n", + "| value_loss | 0.000132 |\n", + "--------------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.158 |\n", + "| total_reward | -7.68 |\n", + "| total_reward_pct | -0.000768 |\n", + "| total_trades | 39204 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 429 |\n", + "| time_elapsed | 11793 |\n", + "| total_timesteps | 878592 |\n", + "| train/ | |\n", + "| approx_kl | 0.044785354 |\n", + "| clip_fraction | 0.192 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -205 |\n", + "| explained_variance | -6.51e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.06 |\n", + "| n_updates | 4280 |\n", + "| policy_gradient_loss | -0.0149 |\n", + "| std | 1.88 |\n", + "| value_loss | 0.00012 |\n", + "-----------------------------------------\n", + "day: 888, episode: 990\n", + "begin_total_asset: 1000000.00\n", + "end_total_asset: 999988.89\n", + "total_reward: -11.11\n", + "total_cost: 0.16\n", + "total_trades: 39222\n", + "Sharpe: -1.312\n", + "=================================\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.154 |\n", + "| total_reward | -10.3 |\n", + "| total_reward_pct | -0.00103 |\n", + "| total_trades | 39185 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 430 |\n", + "| time_elapsed | 11820 |\n", + "| total_timesteps | 880640 |\n", + "| train/ | |\n", + "| approx_kl | 0.041320894 |\n", + "| clip_fraction | 0.204 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -205 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.08 |\n", + "| n_updates | 4290 |\n", + "| policy_gradient_loss | -0.0155 |\n", + "| std | 1.89 |\n", + "| value_loss | 0.000431 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.163 |\n", + "| total_reward | -9.44 |\n", + "| total_reward_pct | -0.000944 |\n", + "| total_trades | 39169 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 431 |\n", + "| time_elapsed | 11847 |\n", + "| total_timesteps | 882688 |\n", + "| train/ | |\n", + "| approx_kl | 0.045572445 |\n", + "| clip_fraction | 0.194 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -205 |\n", + "| explained_variance | -6.74e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.06 |\n", + "| n_updates | 4300 |\n", + "| policy_gradient_loss | -0.0152 |\n", + "| std | 1.89 |\n", + "| value_loss | 0.000257 |\n", + "-----------------------------------------\n", + "----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.161 |\n", + "| total_reward | -11.4 |\n", + "| total_reward_pct | -0.00114 |\n", + "| total_trades | 39115 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 432 |\n", + "| time_elapsed | 11875 |\n", + "| total_timesteps | 884736 |\n", + "| train/ | |\n", + "| approx_kl | 0.01570109 |\n", + "| clip_fraction | 0.209 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -205 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.08 |\n", + "| n_updates | 4310 |\n", + "| policy_gradient_loss | -0.0149 |\n", + "| std | 1.89 |\n", + "| value_loss | 4.21e-06 |\n", + "----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.16 |\n", + "| total_reward | -7.71 |\n", + "| total_reward_pct | -0.000771 |\n", + "| total_trades | 39223 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 433 |\n", + "| time_elapsed | 11902 |\n", + "| total_timesteps | 886784 |\n", + "| train/ | |\n", + "| approx_kl | 0.042489883 |\n", + "| clip_fraction | 0.212 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -206 |\n", + "| explained_variance | -2.07e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.09 |\n", + "| n_updates | 4320 |\n", + "| policy_gradient_loss | -0.0191 |\n", + "| std | 1.9 |\n", + "| value_loss | 1.99e-06 |\n", + "-----------------------------------------\n", + "day: 888, episode: 1000\n", + "begin_total_asset: 1000000.00\n", + "end_total_asset: 999989.16\n", + "total_reward: -10.84\n", + "total_cost: 0.17\n", + "total_trades: 39355\n", + "Sharpe: -1.158\n", + "=================================\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.167 |\n", + "| total_reward | -10.8 |\n", + "| total_reward_pct | -0.00108 |\n", + "| total_trades | 39355 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 434 |\n", + "| time_elapsed | 11929 |\n", + "| total_timesteps | 888832 |\n", + "| train/ | |\n", + "| approx_kl | 0.028637283 |\n", + "| clip_fraction | 0.188 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -206 |\n", + "| explained_variance | -9.72e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.05 |\n", + "| n_updates | 4330 |\n", + "| policy_gradient_loss | -0.0122 |\n", + "| std | 1.9 |\n", + "| value_loss | 5.05e-07 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.171 |\n", + "| total_reward | -9.61 |\n", + "| total_reward_pct | -0.000961 |\n", + "| total_trades | 39316 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 435 |\n", + "| time_elapsed | 11956 |\n", + "| total_timesteps | 890880 |\n", + "| train/ | |\n", + "| approx_kl | 0.032640148 |\n", + "| clip_fraction | 0.223 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -206 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.08 |\n", + "| n_updates | 4340 |\n", + "| policy_gradient_loss | -0.0196 |\n", + "| std | 1.9 |\n", + "| value_loss | 4.76e-07 |\n", + "-----------------------------------------\n", + "----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.169 |\n", + "| total_reward | -9.18 |\n", + "| total_reward_pct | -0.000918 |\n", + "| total_trades | 39518 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 436 |\n", + "| time_elapsed | 11983 |\n", + "| total_timesteps | 892928 |\n", + "| train/ | |\n", + "| approx_kl | 0.03371728 |\n", + "| clip_fraction | 0.168 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -206 |\n", + "| explained_variance | -2.25e+12 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.08 |\n", + "| n_updates | 4350 |\n", + "| policy_gradient_loss | -0.0137 |\n", + "| std | 1.91 |\n", + "| value_loss | 4.22e-07 |\n", + "----------------------------------------\n", + "------------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.165 |\n", + "| total_reward | -11.2 |\n", + "| total_reward_pct | -0.00112 |\n", + "| total_trades | 39370 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 437 |\n", + "| time_elapsed | 12010 |\n", + "| total_timesteps | 894976 |\n", + "| train/ | |\n", + "| approx_kl | 0.0104324715 |\n", + "| clip_fraction | 0.188 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -206 |\n", + "| explained_variance | -2.89e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.07 |\n", + "| n_updates | 4360 |\n", + "| policy_gradient_loss | -0.0143 |\n", + "| std | 1.91 |\n", + "| value_loss | 1.45e-07 |\n", + "------------------------------------------\n", + "day: 888, episode: 1010\n", + "begin_total_asset: 1000000.00\n", + "end_total_asset: 999989.21\n", + "total_reward: -10.79\n", + "total_cost: 0.16\n", + "total_trades: 39666\n", + "Sharpe: -1.335\n", + "=================================\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.164 |\n", + "| total_reward | -10.8 |\n", + "| total_reward_pct | -0.00108 |\n", + "| total_trades | 39666 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 438 |\n", + "| time_elapsed | 12037 |\n", + "| total_timesteps | 897024 |\n", + "| train/ | |\n", + "| approx_kl | 0.018966611 |\n", + "| clip_fraction | 0.221 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -206 |\n", + "| explained_variance | -7.95e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.12 |\n", + "| n_updates | 4370 |\n", + "| policy_gradient_loss | -0.0209 |\n", + "| std | 1.91 |\n", + "| value_loss | 1.38e-07 |\n", + "-----------------------------------------\n", + "----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.17 |\n", + "| total_reward | -10.7 |\n", + "| total_reward_pct | -0.00107 |\n", + "| total_trades | 39283 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 439 |\n", + "| time_elapsed | 12064 |\n", + "| total_timesteps | 899072 |\n", + "| train/ | |\n", + "| approx_kl | 0.02770085 |\n", + "| clip_fraction | 0.214 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -207 |\n", + "| explained_variance | -5.65e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.11 |\n", + "| n_updates | 4380 |\n", + "| policy_gradient_loss | -0.0211 |\n", + "| std | 1.91 |\n", + "| value_loss | 1.65e-07 |\n", + "----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.17 |\n", + "| total_reward | -10.8 |\n", + "| total_reward_pct | -0.00108 |\n", + "| total_trades | 39562 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 440 |\n", + "| time_elapsed | 12092 |\n", + "| total_timesteps | 901120 |\n", + "| train/ | |\n", + "| approx_kl | 0.028026646 |\n", + "| clip_fraction | 0.245 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -207 |\n", + "| explained_variance | -5.94e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.05 |\n", + "| n_updates | 4390 |\n", + "| policy_gradient_loss | -0.021 |\n", + "| std | 1.92 |\n", + "| value_loss | 1.05e-07 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.174 |\n", + "| total_reward | -11.9 |\n", + "| total_reward_pct | -0.00119 |\n", + "| total_trades | 39606 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 441 |\n", + "| time_elapsed | 12119 |\n", + "| total_timesteps | 903168 |\n", + "| train/ | |\n", + "| approx_kl | 0.036766306 |\n", + "| clip_fraction | 0.203 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -207 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.1 |\n", + "| n_updates | 4400 |\n", + "| policy_gradient_loss | -0.0206 |\n", + "| std | 1.92 |\n", + "| value_loss | 1.32e-08 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.171 |\n", + "| total_reward | -10.5 |\n", + "| total_reward_pct | -0.00105 |\n", + "| total_trades | 39579 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 442 |\n", + "| time_elapsed | 12146 |\n", + "| total_timesteps | 905216 |\n", + "| train/ | |\n", + "| approx_kl | 0.027647264 |\n", + "| clip_fraction | 0.181 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -207 |\n", + "| explained_variance | -1.99e+12 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.11 |\n", + "| n_updates | 4410 |\n", + "| policy_gradient_loss | -0.0199 |\n", + "| std | 1.92 |\n", + "| value_loss | 9.39e-09 |\n", + "-----------------------------------------\n", + "day: 888, episode: 1020\n", + "begin_total_asset: 1000000.00\n", + "end_total_asset: 999988.67\n", + "total_reward: -11.33\n", + "total_cost: 0.17\n", + "total_trades: 39571\n", + "Sharpe: -1.416\n", + "=================================\n", + "----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.171 |\n", + "| total_reward | -12.1 |\n", + "| total_reward_pct | -0.00121 |\n", + "| total_trades | 39653 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 443 |\n", + "| time_elapsed | 12173 |\n", + "| total_timesteps | 907264 |\n", + "| train/ | |\n", + "| approx_kl | 0.02125374 |\n", + "| clip_fraction | 0.198 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -207 |\n", + "| explained_variance | -1.77e+12 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.09 |\n", + "| n_updates | 4420 |\n", + "| policy_gradient_loss | -0.0189 |\n", + "| std | 1.93 |\n", + "| value_loss | 7.71e-09 |\n", + "----------------------------------------\n", + "----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.174 |\n", + "| total_reward | -10.5 |\n", + "| total_reward_pct | -0.00105 |\n", + "| total_trades | 39505 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 444 |\n", + "| time_elapsed | 12200 |\n", + "| total_timesteps | 909312 |\n", + "| train/ | |\n", + "| approx_kl | 0.03074074 |\n", + "| clip_fraction | 0.225 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -207 |\n", + "| explained_variance | -3.66e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.11 |\n", + "| n_updates | 4430 |\n", + "| policy_gradient_loss | -0.0224 |\n", + "| std | 1.93 |\n", + "| value_loss | 6.65e-09 |\n", + "----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.172 |\n", + "| total_reward | -10.6 |\n", + "| total_reward_pct | -0.00106 |\n", + "| total_trades | 39515 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 445 |\n", + "| time_elapsed | 12227 |\n", + "| total_timesteps | 911360 |\n", + "| train/ | |\n", + "| approx_kl | 0.029910514 |\n", + "| clip_fraction | 0.212 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -207 |\n", + "| explained_variance | -5.3e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.09 |\n", + "| n_updates | 4440 |\n", + "| policy_gradient_loss | -0.022 |\n", + "| std | 1.93 |\n", + "| value_loss | 5.09e-09 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.175 |\n", + "| total_reward | -13.9 |\n", + "| total_reward_pct | -0.00139 |\n", + "| total_trades | 39630 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 446 |\n", + "| time_elapsed | 12254 |\n", + "| total_timesteps | 913408 |\n", + "| train/ | |\n", + "| approx_kl | 0.027955187 |\n", + "| clip_fraction | 0.176 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -208 |\n", + "| explained_variance | -1.15e+12 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.08 |\n", + "| n_updates | 4450 |\n", + "| policy_gradient_loss | -0.0168 |\n", + "| std | 1.93 |\n", + "| value_loss | 5.16e-09 |\n", + "-----------------------------------------\n", + "day: 888, episode: 1030\n", + "begin_total_asset: 1000000.00\n", + "end_total_asset: 999986.70\n", + "total_reward: -13.30\n", + "total_cost: 0.18\n", + "total_trades: 39928\n", + "Sharpe: -1.318\n", + "=================================\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.175 |\n", + "| total_reward | -13.3 |\n", + "| total_reward_pct | -0.00133 |\n", + "| total_trades | 39928 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 447 |\n", + "| time_elapsed | 12281 |\n", + "| total_timesteps | 915456 |\n", + "| train/ | |\n", + "| approx_kl | 0.038448606 |\n", + "| clip_fraction | 0.187 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -208 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.12 |\n", + "| n_updates | 4460 |\n", + "| policy_gradient_loss | -0.021 |\n", + "| std | 1.94 |\n", + "| value_loss | 5.03e-09 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.172 |\n", + "| total_reward | -9.7 |\n", + "| total_reward_pct | -0.00097 |\n", + "| total_trades | 39780 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 448 |\n", + "| time_elapsed | 12308 |\n", + "| total_timesteps | 917504 |\n", + "| train/ | |\n", + "| approx_kl | 0.009110012 |\n", + "| clip_fraction | 0.159 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -208 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.14 |\n", + "| n_updates | 4470 |\n", + "| policy_gradient_loss | -0.0183 |\n", + "| std | 1.94 |\n", + "| value_loss | 3.94e-09 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.181 |\n", + "| total_reward | -11.3 |\n", + "| total_reward_pct | -0.00113 |\n", + "| total_trades | 39859 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 449 |\n", + "| time_elapsed | 12335 |\n", + "| total_timesteps | 919552 |\n", + "| train/ | |\n", + "| approx_kl | 0.032746986 |\n", + "| clip_fraction | 0.18 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -208 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.14 |\n", + "| n_updates | 4480 |\n", + "| policy_gradient_loss | -0.021 |\n", + "| std | 1.94 |\n", + "| value_loss | 2.98e-09 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.175 |\n", + "| total_reward | -12.1 |\n", + "| total_reward_pct | -0.00121 |\n", + "| total_trades | 39665 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 450 |\n", + "| time_elapsed | 12362 |\n", + "| total_timesteps | 921600 |\n", + "| train/ | |\n", + "| approx_kl | 0.023182968 |\n", + "| clip_fraction | 0.163 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -208 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.09 |\n", + "| n_updates | 4490 |\n", + "| policy_gradient_loss | -0.0165 |\n", + "| std | 1.94 |\n", + "| value_loss | 3.87e-09 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.177 |\n", + "| total_reward | -11.5 |\n", + "| total_reward_pct | -0.00115 |\n", + "| total_trades | 39737 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 451 |\n", + "| time_elapsed | 12389 |\n", + "| total_timesteps | 923648 |\n", + "| train/ | |\n", + "| approx_kl | 0.028496826 |\n", + "| clip_fraction | 0.172 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -208 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.06 |\n", + "| n_updates | 4500 |\n", + "| policy_gradient_loss | -0.0155 |\n", + "| std | 1.94 |\n", + "| value_loss | 3.04e-09 |\n", + "-----------------------------------------\n", + "day: 888, episode: 1040\n", + "begin_total_asset: 1000000.00\n", + "end_total_asset: 999988.27\n", + "total_reward: -11.73\n", + "total_cost: 0.18\n", + "total_trades: 39728\n", + "Sharpe: -1.517\n", + "=================================\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.174 |\n", + "| total_reward | -11.4 |\n", + "| total_reward_pct | -0.00114 |\n", + "| total_trades | 39573 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 452 |\n", + "| time_elapsed | 12416 |\n", + "| total_timesteps | 925696 |\n", + "| train/ | |\n", + "| approx_kl | 0.029642036 |\n", + "| clip_fraction | 0.185 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -208 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.13 |\n", + "| n_updates | 4510 |\n", + "| policy_gradient_loss | -0.0221 |\n", + "| std | 1.95 |\n", + "| value_loss | 3.42e-09 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.176 |\n", + "| total_reward | -12.4 |\n", + "| total_reward_pct | -0.00124 |\n", + "| total_trades | 39800 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 453 |\n", + "| time_elapsed | 12443 |\n", + "| total_timesteps | 927744 |\n", + "| train/ | |\n", + "| approx_kl | 0.018820034 |\n", + "| clip_fraction | 0.18 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -208 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.13 |\n", + "| n_updates | 4520 |\n", + "| policy_gradient_loss | -0.0189 |\n", + "| std | 1.95 |\n", + "| value_loss | 3.41e-09 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.178 |\n", + "| total_reward | -12.1 |\n", + "| total_reward_pct | -0.00121 |\n", + "| total_trades | 39620 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 454 |\n", + "| time_elapsed | 12470 |\n", + "| total_timesteps | 929792 |\n", + "| train/ | |\n", + "| approx_kl | 0.031906802 |\n", + "| clip_fraction | 0.182 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -208 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.11 |\n", + "| n_updates | 4530 |\n", + "| policy_gradient_loss | -0.0198 |\n", + "| std | 1.95 |\n", + "| value_loss | 2.87e-09 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.185 |\n", + "| total_reward | -12.8 |\n", + "| total_reward_pct | -0.00128 |\n", + "| total_trades | 39646 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 455 |\n", + "| time_elapsed | 12497 |\n", + "| total_timesteps | 931840 |\n", + "| train/ | |\n", + "| approx_kl | 0.017811788 |\n", + "| clip_fraction | 0.18 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -209 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.13 |\n", + "| n_updates | 4540 |\n", + "| policy_gradient_loss | -0.0181 |\n", + "| std | 1.95 |\n", + "| value_loss | 4.8e-09 |\n", + "-----------------------------------------\n", + "day: 888, episode: 1050\n", + "begin_total_asset: 1000000.00\n", + "end_total_asset: 999990.59\n", + "total_reward: -9.41\n", + "total_cost: 0.18\n", + "total_trades: 39759\n", + "Sharpe: -0.910\n", + "=================================\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.181 |\n", + "| total_reward | -9.32 |\n", + "| total_reward_pct | -0.000932 |\n", + "| total_trades | 39623 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 456 |\n", + "| time_elapsed | 12524 |\n", + "| total_timesteps | 933888 |\n", + "| train/ | |\n", + "| approx_kl | 0.021281809 |\n", + "| clip_fraction | 0.163 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -209 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.14 |\n", + "| n_updates | 4550 |\n", + "| policy_gradient_loss | -0.0169 |\n", + "| std | 1.96 |\n", + "| value_loss | 4.06e-09 |\n", + "-----------------------------------------\n", + "----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.177 |\n", + "| total_reward | -8.98 |\n", + "| total_reward_pct | -0.000898 |\n", + "| total_trades | 39806 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 457 |\n", + "| time_elapsed | 12551 |\n", + "| total_timesteps | 935936 |\n", + "| train/ | |\n", + "| approx_kl | 0.02066523 |\n", + "| clip_fraction | 0.169 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -209 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.09 |\n", + "| n_updates | 4560 |\n", + "| policy_gradient_loss | -0.0197 |\n", + "| std | 1.96 |\n", + "| value_loss | 3.88e-09 |\n", + "----------------------------------------\n", + "----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.179 |\n", + "| total_reward | -13.7 |\n", + "| total_reward_pct | -0.00137 |\n", + "| total_trades | 39550 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 458 |\n", + "| time_elapsed | 12578 |\n", + "| total_timesteps | 937984 |\n", + "| train/ | |\n", + "| approx_kl | 0.01731565 |\n", + "| clip_fraction | 0.159 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -209 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.12 |\n", + "| n_updates | 4570 |\n", + "| policy_gradient_loss | -0.0153 |\n", + "| std | 1.96 |\n", + "| value_loss | 3.83e-09 |\n", + "----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.178 |\n", + "| total_reward | -11.3 |\n", + "| total_reward_pct | -0.00113 |\n", + "| total_trades | 39694 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 459 |\n", + "| time_elapsed | 12605 |\n", + "| total_timesteps | 940032 |\n", + "| train/ | |\n", + "| approx_kl | 0.018544383 |\n", + "| clip_fraction | 0.183 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -209 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.1 |\n", + "| n_updates | 4580 |\n", + "| policy_gradient_loss | -0.0195 |\n", + "| std | 1.97 |\n", + "| value_loss | 3.7e-09 |\n", + "-----------------------------------------\n", + "day: 888, episode: 1060\n", + "begin_total_asset: 1000000.00\n", + "end_total_asset: 999984.88\n", + "total_reward: -15.12\n", + "total_cost: 0.18\n", + "total_trades: 39716\n", + "Sharpe: -1.454\n", + "=================================\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.18 |\n", + "| total_reward | -15.1 |\n", + "| total_reward_pct | -0.00151 |\n", + "| total_trades | 39716 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 460 |\n", + "| time_elapsed | 12631 |\n", + "| total_timesteps | 942080 |\n", + "| train/ | |\n", + "| approx_kl | 0.020200405 |\n", + "| clip_fraction | 0.147 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -209 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.11 |\n", + "| n_updates | 4590 |\n", + "| policy_gradient_loss | -0.0165 |\n", + "| std | 1.97 |\n", + "| value_loss | 3.85e-09 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.175 |\n", + "| total_reward | -8.36 |\n", + "| total_reward_pct | -0.000836 |\n", + "| total_trades | 39480 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 461 |\n", + "| time_elapsed | 12658 |\n", + "| total_timesteps | 944128 |\n", + "| train/ | |\n", + "| approx_kl | 0.022867868 |\n", + "| clip_fraction | 0.178 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -209 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.09 |\n", + "| n_updates | 4600 |\n", + "| policy_gradient_loss | -0.0152 |\n", + "| std | 1.97 |\n", + "| value_loss | 3.96e-09 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.172 |\n", + "| total_reward | -12.4 |\n", + "| total_reward_pct | -0.00124 |\n", + "| total_trades | 39506 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 462 |\n", + "| time_elapsed | 12686 |\n", + "| total_timesteps | 946176 |\n", + "| train/ | |\n", + "| approx_kl | 0.014113865 |\n", + "| clip_fraction | 0.178 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -210 |\n", + "| explained_variance | -3.56e+12 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.12 |\n", + "| n_updates | 4610 |\n", + "| policy_gradient_loss | -0.0167 |\n", + "| std | 1.97 |\n", + "| value_loss | 3.4e-09 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.173 |\n", + "| total_reward | -9.42 |\n", + "| total_reward_pct | -0.000942 |\n", + "| total_trades | 39432 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 463 |\n", + "| time_elapsed | 12712 |\n", + "| total_timesteps | 948224 |\n", + "| train/ | |\n", + "| approx_kl | 0.017051598 |\n", + "| clip_fraction | 0.174 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -210 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.11 |\n", + "| n_updates | 4620 |\n", + "| policy_gradient_loss | -0.0151 |\n", + "| std | 1.98 |\n", + "| value_loss | 6.28e-09 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.179 |\n", + "| total_reward | -10.9 |\n", + "| total_reward_pct | -0.00109 |\n", + "| total_trades | 39382 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 464 |\n", + "| time_elapsed | 12739 |\n", + "| total_timesteps | 950272 |\n", + "| train/ | |\n", + "| approx_kl | 0.024289519 |\n", + "| clip_fraction | 0.181 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -210 |\n", + "| explained_variance | -8.85e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.13 |\n", + "| n_updates | 4630 |\n", + "| policy_gradient_loss | -0.02 |\n", + "| std | 1.98 |\n", + "| value_loss | 3.39e-08 |\n", + "-----------------------------------------\n", + "day: 888, episode: 1070\n", + "begin_total_asset: 1000000.00\n", + "end_total_asset: 999989.30\n", + "total_reward: -10.70\n", + "total_cost: 0.17\n", + "total_trades: 39377\n", + "Sharpe: -1.328\n", + "=================================\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.174 |\n", + "| total_reward | -10.2 |\n", + "| total_reward_pct | -0.00102 |\n", + "| total_trades | 39625 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 465 |\n", + "| time_elapsed | 12766 |\n", + "| total_timesteps | 952320 |\n", + "| train/ | |\n", + "| approx_kl | 0.032004613 |\n", + "| clip_fraction | 0.153 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -210 |\n", + "| explained_variance | -1.2e+12 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.13 |\n", + "| n_updates | 4640 |\n", + "| policy_gradient_loss | -0.016 |\n", + "| std | 1.98 |\n", + "| value_loss | 5.49e-07 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.178 |\n", + "| total_reward | -13.1 |\n", + "| total_reward_pct | -0.00131 |\n", + "| total_trades | 39646 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 466 |\n", + "| time_elapsed | 12793 |\n", + "| total_timesteps | 954368 |\n", + "| train/ | |\n", + "| approx_kl | 0.033068266 |\n", + "| clip_fraction | 0.211 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -210 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.14 |\n", + "| n_updates | 4650 |\n", + "| policy_gradient_loss | -0.0215 |\n", + "| std | 1.98 |\n", + "| value_loss | 1.01e-05 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.18 |\n", + "| total_reward | -11.7 |\n", + "| total_reward_pct | -0.00117 |\n", + "| total_trades | 39903 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 467 |\n", + "| time_elapsed | 12820 |\n", + "| total_timesteps | 956416 |\n", + "| train/ | |\n", + "| approx_kl | 0.020256283 |\n", + "| clip_fraction | 0.188 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -210 |\n", + "| explained_variance | -9.05e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.14 |\n", + "| n_updates | 4660 |\n", + "| policy_gradient_loss | -0.0169 |\n", + "| std | 1.99 |\n", + "| value_loss | 7.67e-05 |\n", + "-----------------------------------------\n", + "----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.178 |\n", + "| total_reward | -10.9 |\n", + "| total_reward_pct | -0.00109 |\n", + "| total_trades | 39547 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 468 |\n", + "| time_elapsed | 12847 |\n", + "| total_timesteps | 958464 |\n", + "| train/ | |\n", + "| approx_kl | 0.04683347 |\n", + "| clip_fraction | 0.188 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -210 |\n", + "| explained_variance | -1.34e+12 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.12 |\n", + "| n_updates | 4670 |\n", + "| policy_gradient_loss | -0.0177 |\n", + "| std | 1.99 |\n", + "| value_loss | 0.0002 |\n", + "----------------------------------------\n", + "day: 888, episode: 1080\n", + "begin_total_asset: 1000000.00\n", + "end_total_asset: 999989.59\n", + "total_reward: -10.41\n", + "total_cost: 0.17\n", + "total_trades: 39552\n", + "Sharpe: -1.255\n", + "=================================\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.17 |\n", + "| total_reward | -8.71 |\n", + "| total_reward_pct | -0.000871 |\n", + "| total_trades | 39662 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 469 |\n", + "| time_elapsed | 12874 |\n", + "| total_timesteps | 960512 |\n", + "| train/ | |\n", + "| approx_kl | 0.015516952 |\n", + "| clip_fraction | 0.211 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -211 |\n", + "| explained_variance | -6.59e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.16 |\n", + "| n_updates | 4680 |\n", + "| policy_gradient_loss | -0.0196 |\n", + "| std | 1.99 |\n", + "| value_loss | 0.000414 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.18 |\n", + "| total_reward | -10.5 |\n", + "| total_reward_pct | -0.00105 |\n", + "| total_trades | 39735 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 470 |\n", + "| time_elapsed | 12902 |\n", + "| total_timesteps | 962560 |\n", + "| train/ | |\n", + "| approx_kl | 0.026529005 |\n", + "| clip_fraction | 0.17 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -211 |\n", + "| explained_variance | -1.03e+12 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.14 |\n", + "| n_updates | 4690 |\n", + "| policy_gradient_loss | -0.0149 |\n", + "| std | 2 |\n", + "| value_loss | 0.000337 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.17 |\n", + "| total_reward | -11.5 |\n", + "| total_reward_pct | -0.00115 |\n", + "| total_trades | 39499 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 471 |\n", + "| time_elapsed | 12928 |\n", + "| total_timesteps | 964608 |\n", + "| train/ | |\n", + "| approx_kl | 0.018596418 |\n", + "| clip_fraction | 0.195 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -211 |\n", + "| explained_variance | -3.7e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.14 |\n", + "| n_updates | 4700 |\n", + "| policy_gradient_loss | -0.0186 |\n", + "| std | 2 |\n", + "| value_loss | 9.96e-05 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.177 |\n", + "| total_reward | -12 |\n", + "| total_reward_pct | -0.0012 |\n", + "| total_trades | 39481 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 472 |\n", + "| time_elapsed | 12955 |\n", + "| total_timesteps | 966656 |\n", + "| train/ | |\n", + "| approx_kl | 0.010791515 |\n", + "| clip_fraction | 0.207 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -211 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.15 |\n", + "| n_updates | 4710 |\n", + "| policy_gradient_loss | -0.0168 |\n", + "| std | 2 |\n", + "| value_loss | 9.62e-06 |\n", + "-----------------------------------------\n", + "day: 888, episode: 1090\n", + "begin_total_asset: 1000000.00\n", + "end_total_asset: 999988.38\n", + "total_reward: -11.62\n", + "total_cost: 0.18\n", + "total_trades: 39608\n", + "Sharpe: -1.283\n", + "=================================\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.178 |\n", + "| total_reward | -11.6 |\n", + "| total_reward_pct | -0.00116 |\n", + "| total_trades | 39608 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 473 |\n", + "| time_elapsed | 12982 |\n", + "| total_timesteps | 968704 |\n", + "| train/ | |\n", + "| approx_kl | 0.011391513 |\n", + "| clip_fraction | 0.154 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -211 |\n", + "| explained_variance | -4.15e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.12 |\n", + "| n_updates | 4720 |\n", + "| policy_gradient_loss | -0.0116 |\n", + "| std | 2.01 |\n", + "| value_loss | 1.47e-06 |\n", + "-----------------------------------------\n", + "----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.179 |\n", + "| total_reward | -12.2 |\n", + "| total_reward_pct | -0.00122 |\n", + "| total_trades | 39547 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 474 |\n", + "| time_elapsed | 13010 |\n", + "| total_timesteps | 970752 |\n", + "| train/ | |\n", + "| approx_kl | 0.01682519 |\n", + "| clip_fraction | 0.177 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -211 |\n", + "| explained_variance | -3.91e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.17 |\n", + "| n_updates | 4730 |\n", + "| policy_gradient_loss | -0.0155 |\n", + "| std | 2.01 |\n", + "| value_loss | 2.94e-07 |\n", + "----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.182 |\n", + "| total_reward | -9.87 |\n", + "| total_reward_pct | -0.000987 |\n", + "| total_trades | 39436 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 475 |\n", + "| time_elapsed | 13037 |\n", + "| total_timesteps | 972800 |\n", + "| train/ | |\n", + "| approx_kl | 0.029182049 |\n", + "| clip_fraction | 0.228 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -212 |\n", + "| explained_variance | -3.25e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.14 |\n", + "| n_updates | 4740 |\n", + "| policy_gradient_loss | -0.0175 |\n", + "| std | 2.01 |\n", + "| value_loss | 1.55e-07 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.181 |\n", + "| total_reward | -11.2 |\n", + "| total_reward_pct | -0.00112 |\n", + "| total_trades | 39569 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 476 |\n", + "| time_elapsed | 13064 |\n", + "| total_timesteps | 974848 |\n", + "| train/ | |\n", + "| approx_kl | 0.046522826 |\n", + "| clip_fraction | 0.198 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -212 |\n", + "| explained_variance | -3.28e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.15 |\n", + "| n_updates | 4750 |\n", + "| policy_gradient_loss | -0.0177 |\n", + "| std | 2.02 |\n", + "| value_loss | 1.59e-07 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.175 |\n", + "| total_reward | -9.63 |\n", + "| total_reward_pct | -0.000963 |\n", + "| total_trades | 39466 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 477 |\n", + "| time_elapsed | 13091 |\n", + "| total_timesteps | 976896 |\n", + "| train/ | |\n", + "| approx_kl | 0.012649968 |\n", + "| clip_fraction | 0.229 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -212 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.14 |\n", + "| n_updates | 4760 |\n", + "| policy_gradient_loss | -0.0208 |\n", + "| std | 2.02 |\n", + "| value_loss | 1.31e-07 |\n", + "-----------------------------------------\n", + "day: 888, episode: 1100\n", + "begin_total_asset: 1000000.00\n", + "end_total_asset: 999988.04\n", + "total_reward: -11.96\n", + "total_cost: 0.18\n", + "total_trades: 39441\n", + "Sharpe: -1.489\n", + "=================================\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.179 |\n", + "| total_reward | -11.6 |\n", + "| total_reward_pct | -0.00116 |\n", + "| total_trades | 39189 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 478 |\n", + "| time_elapsed | 13119 |\n", + "| total_timesteps | 978944 |\n", + "| train/ | |\n", + "| approx_kl | 0.028167645 |\n", + "| clip_fraction | 0.206 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -212 |\n", + "| explained_variance | -2.46e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.15 |\n", + "| n_updates | 4770 |\n", + "| policy_gradient_loss | -0.017 |\n", + "| std | 2.02 |\n", + "| value_loss | 1.32e-07 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.175 |\n", + "| total_reward | -11.2 |\n", + "| total_reward_pct | -0.00112 |\n", + "| total_trades | 39161 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 479 |\n", + "| time_elapsed | 13146 |\n", + "| total_timesteps | 980992 |\n", + "| train/ | |\n", + "| approx_kl | 0.025091792 |\n", + "| clip_fraction | 0.179 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -212 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.15 |\n", + "| n_updates | 4780 |\n", + "| policy_gradient_loss | -0.0186 |\n", + "| std | 2.03 |\n", + "| value_loss | 1.06e-07 |\n", + "-----------------------------------------\n", + "----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.178 |\n", + "| total_reward | -13.1 |\n", + "| total_reward_pct | -0.00131 |\n", + "| total_trades | 39299 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 480 |\n", + "| time_elapsed | 13173 |\n", + "| total_timesteps | 983040 |\n", + "| train/ | |\n", + "| approx_kl | 0.01181832 |\n", + "| clip_fraction | 0.199 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -212 |\n", + "| explained_variance | -2.71e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.14 |\n", + "| n_updates | 4790 |\n", + "| policy_gradient_loss | -0.0227 |\n", + "| std | 2.03 |\n", + "| value_loss | 1.45e-08 |\n", + "----------------------------------------\n", + "----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.166 |\n", + "| total_reward | -8.96 |\n", + "| total_reward_pct | -0.000896 |\n", + "| total_trades | 38950 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 481 |\n", + "| time_elapsed | 13200 |\n", + "| total_timesteps | 985088 |\n", + "| train/ | |\n", + "| approx_kl | 0.03267536 |\n", + "| clip_fraction | 0.19 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -213 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.14 |\n", + "| n_updates | 4800 |\n", + "| policy_gradient_loss | -0.0207 |\n", + "| std | 2.03 |\n", + "| value_loss | 4.97e-09 |\n", + "----------------------------------------\n", + "day: 888, episode: 1110\n", + "begin_total_asset: 1000000.00\n", + "end_total_asset: 999988.73\n", + "total_reward: -11.27\n", + "total_cost: 0.17\n", + "total_trades: 39131\n", + "Sharpe: -1.459\n", + "=================================\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.17 |\n", + "| total_reward | -8.69 |\n", + "| total_reward_pct | -0.000869 |\n", + "| total_trades | 39048 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 482 |\n", + "| time_elapsed | 13227 |\n", + "| total_timesteps | 987136 |\n", + "| train/ | |\n", + "| approx_kl | 0.016749725 |\n", + "| clip_fraction | 0.185 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -213 |\n", + "| explained_variance | -7.96e+11 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.18 |\n", + "| n_updates | 4810 |\n", + "| policy_gradient_loss | -0.0212 |\n", + "| std | 2.04 |\n", + "| value_loss | 3.87e-09 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.169 |\n", + "| total_reward | -9.97 |\n", + "| total_reward_pct | -0.000997 |\n", + "| total_trades | 39163 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 483 |\n", + "| time_elapsed | 13254 |\n", + "| total_timesteps | 989184 |\n", + "| train/ | |\n", + "| approx_kl | 0.024083346 |\n", + "| clip_fraction | 0.151 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -213 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.16 |\n", + "| n_updates | 4820 |\n", + "| policy_gradient_loss | -0.015 |\n", + "| std | 2.04 |\n", + "| value_loss | 3.98e-09 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.171 |\n", + "| total_reward | -10.5 |\n", + "| total_reward_pct | -0.00105 |\n", + "| total_trades | 38912 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 484 |\n", + "| time_elapsed | 13281 |\n", + "| total_timesteps | 991232 |\n", + "| train/ | |\n", + "| approx_kl | 0.014608376 |\n", + "| clip_fraction | 0.169 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -213 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.16 |\n", + "| n_updates | 4830 |\n", + "| policy_gradient_loss | -0.02 |\n", + "| std | 2.04 |\n", + "| value_loss | 2.98e-09 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.163 |\n", + "| total_reward | -10.1 |\n", + "| total_reward_pct | -0.00101 |\n", + "| total_trades | 38972 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 485 |\n", + "| time_elapsed | 13308 |\n", + "| total_timesteps | 993280 |\n", + "| train/ | |\n", + "| approx_kl | 0.013730422 |\n", + "| clip_fraction | 0.173 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -213 |\n", + "| explained_variance | -3.93e+12 |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.15 |\n", + "| n_updates | 4840 |\n", + "| policy_gradient_loss | -0.0158 |\n", + "| std | 2.04 |\n", + "| value_loss | 4.04e-09 |\n", + "-----------------------------------------\n", + "day: 888, episode: 1120\n", + "begin_total_asset: 1000000.00\n", + "end_total_asset: 999990.12\n", + "total_reward: -9.88\n", + "total_cost: 0.17\n", + "total_trades: 38978\n", + "Sharpe: -1.305\n", + "=================================\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.167 |\n", + "| total_reward | -9.88 |\n", + "| total_reward_pct | -0.000988 |\n", + "| total_trades | 38978 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 486 |\n", + "| time_elapsed | 13336 |\n", + "| total_timesteps | 995328 |\n", + "| train/ | |\n", + "| approx_kl | 0.030101798 |\n", + "| clip_fraction | 0.176 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -213 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.12 |\n", + "| n_updates | 4850 |\n", + "| policy_gradient_loss | -0.0171 |\n", + "| std | 2.04 |\n", + "| value_loss | 2.72e-09 |\n", + "-----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.168 |\n", + "| total_reward | -13.3 |\n", + "| total_reward_pct | -0.00133 |\n", + "| total_trades | 38725 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 487 |\n", + "| time_elapsed | 13363 |\n", + "| total_timesteps | 997376 |\n", + "| train/ | |\n", + "| approx_kl | 0.017914606 |\n", + "| clip_fraction | 0.175 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -213 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.13 |\n", + "| n_updates | 4860 |\n", + "| policy_gradient_loss | -0.0152 |\n", + "| std | 2.04 |\n", + "| value_loss | 2.55e-09 |\n", + "-----------------------------------------\n", + "----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.166 |\n", + "| total_reward | -14.4 |\n", + "| total_reward_pct | -0.00144 |\n", + "| total_trades | 38793 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 488 |\n", + "| time_elapsed | 13390 |\n", + "| total_timesteps | 999424 |\n", + "| train/ | |\n", + "| approx_kl | 0.02382963 |\n", + "| clip_fraction | 0.19 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -213 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.17 |\n", + "| n_updates | 4870 |\n", + "| policy_gradient_loss | -0.0182 |\n", + "| std | 2.05 |\n", + "| value_loss | 3.16e-09 |\n", + "----------------------------------------\n", + "-----------------------------------------\n", + "| environment/ | |\n", + "| portfolio_value | 1e+06 |\n", + "| total_cost | 0.167 |\n", + "| total_reward | -11.7 |\n", + "| total_reward_pct | -0.00117 |\n", + "| total_trades | 39078 |\n", + "| time/ | |\n", + "| fps | 74 |\n", + "| iterations | 489 |\n", + "| time_elapsed | 13417 |\n", + "| total_timesteps | 1001472 |\n", + "| train/ | |\n", + "| approx_kl | 0.011921924 |\n", + "| clip_fraction | 0.161 |\n", + "| clip_range | 0.2 |\n", + "| entropy_loss | -213 |\n", + "| explained_variance | nan |\n", + "| learning_rate | 0.00025 |\n", + "| loss | -2.17 |\n", + "| n_updates | 4880 |\n", + "| policy_gradient_loss | -0.0189 |\n", + "| std | 2.05 |\n", + "| value_loss | 3.6e-09 |\n", + "-----------------------------------------\n" + ], + "name": "stdout" + } + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "QjrKBLwEJ3Ip" + }, + "source": [ + "e_trade_gym = StockTradingEnv(df = trade, **env_kwargs)\r\n", + "# env_trade, obs_trade = e_trade_gym.get_sb_env()\r\n", + "\r\n", + "df_account_value, df_actions = DRLAgent.DRL_prediction(\r\n", + " model=model_ppo, \r\n", + " environment = e_trade_gym)" + ], + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "metadata": { + "id": "gtl4aN1_KH62" + }, + "source": [ + "df_account_value.shape" + ], + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "metadata": { + "id": "aQ8dU9GfKJ9q" + }, + "source": [ + "df_account_value.head()" + ], + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "metadata": { + "id": "W5GysFd_KNCi" + }, + "source": [ + "df_actions.head()" + ], + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "metadata": { + "id": "BlL6jdA8KPMj" + }, + "source": [ + "print(\"==============Get Backtest Results===========\")\r\n", + "now = datetime.datetime.now().strftime('%Y%m%d-%Hh%M')\r\n", + "\r\n", + "perf_stats_all = backtest_stats(account_value=df_account_value)\r\n", + "perf_stats_all = pd.DataFrame(perf_stats_all)\r\n", + "# perf_stats_all.to_csv(\"./\"+config.RESULTS_DIR+\"/perf_stats_all_\"+now+'.csv')" + ], + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "metadata": { + "id": "Uip5cKsPhlbV" + }, + "source": [ + "" + ], + "execution_count": null, + "outputs": [] + } + ] +} \ No newline at end of file diff --git a/notebooks/notebook_new_stocks.py b/notebooks/notebook_new_stocks.py index 877777180..fba246683 100644 --- a/notebooks/notebook_new_stocks.py +++ b/notebooks/notebook_new_stocks.py @@ -32,6 +32,13 @@ start_download_stockdata(ARGS_DOWNLOAD_DATA) +from finrl.data.fetchdata import FetchData +import pandas as pd +from finrl.config import TimeRange + + +df = FetchData(config).fetch_data_stock() +print(df.head) # df = FetchData(config).fetch_data_stock() From 7814ca2b2ecd69081b2dd930424a34a8c2327998 Mon Sep 17 00:00:00 2001 From: Youbadawy Date: Thu, 11 Mar 2021 07:27:07 -0500 Subject: [PATCH 4/5] Configuration Files --- finrl/config/check_exchange.py | 49 +++--- finrl/config/config.py | 221 ++++++++++++++------------- finrl/config/config_setup.py | 9 +- finrl/config/config_validation.py | 110 +++++++------ finrl/config/configuration.py | 212 +++++++++++++++---------- finrl/config/directory_operations.py | 54 ++++--- finrl/config/load_config.py | 32 ++-- finrl/config/timerange.py | 101 ++++++------ 8 files changed, 447 insertions(+), 341 deletions(-) diff --git a/finrl/config/check_exchange.py b/finrl/config/check_exchange.py index 9b6b61b54..77c4cad64 100644 --- a/finrl/config/check_exchange.py +++ b/finrl/config/check_exchange.py @@ -2,8 +2,12 @@ from typing import Any, Dict from finrl.exceptions import OperationalException -from finrl.exchange import (available_exchanges, get_exchange_bad_reason, is_exchange_bad, - is_exchange_known_ccxt, is_exchange_officially_supported) +from finrl.exchange import ( + available_exchanges, + get_exchange_bad_reason, + is_exchange_bad, + is_exchange_known_ccxt, + is_exchange_officially_supported) from finrl.state import RunMode @@ -26,21 +30,21 @@ def remove_credentials(config: Dict[str, Any]) -> None: def check_exchange(config: Dict[str, Any], check_for_bad: bool = True) -> bool: """ Check if the exchange name in the config file is supported by ccxt - + Parameters: ----------- - check_for_bad: + check_for_bad: if True, check the exchange against the list of known 'bad' exchanges - - Return: + + Return: ------- - False if exchange is 'bad', i.e. is known to work with the bot with + False if exchange is 'bad', i.e. is known to work with the bot with critical issues or does not work at all, crashes, etc. True otherwise. raises an exception if the exchange if not supported by ccxt. """ - if (config['runmode'] in [RunMode.PLOT, RunMode.UTIL_NO_EXCHANGE, RunMode.OTHER] - and not config.get('exchange', {}).get('name')): + if (config['runmode'] in [RunMode.PLOT, RunMode.UTIL_NO_EXCHANGE, + RunMode.OTHER] and not config.get('exchange', {}).get('name')): # Skip checking exchange in plot mode, since it requires no exchange return True logger.info("Checking exchange...") @@ -51,29 +55,30 @@ def check_exchange(config: Dict[str, Any], check_for_bad: bool = True) -> bool: f'This command requires a configured exchange. You should either use ' f'`--exchange ` or specify a configuration file via `--config`.\n' f'The following exchanges are available for: ' - f'{", ".join(available_exchanges())}' - ) + f'{", ".join(available_exchanges())}') if not is_exchange_known_ccxt(exchange): raise OperationalException( - f'Exchange "{exchange}" is not known to the ccxt library ' - f'and therefore not available for the bot.\n' - f'The following exchanges are available: ' - f'{", ".join(available_exchanges())}' + f'Exchange "{exchange}" is not known to the ccxt library ' + f'and therefore not available for the bot.\n' + f'The following exchanges are available: ' + f'{", ".join(available_exchanges())}' ) if check_for_bad and is_exchange_bad(exchange): - raise OperationalException(f'Exchange "{exchange}" is known to not work with the bot yet. ' - f'Reason: {get_exchange_bad_reason(exchange)}') + raise OperationalException( + f'Exchange "{exchange}" is known to not work with the bot yet. ' + f'Reason: {get_exchange_bad_reason(exchange)}') if is_exchange_officially_supported(exchange): logger.info(f'Exchange "{exchange}" is officially supported ' f'by FinRL.') else: - logger.warning(f'Exchange "{exchange}" is known to the the ccxt library, ' - f'available for the bot, but not officially supported ' - f'by FinRL. ' - f'It may work flawlessly (please report back) or have serious issues. ' - f'Use it at your own discretion.') + logger.warning( + f'Exchange "{exchange}" is known to the the ccxt library, ' + f'available for the bot, but not officially supported ' + f'by FinRL. ' + f'It may work flawlessly (please report back) or have serious issues. ' + f'Use it at your own discretion.') return True diff --git a/finrl/config/config.py b/finrl/config/config.py index 825942712..c3e34496f 100644 --- a/finrl/config/config.py +++ b/finrl/config/config.py @@ -36,15 +36,24 @@ START_TRADE_DATE = "2019-01-01" -## dataset default columns +# dataset default columns DEFAULT_DATA_COLUMNS = ["date", "tic", "close"] -## stockstats technical indicator column names -## check https://pypi.org/project/stockstats/ for different names -TECHNICAL_INDICATORS_LIST = ["macd","boll_ub","boll_lb","rsi_30", "cci_30", "dx_30","close_30_sma","close_60_sma"] +# stockstats technical indicator column names +# check https://pypi.org/project/stockstats/ for different names +TECHNICAL_INDICATORS_LIST = [ + "macd", + "boll_ub", + "boll_lb", + "rsi_30", + "cci_30", + "dx_30", + "close_30_sma", + "close_60_sma", +] -## Model Parameters +# Model Parameters A2C_PARAMS = {"n_steps": 5, "ent_coef": 0.01, "learning_rate": 0.0007} PPO_PARAMS = { "n_steps": 2048, @@ -53,7 +62,10 @@ "batch_size": 64, } DDPG_PARAMS = {"batch_size": 128, "buffer_size": 50000, "learning_rate": 0.001} -TD3_PARAMS = {"batch_size": 100, "buffer_size": 1000000, "learning_rate": 0.001} +TD3_PARAMS = { + "batch_size": 100, + "buffer_size": 1000000, + "learning_rate": 0.001} SAC_PARAMS = { "batch_size": 64, "buffer_size": 100000, @@ -69,31 +81,31 @@ # self defined SRI_KEHATI_TICKER = [ - "AALI.JK", - "ADHI.JK", - "ASII.JK", - "BBCA.JK", - "BBNI.JK", - "BBRI.JK", - "BBTN.JK", - "BMRI.JK", - "BSDE.JK", - "INDF.JK", - "JPFA.JK", - "JSMR.JK", - "KLBF.JK", - "PGAS.JK", - "PJAA.JK", - "PPRO.JK", - "SIDO.JK", - "SMGR.JK", - "TINS.JK", - "TLKM.JK", - "UNTR.JK", - "UNVR.JK", - "WIKA.JK", - "WSKT.JK", - "WTON.JK" + "AALI.JK", + "ADHI.JK", + "ASII.JK", + "BBCA.JK", + "BBNI.JK", + "BBRI.JK", + "BBTN.JK", + "BMRI.JK", + "BSDE.JK", + "INDF.JK", + "JPFA.JK", + "JSMR.JK", + "KLBF.JK", + "PGAS.JK", + "PJAA.JK", + "PPRO.JK", + "SIDO.JK", + "SMGR.JK", + "TINS.JK", + "TLKM.JK", + "UNTR.JK", + "UNVR.JK", + "WIKA.JK", + "WSKT.JK", + "WTON.JK", ] # check https://wrds-www.wharton.upenn.edu/ for U.S. index constituents @@ -1214,78 +1226,79 @@ ###Jan 20,2020, added by YuQing Huang################### ################FX Ticker Setup Start################### -FX_TICKER = ["AUDCAD", - "AUDCHF", - "AUDJPY", - "AUDNZD", - "AUDSGD", - "AUDUSD", - "AUDUSD", - "AUDUSD", - "AUDUSD", - "AUDUSD", - "AUDUSD", - "AUDUSD", - "CADCHF", - "CADHKD", - "CADJPY", - "CHFJPY", - "CHFSGD", - "EURAUD", - "EURCAD", - "EURCHF", - "EURCHF", - "EURCHF", - "EURCZK", - "EURGBP", - "EURHKD", - "EURHUF", - "EURJPY", - "EURNOK", - "EURNZD", - "EURPLN", - "EURRUB", - "EURSEK", - "EURSGD", - "EURTRY", - "EURTRY", - "EURUSD", - "GBPAUD", - "GBPAUD", - "GBPAUD", - "GBPCAD", - "GBPCHF", - "GBPJPY", - "GBPNZD", - "GBPUSD", - "HKDJPY", - "NZDCAD", - "NZDCHF", - "NZDJPY", - "NZDUSD", - "SGDJPY", - "TRYJPY", - "USDCAD", - "USDCHF", - "USDCNH", - "USDCZK", - "USDHKD", - "USDHUF", - "USDILS", - "USDJPY", - "USDMXN", - "USDNOK", - "USDPLN", - "USDRON", - "USDRUB", - "USDSEK", - "USDSGD", - "USDTHB", - "USDTRY", - "USDZAR", - "XAGUSD", - "XAUUSD", - "ZARJPY", - "EURDKK" +FX_TICKER = [ + "AUDCAD", + "AUDCHF", + "AUDJPY", + "AUDNZD", + "AUDSGD", + "AUDUSD", + "AUDUSD", + "AUDUSD", + "AUDUSD", + "AUDUSD", + "AUDUSD", + "AUDUSD", + "CADCHF", + "CADHKD", + "CADJPY", + "CHFJPY", + "CHFSGD", + "EURAUD", + "EURCAD", + "EURCHF", + "EURCHF", + "EURCHF", + "EURCZK", + "EURGBP", + "EURHKD", + "EURHUF", + "EURJPY", + "EURNOK", + "EURNZD", + "EURPLN", + "EURRUB", + "EURSEK", + "EURSGD", + "EURTRY", + "EURTRY", + "EURUSD", + "GBPAUD", + "GBPAUD", + "GBPAUD", + "GBPCAD", + "GBPCHF", + "GBPJPY", + "GBPNZD", + "GBPUSD", + "HKDJPY", + "NZDCAD", + "NZDCHF", + "NZDJPY", + "NZDUSD", + "SGDJPY", + "TRYJPY", + "USDCAD", + "USDCHF", + "USDCNH", + "USDCZK", + "USDHKD", + "USDHUF", + "USDILS", + "USDJPY", + "USDMXN", + "USDNOK", + "USDPLN", + "USDRON", + "USDRUB", + "USDSEK", + "USDSGD", + "USDTHB", + "USDTRY", + "USDZAR", + "XAGUSD", + "XAUUSD", + "ZARJPY", + "EURDKK", ] ################FX Ticker Setup End################### diff --git a/finrl/config/config_setup.py b/finrl/config/config_setup.py index 556b3a17f..9ade31b98 100644 --- a/finrl/config/config_setup.py +++ b/finrl/config/config_setup.py @@ -10,15 +10,16 @@ logger = logging.getLogger(__name__) -def setup_utils_configuration(args: Dict[str, Any], method: RunMode) -> Dict[str, Any]: +def setup_utils_configuration( + args: Dict[str, Any], method: RunMode) -> Dict[str, Any]: """ Prepare the configuration for utils subcommands - + Parameters: ----------- - args: + args: Cli args from Arguments() - + Return: ------- Configuration diff --git a/finrl/config/config_validation.py b/finrl/config/config_validation.py index cd4069735..112a17a5f 100644 --- a/finrl/config/config_validation.py +++ b/finrl/config/config_validation.py @@ -18,21 +18,22 @@ def _extend_validator(validator_class): Extended validator for the configuration JSON Schema. Currently it only handles defaults for subschemas. """ - validate_properties = validator_class.VALIDATORS['properties'] + validate_properties = validator_class.VALIDATORS["properties"] def set_defaults(validator, properties, instance, schema): for prop, subschema in properties.items(): - if 'default' in subschema: - instance.setdefault(prop, subschema['default']) + if "default" in subschema: + instance.setdefault(prop, subschema["default"]) for error in validate_properties( - validator, properties, instance, schema, + validator, + properties, + instance, + schema, ): yield error - return validators.extend( - validator_class, {'properties': set_defaults} - ) + return validators.extend(validator_class, {"properties": set_defaults}) FinrlValidator = _extend_validator(Draft4Validator) @@ -41,28 +42,27 @@ def set_defaults(validator, properties, instance, schema): def validate_config_schema(conf: Dict[str, Any]) -> Dict[str, Any]: """ Validate the configuration follow the Config Schema - + Parameters: ----------- - conf: + conf: Config in JSON format - + Return: ------- Returns the config if valid, otherwise throw an exception """ conf_schema = deepcopy(constants.CONF_SCHEMA) - if conf.get('runmode', RunMode.OTHER) in (RunMode.DRY_RUN, RunMode.LIVE): - conf_schema['required'] = constants.SCHEMA_TRADE_REQUIRED + if conf.get("runmode", RunMode.OTHER) in (RunMode.DRY_RUN, RunMode.LIVE): + conf_schema["required"] = constants.SCHEMA_TRADE_REQUIRED else: - conf_schema['required'] = constants.SCHEMA_MINIMAL_REQUIRED + conf_schema["required"] = constants.SCHEMA_MINIMAL_REQUIRED try: FinrlValidator(conf_schema).validate(conf) return conf except ValidationError as e: logger.critical( - f"Invalid configuration. See config.json.example. Reason: {e}" - ) + f"Invalid configuration. See config.json.example. Reason: {e}") raise ValidationError( best_match(Draft4Validator(conf_schema).iter_errors(conf)).message ) @@ -73,12 +73,12 @@ def validate_config_consistency(conf: Dict[str, Any]) -> None: Validate the configuration consistency. Should be ran after loading both configuration and strategy, since strategies can set certain configuration settings too. - + Parameters: ----------- - conf: + conf: Config in JSON format - + Return: ------- Returns None if everything is ok, otherwise throw an OperationalException @@ -91,52 +91,60 @@ def validate_config_consistency(conf: Dict[str, Any]) -> None: _validate_unlimited_amount(conf) # validate configuration before returning - logger.info('Validating configuration ...') + logger.info("Validating configuration ...") validate_config_schema(conf) def _validate_unlimited_amount(conf: Dict[str, Any]) -> None: """ If edge is disabled, either max_open_trades or stake_amount need to be set. - - raise: + + raise: OperationalException if config validation failed """ - if (not conf.get('edge', {}).get('enabled') - and conf.get('max_open_trades') == float('inf') - and conf.get('stake_amount') == constants.UNLIMITED_STAKE_AMOUNT): - raise OperationalException("`max_open_trades` and `stake_amount` cannot both be unlimited.") + if ( + not conf.get("edge", {}).get("enabled") + and conf.get("max_open_trades") == float("inf") + and conf.get("stake_amount") == constants.UNLIMITED_STAKE_AMOUNT + ): + raise OperationalException( + "`max_open_trades` and `stake_amount` cannot both be unlimited." + ) def _validate_trailing_stoploss(conf: Dict[str, Any]) -> None: - if conf.get('stoploss') == 0.0: + if conf.get("stoploss") == 0.0: raise OperationalException( - 'The config stoploss needs to be different from 0 to avoid problems with sell orders.' - ) + "The config stoploss needs to be different from 0 to avoid problems with sell orders." + ) # Skip if trailing stoploss is not activated - if not conf.get('trailing_stop', False): + if not conf.get("trailing_stop", False): return - tsl_positive = float(conf.get('trailing_stop_positive', 0)) - tsl_offset = float(conf.get('trailing_stop_positive_offset', 0)) - tsl_only_offset = conf.get('trailing_only_offset_is_reached', False) + tsl_positive = float(conf.get("trailing_stop_positive", 0)) + tsl_offset = float(conf.get("trailing_stop_positive_offset", 0)) + tsl_only_offset = conf.get("trailing_only_offset_is_reached", False) if tsl_only_offset: if tsl_positive == 0.0: raise OperationalException( - 'The config trailing_only_offset_is_reached needs ' - 'trailing_stop_positive_offset to be more than 0 in your config.') + "The config trailing_only_offset_is_reached needs " + "trailing_stop_positive_offset to be more than 0 in your config.") if tsl_positive > 0 and 0 < tsl_offset <= tsl_positive: raise OperationalException( - 'The config trailing_stop_positive_offset needs ' - 'to be greater than trailing_stop_positive in your config.') + "The config trailing_stop_positive_offset needs " + "to be greater than trailing_stop_positive in your config." + ) # Fetch again without default - if 'trailing_stop_positive' in conf and float(conf['trailing_stop_positive']) == 0.0: + if ( + "trailing_stop_positive" in conf + and float(conf["trailing_stop_positive"]) == 0.0 + ): raise OperationalException( - 'The config trailing_stop_positive needs to be different from 0 ' - 'to avoid problems with sell orders.' + "The config trailing_stop_positive needs to be different from 0 " + "to avoid problems with sell orders." ) @@ -145,15 +153,15 @@ def _validate_edge(conf: Dict[str, Any]) -> None: Edge and Dynamic whitelist should not both be enabled, since edge overrides dynamic whitelists. """ - if not conf.get('edge', {}).get('enabled'): + if not conf.get("edge", {}).get("enabled"): return - if conf.get('pairlist', {}).get('method') == 'VolumePairList': + if conf.get("pairlist", {}).get("method") == "VolumePairList": raise OperationalException( "Edge and VolumePairList are incompatible, " "Edge will override whatever pairs VolumePairlist selects." ) - if not conf.get('ask_strategy', {}).get('use_sell_signal', True): + if not conf.get("ask_strategy", {}).get("use_sell_signal", True): raise OperationalException( "Edge requires `use_sell_signal` to be True, otherwise no sells will happen." ) @@ -163,11 +171,17 @@ def _validate_whitelist(conf: Dict[str, Any]) -> None: """ Dynamic whitelist does not require pair_whitelist to be set - however StaticWhitelist does. """ - if conf.get('runmode', RunMode.OTHER) in [RunMode.OTHER, RunMode.PLOT, - RunMode.UTIL_NO_EXCHANGE, RunMode.UTIL_EXCHANGE]: + if conf.get("runmode", RunMode.OTHER) in [ + RunMode.OTHER, + RunMode.PLOT, + RunMode.UTIL_NO_EXCHANGE, + RunMode.UTIL_EXCHANGE, + ]: return - for pl in conf.get('pairlists', [{'method': 'StaticPairList'}]): - if (pl.get('method') == 'StaticPairList' - and not conf.get('exchange', {}).get('pair_whitelist')): - raise OperationalException("StaticPairList requires pair_whitelist to be set.") + for pl in conf.get("pairlists", [{"method": "StaticPairList"}]): + if pl.get("method") == "StaticPairList" and not conf.get( + "exchange", {}).get("pair_whitelist"): + raise OperationalException( + "StaticPairList requires pair_whitelist to be set." + ) diff --git a/finrl/config/configuration.py b/finrl/config/configuration.py index 9bcf9f0dd..e2b67803f 100644 --- a/finrl/config/configuration.py +++ b/finrl/config/configuration.py @@ -34,8 +34,8 @@ def __init__(self, args: Dict[str, Any], runmode: RunMode = None) -> None: def get_config(self) -> Dict[str, Any]: """ Return the config. Use this method to get the bot config - - Return: + + Return: ------- Dict: Bot config """ @@ -53,22 +53,23 @@ def from_files(files: List[str]) -> Dict[str, Any]: override the same parameter from an earlier file (last definition wins). Runs through the whole Configuration initialization, so all expected config entries are available to interactive environments. - + Parameters: ----------- - files: + files: List of file paths - - Return: + + Return: ------- configuration dictionary """ - c = Configuration({'config': files}, RunMode.OTHER) + c = Configuration({"config": files}, RunMode.OTHER) return c.get_config() def load_from_files(self, files: List[str]) -> Dict[str, Any]: - # Keep this method as staticmethod, so it can be used from interactive environments + # Keep this method as staticmethod, so it can be used from interactive + # environments config: Dict[str, Any] = {} if not files: @@ -76,21 +77,21 @@ def load_from_files(self, files: List[str]) -> Dict[str, Any]: # We expect here a list of config filenames for path in files: - logger.info(f'Using config: {path} ...') + logger.info(f"Using config: {path} ...") # Merge config options, overwriting old values config = deep_merge_dicts(load_config_file(path), config) # Normalize config - if 'internals' not in config: - config['internals'] = {} + if "internals" not in config: + config["internals"] = {} # TODO: This can be deleted along with removal of deprecated # experimental settings - if 'ask_strategy' not in config: - config['ask_strategy'] = {} + if "ask_strategy" not in config: + config["ask_strategy"] = {} - if 'pairlists' not in config: - config['pairlists'] = [] + if "pairlists" not in config: + config["pairlists"] = [] return config @@ -100,10 +101,11 @@ def load_config(self) -> Dict[str, Any]: :return: Configuration dictionary """ # Load all configs - config: Dict[str, Any] = self.load_from_files(self.args.get("config", [])) + config: Dict[str, Any] = self.load_from_files( + self.args.get("config", [])) # Keep a copy of the original configuration file - config['original_config'] = deepcopy(config) + config["original_config"] = deepcopy(config) self._process_logging_options(config) @@ -112,7 +114,10 @@ def load_config(self) -> Dict[str, Any]: self._process_optimize_options(config) # Check if the exchange set by the user is supported - check_exchange(config, config.get('experimental', {}).get('block_bad_exchanges', True)) + check_exchange( + config, config.get( + "experimental", {}).get( + "block_bad_exchanges", True)) self._resolve_pairs_list(config) @@ -124,103 +129,138 @@ def _process_logging_options(self, config: Dict[str, Any]) -> None: the -v/--verbose, --logfile options """ # Log level - config.update({'verbosity': self.args.get('verbosity', 0)}) + config.update({"verbosity": self.args.get("verbosity", 0)}) - if 'logfile' in self.args and self.args['logfile']: - config.update({'logfile': self.args['logfile']}) + if "logfile" in self.args and self.args["logfile"]: + config.update({"logfile": self.args["logfile"]}) setup_logging(config) - def _process_datadir_options(self, config: Dict[str, Any]) -> None: """ Extract information for sys.argv and load directory configurations --user-data, --datadir """ # Check exchange parameter here - otherwise `datadir` might be wrong. - if 'exchange' in self.args and self.args['exchange']: - config['exchange']['name'] = self.args['exchange'] + if "exchange" in self.args and self.args["exchange"]: + config["exchange"]["name"] = self.args["exchange"] logger.info(f"Using exchange {config['exchange']['name']}") - if 'pair_whitelist' not in config['exchange']: - config['exchange']['pair_whitelist'] = [] + if "pair_whitelist" not in config["exchange"]: + config["exchange"]["pair_whitelist"] = [] - if 'user_data_dir' in self.args and self.args['user_data_dir']: - config.update({'user_data_dir': self.args['user_data_dir']}) - elif 'user_data_dir' not in config: + if "user_data_dir" in self.args and self.args["user_data_dir"]: + config.update({"user_data_dir": self.args["user_data_dir"]}) + elif "user_data_dir" not in config: # Default to cwd/user_data (legacy option ...) - config.update({'user_data_dir': str(Path.cwd() / 'user_data')}) + config.update({"user_data_dir": str(Path.cwd() / "user_data")}) # reset to user_data_dir so this contains the absolute path. - config['user_data_dir'] = create_userdata_dir(config['user_data_dir'], create_dir=False) - logger.info('Using user-data directory: %s ...', config['user_data_dir']) - - config.update({'datadir': create_datadir(config, self.args.get('datadir', None))}) - logger.info('Using data directory: %s ...', config.get('datadir')) - - if self.args.get('exportfilename'): - self._args_to_config(config, argname='exportfilename', - logstring='Storing backtest results to {} ...') - config['exportfilename'] = Path(config['exportfilename']) + config["user_data_dir"] = create_userdata_dir( + config["user_data_dir"], create_dir=False + ) + logger.info( + "Using user-data directory: %s ...", + config["user_data_dir"]) + + config.update( + {"datadir": create_datadir(config, self.args.get("datadir", None))} + ) + logger.info("Using data directory: %s ...", config.get("datadir")) + + if self.args.get("exportfilename"): + self._args_to_config( + config, + argname="exportfilename", + logstring="Storing backtest results to {} ...", + ) + config["exportfilename"] = Path(config["exportfilename"]) else: - config['exportfilename'] = (config['user_data_dir'] - / 'backtest_results') + config["exportfilename"] = config["user_data_dir"] / \ + "backtest_results" def _process_optimize_options(self, config: Dict[str, Any]) -> None: # This will override the strategy configuration - self._args_to_config(config, argname='timeframes', - logstring='Parameter -i/--timeframes detected ... ' - 'Using timeframes: {} ...') - - self._args_to_config(config, argname='position_stacking', - logstring='Parameter --enable-position-stacking detected ...') - - self._args_to_config(config, argname='timerange', - logstring='Parameter --timerange detected: {} ...') - self._args_to_config(config, argname='days', - logstring='Parameter --days detected: {} ...') + self._args_to_config( + config, + argname="timeframes", + logstring="Parameter -i/--timeframes detected ... " + "Using timeframes: {} ...", + ) + + self._args_to_config( + config, + argname="position_stacking", + logstring="Parameter --enable-position-stacking detected ...", + ) + + self._args_to_config( + config, + argname="timerange", + logstring="Parameter --timerange detected: {} ...", + ) + self._args_to_config( + config, + argname="days", + logstring="Parameter --days detected: {} ...") self._process_datadir_options(config) - self._args_to_config(config, argname='timeframes', - logstring='Overriding timeframe with Command line argument') + self._args_to_config( + config, + argname="timeframes", + logstring="Overriding timeframe with Command line argument", + ) def _process_runmode(self, config: Dict[str, Any]) -> None: - self._args_to_config(config, argname='dry_run', - logstring='Parameter --dry-run detected, ' - 'overriding dry_run to: {} ...') + self._args_to_config( + config, + argname="dry_run", + logstring="Parameter --dry-run detected, " + "overriding dry_run to: {} ...", + ) if not self.runmode: # Handle real mode, infer dry/live from config - self.runmode = RunMode.DRY_RUN if config.get('dry_run', True) else RunMode.LIVE + self.runmode = ( + RunMode.DRY_RUN if config.get( + "dry_run", True) else RunMode.LIVE) logger.info(f"Runmode set to {self.runmode.value}.") - config.update({'runmode': self.runmode}) + config.update({"runmode": self.runmode}) - def _args_to_config(self, config: Dict[str, Any], argname: str, - logstring: str, logfun: Optional[Callable] = None, - deprecated_msg: Optional[str] = None) -> None: + def _args_to_config( + self, + config: Dict[str, Any], + argname: str, + logstring: str, + logfun: Optional[Callable] = None, + deprecated_msg: Optional[str] = None, + ) -> None: """ Parameters: ----------- - config: + config: Configuration dictionary - - argname: + + argname: Argumentname in self.args - will be copied to config dict. - - logstring: + + logstring: Logging String - - logfun: + + logfun: logfun is applied to the configuration entry before passing that entry to the log string using .format(). sample: logfun=len (prints the length of the found configuration instead of the content) """ - if (argname in self.args and self.args[argname] is not None - and self.args[argname] is not False): + if ( + argname in self.args + and self.args[argname] is not None + and self.args[argname] is not False + ): config.update({argname: self.args[argname]}) if logfun: @@ -228,7 +268,9 @@ def _args_to_config(self, config: Dict[str, Any], argname: str, else: logger.info(logstring.format(config[argname])) if deprecated_msg: - warnings.warn(f"DEPRECATED: {deprecated_msg}", DeprecationWarning) + warnings.warn( + f"DEPRECATED: {deprecated_msg}", + DeprecationWarning) def _resolve_pairs_list(self, config: Dict[str, Any]) -> None: """ @@ -248,20 +290,22 @@ def _resolve_pairs_list(self, config: Dict[str, Any]) -> None: # Download pairs from the pairs file if no config is specified # or if pairs file is specified explicitely if not pairs_file.exists(): - raise OperationalException(f'No pairs file found with path "{pairs_file}".') - with pairs_file.open('r') as f: - config['pairs'] = json_load(f) - config['pairs'].sort() + raise OperationalException( + f'No pairs file found with path "{pairs_file}".' + ) + with pairs_file.open("r") as f: + config["pairs"] = json_load(f) + config["pairs"].sort() return - if 'config' in self.args and self.args['config']: + if "config" in self.args and self.args["config"]: logger.info("Using pairlist from configuration.") - config['pairs'] = config.get('exchange', {}).get('pair_whitelist') + config["pairs"] = config.get("exchange", {}).get("pair_whitelist") else: # Fall back to /dl_path/pairs.json - pairs_file = config['datadir'] / 'pairs.json' + pairs_file = config["datadir"] / "pairs.json" if pairs_file.exists(): - with pairs_file.open('r') as f: - config['pairs'] = json_load(f) - if 'pairs' in config: - config['pairs'].sort() + with pairs_file.open("r") as f: + config["pairs"] = json_load(f) + if "pairs" in config: + config["pairs"].sort() diff --git a/finrl/config/directory_operations.py b/finrl/config/directory_operations.py index 22ec75b0c..abdc7be1c 100644 --- a/finrl/config/directory_operations.py +++ b/finrl/config/directory_operations.py @@ -10,17 +10,19 @@ logger = logging.getLogger(__name__) -def create_datadir(config: Dict[str, Any], datadir: Optional[str] = None) -> Path: +def create_datadir(config: Dict[str, Any], + datadir: Optional[str] = None) -> Path: - folder = Path(datadir) if datadir else Path(f"{config['user_data_dir']}/data") + folder = Path(datadir) if datadir else Path( + f"{config['user_data_dir']}/data") if not datadir: # set datadir - exchange_name = config.get('exchange', {}).get('name').lower() + exchange_name = config.get("exchange", {}).get("name").lower() folder = folder.joinpath(exchange_name) if not folder.is_dir(): folder.mkdir(parents=True) - logger.info(f'Created data directory: {datadir}') + logger.info(f"Created data directory: {datadir}") return folder @@ -30,30 +32,36 @@ def create_userdata_dir(directory: str, create_dir: bool = False) -> Path: if create_dir is True, then the parent-directory will be created if it does not exist. Sub-directories will always be created if the parent directory exists. Raises OperationalException if given a non-existing directory. - + Parameters: ----------- - directory: + directory: Directory to check - - create_dir: + + create_dir: Create directory if it does not exist. - - Return: + + Return: ------- Path object containing the directory """ - sub_dirs = ["backtest_results", "data", "logs", - "notebooks", "plot", "agents_trained", ] + sub_dirs = [ + "backtest_results", + "data", + "logs", + "notebooks", + "plot", + "agents_trained", + ] folder = Path(directory) if not folder.is_dir(): if create_dir: folder.mkdir(parents=True) - logger.info(f'Created user-data directory: {folder}') + logger.info(f"Created user-data directory: {folder}") else: raise OperationalException( f"Directory `{folder}` does not exist. " - "Please use `finrl create-userdir` to create a user directory") + ) # Create required subdirectories for f in sub_dirs: @@ -66,13 +74,13 @@ def create_userdata_dir(directory: str, create_dir: bool = False) -> Path: def copy_sample_files(directory: Path, overwrite: bool = False) -> None: """ Copy files from templates to User data directory. - + Parameters: ----------- - directory: + directory: Directory to copy data to - - overwrite: + + overwrite: Overwrite existing sample files """ if not directory.is_dir(): @@ -81,12 +89,16 @@ def copy_sample_files(directory: Path, overwrite: bool = False) -> None: for source, target in USER_DATA_FILES.items(): targetdir = directory / target if not targetdir.is_dir(): - raise OperationalException(f"Directory `{targetdir}` does not exist.") + raise OperationalException( + f"Directory `{targetdir}` does not exist.") targetfile = targetdir / source if targetfile.exists(): if not overwrite: - logger.warning(f"File `{targetfile}` exists already, not deploying sample file.") + logger.warning( + f"File `{targetfile}` exists already, not deploying sample file." + ) continue else: - logger.warning(f"File `{targetfile}` exists already, overwriting.") + logger.warning( + f"File `{targetfile}` exists already, overwriting.") shutil.copy(str(sourcedir / source), str(targetfile)) diff --git a/finrl/config/load_config.py b/finrl/config/load_config.py index 03d133ea6..5931cc8a2 100644 --- a/finrl/config/load_config.py +++ b/finrl/config/load_config.py @@ -22,49 +22,51 @@ def log_config_error_range(path: str, errmsg: str) -> str: """ Parses configuration file and prints range around error """ - if path != '-': - offsetlist = re.findall(r'(?<=Parse\serror\sat\soffset\s)\d+', errmsg) + if path != "-": + offsetlist = re.findall(r"(?<=Parse\serror\sat\soffset\s)\d+", errmsg) if offsetlist: offset = int(offsetlist[0]) text = Path(path).read_text() # Fetch an offset of 80 characters around the error line - subtext = text[offset-min(80, offset):offset+80] - segments = subtext.split('\n') + subtext = text[offset - min(80, offset): offset + 80] + segments = subtext.split("\n") if len(segments) > 3: # Remove first and last lines, to avoid odd truncations - return '\n'.join(segments[1:-1]) + return "\n".join(segments[1:-1]) else: return subtext - return '' + return "" def load_config_file(path: str) -> Dict[str, Any]: """ Loads a config file from the given path - + Parameters: ----------- - path: + path: path as str - - Return: + + Return: ------- configuration as dictionary """ try: # Read config from stdin if requested in the options - with open(path) if path != '-' else sys.stdin as file: + with open(path) if path != "-" else sys.stdin as file: config = rapidjson.load(file, parse_mode=CONFIG_PARSE_MODE) except FileNotFoundError: raise OperationalException( f'Config file "{path}" not found!' - ' Please create a config file or check whether it exists.') + " Please create a config file or check whether it exists." + ) except rapidjson.JSONDecodeError as e: err_range = log_config_error_range(path, str(e)) raise OperationalException( - f'{e}\n' - f'Please verify the following segment of your configuration:\n{err_range}' - if err_range else 'Please verify your configuration file for syntax errors.' + f"{e}\n" + f"Please verify the following segment of your configuration:\n{err_range}" + if err_range + else "Please verify your configuration file for syntax errors." ) return config diff --git a/finrl/config/timerange.py b/finrl/config/timerange.py index 60a192d59..698e232e5 100644 --- a/finrl/config/timerange.py +++ b/finrl/config/timerange.py @@ -18,8 +18,13 @@ class TimeRange: if *type is None, don't use corresponding startvalue. """ - def __init__(self, starttype: Optional[str] = None, stoptype: Optional[str] = None, - startts: int = 0, stopts: int = 0): + def __init__( + self, + starttype: Optional[str] = None, + stoptype: Optional[str] = None, + startts: int = 0, + stopts: int = 0, + ): self.starttype: Optional[str] = starttype self.stoptype: Optional[str] = stoptype @@ -28,79 +33,89 @@ def __init__(self, starttype: Optional[str] = None, stoptype: Optional[str] = No def __eq__(self, other): """Override the default Equals behavior""" - return (self.starttype == other.starttype and self.stoptype == other.stoptype - and self.startts == other.startts and self.stopts == other.stopts) + return ( + self.starttype == other.starttype + and self.stoptype == other.stoptype + and self.startts == other.startts + and self.stopts == other.stopts + ) def subtract_start(self, seconds: int) -> None: """ Subtracts from startts if startts is set. - + Parameters: ----------- seconds: Seconds to subtract from starttime - - return: + + return: -------- None (Modifies the object in place) """ if self.startts: self.startts = self.startts - seconds - def adjust_start_if_necessary(self, timeframe_secs: int, startup_candles: int, - min_date: arrow.Arrow) -> None: + def adjust_start_if_necessary( + self, timeframe_secs: int, startup_candles: int, min_date: arrow.Arrow + ) -> None: """ Adjust startts by candles. Applies only if no startup-candles have been available. - + Parameters: ----------- - timeframe_secs: + timeframe_secs: Timeframe in seconds e.g. `timeframe_to_seconds('5m')` - - startup_candles: + + startup_candles: Number of candles to move start-date forward - - min_date: + + min_date: Minimum data date loaded. Key kriterium to decide if start-time has to be moved - - Return: + + Return: ------- None (Modifies the object in place) """ - if (not self.starttype or (startup_candles - and min_date.int_timestamp >= self.startts)): - # If no startts was defined, or backtest-data starts at the defined backtest-date - logger.warning("Moving start-date by %s candles to account for startup time.", - startup_candles) - self.startts = (min_date.int_timestamp + timeframe_secs * startup_candles) - self.starttype = 'date' + if not self.starttype or ( + startup_candles and min_date.int_timestamp >= self.startts + ): + # If no startts was defined, or backtest-data starts at the defined + # backtest-date + logger.warning( + "Moving start-date by %s candles to account for startup time.", + startup_candles, + ) + self.startts = min_date.int_timestamp + timeframe_secs * startup_candles + self.starttype = "date" @staticmethod - def parse_timerange(text: Optional[str]) -> 'TimeRange': + def parse_timerange(text: Optional[str]) -> "TimeRange": """ Parse the value of the argument --timerange to determine what is the range desired - + Parameters: ----------- - text: + text: value from --timerange - - Return: + + Return: ------- Start and End range period """ if text is None: return TimeRange(None, None, 0, 0) - syntax = [(r'^-(\d{8})$', (None, 'date')), - (r'^(\d{8})-$', ('date', None)), - (r'^(\d{8})-(\d{8})$', ('date', 'date')), - (r'^-(\d{10})$', (None, 'date')), - (r'^(\d{10})-$', ('date', None)), - (r'^(\d{10})-(\d{10})$', ('date', 'date')), - (r'^-(\d{13})$', (None, 'date')), - (r'^(\d{13})-$', ('date', None)), - (r'^(\d{13})-(\d{13})$', ('date', 'date')), - ] + syntax = [ + (r"^-(\d{8})$", (None, "date")), + (r"^(\d{8})-$", ("date", None)), + (r"^(\d{8})-(\d{8})$", ("date", "date")), + (r"^-(\d{10})$", (None, "date")), + (r"^(\d{10})-$", ("date", None)), + (r"^(\d{10})-(\d{10})$", ("date", "date")), + (r"^-(\d{13})$", (None, "date")), + (r"^(\d{13})-$", ("date", None)), + (r"^(\d{13})-(\d{13})$", ("date", "date")), + ] for rex, stype in syntax: # Apply the regular expression to text match = re.match(rex, text) @@ -111,8 +126,8 @@ def parse_timerange(text: Optional[str]) -> 'TimeRange': stop: int = 0 if stype[0]: starts = rvals[index] - if stype[0] == 'date' and len(starts) == 8: - start = arrow.get(starts, 'YYYYMMDD').int_timestamp + if stype[0] == "date" and len(starts) == 8: + start = arrow.get(starts, "YYYYMMDD").int_timestamp elif len(starts) == 13: start = int(starts) // 1000 else: @@ -120,8 +135,8 @@ def parse_timerange(text: Optional[str]) -> 'TimeRange': index += 1 if stype[1]: stops = rvals[index] - if stype[1] == 'date' and len(stops) == 8: - stop = arrow.get(stops, 'YYYYMMDD').int_timestamp + if stype[1] == "date" and len(stops) == 8: + stop = arrow.get(stops, "YYYYMMDD").int_timestamp elif len(stops) == 13: stop = int(stops) // 1000 else: From 0649f9efc9be791fc4f623f967e475f16bb0a57e Mon Sep 17 00:00:00 2001 From: Youbadawy Date: Thu, 11 Mar 2021 10:47:34 -0500 Subject: [PATCH 5/5] Configuration Tests --- tests/test_config/__init__.py | 0 tests/test_config/conftest.py | 116 ++++++++++++++++++++ tests/test_config/test_config.py | 32 ++++++ tests/test_config/test_config_make.py | 34 ++++++ tests/test_env/test_env_cashpenalty.py | 60 ++++++---- tests/test_marketdata/test_yahoodownload.py | 5 +- 6 files changed, 223 insertions(+), 24 deletions(-) create mode 100644 tests/test_config/__init__.py create mode 100644 tests/test_config/conftest.py create mode 100644 tests/test_config/test_config.py create mode 100644 tests/test_config/test_config_make.py diff --git a/tests/test_config/__init__.py b/tests/test_config/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/test_config/conftest.py b/tests/test_config/conftest.py new file mode 100644 index 000000000..28ec1d2d8 --- /dev/null +++ b/tests/test_config/conftest.py @@ -0,0 +1,116 @@ +import pytest +from pathlib import Path + + +def get_default_conf(testdatadir): + """ Returns validated configuration suitable for most tests """ + configuration = { + "max_open_trades": 10, + "stake_currency": "BTC", + "stake_amount": 0.1, + "tradable_balance_ratio": 0.99, + "fiat_display_currency": "USD", + "timeframe": "1d", + "dry_run": True, + "exchange": { + "name": "binance", + "key": "", + "secret": "", + "ccxt_config": { + "enableRateLimit": True + }, + "ccxt_async_config": { + "enableRateLimit": True, + "rateLimit": 200 + }, + "pair_whitelist": [ + "SC/BTC", + "TROY/BTC", + "DREP/BTC", + "STMX/BTC", + "DOGE/BTC", + "TRX/BTC", + "IOST/BTC", + "XVG/BTC", + "REEF/BTC", + "CKB/BTC" + ], + "pair_blacklist": [] + }, + "ticker_list": [ + "AAPL", + "MSFT", + "JPM", + "V", + "RTX", + "PG", + "GS", + "NKE", + "DIS", + "AXP", + "HD", + "INTC", + "WMT", + "IBM", + "MRK", + "UNH", + "KO", + "CAT", + "TRV", + "JNJ", + "CVX", + "MCD", + "VZ", + "CSCO", + "XOM", + "BA", + "MMM", + "PFE", + "WBA", + "DD" + ], + "pairlists": [ + { + "method": "StaticPairList" + } + ], + "telegram": { + "enabled": True, + "token": "", + "chat_id": "" + }, + "api_server": { + "enabled": False, + "listen_ip_address": "127.0.0.1", + "listen_port": 8080, + "verbosity": "info", + "jwt_secret_key": "somethingrandom", + "CORS_origins": [], + "username": "", + "password": "" + }, + "dataformat_ohlcv": "json", + "dataformat_trades": "jsongz", + "user_data_dir": "./user_data/", + "TECHNICAL_INDICATORS_LIST": [ + "macd", + "boll_ub", + "boll_lb", + "rsi_30", + "cci_30", + "dx_30", + "close_30_sma", + "close_60_sma" + ] +} + return configuration + + +@pytest.fixture +def testdatadir() -> Path: + """Return the path where testdata files are stored""" + return (Path(__file__).parent / "testdata").resolve() + +@pytest.fixture(scope="function") +def default_conf(testdatadir): + return get_default_conf(testdatadir) \ No newline at end of file diff --git a/tests/test_config/test_config.py b/tests/test_config/test_config.py new file mode 100644 index 000000000..d53a08604 --- /dev/null +++ b/tests/test_config/test_config.py @@ -0,0 +1,32 @@ +# pragma pylint: disable=missing-docstring, protected-access, invalid-name +import json +import logging +import sys +import warnings +from copy import deepcopy +from pathlib import Path +from unittest.mock import MagicMock + +import pytest +from jsonschema import ValidationError + +from finrl.config import Configuration + + +def test_print_config(default_conf, mocker, caplog) -> None: + conf1 = deepcopy(default_conf) + # Delete non-json elements from default_conf + del conf1['user_data_dir'] + config_files = [conf1] + + configsmock = MagicMock(side_effect=config_files) + mocker.patch('finrl.config.configuration.create_datadir', lambda c, x: x) + mocker.patch('finrl.config.configuration.load_config_file', configsmock) + + validated_conf = Configuration.from_files(['test_conf.json']) + + assert isinstance(validated_conf['user_data_dir'], Path) + assert "user_data_dir" in validated_conf + assert "original_config" in validated_conf + assert isinstance(json.dumps(validated_conf['original_config']), str) + diff --git a/tests/test_config/test_config_make.py b/tests/test_config/test_config_make.py new file mode 100644 index 000000000..937b6d133 --- /dev/null +++ b/tests/test_config/test_config_make.py @@ -0,0 +1,34 @@ +from pathlib import Path +from unittest.mock import MagicMock + +import pytest + +from finrl.config.directory_operations import create_datadir, create_userdata_dir +from tests.test_config.conftest import default_conf + + +def test_create_datadir(mocker, default_conf, caplog) -> None: + mocker.patch.object(Path, "is_dir", MagicMock(return_value=False)) + md = mocker.patch.object(Path, 'mkdir', MagicMock()) + + create_datadir(default_conf, '/foo/bar') + assert md.call_args[1]['parents'] is True + + +def test_create_userdata_dir(mocker, default_conf, caplog) -> None: + mocker.patch.object(Path, "is_dir", MagicMock(return_value=False)) + md = mocker.patch.object(Path, 'mkdir', MagicMock()) + + x = create_userdata_dir('/tmp/bar', create_dir=True) + assert md.call_count == 7 + assert md.call_args[1]['parents'] is False + assert isinstance(x, Path) + assert str(x) == str(Path("/tmp/bar")) + + +def test_create_userdata_dir_exists(mocker, default_conf, caplog) -> None: + mocker.patch.object(Path, "is_dir", MagicMock(return_value=True)) + md = mocker.patch.object(Path, 'mkdir', MagicMock()) + + create_userdata_dir('/tmp/bar') + assert md.call_count == 0 diff --git a/tests/test_env/test_env_cashpenalty.py b/tests/test_env/test_env_cashpenalty.py index e8373d2e6..9da948323 100644 --- a/tests/test_env/test_env_cashpenalty.py +++ b/tests/test_env/test_env_cashpenalty.py @@ -9,8 +9,9 @@ class TestStocktradingEnvCashpenalty(unittest.TestCase): def setUp(cls): cls.ticker_list = ["AAPL", "GOOG"] cls.df = YahooDownloader( - start_date="2009-01-01", end_date="2021-01-01", ticker_list=cls.ticker_list - ).fetch_data() + start_date="2009-01-01", + end_date="2021-01-01", + ticker_list=cls.ticker_list).fetch_data() print(f"df columns: {cls.df.columns}") cls.indicators = ["open", "close", "high", "low", "volume"] @@ -19,7 +20,8 @@ def test_trivial(self): self.assertTrue(True) def test_zero_step(self): - # Prove that zero actions results in zero stock buys, and no price changes + # Prove that zero actions results in zero stock buys, and no price + # changes init_amt = 1e6 env = StockTradingEnvCashpenalty( df=self.df, initial_amount=init_amt, cache_indicator_data=False @@ -32,7 +34,7 @@ def test_zero_step(self): actions = np.zeros(len(self.ticker_list)) next_state, _, _, _ = env.step(actions) cash = next_state[0] - holdings = next_state[1 : 1 + len(self.ticker_list)] + holdings = next_state[1: 1 + len(self.ticker_list)] asset_value = env.account_information["asset_value"][-1] total_assets = env.account_information["total_assets"][-1] self.assertEqual(cash, init_amt) @@ -42,46 +44,60 @@ def test_zero_step(self): self.assertEqual(i + 1, env.current_step) def test_shares_increment(self): - # Prove that we can only buy/sell multiplies of shares based on shares_increment parameter - aapl_first_close = self.df[self.df['tic']=='AAPL'].head(1)['close'].values[0] + # Prove that we can only buy/sell multiplies of shares based on + # shares_increment parameter + aapl_first_close = self.df[self.df["tic"] == "AAPL"].head(1)[ + "close"].values[0] init_amt = 1e6 hmax = aapl_first_close * 100 shares_increment = 10 - env = StockTradingEnvCashpenalty(discrete_actions = True, - df=self.df, initial_amount=init_amt, hmax=hmax, - cache_indicator_data=False,shares_increment=shares_increment, - random_start=False + env = StockTradingEnvCashpenalty( + discrete_actions=True, + df=self.df, + initial_amount=init_amt, + hmax=hmax, + cache_indicator_data=False, + shares_increment=shares_increment, + random_start=False, ) _ = env.reset() - actions = np.array([0.29,0.0]) + actions = np.array([0.29, 0.0]) next_state, _, _, _ = env.step(actions) - holdings = next_state[1 : 1 + len(self.ticker_list)] + holdings = next_state[1: 1 + len(self.ticker_list)] self.assertEqual(holdings[0], 20.0) self.assertEqual(holdings[1], 0.0) - hmax_mc = self.df[self.df['tic']=='AAPL'].head(2).iloc[-1]['close'] / aapl_first_close - actions = np.array([-0.12 * hmax_mc,0.0]) + hmax_mc = ( + self.df[self.df["tic"] == "AAPL"].head(2).iloc[-1]["close"] + / aapl_first_close + ) + actions = np.array([-0.12 * hmax_mc, 0.0]) next_state, _, _, _ = env.step(actions) - holdings = next_state[1 : 1 + len(self.ticker_list)] + holdings = next_state[1: 1 + len(self.ticker_list)] self.assertEqual(holdings[0], 10.0) self.assertEqual(holdings[1], 0.0) def test_patient(self): - # Prove that we just not buying any new assets if running out of cash and the cycle is not ended - aapl_first_close = self.df[self.df['tic']=='AAPL'].head(1)['close'].values[0] + # Prove that we just not buying any new assets if running out of cash + # and the cycle is not ended + aapl_first_close = self.df[self.df["tic"] == "AAPL"].head(1)[ + "close"].values[0] init_amt = aapl_first_close hmax = aapl_first_close * 100 env = StockTradingEnvCashpenalty( - df=self.df, initial_amount=init_amt, hmax=hmax, - cache_indicator_data=False,patient=True, - random_start=False, + df=self.df, + initial_amount=init_amt, + hmax=hmax, + cache_indicator_data=False, + patient=True, + random_start=False, ) _ = env.reset() - actions = np.array([1.0,1.0]) + actions = np.array([1.0, 1.0]) next_state, _, is_done, _ = env.step(actions) - holdings = next_state[1 : 1 + len(self.ticker_list)] + holdings = next_state[1: 1 + len(self.ticker_list)] self.assertEqual(False, is_done) self.assertEqual(0.0, np.sum(holdings)) diff --git a/tests/test_marketdata/test_yahoodownload.py b/tests/test_marketdata/test_yahoodownload.py index 45571bab5..399edaa2a 100644 --- a/tests/test_marketdata/test_yahoodownload.py +++ b/tests/test_marketdata/test_yahoodownload.py @@ -9,7 +9,8 @@ def setUp(cls): def test_download(self): df = YahooDownloader( - start_date="2019-01-01", end_date="2019-02-01", ticker_list=self.ticker_list - ).fetch_data() + start_date="2019-01-01", + end_date="2019-02-01", + ticker_list=self.ticker_list).fetch_data() self.assertIsInstance(df, pd.DataFrame)