Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
2076f51
started to implement rl env and extended cryptodataset for it
danielhomola Dec 23, 2020
c07fb1c
modifying the definition of p1 due to experiments in the rl notebook
danielhomola Dec 23, 2020
9728317
flashing out the runner and env.py a bit more
danielhomola Dec 23, 2020
aa12cb1
now we have all the components in place and I know what to do, now le…
danielhomola Dec 30, 2020
78b8650
going through environment.py and trying to make it work
danielhomola Dec 30, 2020
6e466d1
working on environment
danielhomola Dec 31, 2020
28b11cb
adding rl args and setting up the runner properly, time to go through…
danielhomola Jan 1, 2021
d35e2ca
adding rl args and setting up the runner properly, time to go through…
danielhomola Jan 1, 2021
d6f8fd3
going through ppo and networks to make it work with TCNs
danielhomola Jan 1, 2021
67f84a3
trying to get the tensor dims right to pass data through the TCN - no…
danielhomola Jan 1, 2021
85c8c9f
solved the data feeding problem, now onto making the env work
danielhomola Jan 2, 2021
ed384b9
solved the data feeding problem, now onto making the env work
danielhomola Jan 2, 2021
a596113
nearly training the network.. added dirichlet distribution instead of…
danielhomola Jan 2, 2021
c32ed32
ppo is training (and producing nonsensical results) but it's TRAINING…
danielhomola Jan 2, 2021
466d7b2
deleted unnecessary files
danielhomola Jan 2, 2021
15c2283
blackening somehow didn't run...Marci used to have this..
danielhomola Jan 2, 2021
06aec4e
ppo now trains and loss doesn't explode (nearly as often)
danielhomola Jan 4, 2021
9a7a57a
started
marcell-mate Jan 7, 2021
0e7cc25
small changes
danielhomola Jan 7, 2021
530f121
init
marcell-mate Jan 8, 2021
bf55dc4
fixing inverse linear implementation, changing past weights to past d…
danielhomola Jan 9, 2021
e8d9e8f
major rewrite of the experience collection to make it parallel - does…
danielhomola Jan 11, 2021
d90a86b
optimizers
marcell-mate Jan 12, 2021
7630ab2
clean up some of mess, adding flow of training step
marcell-mate Jan 12, 2021
1cb5a8e
gave up on parallel ppo on windows, let's try it on aws/linux
danielhomola Jan 13, 2021
0dc2b31
gotta commit
marcell-mate Jan 13, 2021
4e7e0a8
on track
marcell-mate Jan 14, 2021
2ee9d54
disc
marcell-mate Jan 14, 2021
f528469
got parallel experience gathering to a point, but now I simpy can't m…
danielhomola Jan 15, 2021
7c144d4
training_step is done for now
marcell-mate Jan 15, 2021
2c9edd4
start data
marcell-mate Jan 15, 2021
1123074
I cannot fucking believe it but I think I managed to crack this multi…
danielhomola Jan 16, 2021
86dcdfd
it works, even on windows but after a while it crashes with RuntimeEr…
danielhomola Jan 16, 2021
f78c606
now it works reliably both on win/linux! hallefuckingluja
danielhomola Jan 17, 2021
5785c57
adding logging of weights/portfolio and making few fixes to how actio…
danielhomola Jan 20, 2021
24b2837
data, runner, cleanup
marcell-mate Jan 21, 2021
232bdd3
preproc, volume scaling
marcell-mate Jan 22, 2021
57b4f56
adding immediate reward like in the pgportfolio paper@
danielhomola Jan 23, 2021
e92e857
making ppo env and reward calculation as close to the pgportfolio pap…
danielhomola Jan 26, 2021
9506e3f
making ppo env and reward calculation as close to the pgportfolio pap…
danielhomola Jan 26, 2021
6c31d18
sorting shit
marcell-mate Jan 29, 2021
ad59f60
merged in rl
marcell-mate Jan 29, 2021
c504ca7
plots
marcell-mate Jan 29, 2021
d48c2fb
adding multi head environment to speed up experience gathering withou…
danielhomola Jan 30, 2021
629b4a9
num_env_heads works with 1 or many, num_env_workers works with 1 or m…
danielhomola Jan 31, 2021
3d66510
args and stuff
marcell-mate Feb 3, 2021
b29a69c
Merge branch 'feat/rl' of https://github.com/danielhomola/dagobert in…
marcell-mate Feb 3, 2021
cd94349
debug
marcell-mate Feb 9, 2021
99cbea4
vaaaaa
marcell-mate Feb 9, 2021
d646bf6
bugz
marcell-mate Feb 18, 2021
26f41b0
just do it
marcell-mate Feb 22, 2021
de53399
corrections
marcell-mate Feb 23, 2021
4f055d3
TGAN
marcell-mate Feb 24, 2021
9c4913b
fixed optimizers as per TGAN paper. not sure if/why images log or not…
marcell-mate Feb 28, 2021
efc0556
fix fix
marcell-mate Feb 28, 2021
cc8f9b8
testing on local and adding more flexibility
Mar 17, 2021
79b9ee2
black. run!
Mar 17, 2021
f7c93d0
more graphs
Mar 24, 2021
337420d
keep models based on training loss
Mar 25, 2021
951ffcd
changing config
Mar 25, 2021
eec0ee7
changing config
Mar 25, 2021
fa5ab6f
changing config
Mar 25, 2021
96570be
config and accessing node nb
Jul 14, 2021
11296f7
tgan readme
Jul 15, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/custom/tcn_config_local.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ optuna_submission_delay: 30

