Created
July 23, 2019 02:43
-
-
Save jsrimr/f0c639b040b71b444c0fd4a9a928d935 to your computer and use it in GitHub Desktop.
trading env Getting started
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
import numpy as np | |
import pandas as pd | |
import trading_env | |
df = pd.read_hdf('dataset/SGXTW.h5', 'STW') | |
env = trading_env.make(env_id='training_v1', obs_data_len=256, step_len=128, | |
df=df, fee=0.1, max_position=5, deal_col_name='Price', | |
feature_names=['Price', 'Volume', | |
'Ask_price','Bid_price', | |
'Ask_deal_vol','Bid_deal_vol', | |
'Bid/Ask_deal', 'Updown']) | |
env.reset() | |
env.render() | |
state, reward, done, info = env.step(random.randrange(3)) | |
### randow choice action and show the transaction detail | |
for i in range(500): | |
print(i) | |
state, reward, done, info = env.step(random.randrange(3)) | |
print(state, reward) | |
env.render() | |
if done: | |
break | |
env.transaction_details |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment