Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,97 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: apache-2.0
|
| 3 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
---
|
| 4 |
+
|
| 5 |
+
Thanks for letting me know! Here's a concise guide on how to use `bluewenne8.py`, incorporating its specific name and usage scenarios:
|
| 6 |
+
|
| 7 |
+
### How to Use `bluewenne8.py`
|
| 8 |
+
|
| 9 |
+
1. **Install Dependencies**:
|
| 10 |
+
Ensure you have the required libraries installed:
|
| 11 |
+
```sh
|
| 12 |
+
pip install ccxt pandas scikit-learn joblib argparse pytz
|
| 13 |
+
```
|
| 14 |
+
|
| 15 |
+
2. **Script Overview**:
|
| 16 |
+
`bluewenne8.py` performs cryptocurrency data analysis, trains a machine learning model, and makes predictions.
|
| 17 |
+
|
| 18 |
+
### Command-Line Usage
|
| 19 |
+
|
| 20 |
+
You run the script from the command line with various arguments to control its behavior:
|
| 21 |
+
|
| 22 |
+
#### 1. **Fetch Data and Analyze Symbols**
|
| 23 |
+
This command will fetch data for symbols, analyze the greatest candles, and save the results:
|
| 24 |
+
|
| 25 |
+
```sh
|
| 26 |
+
python bluewenne8.py --timeframe 1d
|
| 27 |
+
```
|
| 28 |
+
|
| 29 |
+
- **`--timeframe`**: Required. Defines the candlestick timeframe, e.g., '1d' for daily candles, '1h' for hourly candles.
|
| 30 |
+
|
| 31 |
+
#### 2. **Train the Model**
|
| 32 |
+
If you want to train a model on historical data, use the following command:
|
| 33 |
+
|
| 34 |
+
```sh
|
| 35 |
+
python bluewenne8.py --timeframe 1d --train
|
| 36 |
+
```
|
| 37 |
+
|
| 38 |
+
- **`--train`**: Optional. If included, the script will train a machine learning model using existing historical data.
|
| 39 |
+
|
| 40 |
+
#### 3. **Use Existing Model to Make Predictions**
|
| 41 |
+
To make predictions using an existing model:
|
| 42 |
+
|
| 43 |
+
```sh
|
| 44 |
+
python bluewenne8.py --timeframe 1d --use-existing
|
| 45 |
+
```
|
| 46 |
+
|
| 47 |
+
- **`--use-existing`**: Optional. If included, the script will use the pre-trained model to make predictions based on existing historical data.
|
| 48 |
+
|
| 49 |
+
### Detailed Steps for Each Mode
|
| 50 |
+
|
| 51 |
+
#### A. **Fetch Data and Analyze Symbols**
|
| 52 |
+
|
| 53 |
+
1. **Fetch Markets**: The script retrieves a list of available markets from the Binance exchange.
|
| 54 |
+
2. **Fetch OHLCV Data**: Collects candlestick data for each symbol based on the provided timeframe.
|
| 55 |
+
3. **Save Data**: Saves the fetched historical data to CSV files in the `downloaded_history` directory.
|
| 56 |
+
4. **Analyze Symbols**: Identifies and logs the greatest candle for each symbol, including current prices.
|
| 57 |
+
|
| 58 |
+
#### B. **Train the Model**
|
| 59 |
+
|
| 60 |
+
1. **Load Historical Data**: Reads data from CSV files in the `downloaded_history` directory.
|
| 61 |
+
2. **Preprocess Data**: Prepares data by formatting timestamps, setting indices, and splitting features and target variables.
|
| 62 |
+
3. **Train Model**: Uses a RandomForestRegressor to train on the historical data.
|
| 63 |
+
4. **Save Model**: Saves the trained model and scaler to disk (`model.pkl` and `scaler.pkl`).
|
| 64 |
+
|
| 65 |
+
#### C. **Use Existing Model to Make Predictions**
|
| 66 |
+
|
| 67 |
+
1. **Load Model and Data**: Loads the saved model and scaler, and reads historical data.
|
| 68 |
+
2. **Predict Next Candle**: Uses the trained model to predict future price movements based on the latest data.
|
| 69 |
+
3. **Save Predictions**: Writes predictions to a results file.
|
| 70 |
+
|
| 71 |
+
### File Structure and Directories
|
| 72 |
+
|
| 73 |
+
- **`downloaded_history/`**: Directory where historical data CSV files are saved.
|
| 74 |
+
- **`scan_results_bluewenne8/`**: Directory where results and prediction files are saved. Created based on the script name.
|
| 75 |
+
- **Model Files**: `model.pkl` and `scaler.pkl` are saved in the script's working directory when training.
|
| 76 |
+
|
| 77 |
+
### Example Use Case
|
| 78 |
+
|
| 79 |
+
1. **Fetch and Analyze Data**:
|
| 80 |
+
```sh
|
| 81 |
+
python bluewenne8.py --timeframe 1d
|
| 82 |
+
```
|
| 83 |
+
This will fetch data for all available USDT pairs, analyze it, and save results.
|
| 84 |
+
|
| 85 |
+
2. **Train Model**:
|
| 86 |
+
```sh
|
| 87 |
+
python bluewenne8.py --timeframe 1d --train
|
| 88 |
+
```
|
| 89 |
+
This will train the model on data from files matching the filter `BTC_USDT`.
|
| 90 |
+
|
| 91 |
+
3. **Predict with Existing Model**:
|
| 92 |
+
```sh
|
| 93 |
+
python bluewenne8.py --timeframe 1d --use-existing
|
| 94 |
+
```
|
| 95 |
+
This uses the pre-trained model to make predictions based on the latest historical data.
|
| 96 |
+
|
| 97 |
+
Feel free to adjust the timeframe and filters as needed for your specific analysis or training tasks.
|