Metadata-Version: 2.1
Name: qfinuwa
Version: 1.0.3
Summary: Framework for backtesting quantitative trading algorithims.
Home-page: https://github.com/QFinUWA/algo-backtester/issues
Author: Isaac Bergl
Author-email: tberg644@gmail.com
Project-URL: Bug Tracker, https://github.com/QFinUWA/algo-backtester/issues
Project-URL: repository, https://github.com/QFinUWA/algo-backtester
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE.txt

# QFIN's Algorithmic Backtester (QFAB)

## Setup

To install on your system, use pip:

```
pip install qfinuwa
```

## API


## Algorithm

You algorithm can be initialised as follows:

```py

class MyCustomStrategy(Algorithm):
  
    def __init__(self):
        return
        
    def on_data(self, data, indicators, portfolio):
        return

```

Any hyperparameters you want to add to your model you can do in ``__init__``.


### on_data

``on_data`` takes in data and indicators which are both type ``dict``, keyed by the stocks. The portfolio class manages buying and selling stocks. 

### Indicators

To add an indicator to be passed into ``on_data`` during evalutation, define a new function in your strategy class that takes in data and returns a data column of the same length.

```py
# super bad example I need to change this
class MyCustomStrategy(Algorithm):
  
    def __init__(self):
        return
        
    def on_data(self, data, indicators, portfolio):
        return

    @Algorithm.indicator
    def vol_difference(data):
        return data['volume'].diff() + addition
```

In the above example we added an indicator called ``"vol_difference"`` that can be accessed during execution by 

```py
        
    def on_data(self, data, indicators, portfolio):

        V = indicators["vol_difference"]

        return
```

We can also add parameters to the indicator and algorithm itself, but we'll see that later.

## Backtester 

The ``Backtester`` class runs backtests given the inputs:
- An algorithm to test
- Data to test it on
- Hyperparameters for the algorithm including
  - Algorithm Hyperparameters
  - Indicator Hyperparameters
- Starting Balance and Fee
- Evaluation time

A backtester can be initialised like so:

```py
backtester = Backtester(['AAPL', 'GOOG'])
```

You can pass in your algorithm when initialising, or later.

```py
backtester = Backtester(['AAPL', 'GOOG'], strategy=MyCustomStrategy)
```

TODO finish this section.

MIT License

Copyright (c) 2022 Isaac Bergl, QFIN UWA

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
