Giter Club home page Giter Club logo

delphi-oracle's Introduction

delphi-oracle's People

Contributors

kevb10 avatar

Watchers

 avatar  avatar  avatar

delphi-oracle's Issues

MACD

Technically we don't add the technical analyses into the model. Instead, these would be a form of confirmation.

Scenarios

In addition to testing against real market data, we need to create our own data for the worst and best case scenario. Compare those results against buy and hold and the S&P.

cleanup

add .vscode, .idea, *.nohup and some others to gitignore

Development chunks and schedule

This group of issues is to break the work down into smaller chunks so that we can set a schedule to the project parts.

Here are notes from the meeting this content came out of on 12/10/2020

FINANCIAL APP GOALS

  • An app that runs a machine learning algorithm to make trades for a user
  • Strategies are inputs
  • AI/ML executes strategies
  • Report of ML Strategy recommendations
  • UI for inputting strategy
  • Include Stop Loss

What already exists?

  • Intelligence/ML exists
    -Strategy to start needs iterated on
  • Back test before automating

What do we still need?

  • Need effective Backtester and Strategy (currently using TradingView)
  • Target with backtester is to have 80% confidence strategy is correct. also the strategy needs to beat buy and hold for the strategy and needs to beat S&P500.
  • Currently reliant on list that tells us what to look into. The screener updates the list. (currently TradingView)
  • Need a 70%+ (80%) rating on strategy to begin.

Strategy + Screener + Analysis + Exit = App.

Add news

Currently, news aren't a part of the analysis. This info would def improve the model

Rate of change

Filter based off of the rate of change. Buy the strongest. Sell the weakest.

Back testing

What: Leg work (by hand) to do back testing to test strategy before building.

Done: Strategy meets 80% effective.

When: 1 week (Dec 17th)

RSI

RSI above 80, especially 90 is a has good uptrend momentum

Tools

Here's a little guide that can help you play around with the notebooks:

Once you have all of that install, launch Anaconda Navigator, and click on Jupyter (should be the second box). It will launch a new tab and a folder tree. Go to the notebook's location (where you cloned this repo) and launch it. Hit the >> button and voila!

I might be missing a couple of dependencies but it should tell you what you're missing anyway. Just run pip3 install <whatever it's complaining about>.

Backtest strategies

Instead of #12 , we should just find a backtesting software and use that. Maybe in the future we can create our own.

Operating expenses

Create google doc for operating expenses and projections. (Based on data set and other costs)

Use Intrinio

Intrinio is has a very powerful API that has everything we need: stocks, options, fundamentals, news, etc..

It's a bit pricey compared to its competitors but it's the right kind of data.
This is it!

Use HighStock instead of matplotlib

We have a non-commercial license

Date of issue:  
License holder:   Manaser Kevi  
N/A
This license is valid for:   Personal / Student

Use usage of the following product(s):   Highcharts|Highstock.
This software is released under Creative Commons Attribution-NonCommercial 3.0, and is available for download at highcharts.com/download. No further activation or license key is required.    
Should you require a commercial license in the future, please visit our shop.   © 2018 HIGHSOFT - ALL RIGHTS RESERVED SENTRUMSGATA 44   6893 VIK I SOGN, NORWAY

Reports

What: Report on strategy and Success / Failures
Done: Need details
When: 2 weeks (2/11/2020)

Portfolio backtesting

Backtest our portfolio or composite against its buy and hold and popular composites like the S&P.

List of services and functions

algotrader

🔍 Screener Service

Trigger

This service runs after the market is closed (after 3pm) so we can include the latest daily data. We will start by running it at 7 pm and see if we need to move it a little bit earlier. So the trigger here is time.

Task

This service screens/filters the market for potential plays according to our parameters. It will give us a list of stocks that match our strategy(ies). We persist this list in DynamoDB where it will be picked up by another service.

🤑 Buy Lambda Function

Trigger

This function is scheduled to run at 7 am. More about cron jobs in AWS.

Task

At a high level, this function would place buy orders for stocks of interest. The implementation of it might be a two step one, though. Hitting DynamoDB might be an "event".

