# Strategies This module provides implementations of various trading strategies. The [Swing Trading Dashboard](https://moshferatu.dev/moshferatu/swing-trading-dashboard) depends on this module in order to provide an overview of recent trade signals. ## Example Usage The following is an example of obtaining trade signals for the 2-Period RSI strategy: ```python from datetime import datetime, timedelta from ohlc import ohlc from strategies import two_period_rsi # Obtain the necessary OHLC data first. today = datetime.today() data = ohlc('SPY', start_date = today - timedelta(days = 365), end_date = today) # Signals are returned as a pandas Series. signals = two_period_rsi(data) # Combining signals with date information from the OHLC data for demonstration purposes only. result = data[['Date']].copy() result['Signal'] = signals print(result) ``` ## Dependencies The strategies module depends on the following Python packages: ``` numpy pandas ``` It also depends on the following packages hosted here: * [Indicators](https://moshferatu.dev/moshferatu/indicators) * [OHLC](https://moshferatu.dev/moshferatu/ohlc) (only required for running tests) ## Local Workspace Setup After checking out the repository, the dependencies can be installed as follows (ideally in a virtual environment): ```shell pip install . --extra-index-url https://moshferatu.dev/api/packages/moshferatu/pypi/simple ``` If you want the build and test dependencies as well: ```shell pip install .[build,test] --extra-index-url https://moshferatu.dev/api/packages/moshferatu/pypi/simple ``` ---