Skip to content

tapishsharma/GM_Stocks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Certainly! Here's the README.md file with the code snippets included for the API and License Functions sections:

Grand Master of Stocks

Overview

This repository serves as a hub for various tools, data, and scripts related to stock analysis. It includes a wide range of resources, such as:

  • Stock Data: Historical stock price data, annual reports, quarterly reports, and more.
  • Technical Analysis Strategies: A collection of technical analysis scripts and strategies to analyze stock data.
  • Natural Language Processing (NLP): Scripts and models for sentiment analysis and text analysis related to stock news and reports.
  • Chart Drawing: Utilities for creating visually informative charts and visualizations.
  • Utility Functions: A set of utility functions and tools to assist with various aspects of stock analysis.

Problem Statement

Briefly describe the problem your project is solving.

Price Table

Symbol Date 1 Date 2 Date 3 ...
col2
col3
...

Info Table

Symbol Number of Shares Market Cap Ratios Summary/About
col2
col3
...

API

1. Index Generator

Generate an index of stocks based on market cap.

def IndexGenerator(arrayOfStocks):
    sum = sum of market cap of all the stocks mentioned in this array
    keyValuePair = {}
    for stock in arrayOfStocks:
        keyValuePair[stock.symbol] = (stock.marketCap / sum) * 100
    return keyValuePair

2. Invested Amount in Index

Generate a portfolio based on invested amount and index.

def InvestedAmountInIndex(index, moneyToInvest):
    portfolio = {}
    for stock, weight in index.items():
        portfolio[stock] = (moneyToInvest * weight / 100) / stock.currentMarketPrice
    return portfolio

3. Plot Chart (Overloading)

Generate a chart for a stock.

def PlotChart(symbol, time):
    # chart generating library (needs research and development)
    return chart from today - time, today

def PlotChart(symbol, date1, date2):
    # chart generating library (needs research and development)
    return chart from date1, date2

4. All-Time High Teller

Get stocks near their all-time high price.

def AllTimeHighTeller(listOfStocks, percentage, up):
    result = []
    for stock in listOfStocks:
        if up:
            if (stock.currentPrice / stock.allTimeHighPrice) >= (1 - percentage / 100):
                result.append(stock)
        else:
            if (stock.currentPrice / stock.allTimeHighPrice) <= (percentage / 100):
                result.append(stock)
    return result

5. High Teller

Get stocks near their high price within a timeframe.

def HighTeller(listOfStocks, percentage, up, timeframe):
    result = []
    for stock in listOfStocks:
        if up:
            if (stock.currentPrice / stock.highPriceInTimeframe(timeframe)) >= (1 - percentage / 100):
                result.append(stock)
        else:
            if (stock.currentPrice / stock.highPriceInTimeframe(timeframe)) <= (percentage / 100):
                result.append(stock)
    return result

6. All-Time Low Teller

Get stocks near their all-time low price.

def AllTimeLowTeller(listOfStocks, percentage, down):
    result = []
    for stock in listOfStocks:
        if down:
            if (stock.currentPrice / stock.allTimeLowPrice) <= (percentage / 100):
                result.append(stock)
    return result

7. Low Teller

Get stocks near their low price within a timeframe.

def LowTeller(listOfStocks, percentage, down, timeframe):
    result = []
    for stock in listOfStocks:
        if down:
            if (stock.currentPrice / stock.lowPriceInTimeframe(timeframe)) <= (percentage / 100):
                result.append(stock)
    return result

8. Get F&O Stocks

Retrieve a list of stocks present in the F&O market.

def GetFNOStocks():
    # modify database of F&O
    return list of stocks present in F&O

9. Market Holidays

Get a list of market holidays starting from today.

def MarketHolidays(today):
    return list of holidays from today

10. Is Holiday

Check if today is a market holiday.

def IsHoliday():
    return True if today is a holiday else False

11. Recent Holiday

Get the most recent market holiday.

def RecentHoliday():
    return most recent holiday

License Functions

Test a Strategy

Test a trading strategy and calculate returns.

def CheckStrategy(listOfStocks, dateOfStart, dateEnd):
    sum = 0
    for stock in listOfStocks:
        try:
            sum += stock.currentMarketPrice / stock.priceOnDate(dateOfStart)
        except Exception as e:
            # handle null pointer exception
            pass
    return sum

def CheckStrategy(mapOfStocksWithMoney, dateOfStart, dateEnd):
    totalMoney = 0
    sum = 0
    for stock, money in mapOfStocksWithMoney.items():
        totalMoney += money
        try:
            sum += stock.currentMarketPrice / stock.priceOnDate(dateOfStart) * money
        except Exception as e:
            # handle null pointer exception
            pass
    return sum / totalMoney

Algorithms

Describe any algorithms or logic used in your project.

Baskets

Find stocks with similar movement to a given stock.

def SimilarStocks(stockName):
    return list of stocks that show similar movement to stockName

Web Scraper

Get Company's Consolidated Data

def GetConsolidatedData(symbol):
    return last four consolidated data points

Get Annual Report

def GetAnnualReport(symbol):
    return last four annual reports

Get News

def GetNews(symbol):
    return news related to that stock

def GetGeneralNews():
    return general news about the market

Get Financial Results

def GetResults():
    return financial results

Get Dividends

def GetDividends():
    return dividends

Get IPOs

def GetIPOs():
    return IPOs

Get Mergers

def GetMergers():
    return mergers

Get Demergers

def GetDemergers():
    return demergers

NLP

Analyze Annual Report

def AnalyzeAnnualReport(pdf):
    return summary

Analyze Differential Annual Reports

def AnalyzeDifferentialAnnualReports(pdf1, pdf2):
    return differential summary

Analyze Consolidated Report

def AnalyzeConsolidatedReport(pdf):
    return summary

Charts (Web Interface)

Generate and display charts on the web interface.

def PlotCharts():
    # drawable chart logic

Please replace the placeholder descriptions with detailed explanations for each section

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages