Custom dataset, reformatted to fit example dataset
OS: Ubuntu 20.04
TensorTrade version: 1.0.1b0
TensorFlow version: 2.3.1
Python version: 3.8
Running this script results in the following stacktrace. Most importantly:
File "/home/kristian/.local/lib/python3.8/site-packages/tensortrade/env/generic/environment.py", line 145, in reset c.reset() TypeError: reset() missing 1 required positional argument: 'self'
`
import pandas as pd
import tensortrade.env.default as default
from tensortrade.agents import DQNAgent
from tensortrade.feed.core import Stream, DataFeed, NameSpace
from tensortrade.oms.instruments import USDT, BTC, ETH, XRP
from tensortrade.oms.wallets import Wallet, Portfolio
from tensortrade.oms.exchanges import Exchange, ExchangeOptions
from tensortrade.oms.services.execution.simulated import execute_order
2021-02-06 19:27:31.193883: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'libcudart.so.10.1'; dlerror: libcudart.so.10.1: cannot open shared object file: No such file or directory 2021-02-06 19:27:31.193906: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine. 2021-02-06 19:27:32.611411: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'libcuda.so.1'; dlerror: libcuda.so.1: cannot open shared object file: No such file or directory 2021-02-06 19:27:32.611431: W tensorflow/stream_executor/cuda/cuda_driver.cc:312] failed call to cuInit: UNKNOWN ERROR (303) 2021-02-06 19:27:32.611447: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:156] kernel driver does not appear to be running on this host (kristian-dell): /proc/driver/nvidia/version does not exist 2021-02-06 19:27:32.611606: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN)to use the following CPU instructions in performance-critical operations: AVX2 FMA To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags. 2021-02-06 19:27:32.639139: I tensorflow/core/platform/profile_utils/cpu_utils.cc:104] CPU Frequency: 2899885000 Hz 2021-02-06 19:27:32.639480: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x5d7c3a0 initialized for platform Host (this does not guarantee that XLA will be used). Devices: 2021-02-06 19:27:32.639517: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Host, Default Version ==== AGENT ID: 22e8a74e-d3a1-4a6c-ad4f-a688385978fb ==== Traceback (most recent call last): File "/home/kristian/repos/MsXs/botpy.py", line 81, in <module> agent.train(n_steps=200, n_episodes=2, save_path="agents/") File "/home/kristian/.local/lib/python3.8/site-packages/tensortrade/agents/dqn_agent.py", line 149, in train state = self.env.reset() File "/home/kristian/.local/lib/python3.8/site-packages/tensortrade/env/generic/environment.py", line 145, in reset c.reset() TypeError: reset() missing 1 required positional argument: 'self'
System information
Running this script results in the following stacktrace. Most importantly:
File "/home/kristian/.local/lib/python3.8/site-packages/tensortrade/env/generic/environment.py", line 145, in reset c.reset() TypeError: reset() missing 1 required positional argument: 'self'
` import pandas as pd import tensortrade.env.default as default
from tensortrade.agents import DQNAgent from tensortrade.feed.core import Stream, DataFeed, NameSpace from tensortrade.oms.instruments import USDT, BTC, ETH, XRP from tensortrade.oms.wallets import Wallet, Portfolio from tensortrade.oms.exchanges import Exchange, ExchangeOptions from tensortrade.oms.services.execution.simulated import execute_order
btc_usdt_data = pd.read_csv('BTCUSDT-1m-withta.csv', nrows=20000)
eth_usdt_data = pd.read_csv('ETHUSDT-1m-withta.csv')
xrp_usdt_data = pd.read_csv('XRPUSDT-1m-withta.csv')
binance_options = ExchangeOptions(commission=0.1, min_trade_price=10) binance = Exchange("binance", service=execute_order, options=binance_options)( Stream.source(list(btc_usdt_data['BTC:close']), dtype="float").rename("USDT-BTC"),
Stream.source(list(eth_usdt_data['ETH:close']), dtype="float").rename("USDT-ETH"),
)
binance_btc = btc_usdt_data.loc[:, [name.startswith("BTC") for name in btc_usdt_data.columns]]
with NameSpace("binance"): binance_streams = [ Stream.source(list(binance_btc[c]), dtype="float").rename(c) for c in binance_btc.columns ]
feed = DataFeed(binance_streams) feed.next()
portfolio = Portfolio(USDT, [ Wallet(binance, 10000 USDT), Wallet(binance, 1 BTC) ])
binance_btc.head() renderer_feed = DataFeed([ Stream.source(list(btc_usdt_data["BTC:close_time"])).rename("date"), Stream.source(list(btc_usdt_data["BTC:open"]), dtype="float").rename("open"), Stream.source(list(btc_usdt_data["BTC:high"]), dtype="float").rename("high"), Stream.source(list(btc_usdt_data["BTC:low"]), dtype="float").rename("low"), Stream.source(list(btc_usdt_data["BTC:close"]), dtype="float").rename("close"), Stream.source(list(btc_usdt_data["BTC:volume"]), dtype="float").rename("volume") ]) env = default.create( portfolio=portfolio, action_scheme="managed-risk", reward_scheme="risk-adjusted", feed=feed, renderer_feed=renderer_feed, renderer=default.renderers.PlotlyTradingChart, window_size=20 )
env.observer.feed.next()
agent = DQNAgent(env) agent.train(n_steps=200, n_episodes=2, save_path="agents/")
`
2021-02-06 19:27:31.193883: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'libcudart.so.10.1'; dlerror: libcudart.so.10.1: cannot open shared object file: No such file or directory 2021-02-06 19:27:31.193906: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine. 2021-02-06 19:27:32.611411: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'libcuda.so.1'; dlerror: libcuda.so.1: cannot open shared object file: No such file or directory 2021-02-06 19:27:32.611431: W tensorflow/stream_executor/cuda/cuda_driver.cc:312] failed call to cuInit: UNKNOWN ERROR (303) 2021-02-06 19:27:32.611447: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:156] kernel driver does not appear to be running on this host (kristian-dell): /proc/driver/nvidia/version does not exist 2021-02-06 19:27:32.611606: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN)to use the following CPU instructions in performance-critical operations: AVX2 FMA To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags. 2021-02-06 19:27:32.639139: I tensorflow/core/platform/profile_utils/cpu_utils.cc:104] CPU Frequency: 2899885000 Hz 2021-02-06 19:27:32.639480: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x5d7c3a0 initialized for platform Host (this does not guarantee that XLA will be used). Devices: 2021-02-06 19:27:32.639517: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Host, Default Version ==== AGENT ID: 22e8a74e-d3a1-4a6c-ad4f-a688385978fb ==== Traceback (most recent call last): File "/home/kristian/repos/MsXs/botpy.py", line 81, in <module> agent.train(n_steps=200, n_episodes=2, save_path="agents/") File "/home/kristian/.local/lib/python3.8/site-packages/tensortrade/agents/dqn_agent.py", line 149, in train state = self.env.reset() File "/home/kristian/.local/lib/python3.8/site-packages/tensortrade/env/generic/environment.py", line 145, in reset c.reset() TypeError: reset() missing 1 required positional argument: 'self'