--- 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` 1. **Install Dependencies**: Ensure you have the required libraries installed: ```sh pip install ccxt pandas scikit-learn joblib argparse pytz ``` 2. **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: ```sh 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: ```sh 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: ```sh 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** 1. **Fetch Markets**: The script retrieves a list of available markets from the Binance exchange. 2. **Fetch OHLCV Data**: Collects candlestick data for each symbol based on the provided timeframe. 3. **Save Data**: Saves the fetched historical data to CSV files in the `downloaded_history` directory. 4. **Analyze Symbols**: Identifies and logs the greatest candle for each symbol, including current prices. #### B. **Train the Model** 1. **Load Historical Data**: Reads data from CSV files in the `downloaded_history` directory. 2. **Preprocess Data**: Prepares data by formatting timestamps, setting indices, and splitting features and target variables. 3. **Train Model**: Uses a RandomForestRegressor to train on the historical data. 4. **Save Model**: Saves the trained model and scaler to disk (`model.pkl` and `scaler.pkl`). #### C. **Use Existing Model to Make Predictions** 1. **Load Model and Data**: Loads the saved model and scaler, and reads historical data. 2. **Predict Next Candle**: Uses the trained model to predict future price movements based on the latest data. 3. **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` and `scaler.pkl` are saved in the script's working directory when training. ### Example Use Case 1. **Fetch and Analyze Data**: ```sh python bluewenne8.py --timeframe 1d ``` This will fetch data for all available USDT pairs, analyze it, and save results. 2. **Train Model**: ```sh python bluewenne8.py --timeframe 1d --train ``` This will train the model on data from files matching the filter `BTC_USDT`. 3. **Predict with Existing Model**: ```sh 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.