{"id":13579088,"url":"https://github.com/philipperemy/deep-learning-bitcoin","last_synced_at":"2025-04-05T09:07:42.096Z","repository":{"id":51225965,"uuid":"95946030","full_name":"philipperemy/deep-learning-bitcoin","owner":"philipperemy","description":"Exploiting Bitcoin prices patterns with Deep Learning.","archived":false,"fork":false,"pushed_at":"2018-09-22T01:46:18.000Z","size":549,"stargazers_count":527,"open_issues_count":9,"forks_count":133,"subscribers_count":86,"default_branch":"master","last_synced_at":"2025-03-29T08:08:04.785Z","etag":null,"topics":["artificial-intelligence","bitcoin","deep-learning","machine-learning"],"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/philipperemy.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-07-01T06:16:02.000Z","updated_at":"2025-03-21T14:39:39.000Z","dependencies_parsed_at":"2022-09-07T17:33:26.803Z","dependency_job_id":null,"html_url":"https://github.com/philipperemy/deep-learning-bitcoin","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philipperemy%2Fdeep-learning-bitcoin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philipperemy%2Fdeep-learning-bitcoin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philipperemy%2Fdeep-learning-bitcoin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/philipperemy%2Fdeep-learning-bitcoin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/philipperemy","download_url":"https://codeload.github.com/philipperemy/deep-learning-bitcoin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247312078,"owners_count":20918344,"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":["artificial-intelligence","bitcoin","deep-learning","machine-learning"],"created_at":"2024-08-01T15:01:36.432Z","updated_at":"2025-04-05T09:07:42.050Z","avatar_url":"https://github.com/philipperemy.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# When Bitcoin meets Artificial Intelligence\n[![dep1](https://img.shields.io/badge/Status-Work_In_Progress-orange.svg)]()\n\nExploiting Bitcoin prices patterns with Deep Learning. Like OpenAI, we train our models on raw pixel data. Exactly how an experienced human would see the curves and takes an action.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://bitcoin.org/img/icons/opengraph.png\" width=\"100\"\u003e\n\u003c/p\u003e\n\nSo far, we achieved:\n\n- [x] Download Bitcoin tick data\n- [x] Convert to 5-minute data\n- [x] Convert to Open High Low Close representation\n- [x] Train a simple AlexNet on 20,000 samples: accuracy is 70% for predicting if asset will go UP or DOWN. Training is done on [NVIDIA DIGITS](https://github.com/nvidia/digits) and with the Caffe framework.\n- [x] Quantify how much the price will go UP or DOWN. Because the price can go UP by epsilon percent 99% of the time, and pulls back by 50%\n- [ ] Train on **1,000,000+** samples (at least)\n- [ ] Apply more complex Conv Nets (at least Google LeNet)\n- [ ] Integrate bar volumes on the generated OHLC (Open, High, Low, Close) image\n- [ ] Use CNN attention to know what's important for which image. Maybe only a fraction of the image matters for the prediction\n\n## Results on 20,000 samples (small dataset)\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"assets/1.png\" width=\"500\"\u003e\n  \u003cbr\u003e\u003ci\u003eTraining on 5 minute price data (Coinbase USD)\u003c/i\u003e\n\u003c/p\u003e\n\n\u003chr/\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"assets/2.png\" width=\"500\"\u003e\n  \u003cbr\u003e\u003ci\u003eSome examples of the training set\u003c/i\u003e\n\u003c/p\u003e\n\n\u003chr/\u003e\n\n## Illustration of the dataset from CoinbaseUSD\n\n```\n                     price_open  price_high  price_low  price_close      volume  close_price_returns close_price_returns_bins  close_price_returns_labels\nDateTime_UTC                                                                                                                                             \n2017-05-29 11:55:00     2158.86     2160.06    2155.78      2156.00   21.034283             0.000000          (-0.334, 0.015]                           5\n2017-05-29 12:00:00     2155.98     2170.88    2155.79      2158.53   47.772555             0.117347           (0.015, 0.364]                           6\n2017-05-29 12:05:00     2158.49     2158.79    2141.12      2141.92  122.332090            -0.769505        (-1.0322, -0.683]                           3\n2017-05-29 12:10:00     2141.87     2165.90    2141.86      2162.44   87.253402             0.958019          (0.713, 1.0623]                           8\n```\n- Scroll right to see all the columns!\n- Volumes are displayed in BTC.\n- Returns are in percentage and are computed on the close prices.\n\n## How to get started?\n```\ngit clone https://github.com/philipperemy/deep-learning-bitcoin.git\ncd deep-learning-bitcoin\n./data_download.sh # will download it to /tmp/\npython3 data_generator.py /tmp/btc-trading-patterns/ /tmp/coinbaseUSD.csv 1 # 1 means we want to use quantiles on returns. 0 would mean we are interested if the bitcoin goes UP or DOWN only.\n```\n\nIf you are interested into building a huge dataset (coinbase.csv contains around 18M rows), it's preferrable to run the program in background mode:\n\n```\nnohup python3 -u data_generator.py /tmp/btc-trading-patterns/ /tmp/coinbaseUSD.csv 1 \u003e /tmp/btc.out 2\u003e\u00261 \u0026\ntail -f /tmp/btc.out\n```\n\nIf you ever see this error:\n\n```\n_tkinter.TclError: no display name and no $DISPLAY environment variable\n```\n\nPlease refer to this solution: https://stackoverflow.com/questions/37604289/tkinter-tclerror-no-display-name-and-no-display-environment-variable\n\n## Run with Docker\n\nTo build the docker image just execute\n\n```\ndocker build -t dlb .\n```\n\nfrom the repository folder and then run the container\n\n```\ndocker run -it --name dlb -v $PWD:/app dlb /bin/bash\n```\n\nthe current folder will be mounted into `/app`. To verify the correct mount\nexecute inside the container\n\n```\nroot@c11ef702a6d6:/app# mount| grep app\n/dev/sda2 on /app type ext4 (rw,relatime,errors=remount-ro,data=ordered)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphilipperemy%2Fdeep-learning-bitcoin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphilipperemy%2Fdeep-learning-bitcoin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphilipperemy%2Fdeep-learning-bitcoin/lists"}