GetStocks
Overview: This module finds and returns the top 20 S&P 500 index stocks in sectors of your choosingFunctionality: - Scrapes the S&P 500 company symbols from Wikipedia. - Fetches historical stock data for each symbol using `yfinance`. - Calculates the average annual return for each stock based on monthly closing prices. - Ranks the stocks by their average annual returns and returns the top investment options.
Args: - `sectors_of_interest (str)`: A string containing a list of all sectors you want to filter for
Return: - The `stocks` function returns a JSON formatted string representing the top investment options. Each investment option is a dictionary containing the stock symbol, its average annual return and current price
Example Call: dagger call stocks --sectors_of_interest="Health Care,Information Technology,Financials,Energy"
Installation
dagger install github.com/EmmS21/daggerverse/GetStocks@v0.0.5
Entrypoint
Return Type
GetStocks !
Example
dagger -m github.com/EmmS21/daggerverse/GetStocks@2f015d063a68519c8a968d43785ec248bd14c8b3 call \
func (m *myModule) example() *GetStocks {
return dag.
GetStocks()
}
@function
def example() -> dag.GetStocks:
return (
dag.get_stocks()
)
@func()
example(): GetStocks {
return dag
.getStocks()
}
Types
GetStocks 🔗
stocks() 🔗
Return Type
String !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
sectorsOfInterest | String ! | - | No description provided |
Example
dagger -m github.com/EmmS21/daggerverse/GetStocks@2f015d063a68519c8a968d43785ec248bd14c8b3 call \
stocks --sectors-of-interest string
func (m *myModule) example(ctx context.Context, sectorsOfInterest string) string {
return dag.
GetStocks().
Stocks(ctx, sectorsOfInterest)
}
@function
async def example(sectors_of_interest: str) -> str:
return await (
dag.get_stocks()
.stocks(sectors_of_interest)
)
@func()
async example(sectorsOfInterest: string): Promise<string> {
return dag
.getStocks()
.stocks(sectorsOfInterest)
}