😎 Sell Lambda Function

Trigger

There multiple triggers:

Task

Its only job is to close a position: either before market open (or first thing when it does), or the stop loss, or take profit trigger is hit.

Interface

close(symbol, price=market)
symbol: the stock ticker symbol.
price: by default, we'll close at market price.

⛏ Analysis Service

Trigger

This service is scheduled to run intra-day: between 8 am - 3:30 pm, when the market is open.

Task

This service analyzes each position in the portfolio one by one (probably on an hourly basis). According to our strategy, we don't expect to close a position intra-day.

Build Exit Strategy

What: The exit strategy and stop loss strategy is accounted for.
Done: When a declared goal is reached the strategy exits. When the strategy doesnt meet a certain percentage of expected it will terminate (stop loss)
When: 2 weeks (10/28/2020)

Automate Placing Trade

What: Be able to automatically place a trade because you selected a strategy.
Done: Brokerage is connected to our tool. you only have to log into our tool and select the strategy and trades will be places. You will be able to determine how much money etc.
When: 2 days (01/14/2020)

Notes: need to define details of what you can define in the strategy.

Build Strategy into Screener

What: The strategy that has been tested with the back tester is built into the screener so that is can be automated. The strategy should be reportable. The strategy should be condensed and clear with a description so we know what it is when we create multiple in the future. Strategy should be selectable in the UI.
Done: Strategy is built into Screener.
When: 3 weeks. (01/07/2020)

Strategies

The trading style is trend-following, for the majority of our allocations.

  • MA 10,20,50
  • RSI

MA 20 == basis

Breakout

A breakout happens if:

  • last month's
    • low < basis
    • close > basis
  • this month's close (to date) > last month's close

Stop loss

If the stock closes below basis, close position.


Those alone can get us more than 70% accuracy. It won't beat the buy and hold for a single security, but it will beat buy and hold for a portfolio. (Need further backtesting #35)

Will go in-depth later..

Create a backtester

A backtest is the application of trading strategy rules to a set of historical pricing data.
That is, if we define a set of mechanisms for entry and exit into a portfolio of assets, and apply those rules to historical pricing data of those assets, we can attempt to understand the performance of this "trading strategy" that might have been attained in the past.

We have something in place right now in a Jupyter notebook and it's good enough but some things that can be improved are:

  • Mid-day open/close (swing)
  • Test script
  • Dashboard or some kind of front-end

Find the optimal changepoint value

Documentation here

tldr; a higher value makes the model more flexible while a lower value makes it less flexible

This will have to be different for every stock.

delphi-oracle/stocker.py

Lines 338 to 359 in 5c95102

def changepoint_prior_analysis(self, changepoint_priors=[0.001, 0.05, 0.1, 0.2], colors=['b', 'r', 'grey', 'gold']):
# Training and plotting with specified years of data
global predictions
train = self.stock[
(self.stock['Date'] > (max(self.stock['Date']) - pd.DateOffset(years=self.training_years)).date())]
# Iterate through all the changepoints and make models
for i, prior in enumerate(changepoint_priors):
# Select the changepoint
self.changepoint_prior_scale = prior
# Create and train a model with the specified cps
model = self.create_model()
model.fit(train)
future = model.make_future_dataframe(periods=180, freq='D')
# Make a dataframe to hold predictions
if i == 0:
predictions = future.copy()
future = model.predict(future)

AWS

Fargate
Forecast
Sagemaker
API-Gateway
DynamoDB

Build screener service

Create a service that takes a list of company stock symbol as the input and spits out a list of potential stock plays as the output.

Others Fixes

What: Things that come up or need wrapped up
Done: After an amount of time because we need to complete this iteration and then begin lining out the next iteration.
When: 2 weeks (03/10/2020)

UI

What: A user interface that allows you to set your goals enter your data and choose a strategy.
Done: The UI lets you pick the pieces needed for a strategy. you enter your dollar amount.
When: 1 week (02/25/2020)

Note: Kevbot will try and work on this so that it is to his liking and Kevb10 has a head start.

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.