{"id":13460960,"url":"https://github.com/kkuette/TradzQAI","last_synced_at":"2025-03-24T19:33:33.506Z","repository":{"id":26155478,"uuid":"92601869","full_name":"kkuette/TradzQAI","owner":"kkuette","description":"Trading environnement for RL agents, backtesting and training.","archived":false,"fork":false,"pushed_at":"2022-06-21T21:28:48.000Z","size":520,"stargazers_count":164,"open_issues_count":7,"forks_count":47,"subscribers_count":23,"default_branch":"master","last_synced_at":"2024-10-29T06:33:34.605Z","etag":null,"topics":["algorithm","backtesting","bitcoin","bitcoin-bot","reinforcement-learning","reinforcement-learning-agent","reinforcement-learning-algorithms","trading","trading-algorithms","trading-bot","trading-env"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kkuette.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-05-27T13:55:54.000Z","updated_at":"2024-10-09T13:00:18.000Z","dependencies_parsed_at":"2022-09-01T11:10:19.013Z","dependency_job_id":null,"html_url":"https://github.com/kkuette/TradzQAI","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kkuette%2FTradzQAI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kkuette%2FTradzQAI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kkuette%2FTradzQAI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kkuette%2FTradzQAI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kkuette","download_url":"https://codeload.github.com/kkuette/TradzQAI/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245338651,"owners_count":20599067,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algorithm","backtesting","bitcoin","bitcoin-bot","reinforcement-learning","reinforcement-learning-agent","reinforcement-learning-algorithms","trading","trading-algorithms","trading-bot","trading-env"],"created_at":"2024-07-31T10:00:51.675Z","updated_at":"2025-03-24T19:33:33.043Z","avatar_url":"https://github.com/kkuette.png","language":"Python","funding_links":[],"categories":["Exchange API","Reinforcement Learning environments"],"sub_categories":["GYM Environment","Events \u0026 Sentiment trading"],"readme":"# TradzQAI\n\nTrading environnement for RL agents, backtesting and training.\n\nLive session with [coinbasepro-python](https://github.com/danpaquin/coinbasepro-python) is finaly arrived !\n\n- Available sessions:\n    - Local\n        - 1M bar datasets any size.\n            - header should be ['Time', 'Open', 'High', 'Low', 'Close', 'Volume'] with ';' as separator\n        - Tick datasets any size.\n            - header should be ['Time', 'BID', 'ASK', 'VOL'] or ['Time', 'Price', 'Volume'] with ',' as separator\n    - Live\n        - Gdax API\n\n- Available agents:\n    - DDPG\n    - DQFD\n    - DQN\n    - DQNN\n    - NAF\n    - PPO\n    - TRPO\n    - VPG\n\n- Available contract type:\n    - CFD\n    - Classic\n\nTradzQAI has been inspired by q-trader.\n\nIndicators lib come from [pyti](https://github.com/kylejusticemagnuson/pyti)\n\nMore datasets available [here](http://www.histdata.com/download-free-forex-data/)\n\n## Status\n\n    Alpha in development\n        GUI rework on track\n\n## Getting Started\n\n- Dependencies :\n  - [Tensorflow](https://github.com/tensorflow/tensorflow)\n  - [Tensorforce](https://github.com/reinforceio/tensorforce)\n  - [coinbasepro-python](https://github.com/danpaquin/coinbasepro-python)\n  - Pandas\n  - Numpy\n  - tqdm\n  - h5py\n\n  ### Installation :\n    ```pip install -r requirements.txt```\n\n- Running the project\n  ```\n  Usage:\n    python run.py -h (Show usage)\n    python run.py -b agent_name (to manually build config file, it build config files from agent, default PPO)\n    python run.py -s live (for live session) \n    python run.py -m eval (for eval mode)\n    python run.py -c config_dir/ # load config from directory, make sure you have agent, env and network json files in it\n    python run.py (Run as default)\n  ```\n  When you run it for the first time, a config directory is created, you can change it to changes environnement settings and some agents settings.\n  It save settings (env, agent, network) in a save directory, and create a new directory if make any changes.\n  \n  - Do you own decision function for maker side.\n    For more info look at [this function](https://github.com/kkuette/TradzQAI/blob/master/API/api.py#L41)\n    ```python\n    from core import Local_session as Session\n    from mymodule import myfunc\n    session = Session(mode=args.mode, config=args.config)\n    session.initApi(key=key, b64=b64, passphrase=passphrase, url=url,\n            product_id=product_id)\n    session.getApi().setBestPriceFunc(myfunc)\n     ```\n\n  - Do your own runner.\n  ```python\n  from core import Local_session as Session\n  session = Session() # Run with default values\n  session.loadSession() # loading environnement, worker and agent\n  session.start() # Start the session thread\n  ```\n  - Do your own worker.\n  ```python\n  from core import Local_env\n  env = Local_env() # run with default values\n  for e in episode:\n    state = env.reset()\n    for s in step:\n      action = agent.act(state)\n      next_state, terminal, reward = env.execute(action)\n      agent.observe(reward, terminal)\n      if terminal or env.stop:\n        break\n    if env.stop or e == episode - 1:\n      env.logger._running = False #Close the logger thread\n      break\n  ```\n  - How to use networks.\n    - You have to define your input to fit with columns name of your datasets, it will automaticaly it grab input from network and compare it with your dataset columns in [getState](https://github.com/kkuette/TradzQAI/blob/master/tools/utils.py#L326) function, it allow you to do complex network like this :\n        ```json\n        [\n            [\n                {\"names\": [\"Price\"], \"type\": \"input\"},\n                {\"activation\": \"relu\", \"size\": 8, \"type\": \"dense\"},\n                {\"activation\": \"relu\", \"size\": 8, \"type\": \"dense\"},\n                {\"name\": \"pricenet\", \"type\": \"output\"}\n            ],\n            [\n                {\"names\": [\"Volume\"], \"type\": \"input\"},\n                {\"activation\": \"relu\", \"size\": 8, \"type\": \"dense\"},\n                {\"activation\": \"relu\", \"size\": 8, \"type\": \"dense\"},\n                {\"name\": \"volnet\", \"type\": \"output\"}\n            ],\n            [\n                {\"names\": [\"pricenet\", \"volnet\"], \"type\": \"input\"},\n                {\"activation\": \"relu\", \"size\": 64, \"type\": \"dense\"},\n                {\"activation\": \"relu\", \"size\": 32, \"type\": \"dense\"},\n                {\"activation\": \"relu\", \"size\": 8, \"type\": \"dense\"},\n                {\"name\": \"prediction\", \"type\": \"output\"}\n            ]\n        ]\n        ```\n\n      - Simple network are handled as well without defining any input:\n      ```json\n        [\n            {\"activation\": \"relu\", \"size\": 64, \"type\": \"dense\"},\n            {\"activation\": \"relu\", \"size\": 64, \"type\": \"dense\"}\n        ]\n        ```\n  - Also TradzQAI support pre trained keras model:\n    - You can build settings for your model by using ```py run.py -b DEEP```.\n    Your model have to be placed in the same directory as the one you use to launch it and have to be called ```deep_model.h5```.\n\n        \n\n## Relevant project\n  - [TradingBrain](https://github.com/Prediction-Machines/Trading-Brain)\n  - [q-trader](https://github.com/edwardhdlu/q-trader)\n  \n### This project isn't perfect so keep this in mind.\n```THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkkuette%2FTradzQAI","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkkuette%2FTradzQAI","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkkuette%2FTradzQAI/lists"}