output_size: 3
num_channels: [150, 150, 150, 150, 150, 150, 150]
kernel_size: 3
kernel_size: 10
dropout: 0.5
use_last_timepoint: True
last_y: False
Expand Down
41 changes: 21 additions & 20 deletions config/custom/tcn_config_m.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ tags:
- ethusdt_volume500
- simple_lookahead_y
no_comet_logger: True
seed: 40
seed: 42
batch_size: 256
early_stopping_rounds: 15
optimizer: adabelief
lr: 0.001
lr: 'auto'
max_lr: 0.1
max_lr_multiplier: 10
one_cycle_length: 60
Expand All @@ -40,7 +40,7 @@ output_size: 1
num_channels: [20, 20, 20, 20]
kernel_size: 3
dropout: 0.5
use_last_timepoint: False
use_last_timepoint: True
last_y: True
non_last_y_frac: 0.5
regression: False
Expand All @@ -58,14 +58,14 @@ no_sample_weights: True
data_dir: "C:/Users/u164428/Desktop/Dagobert/data/modelling"

lookback: auto
mini_series_length: 20
mini_series_length: auto

# If this is set to a number, then simple lookahead labelling is in place
simple_lookahead_y: 15
simple_lookahead_reg: False

# If this is True, anchor is labelled before preprocessing. to_label and simple_lookahead_y cannot be used together.
to_label: False
to_label: True
label_sl: 1
label_pt: 1
label_first_or_max: "first"
Expand All @@ -84,6 +84,12 @@ cols_to_model:
- high
- low
- close
- volume
- cum_volume_buy
- cum_volume_sell
- cum_volume_quote
- cum_volume_quote_buy
- cum_volume_quote_sell
# - open_fd_0.0
# - high_fd_0.0
# - low_fd_0.0
Expand All @@ -94,12 +100,6 @@ cols_to_model:
# - close_fd_tuned
# - cum_ticks
# - cum_dollar
# - volume
# - cum_volume_buy
# - cum_volume_sell
# - cum_volume_quote
# - cum_volume_quote_buy
# - cum_volume_quote_sell
# - sin_date
# - cos_date
# - sin_time
Expand Down Expand Up @@ -131,22 +131,23 @@ augment_method: random_fast
augment_prob: 0.25
simple_augment_dfs:
- std_bar_BTCUSDT_tick_1.feather
- std_bar_LTCUSDT_tick_1.feather
- std_bar_XRPUSDT_tick_1.feather
- std_bar_BTCUSDT_volume_100.feather
- std_bar_LTCUSDT_volume_1000.feather
- std_bar_XRPUSDT_volume_125000.feather
- std_bar_BTCUSDT_dollar_1000000.feather
- std_bar_LTCUSDT_dollar_40000.feather
- std_bar_XRPUSDT_dollar_20000.feather
# - std_bar_LTCUSDT_tick_1.feather
# - std_bar_XRPUSDT_tick_1.feather
# - std_bar_BTCUSDT_volume_100.feather
# - std_bar_LTCUSDT_volume_1000.feather
# - std_bar_XRPUSDT_volume_125000.feather
# - std_bar_BTCUSDT_dollar_1000000.feather
# - std_bar_LTCUSDT_dollar_40000.feather
# - std_bar_XRPUSDT_dollar_20000.feather
simple_augment_prob: 0.5
augment_dfs_mix: 0.33

# --------------------------------------------------------------------------------------
# PREPROCESSING
# --------------------------------------------------------------------------------------

