poliniex to poloniex

This commit is contained in:
wassname
2017-07-18 09:07:07 +08:00
parent 4511baecec
commit f8a407c648
23 changed files with 18 additions and 18 deletions
+4 -4
View File
@@ -4,7 +4,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"load 30m poliniex data"
"load 30m poloniex data"
]
},
{
@@ -52,7 +52,7 @@
"outputs": [],
"source": [
"dfs=[]\n",
"for infile in glob.glob('./data/poliniex_teachmehowtotrade/*.csv'):\n",
"for infile in glob.glob('./data/poloniex_teachmehowtotrade/*.csv'):\n",
" df = pd.read_csv(infile)\n",
" \n",
" # date\n",
@@ -5731,8 +5731,8 @@
],
"source": [
"# save\n",
"df_train.to_hdf('./data/poliniex_30m.hf',key='train')\n",
"df_test.to_hdf('./data/poliniex_30m.hf',key='test')\n",
"df_train.to_hdf('./data/poloniex_30m.hf',key='train')\n",
"df_test.to_hdf('./data/poloniex_30m.hf',key='test')\n",
"df_train"
]
},
Can't render this file because it is too large.
Can't render this file because it is too large.
Can't render this file because it is too large.
Can't render this file because it is too large.
Can't render this file because it is too large.
Can't render this file because it is too large.
Can't render this file because it is too large.
Can't render this file because it is too large.
Can't render this file because it is too large.
Can't render this file because it is too large.
Can't render this file because it is too large.
Can't render this file because it is too large.
Can't render this file because it is too large.
Can't render this file because it is too large.
+2 -2
View File
@@ -164,7 +164,7 @@
},
"outputs": [],
"source": [
"df_train = pd.read_hdf('./data/poliniex_30m.hf',key='train')\n",
"df_train = pd.read_hdf('./data/poloniex_30m.hf',key='train')\n",
"env = PortfolioEnv(\n",
" df=df_train,\n",
" steps=30, \n",
@@ -176,7 +176,7 @@
")\n",
"env.seed = 0 \n",
"\n",
"df_test = pd.read_hdf('./data/poliniex_30m.hf',key='test')\n",
"df_test = pd.read_hdf('./data/poloniex_30m.hf',key='test')\n",
"env_test = PortfolioEnv(\n",
" df=df_test,\n",
" steps=30, \n",
+2 -3
View File
@@ -8,8 +8,7 @@ The main differences from Jian et. al. 2017 are:
- The first step in a deep learning project should be to make sure the model can overfit, this provides a sanity check. So I am first trying to acheive good results with no trading costs.
- I have not used portfolio vector memory, which could lead to it incurring large trading costs. But as I have disabled trading costs this shouldn't be a problem.
- I added some random shifts as data augmentation to prevent overfitting
- As well as vanilla policy gradient I tried generalized advantage estimation and Deep DPG ([Lillicrap et al. 2015]( http://arxiv.org/pdf/1509.02971v2.pdf))
- Instead of DPG (Deterinate policy gradient) I tried and DDPG (deep determinate policy gradient ([Lillicrap et al. 2015]( http://arxiv.org/pdf/1509.02971v2.pdf))) and VPG (vanilla policy gradient) with generalized advantage estimation.
- I tried to replicate the best CNN model from the paper (not the LSTM or RNN models)
Author: wassname
@@ -34,7 +33,7 @@ I have not managed to overfit to the training data or generalise to the test dat
- enviroments/portfolio.py - contains an openai environment for porfolio trading
- tensorforce-VPG.ipynb - notebook to try a policy gradient agent
- keras-ddpg - notebook to try a Deep DPG agent
- data/polinies_30m.hdf - hdf file with cryptocurrency 30 minutes prices
- data/poloniex_30m.hdf - hdf file with cryptocurrency 30 minutes prices
# Tests
+1
View File
@@ -14,3 +14,4 @@ numpy==1.12.1
matplotlib==2.0.0
# misc
tqdm==4.11.2
seaborn==0.7.1
+3 -3
View File
@@ -17,7 +17,7 @@ class DataSrc(object):
DataSrc.
df - csv for data frame index of timestamps
and multi-index columns levels=[['LTCBTC'],...],['close',...]]
and multi-index columns levels=[['LTCBTC'],...],['open','low','high','close']]
steps - total steps in episode
scale - scale the data for each episode
augment - fraction to augment the data by
@@ -167,8 +167,8 @@ class PortfolioEnv(gym.Env):
An environment for financial portfolio management.
Params:
df - data frame index of timestamps
and multi-index columns levels=[['LTCBTC'],...],['close',...]]
df - csv for data frame index of timestamps
and multi-index columns levels=[['LTCBTC'],...],['open','low','high','close']]
steps - steps in episode
scale - scale data and each episode (except return)
augment - fraction to randomly shift data by
+2 -2
View File
@@ -183,7 +183,7 @@
}
],
"source": [
"df_train = pd.read_hdf('./data/poliniex_30m.hf',key='train')\n",
"df_train = pd.read_hdf('./data/poloniex_30m.hf',key='train')\n",
"env = EnvWrapper(\n",
" df=df_train,\n",
" steps=30, \n",
@@ -195,7 +195,7 @@
")\n",
"env.seed = 0 \n",
"\n",
"df_test = pd.read_hdf('./data/poliniex_30m.hf',key='test')\n",
"df_test = pd.read_hdf('./data/poloniex_30m.hf',key='test')\n",
"env_test = EnvWrapper(\n",
" df=df_test,\n",
" steps=30, \n",
+4 -4
View File
@@ -3,7 +3,7 @@ import numpy as np
from src.environments.portfolio import PortfolioEnv
def test_env_outputs():
df = pd.read_hdf('./data/poliniex_30m.hf', key='train')
df = pd.read_hdf('./data/poloniex_30m.hf', key='train')
env = PortfolioEnv(df=df)
action = np.random.random(env.action_space.shape)
@@ -19,7 +19,7 @@ def test_env_outputs():
assert np.isfinite(v), '%s=%s should be finite' % (k, v)
def test_portfolio_env():
df = pd.read_hdf('./data/poliniex_30m.hf', key='train')
df = pd.read_hdf('./data/poloniex_30m.hf', key='train')
asset_names = df.columns.levels[0]
env = PortfolioEnv(df=df)
@@ -41,7 +41,7 @@ def test_portfolio_env():
def test_portfolio_env_hold():
df = pd.read_hdf('./data/poliniex_30m.hf', key='train')
df = pd.read_hdf('./data/poloniex_30m.hf', key='train')
asset_names = df.columns.levels[0]
np.random.seed(0)
@@ -57,7 +57,7 @@ def test_portfolio_env_hold():
def test_scaled():
df = pd.read_hdf('./data/poliniex_30m.hf', key='train')
df = pd.read_hdf('./data/poloniex_30m.hf', key='train')
np.random.seed(0)
env1 = PortfolioEnv(df=df, scale=True)