The project consists of three main folders:
- Backtesting: Contains scripts for backtesting trading strategies.
- Csv: Contains historical price data in CSV format.
- Bots: Contains the trading bot scripts.
In this README file, we will be focusing on the eth_short.py file located in the Bots folder, which contains the code for a trading bot that trades the ETH/USDT pair on the Bybit exchange.
The eth_short.py file contains a Python script that implements a short strategy for ETH using Bybit API. This script uses technical analysis to make decisions about when to open and close a short position on ETH.
This script requires the following dependencies:
- Python 3.7 or later
- pandas
- numpy
- talib
- ccxt
- dotenv
The strategy_short function is the main function that implements the short strategy for ETH. This function takes two arguments:
- qty: The quantity of ETH to short.
- open_position: A boolean flag indicating whether there is an open position.
The function first retrieves the latest 5-minute candlestick data for ETH using the Bybit API and applies technical indicators such as RSI and Stochastic RSI to the data. It then makes a decision about whether to open or close a short position based on the indicators.
If there is no open position and the indicators suggest that it is a good time to short, the function opens a short position with a limit order. The function then continuously monitors the price of ETH and the technical indicators to decide whether to close the position based on a stop loss or take profit level, or based on an RSI exit condition.
If there is an open position, the function continuously monitors the price of ETH and the technical indicators to decide whether to close the position based on a stop loss or take profit level, or based on an RSI exit condition.
The script will continuously run and monitor the market until it is manually stopped.
This script is provided for educational purposes only and should not be used for actual trading without careful testing and verification of the results. Trading involves risk and should only be undertaken with risk capital.