Git Product home page Git Product logo

tradzqai's People

Contributors

kkuette avatar quentindutot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tradzqai's Issues

Error

python run.py

Traceback (most recent call last):
File "run.py", line 30, in
from TradzQAI import Local_session as Session
File "/home/desktop/Downloads/TradzQAI-master/TradzQAI/init.py", line 1, in
from .core import Local_session
File "/home/desktop/Downloads/TradzQAI-master/TradzQAI/core/init.py", line 1, in
from .environnement import Local_env
File "/home/desktop/Downloads/TradzQAI-master/TradzQAI/core/environnement/init.py", line 1, in
from .local_env import Local_env
File "/home/desktop/Downloads/TradzQAI-master/TradzQAI/core/environnement/local_env.py", line 1, in
from TradzQAI.tools import act_processing
File "/home/desktop/Downloads/TradzQAI-master/TradzQAI/tools/init.py", line 5, in
from .utils import *
File "/home/desktop/Downloads/TradzQAI-master/TradzQAI/tools/utils.py", line 22
SyntaxError: Non-ASCII character '\xe2' in file /home/desktop/Downloads/TradzQAI-master/TradzQAI/tools/utils.py on line 22, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

Usage

Hello. How can I run normal backtest with real data? Just use python run.py?

Cannot modify training data

Hi.

I can successfully run the PPO agent using the provided file structure of the data directory. For this I am using "data_directory": "data/" as argument in environnement.json.

However, I tried pulling out the directory BTC_EUR_2018_07 and placed it in a new directory eval_data at the same level as the data dir. Now when I do 'python run.py -m train' I get the following error.

  File "run.py", line 110, in <module>
    session.loadSession()
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/TradzQAI/core/session/local.py", line 46, in loadSession
    self.initAgent()
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/TradzQAI/core/session/local.py", line 57, in initAgent
    self.agent = self.agent(env=self.env, device=self.device)._get()
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/TradzQAI/agents/PPO.py", line 6, in __init__
    Agent.__init__(self, env=env, device=device)
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/TradzQAI/agents/agent.py", line 27, in __init__
    device=device
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/lib/python3.6/site-packages/tensorforce/agents/agent.py", line 283, in from_spec
    kwargs=kwargs
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/lib/python3.6/site-packages/tensorforce/util.py", line 192, in get_object
    return obj(*args, **kwargs)
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/lib/python3.6/site-packages/tensorforce/agents/ppo_agent.py", line 155, in __init__
    entropy_regularization=entropy_regularization
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/lib/python3.6/site-packages/tensorforce/agents/learning_agent.py", line 141, in __init__
    batching_capacity=batching_capacity
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/lib/python3.6/site-packages/tensorforce/agents/agent.py", line 80, in __init__
    self.model = self.initialize_model()
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/lib/python3.6/site-packages/tensorforce/agents/ppo_agent.py", line 183, in initialize_model
    likelihood_ratio_clipping=self.likelihood_ratio_clipping
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/lib/python3.6/site-packages/tensorforce/models/pg_prob_ratio_model.py", line 88, in __init__
    gae_lambda=gae_lambda
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/lib/python3.6/site-packages/tensorforce/models/pg_model.py", line 98, in __init__
    requires_deterministic=False
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/lib/python3.6/site-packages/tensorforce/models/distribution_model.py", line 90, in __init__
    discount=discount
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/lib/python3.6/site-packages/tensorforce/models/memory_model.py", line 114, in __init__
    reward_preprocessing=reward_preprocessing
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/lib/python3.6/site-packages/tensorforce/models/model.py", line 217, in __init__
    self.setup()
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/lib/python3.6/site-packages/tensorforce/models/model.py", line 242, in setup
    self.setup_placeholders()
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/lib/python3.6/site-packages/tensorforce/models/model.py", line 448, in setup_placeholders
    kwargs=dict(shape=self.states_spec[name]['shape']))
UnboundLocalError: local variable 'name' referenced before assignment

Any idea?

base_env.py check_time_before_closing() idx not defined

I loaded a Dataset with LTCUSDT data from binance (Format: Timestamp;Open;Low,High;Close;Volume)
I now got the following error:

agent not loaded
binanceData_LTCUSDT_1m.csv :   0%|                        | 0/1 [00:00<?, ?it/sException in thread Thread-3:                              | 0/1 [00:00<?, ?it/s]
Traceback (most recent call last):█████▉| 200994/200998 [54:19<00:00, 27.90it/s]
  File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "/home/alcon/Desktop/TradzQAI/TradzQAI/core/worker/local_worker.py", line 23, in run
    self.step()
  File "/home/alcon/Desktop/TradzQAI/TradzQAI/core/worker/local_worker.py", line 46, in step
    state, terminal, reward = self.env.execute(action)
  File "/home/alcon/Desktop/TradzQAI/TradzQAI/core/environnement/local_env.py", line 178, in execute
    self.check_time_before_closing()
  File "/home/alcon/Desktop/TradzQAI/TradzQAI/core/environnement/base/base_env.py", line 148, in check_time_before_closing
    self.step_left = idx - self.current_step['step'] + 1
UnboundLocalError: local variable 'idx' referenced before assignment

binanceData_LTCUSDT_1m.csv : 100%|██████████████| 1/1 [54:19<00:00, 3259.48s/it]
^[[A Processing : 100%|████████████████▉| 200996/200998 [54:19<00:00, 61.67it/s]


Looking at the function i see that the runnervar idx is really not defined in the last line. I then defined the var at the begining as idx=0

    def check_time_before_closing(self):
        if self.current_step['step'] == self.len_data - 1:
            return
        for idx in range(self.current_step['step'] + 1 , self.len_data - 1):
            if self._date[idx - 1][7] != self._date[idx][7]:
                break
        self.step_left = idx - self.current_step['step'] + 1

The process ran smothly with my own data and the dax data in the repo but when running python3 run.py -m eval and checking the save logs everything is 0 like this:

2019:04:09 17:47:40 000000 Starting episode : 1
2019:04:09 17:47:56 000001 ######################################################
2019:04:09 17:47:56 000002 Total reward : 0
2019:04:09 17:47:56 000003 Average reward : 0.000
2019:04:09 17:47:56 000004 Avg reward 500 : 0.0
2019:04:09 17:47:56 000005 Avg reward 100 : 0.0
2019:04:09 17:47:56 000006 Avg reward 50 : 0.0
2019:04:09 17:47:56 000007 Avg reward 10 : 0.0
2019:04:09 17:47:56 000008 Total profit : 0
2019:04:09 17:47:56 000009 Total trade : 0
2019:04:09 17:47:56 000010 Sharp ratio : 0.000
2019:04:09 17:47:56 000011 Mean return : 0.000
2019:04:09 17:47:56 000012 Max Drawdown : 0.000
2019:04:09 17:47:56 000013 Max return : 0.000
2019:04:09 17:47:56 000014 Percent return : 0.000
2019:04:09 17:47:56 000015 Trade W/L : 0.000
2019:04:09 17:47:56 000016 Step : 18353
2019:04:09 17:47:56 000017 ######################################################

Any idea what i can do?

How to change the agent type?

Hi, I tried to build "-b BUILD" using DQN instead of PPO inside run.py line-10 / agent = "PPO". However, when I try to run the run.py, it still create directory for PPO_n. Where I should change it to switch the agent effectively. Thanks.

Choosing different agent than PPO produces faulty behavior.

I can run the default agent without issues, but had some trouble when running TRPO and DQN.

I tried removing both the save and config directories and rebuilding with trpo using 'python run.py -b TRPO'. The config directory seemed to be correctly created. The containing agent.json file had the correct property "type": "trpo_agent".

When I tried running the agent (python run.py) a save directory containing a PPO_0 directory was created. I tried changing the default agent in run.py to be TRPO as well but had the same result. The model could not evaluate and produced the following error.

Traceback (most recent call last):
  File "run.py", line 110, in <module>
    session.loadSession()
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/TradzQAI/core/session/local.py", line 46, in loadSession
    self.initAgent()
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/TradzQAI/core/session/local.py", line 57, in initAgent
    self.agent = self.agent(env=self.env, device=self.device)._get()
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/TradzQAI/agents/PPO.py", line 6, in __init__
    Agent.__init__(self, env=env, device=device)
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/TradzQAI/agents/agent.py", line 27, in __init__
    device=device
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/lib/python3.6/site-packages/tensorforce/agents/agent.py", line 283, in from_spec
    kwargs=kwargs
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/lib/python3.6/site-packages/tensorforce/util.py", line 192, in get_object
    return obj(*args, **kwargs)
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/lib/python3.6/site-packages/tensorforce/agents/trpo_agent.py", line 161, in __init__
    entropy_regularization=entropy_regularization
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/lib/python3.6/site-packages/tensorforce/agents/learning_agent.py", line 141, in __init__
    batching_capacity=batching_capacity
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/lib/python3.6/site-packages/tensorforce/agents/agent.py", line 80, in __init__
    self.model = self.initialize_model()
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/lib/python3.6/site-packages/tensorforce/agents/trpo_agent.py", line 189, in initialize_model
    likelihood_ratio_clipping=self.likelihood_ratio_clipping
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/lib/python3.6/site-packages/tensorforce/models/pg_prob_ratio_model.py", line 88, in __init__
    gae_lambda=gae_lambda
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/lib/python3.6/site-packages/tensorforce/models/pg_model.py", line 98, in __init__
    requires_deterministic=False
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/lib/python3.6/site-packages/tensorforce/models/distribution_model.py", line 90, in __init__
    discount=discount
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/lib/python3.6/site-packages/tensorforce/models/memory_model.py", line 114, in __init__
    reward_preprocessing=reward_preprocessing
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/lib/python3.6/site-packages/tensorforce/models/model.py", line 217, in __init__
    self.setup()
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/lib/python3.6/site-packages/tensorforce/models/model.py", line 290, in setup
    independent=independent
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/lib/python3.6/site-packages/tensorforce/models/memory_model.py", line 605, in create_operations
    independent=independent
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/lib/python3.6/site-packages/tensorforce/models/model.py", line 1195, in create_operations
    self.create_observe_operations(reward=reward, terminal=terminal)
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/lib/python3.6/site-packages/tensorforce/models/model.py", line 1129, in create_observe_operations
    reward=reward
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/lib/python3.6/site-packages/tensorflow/python/ops/template.py", line 368, in __call__
    return self._call_func(args, kwargs)
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/lib/python3.6/site-packages/tensorflow/python/ops/template.py", line 311, in _call_func
    result = self._func(*args, **kwargs)
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/lib/python3.6/site-packages/tensorforce/models/memory_model.py", line 566, in tf_observe_timestep
    return tf.cond(pred=optimize, true_fn=true_fn, false_fn=tf.no_op)
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 488, in new_func
    return func(*args, **kwargs)
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/lib/python3.6/site-packages/tensorflow/python/ops/control_flow_ops.py", line 2076, in cond
    orig_res_t, res_t = context_t.BuildCondBranch(true_fn)
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/lib/python3.6/site-packages/tensorflow/python/ops/control_flow_ops.py", line 1920, in BuildCondBranch
    original_result = fn()
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/lib/python3.6/site-packages/tensorforce/models/memory_model.py", line 562, in true_fn
    optimize = self.fn_optimization(**batch)
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/lib/python3.6/site-packages/tensorflow/python/ops/template.py", line 368, in __call__
    return self._call_func(args, kwargs)
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/lib/python3.6/site-packages/tensorflow/python/ops/template.py", line 311, in _call_func
    result = self._func(*args, **kwargs)
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/lib/python3.6/site-packages/tensorforce/models/pg_model.py", line 305, in tf_optimization
    next_internals=next_internals
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/lib/python3.6/site-packages/tensorforce/models/memory_model.py", line 491, in tf_optimization
    return self.optimizer.minimize(**arguments)
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/lib/python3.6/site-packages/tensorforce/core/optimizers/optimizer.py", line 139, in minimize
    deltas = self.step(time=time, variables=variables, **kwargs)
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/lib/python3.6/site-packages/tensorflow/python/ops/template.py", line 368, in __call__
    return self._call_func(args, kwargs)
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/lib/python3.6/site-packages/tensorflow/python/ops/template.py", line 311, in _call_func
    result = self._func(*args, **kwargs)
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/lib/python3.6/site-packages/tensorforce/core/optimizers/optimized_step.py", line 102, in tf_step
    **kwargs
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/lib/python3.6/site-packages/tensorflow/python/ops/template.py", line 368, in __call__
    return self._call_func(args, kwargs)
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/lib/python3.6/site-packages/tensorflow/python/ops/template.py", line 311, in _call_func
    result = self._func(*args, **kwargs)
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/lib/python3.6/site-packages/tensorforce/core/optimizers/natural_gradient.py", line 123, in tf_step
    deltas = self.solver.solve(fn_x=fisher_matrix_product, x_init=None, b=[-grad for grad in loss_gradients])
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/lib/python3.6/site-packages/tensorflow/python/ops/template.py", line 368, in __call__
    return self._call_func(args, kwargs)
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/lib/python3.6/site-packages/tensorflow/python/ops/template.py", line 311, in _call_func
    result = self._func(*args, **kwargs)
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/lib/python3.6/site-packages/tensorforce/core/optimizers/solvers/conjugate_gradient.py", line 80, in tf_solve
    return super(ConjugateGradient, self).tf_solve(fn_x, x_init, b)
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/lib/python3.6/site-packages/tensorforce/core/optimizers/solvers/iterative.py", line 78, in tf_solve
    args = tf.while_loop(cond=self.next_step, body=self.step, loop_vars=args)
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/lib/python3.6/site-packages/tensorflow/python/ops/control_flow_ops.py", line 3274, in while_loop
    return_same_structure)
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/lib/python3.6/site-packages/tensorflow/python/ops/control_flow_ops.py", line 2994, in BuildLoop
    pred, body, original_loop_vars, loop_vars, shape_invariants)
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/lib/python3.6/site-packages/tensorflow/python/ops/control_flow_ops.py", line 2929, in _BuildLoop
    body_result = body(*packed_vars_for_body)
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/lib/python3.6/site-packages/tensorflow/python/ops/template.py", line 368, in __call__
    return self._call_func(args, kwargs)
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/lib/python3.6/site-packages/tensorflow/python/ops/template.py", line 311, in _call_func
    result = self._func(*args, **kwargs)
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/lib/python3.6/site-packages/tensorforce/core/optimizers/solvers/conjugate_gradient.py", line 128, in tf_step
    A_conjugate = self.fn_x(conjugate)
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/lib/python3.6/site-packages/tensorforce/core/optimizers/natural_gradient.py", line 112, in fisher_matrix_product
    return tf.gradients(ys=delta_kldiv_gradients, xs=variables)
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/lib/python3.6/site-packages/tensorflow/python/ops/gradients_impl.py", line 596, in gradients
    gate_gradients, aggregation_method, stop_gradients)
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/lib/python3.6/site-packages/tensorflow/python/ops/gradients_impl.py", line 749, in _GradientsHelper
    _RaiseNoGradWrtInitialLoopValError(op, from_ops, xs)
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/lib/python3.6/site-packages/tensorflow/python/ops/gradients_impl.py", line 441, in _RaiseNoGradWrtInitialLoopValError
    % target_op.name)
