Giter Club home page Giter Club logo

pairs's People

Contributors

def-mycroft avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

genusgeoff

pairs's Issues

Create a web and browser app

wouldn't be too bad to use heroku or even a little aws server to spin up a web app.

I'd use Heroku and plotly dash for sure, I've built a handful of little webapps like that. heroku offers a free version too.

with plotly could easily create a formatted table of the trade history and get into some graphs.

would be cool to have this on heroku to make the project accessible to non-technical people.

also would be able to run this on localhost and create a browser-based application.

Added share sizes to output table

it would be useful to see what the latest share sizes for the pair are in the backtesting output. these sizes change based on realized volatility, so only the latest one would be used. it might be best to isolate the size calculation logic into its own module in the process of doing this as well.

Document backtest logic

Module pairs/lib/backtest/backtest.py contains the backtesting logic. A description of what this logic is should be written.

Find source of indeterminacy and implement fix

given the same input data, the results should be the same every time the backtest is ran, however this isn't the case:

(base) [main] m $  pairs analyze-pair
running backtest for FB-AMZN using archived data:
done, here are stats for FB-AMZN:
|    | metric               | value                     |
|---:|:---------------------|:--------------------------|
|  0 | date_min             | 2019-03-14T00:00:00-05:00 |
|  1 | date_max             | 2021-03-12T00:00:00-06:00 |
|  2 | count_data_points    | 504                       |
|  3 | count_trades         | 21                        |
|  4 | winrate              | 52.38%                    |
|  5 | count_losing_trades  | 10                        |
|  6 | count_winning_trades | 11                        |
|  7 | profit_max           | $10.36                    |
|  8 | loss_max             | $-47.72                   |
|  9 | sum_profit           | $-174.41                  |
| 10 | profit_mean          | $5.56                     |
| 11 | loss_mean            | $-23.56                   |
(base) [main] m $  pairs analyze-pair
running backtest for FB-AMZN using archived data:
done, here are stats for FB-AMZN:
|    | metric               | value                     |
|---:|:---------------------|:--------------------------|
|  0 | date_min             | 2019-03-14T00:00:00-05:00 |
|  1 | date_max             | 2021-03-12T00:00:00-06:00 |
|  2 | count_data_points    | 504                       |
|  3 | count_trades         | 21                        |
|  4 | winrate              | 57.14%                    |
|  5 | count_losing_trades  | 9                         |
|  6 | count_winning_trades | 12                        |
|  7 | profit_max           | $10.36                    |
|  8 | loss_max             | $-47.72                   |
|  9 | sum_profit           | $-168.23                  |
| 10 | profit_mean          | $5.93                     |
| 11 | loss_mean            | $-26.60                   |
(base) [main] m $  

Create Optimization Capacity

It might be nice to optimize the params, i.e. try a large number of different lookback windows and standard deviations to find ones that empirically were "best" according to some objective.

one hard part about this is that it may be too intensive for the current code...may consider integrating somehow with Stratagems.jl anyway, which would make optimization more possible.

Create User Config Functionality

I think this is a pre-req for a handful of other issues that are currently open, e.g. #9 (Tiingo addition), need to be able to accept api key from user and store it somewhere.

cement as config support.

should be able to run pairs config and walk the user through a configuration setup and ask for things like API keys and desired data storage location.

Create test cases and testing framework

need to be able to verify that the code is behaving as expected, and a good way of doing this is to feed a frozen dataset into the backtesting logic and compare the generated results to a frozen copy of the generated results.

as of now, there is a python module fb_amzn that contains a csv file (as a string) that is two years of $amzn and $fb data. this could be used as the input for the test.

Create sizing and risk limit / take profit threshold calculator

figuring out how to size the spread is a little bit tricky and having a calculator tool would be helpful.

there is already functionality that can model the spread (see here), that can be used to get a standard deviation of the spread price.

users could put their capital base and other similar params in the config file (a new section) and the cli would then spit out the number of shares and spread price thresholds.

also would want to calculate a maximum size for each leg, based on a 2-sigma daily move and risk parameter, it is important to avoid oversizing individual legs on these trades.

Create Market Scanner Tool

create functionality that scans a very large number of potential pairs, backtests a subset of them and returns pairs that have good backtesting scores.

there are a whole host of different potential problems with this and this is likely to be a really good way of showing that there is a huge difference between backtesting and actual trading, but regardless I think it could be useful.

finding a way to reduce the number of backtests might be key to making this possible. one way would be to create a correlation matrix of all candidate assets and only run backtesting on ones that meet a certain correlation level.

would need to evaluate whether or not all of this could be done in-memory or not, as well.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.