Skip to main content

Machine learning based crypto currency price prediction

Project description

TradeX

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.3.tar.gz (24.9 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.3-py3-none-any.whl (36.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tradeX-0.0.3.tar.gz
  • Upload date:
  • Size: 24.9 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.3.tar.gz
Algorithm Hash digest
SHA256 565e5cb86be0d7fdb4a7da15373d7d02f3bcde4019f437b6372381643922fbff
MD5 9cd0f8428b58a11bec09b5a80cc70a9f
BLAKE2b-256 9c4539afca143e55c317d5393bd8c95c6e3a5d7393368ed9ed152116dc510413

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tradeX-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 36.6 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 05652c95bc2620483885d784dcb3c1d0d11d3aa2c07c4fdfc34a995fae85dda1
MD5 ab41e0f1f5e2a270f6f389b375df5056
BLAKE2b-256 a48eed4ce1e52f8b5edda4706507be459edb7e218ffd2a790637211f50c54b2b

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