ValueError: Cannot compute gradient inside while loop with respect to op 'trpo/actions-and-internals/layered-network/apply/dense0/apply/linear/apply/W'. We do not support taking the gradient wrt or through the initial value of a loop variable. Gradients can be computed through loop invariants or wrt the input parameters to the loop body.

Switching to dqn produced the same problems with the file structure, although the model could evaluate.

Performing training automatically evaluates the model.

So I have a little trouble understanding how the training/evaluation works.

If I run 'python run.py -m train', a log file "train_date.txt" is created with the resulting award in /save/agent_#. Likewise a log file "eval_date.txt" is created when I run the evaluation command.

I can run the eval command and get results even without running the training command first. The results of the evaluation seem to be the same regardless of how many times the evaluation is run, but the results of the training differ every time.

Can you explain what the difference is and what data is being used to evaluate the model? To me it seems like both commands train a model on all the provided data and then evaluate on parts of that same data, but I can't figure out what really is happening.

We cant afford any contract. Please check wallet settings.

Hi, i encountered another issue using the new code. I tried to increase the capital from 200 to 20000 (for example) and it still happened the same way. Any idea? Thanks.

/TradzQAI-master$ python3.6 run.py -m train
DAT_ASCII_GRXEUR_M1_201711.csv : 0%| | 0/1 [00:00<?, ?it/sException in thread Thread-4: | 0/1 [00:00<?, ?it/s]
Traceback (most recent call last): | 0/18354 [00:00<?, ?it/s]
File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "/usr/lib/python3.6/threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "/home/lamhk/TradzQAI-master/core/worker/local_worker.py", line 45, in run
self.step()
File "/home/lamhk/TradzQAI-master/core/worker/local_worker.py", line 71, in step
state, terminal, reward = self.env.execute(action)
File "/home/lamhk/TradzQAI-master/core/environnement/local_env.py", line 184, in execute
self.wallet.manage_exposure(self.contract_settings)
File "/home/lamhk/TradzQAI-master/core/environnement/base/wallet.py", line 197, in manage_exposure
raise ValueError('current_max_pos : {:.3f} We cant afford any contract. Please check wallet settings.'.format(self.risk_managment['current_max_pos']))
ValueError: current_max_pos : 0.000 We cant afford any contract. Please check wallet settings.

DAT_ASCII_GRXEUR_M1_201711.csv : 100%|████████████| 1/1 [00:00<00:00, 5.25it/s]

Regards,
lamhk

Possible bug in dataloader.py

Hi,

I ran into a problem when I tried running the new core. I successfully built the PPO agent, but when I executed an eval session I received the following exception.

#PRINT# lines.split(sep) = ['20180701000108', '5467.87', '0.062', '56.86932808248668', '1.828228906843833', '0.12368473729161092', '5468.798899294792', '5457.467818250765', '5444.815160592744']
Traceback (most recent call last):
  File "run.py", line 42, in <module>
    session.loadSession()
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/TradzQAI/TradzQAI/core/session/local.py", line 71, in loadSession
    self.initEnv()
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/TradzQAI/TradzQAI/core/session/local.py", line 102, in initEnv
    logger=self.logger, saver=self.saver, dataloader=self.dl)
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/TradzQAI/TradzQAI/core/environnement/local_env.py", line 84, in __init__
    self.dl.loadFile()
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/TradzQAI/TradzQAI/core/environnement/base/dataloader.py", line 177, in loadFile
    tmp_data, tmp_raw, tmp_time = self.getStockDataVec(self.files[self.files_index])
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/TradzQAI/TradzQAI/core/environnement/base/dataloader.py", line 150, in getStockDataVec
    df.columns = names
