Code Monkey home page Code Monkey logo

dataproject's Introduction

Back testing Portal

Implementing the Stastical Concepts and Understanding!!!

Requirements

Use the package manager python to install.

yfinance==0.1.63  #for fetching OHLC Data of indian Tickets
numpy==1.18.3     # Numeric computation
pandas==1.1.5     # Working with Data
plotly==4.6.0     # Data visualization
backtesting==0.3.2 # Backtesting library
streamlit==0.89.0  # used to build DS apps

Usage

import streamlit as st
# To make things easier later, we're also importing numpy and pandas for
# working with data
import numpy as np
import pandas as pd
import yfinance as yf
from backtesting import Backtest, Strategy
from backtesting.lib import crossover
from backtesting.test import SMA
import time
import plotly.express as px
import plotly.graph_objects as go
from PIL import Image            # for using images 

Functions

class SmaCross(Strategy):  #this is a simple moving average strategy we used 20,200 as mention below
    n1 = 20
    n2 = 200

    def init(self):
        close = self.data.Close
        self.sma1 = self.I(SMA, close, self.n1)
        self.sma2 = self.I(SMA, close, self.n2)

    def next(self):
        if crossover(self.sma1, self.sma2):
            self.buy()
        elif crossover(self.sma2, self.sma1):
            self.sell()


bt = Backtest(data_hist, SmaCross,
              cash=100000, commission=0.001,
              exclusive_orders=True)

output = pd.DataFrame(bt.run())

#Please make sure to update tests as appropriate.

Hosting

with the help of proc file we host in Heroku 
web: sh setup.sh && streamlit run dataproject.py

License

MIT

dataproject's People

Contributors

bharath-varma-p avatar

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.