Dagger
Search

StocksToMongo

Overview:
This module writes stocks data from the GetStocks function to a MongoDB document, each stock is written as it's own document

Functionality:
- Fetches stock data for specified sectors.
- Writes processed stock data to MongoDB.

Args:
- connection (Secret): Mongo Connection string
- db (str): Name of the database
- collection (str): Name of the collections
- sectors_of_interest (str): Name of the sectors of interest as a string
- period (str): Period of time to return returns and stock price for

Returns:
- Sucess if data is successfully written

Example Call:
dagger call getStocks --connection= --db= --collection= --sectors_of_interest= --period=

Installation

dagger install github.com/EmmS21/daggerverse/StocksToMongo@v0.0.1

Entrypoint

Return Type
StocksToMongo !
Example
func (m *myModule) example() *StocksToMongo  {
	return dag.
			StocksToMongo()
}
@function
def example() -> dag.StocksToMongo:
	return (
		dag.stocks_to_mongo()
	)
@func()
example(): StocksToMongo {
	return dag
		.stocksToMongo()
}

Types

StocksToMongo 🔗

getStocks() 🔗

Return Type
String !
Arguments
NameTypeDefault ValueDescription
connectionSecret !-A reference to a secret value, which can be handled more safely than the value itself.
dbString !-No description provided
collectionString !-No description provided
sectorsOfInterestString !-No description provided
periodString !-No description provided
Example
func (m *myModule) example(ctx context.Context, connection *Secret, db string, collection string, sectorsOfInterest string, period string) string  {
	return dag.
			StocksToMongo().
			GetStocks(ctx, connection, db, collection, sectorsOfInterest, period)
}
@function
async def example(connection: dagger.Secret, db: str, collection: str, sectors_of_interest: str, period: str) -> str:
	return await (
		dag.stocks_to_mongo()
		.get_stocks(connection, db, collection, sectors_of_interest, period)
	)
@func()
async example(connection: Secret, db: string, collection: string, sectorsOfInterest: string, period: string): Promise<string> {
	return dag
		.stocksToMongo()
		.getStocks(connection, db, collection, sectorsOfInterest, period)
}