license: apache-2.0
The project on GitHub : https://github.com/reuniware/CryptoForex-Trader-Framework/tree/main/CCXT_ICHIMOKU/julie_scanner
How to Use bluewenne8.py
Install Dependencies: Ensure you have the required libraries installed:
pip install ccxt pandas scikit-learn joblib argparse pytz
Script Overview:
bluewenne8.py
performs cryptocurrency data analysis, trains a machine learning model, and makes predictions.
Command-Line Usage
You run the script from the command line with various arguments to control its behavior:
1. Fetch Data and Analyze Symbols
This command will fetch data for symbols, analyze the greatest candles, and save the results:
python bluewenne8.py --timeframe 1d
--timeframe
: Required. Defines the candlestick timeframe, e.g., '1d' for daily candles, '1h' for hourly candles.
2. Train the Model
If you want to train a model on historical data, use the following command:
python bluewenne8.py --timeframe 1d --train
--train
: Optional. If included, the script will train a machine learning model using existing historical data.
3. Use Existing Model to Make Predictions
To make predictions using an existing model:
python bluewenne8.py --timeframe 1d --use-existing
--use-existing
: Optional. If included, the script will use the pre-trained model to make predictions based on existing historical data.
Detailed Steps for Each Mode
A. Fetch Data and Analyze Symbols
- Fetch Markets: The script retrieves a list of available markets from the Binance exchange.
- Fetch OHLCV Data: Collects candlestick data for each symbol based on the provided timeframe.
- Save Data: Saves the fetched historical data to CSV files in the
downloaded_history
directory. - Analyze Symbols: Identifies and logs the greatest candle for each symbol, including current prices.
B. Train the Model
- Load Historical Data: Reads data from CSV files in the
downloaded_history
directory. - Preprocess Data: Prepares data by formatting timestamps, setting indices, and splitting features and target variables.
- Train Model: Uses a RandomForestRegressor to train on the historical data.
- Save Model: Saves the trained model and scaler to disk (
model.pkl
andscaler.pkl
).
C. Use Existing Model to Make Predictions
- Load Model and Data: Loads the saved model and scaler, and reads historical data.
- Predict Next Candle: Uses the trained model to predict future price movements based on the latest data.
- Save Predictions: Writes predictions to a results file.
File Structure and Directories
downloaded_history/
: Directory where historical data CSV files are saved.scan_results_bluewenne8/
: Directory where results and prediction files are saved. Created based on the script name.- Model Files:
model.pkl
andscaler.pkl
are saved in the script's working directory when training.
Example Use Case
Fetch and Analyze Data:
python bluewenne8.py --timeframe 1d
This will fetch data for all available USDT pairs, analyze it, and save results.
Train Model:
python bluewenne8.py --timeframe 1d --train
This will train the model on data from files matching the filter
BTC_USDT
.Predict with Existing Model:
python bluewenne8.py --timeframe 1d --use-existing
This uses the pre-trained model to make predictions based on the latest historical data.
Feel free to adjust the timeframe and filters as needed for your specific analysis or training tasks.