UnboundLocalError: local variable 'names' referenced before assignment

I'm not sure if the code is supposed to be able to handle a row length of 10 or not, but there shouldn't be any problem with the data as I tested it before and made sure the path is correct.

How to specify which trained model to be used for "eval"

Hi, I trained one model using 1 episode (PPO_0 and 1) and another one with 100 episodes (PPO_2). However, when I tried to perform the -m eval, i got the same result. I believe it used the same model even I have a trained model with 100 episodes. Please advise how i could specify which PPO_# to be used for eval? Thx.

Daily trading

Hello and thanks for great project.

Just wondering if it is possible to run TradzQAI with daily data or just in high frequency setup with minute bars.

Thanks.

Exception when running live version

I created a config for the PPO agent and trained it on the provided data without problems.

When I run 'python run.py -s live' I get the exception

  File "run.py", line 110, in <module>
    session.loadSession()
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/TradzQAI/core/session/live.py", line 61, in loadSession
    self.initAgent()
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/TradzQAI/core/session/live.py", line 74, in initAgent
    self.agent = self.agent(env=self.env, device=self.device)._get()
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/TradzQAI/agents/PPO.py", line 6, in __init__
    Agent.__init__(self, env=env, device=device)
  File "/Users/Oscar/Documents/Cryptotrading/Tradz/TradzQAI/agents/agent.py", line 24, in __init__
    states=self.env.states,
