mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-02 23:41:27 +00:00
108 lines
2.4 KiB
Python
108 lines
2.4 KiB
Python
"""Optimization helpers"""
|
|
__docformat__ = "numpy"
|
|
|
|
import argparse
|
|
|
|
# These are all the possible yfinance properties
|
|
valid_property_infos = [
|
|
"previousClose",
|
|
"regularMarketOpen",
|
|
"twoHundredDayAverage",
|
|
"trailingAnnualDividendYield",
|
|
"payoutRatio",
|
|
"volume24Hr",
|
|
"regularMarketDayHigh",
|
|
"navPrice",
|
|
"averageDailyVolume10Day",
|
|
"totalAssets",
|
|
"regularMarketPreviousClose",
|
|
"fiftyDayAverage",
|
|
"trailingAnnualDividendRate",
|
|
"open",
|
|
"toCurrency",
|
|
"averageVolume10days",
|
|
"expireDate",
|
|
"yield",
|
|
"algorithm",
|
|
"dividendRate",
|
|
"exDividendDate",
|
|
"beta",
|
|
"circulatingSupply",
|
|
"regularMarketDayLow",
|
|
"priceHint",
|
|
"currency",
|
|
"trailingPE",
|
|
"regularMarketVolume",
|
|
"lastMarket",
|
|
"maxSupply",
|
|
"openInterest",
|
|
"marketCap",
|
|
"volumeAllCurrencies",
|
|
"strikePrice",
|
|
"averageVolume",
|
|
"priceToSalesTrailing12Months",
|
|
"dayLow",
|
|
"ask",
|
|
"ytdReturn",
|
|
"askSize",
|
|
"volume",
|
|
"fiftyTwoWeekHigh",
|
|
"forwardPE",
|
|
"fromCurrency",
|
|
"fiveYearAvgDividendYield",
|
|
"fiftyTwoWeekLow",
|
|
"bid",
|
|
"dividendYield",
|
|
"bidSize",
|
|
"dayHigh",
|
|
"annualHoldingsTurnover",
|
|
"enterpriseToRevenue",
|
|
"beta3Year",
|
|
"profitMargins",
|
|
"enterpriseToEbitda",
|
|
"52WeekChange",
|
|
"morningStarRiskRating",
|
|
"forwardEps",
|
|
"revenueQuarterlyGrowth",
|
|
"sharesOutstanding",
|
|
"fundInceptionDate",
|
|
"annualReportExpenseRatio",
|
|
"bookValue",
|
|
"sharesShort",
|
|
"sharesPercentSharesOut",
|
|
"fundFamily",
|
|
"lastFiscalYearEnd",
|
|
"heldPercentInstitutions",
|
|
"netIncomeToCommon",
|
|
"trailingEps",
|
|
"lastDividendValue",
|
|
"SandP52WeekChange",
|
|
"priceToBook",
|
|
"heldPercentInsiders",
|
|
"shortRatio",
|
|
"sharesShortPreviousMonthDate",
|
|
"floatShares",
|
|
"enterpriseValue",
|
|
"threeYearAverageReturn",
|
|
"lastSplitFactor",
|
|
"legalType",
|
|
"lastDividendDate",
|
|
"morningStarOverallRating",
|
|
"earningsQuarterlyGrowth",
|
|
"pegRatio",
|
|
"lastCapGain",
|
|
"shortPercentOfFloat",
|
|
"sharesShortPriorMonth",
|
|
"impliedSharesOutstanding",
|
|
"fiveYearAverageReturn",
|
|
"regularMarketPrice",
|
|
]
|
|
|
|
|
|
def check_valid_property_type(check_property: str) -> str:
|
|
"""Check that the property selected is valid"""
|
|
if check_property in valid_property_infos:
|
|
return check_property
|
|
|
|
raise argparse.ArgumentTypeError(f"{check_property} is not a valid info")
|