|
from easydict import EasyDict |
|
|
|
stocks_dqn_config = dict( |
|
exp_name='stocks_dqn_seed0', |
|
env=dict( |
|
|
|
|
|
collector_env_num=8, |
|
evaluator_env_num=8, |
|
env_id='stocks-v0', |
|
n_evaluator_episode=8, |
|
stop_value=2, |
|
|
|
eps_length=253, |
|
|
|
window_size=20, |
|
|
|
save_path='./fig/', |
|
|
|
stocks_data_filename='STOCKS_GOOGL', |
|
|
|
|
|
train_range=None, |
|
test_range=None, |
|
), |
|
policy=dict( |
|
|
|
cuda=True, |
|
model=dict( |
|
obs_shape=62, |
|
action_shape=5, |
|
encoder_hidden_size_list=[128], |
|
head_layer_num=1, |
|
|
|
dueling=True, |
|
), |
|
|
|
discount_factor=0.99, |
|
|
|
nstep=5, |
|
|
|
learn=dict( |
|
update_per_collect=10, |
|
batch_size=64, |
|
learning_rate=0.001, |
|
|
|
target_update_freq=100, |
|
ignore_done=True, |
|
), |
|
|
|
collect=dict( |
|
|
|
|
|
n_sample=64, |
|
|
|
unroll_len=1, |
|
), |
|
|
|
other=dict( |
|
|
|
eps=dict( |
|
|
|
type='exp', |
|
start=0.95, |
|
end=0.1, |
|
decay=50000, |
|
), |
|
replay_buffer=dict(replay_buffer_size=100000, ) |
|
), |
|
), |
|
) |
|
stocks_dqn_config = EasyDict(stocks_dqn_config) |
|
main_config = stocks_dqn_config |
|
|
|
stocks_dqn_create_config = dict( |
|
env=dict( |
|
type='stocks-v0', |
|
import_names=['dizoo.gym_anytrading.envs.stocks_env'], |
|
), |
|
env_manager=dict(type='base'), |
|
policy=dict(type='dqn', ), |
|
evaluator=dict( |
|
type='trading_interaction', |
|
import_names=['dizoo.gym_anytrading.worker'], |
|
), |
|
) |
|
stocks_dqn_create_config = EasyDict(stocks_dqn_create_config) |
|
create_config = stocks_dqn_create_config |
|
|
|
if __name__ == "__main__": |
|
from ding.entry import serial_pipeline |
|
serial_pipeline([main_config, create_config], seed=0, max_env_step=int(1e7)) |
|
|