AttributeError: 'Live_env' object has no attribute 'states'

I made sure my api-key, pass and secret are correct. I am connecting to https://api.pro.coinbase.com as endpoint.

Anything I missed?

live session error

I have this problem when run with the live session:

  File "run.py", line 42, in <module>
    product_id=product_id)
  File "C:\Users\dannox\Google Drive\stockOptionsTrading\TradzQAI\TradzQAI\core\session\live.py", line 119, in initApi
    self.initEnv()
  File "C:\Users\dannox\Google Drive\stockOptionsTrading\TradzQAI\TradzQAI\core\session\live.py", line 124, in initEnv
    logger=self.logger, saver=self.saver, dataloader=self.dl, api=self.api)
  File "C:\Users\dannox\Google Drive\stockOptionsTrading\TradzQAI\TradzQAI\core\environnement\live_env.py", line 99, in __init__
    self.dl.loadHistorical()
  File "C:\Users\dannox\Google Drive\stockOptionsTrading\TradzQAI\TradzQAI\core\environnement\base\dataloader.py", line 245, in loadHistorical
    self.ticks = tick.join(self.indics.build_indicators(tick['Price']))
  File "C:\Users\dannox\Google Drive\stockOptionsTrading\TradzQAI\TradzQAI\tools\indicators\build_indicators.py", line 76, in build_indicators
    indicators[idx[1]] = idx[0](data, idx[2][0], idx[2][1])
  File "C:\Users\dannox\Google Drive\stockOptionsTrading\TradzQAI\TradzQAI\tools\indicators\moving_average_convergence_divergence.py", line 12, in moving_average_convergence_divergence
    check_for_period_error(data, long_period)
  File "C:\Users\dannox\Google Drive\stockOptionsTrading\TradzQAI\TradzQAI\tools\indicators\catch_errors.py", line 14, in check_for_period_error
    raise Exception("Error: data_len < period")