train_start_date: "2018-06-01"
train_days: 30
train_days: 2
val_days: 1
val_train_offset_days: 1
val_puffer_days: 1
Expand Down
165 changes: 165 additions & 0 deletions config/rl_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@


# --------------------------------------------------------------------------------------
# LIGHTNING
# --------------------------------------------------------------------------------------

gpus: 1
pin_memory: True
profiler: True
#val_check_interval: 0.5
# enable it with 'power' or 'binsearch'
auto_scale_batch_size:
#precision: 16

# --------------------------------------------------------------------------------------
# RUN
# --------------------------------------------------------------------------------------

log_dir: logs
num_workers: 1
exp_name: RL-PPO-TCN
tags:
- RL_test
no_comet_logger: True
seed: 42
batch_size: 500
max_epochs: 100

# --------------------------------------------------------------------------------------
# RL
# --------------------------------------------------------------------------------------

asset_names:
- BTC
- ETH
- XRP
- LTC
trading_cost: 0.002
reward_type: portfolio_vs_market
num_env_heads: 20
num_env_workers: 1
normalize_advantages: True
pgportfolio: False
max_episode_length: 2000
steps_per_epoch: 80000
n_optim_iters: 4
gamma: 0.99
lam: 0.95
lr_actor: 0.0001
lr_critic: 0.0003
clip_ratio: 0.2
target_kl: 0.01


# don't change these, or preprocessing won't work
target_col: rl_return
to_label: False
no_sample_weights: True
binariser_method:

# --------------------------------------------------------------------------------------
# MODEL
# --------------------------------------------------------------------------------------

actor_num_channels: [50, 50, 50, 50, 50]
actor_kernel_size: 5
actor_dropout: 0.2
# sample size - exp abs diff to mean | 20 - 5% | 50 - 3% | 100 - 2% | 500 - 1%
actor_dirichlet_sample_size: 20
critic_num_channels: [50, 50, 50, 50, 50]
critic_kernel_size: 5
critic_dropout: 0.2
use_last_timepoint: False

# --------------------------------------------------------------------------------------
# DATA
# --------------------------------------------------------------------------------------

data_dir: "C:/Work/dagobert/data/modelling"

lookback: auto
mini_series_length: auto

df_train:
# anchor: std_bar_BTCUSDT_volume_100.feather
# df2: std_bar_ETHUSDT_volume_500.feather
# df3: std_bar_XRPUSDT_volume_125000.feather
# df4: std_bar_LTCUSDT_volume_1000.feather
anchor: std_bar_BTCUSDT_tick_1.feather
df2: std_bar_ETHUSDT_tick_1.feather
df3: std_bar_XRPUSDT_tick_1.feather
df4: std_bar_LTCUSDT_tick_1.feather
df_val:
df_test:
cols_to_model:
anchor:
- date_diff
- open
- high
- low
- close
# - open_fd_0.0
# - high_fd_0.0
# - low_fd_0.0
# - close_fd_0.0
# - open_fd_tuned
# - high_fd_tuned
# - low_fd_tuned
# - close_fd_tuned
- cum_ticks
- cum_dollar
- volume
- cum_volume_buy
- cum_volume_sell
- cum_volume_quote
- cum_volume_quote_buy
- cum_volume_quote_sell
- sin_date
- cos_date
- sin_time
- cos_time
# - boll
# - boll_lb
# - boll_ub
# - macd
# - macds
# - macdh
# - wr_60
# - rsi_60
# - rsv_60
# - atr_60
# - cci_60
# - kdjk_60
# - kdjd_60
# - kdjj_60
# - pdi_60
# - mdi_60
# - vr_60
df2:
df3:
df4:
# the cols of the secondary DFs will automatically be set to anchor's if not defined

time_feat_n: 1
time_embed_dim: 12

augment_method: random_fast
augment_prob: 0
augment_dfs:
augment_dfs_mix: 0

# --------------------------------------------------------------------------------------
# PREPROCESSING
# --------------------------------------------------------------------------------------

train_start_date: "2019-01-01"
train_days: 500
val_days: 30
val_train_offset_days: 1
val_puffer_days: 1
test_days: 30
test_train_offset_days: 62
test_puffer_days: 1

scaling_method: minmax
3 changes: 2 additions & 1 deletion config/tcn_config_data.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ no_sample_weights: False
# DATA
# --------------------------------------------------------------------------------------

data_dir: "/home/ubuntu/dagobert/data/modelling"
#data_dir: "/home/ubuntu/dagobert/data/modelling"
data_dir: "C:/Users/u164428/Desktop/Dagobert/data/modelling"

lookback: auto
mini_series_length: auto
Expand Down
Loading