get daylows
This commit is contained in:
0
stock/__init__.py
Normal file
0
stock/__init__.py
Normal file
25
stock/stock.py
Normal file
25
stock/stock.py
Normal file
@@ -0,0 +1,25 @@
|
||||
import yfinance as yf
|
||||
import json
|
||||
import argparse
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("stocks", metavar="N", type=str, nargs="+")
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
stocks = args.stocks
|
||||
daylows = [{"stock": stock, "daylow": return_daylow(stock)} for stock in stocks]
|
||||
|
||||
print(json.dumps(daylows))
|
||||
|
||||
|
||||
def return_daylow(stock: str):
|
||||
msft = yf.Ticker(stock)
|
||||
|
||||
return msft.info.get("dayLow")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user