Exception: Error: data_len < period
Error: messages missing (4948236479 - 4948236523). Re-initializing  book at sequence.

Training on GPU

when I set the device to my GPU in run.py i get the following error:

InvalidArgumentError (see above for traceback): Cannot assign a device for operation 'ppo/initialize/action-action/Initializer/zeros': Could not satisfy explicit device specification '' because the node was colocated with a group of nodes that required incompatible device '/device:GPU:0' Colocation Debug Info: Colocation group had the following types and devices: Assign: CPU Const: CPU Fill: GPU CPU Switch: GPU CPU VariableV2: CPU Identity: GPU CPU RefSwitch: GPU CPU StridedSliceAssign: GPU CPU IsVariableInitialized: CPU

Does anybody has the same issue? Do you know were you can set something like
allow_soft_placement=True?
Thanks for your help!

PPO implementation

Hi man, could you please help me out with PPO? I "ported" q-trader to tensorflow js. It's painfully slow and i'd like to try to implement a different policy to it. Could you please walk me through a simple implementation for trading porpuses (3 actions, 1 stock, etc...) of the PPO?

I'm not a Python coder, and my python reading skills are not that great and for i can't seem to fully understand your code to try and implement it on tfjs.

How does the policy gets updated, what parameters go into it, how much faster is it from q function, etc...

Thanks,
Tiago

We cant afford any contract.

I get this error even though i set the wallet to a high amount. Can anybody help?

File "C:\Users\Miner_cunt\projects\TradzQAI\TradzQAI\core\environnement\base\wallet.py", line 199, in manage_exposure
raise ValueError('current_max_pos : {:.3f} We cant afford any contract. Please check wallet settings.'.format(self.risk_managment['current_max_pos']))
ValueError: current_max_pos : 0.000 We cant afford any contract. Please check wallet settings.

Thanks

h_len is zero

Hi kkuette,

I tried to the run the "-m eval" and get the following warning. Will this affect the result? Thanks.

File "...TradzQAI-master/core/environnement/base/base_env.py", line 373, in eval_processing
avg_profit /= h_len
ZeroDivisionError: division by zero

complex network "names" issue

When I try to change the network to a complex network I get this error:

File "/Users/dropper/projects/crypto_bot/tforce_btc_trader/tensorforce/tensorforce/util.py", line 159, in get_object return obj(*args, **kwargs) TypeError: __init__() got an unexpected keyword argument 'names'

Do I have to change something in the dataloader.py?

Thank you

Using other exchanges

Is it possible to change the exchanges for the life exchanges?
Where to start?
If you give me a starting point i could try and do it myself and make a pull request afterwards

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.