Skip to main content

Machine learning based crypto currency price prediction

Project description

Intel-Trace

This project provides tool to download Binance trading data in the past. Use the data to develop a mini AI model for coin prediction. Follow below step to reproduce:

  1. Install Python and required packages
  2. pip install -r requirements.txt
    

    Other lacking library can be installed manually by pip install <lib_name> command.

  3. Download Binance Kline-Candlestick Data
  4. cd tradeX
    # ex1: install BTC data from Sep 08 2019 to now, interval is one hour
    PYTHONPATH=. python scripts/get_all_time_data.py --symbol BTCUSDT --interval 1h
    
    # ex2: install other coin pairs data, .e.g Solona
    PYTHONPATH=. python scripts/get_all_time_data.py --symbol SOLUSDT --interval 3m
    
    # ex3: install data from a specified time to now, if not passed, default value is 1567962000000
    PYTHONPATH=. python scripts/get_all_time_data.py --symbol BTCUSDT --dfrom <time_in_milliseconds> --interval 1h
    

    Downloaded data is saved in data directory as default. Try to play with other interval values (1m 3m 5m 15m 30m 1h 2h 4h 6h 8h 12h 1d 3d 1w 1M).

  5. Split train-val data
  6. cd tradeX
    
    # replace the data path below with the newly downloaded data file.
    PYTHONPATH=. python scripts/split_train_val.py --data data/BTCUSDT_3m_2022.10.23_14.24.54.json
    

    After running above script, there will be 2 files ending with *_train.json and *_val.json generated.

  7. Train a simple model
  8. cd tradeX
    
    # Without GPU
    python scripts/train.py 
    --train_data <data/*_train.json file path> 
    --val_data <data/*_val.json file path>
    --window_size <50 or 100 or any positive number, default 50>
    --epochs 30
    --bsize 8
      
    # With GPU
    CUDA_VISIBLE_DEVICES=0,1,2,3 PYTHONPATH=. python scripts/train.py 
    --train_data <data/*_train.json file path> 
    --val_data <data/*_val.json file path>
    --window_size <50 or 100 or any positive number, default 50>
    --epochs 30
    --bsize 8
    --num_gpus 3
    

    Trained models is saved in weights directory with latest timestamp.

  9. Eval model on validation set
  10. cd tradeX
    
    python scripts/eval.py 
    --val_data data/BTCUSDT_3m_2022.10.23_14.24.54_val.json
    --window_size <50 or any positive number, should be same with trained window_size>
    --weight weights/2022.10.23_15.50.09/epoch=19-val_loss=3.94.pth.ckpt
    
  11. Auto futures-trading on Binance with your own strategy
  12. python run_testnet.py --interval 3m --symbol btcusdt
    

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tradeX-0.0.2.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tradeX-0.0.2-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

Details for the file tradeX-0.0.2.tar.gz.

File metadata

  • Download URL: tradeX-0.0.2.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.13

File hashes

Hashes for tradeX-0.0.2.tar.gz
Algorithm Hash digest
SHA256 606438e477be150978eb16678e03b92ea3f07bad65290663f2e545d8d9d47af6
MD5 9f094cfc48b1fd5fc047d3e3fbb09e7b
BLAKE2b-256 2a189b936c0b6dc60cc2ca080928a81ad81e9775a4618e8e9df4aebfa684765d

See more details on using hashes here.

File details

Details for the file tradeX-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: tradeX-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 3.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.13

File hashes

Hashes for tradeX-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9e31200e83cf00eda9f4ee8d498ec3bffdfbe03e637fd3ed1ccfa941263c92e9
MD5 2516c2a399424c59cedbcfc9fa7649d5
BLAKE2b-256 d3b2752dccbb08b0c270b4a5122169996a26296b9bf31cdfd2a45a0f06a49dea

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page