investfly.models.strategy.SecurityUniverseSelector

class StandardSymbolsList(builtins.str, enum.Enum):

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

SP_100 = SP_100
SP_500 = SP_500
NASDAQ_100 = NASDAQ_100
NASDAQ_COMPOSITE = NASDAQ_COMPOSITE
RUSSELL_1000 = RUSSELL_1000
RUSSELL_2000 = RUSSELL_2000
DOW_JONES_INDUSTRIALS = DOW_JONES_INDUSTRIALS
BIOTECH_ETF = BIOTECH_ETF
FINANCIAL_ETF = FINANCIAL_ETF
INDUSTRIAL_ETF = INDUSTRIAL_ETF
LARGECAP_GROWTH_ETF = LARGECAP_GROWTH_ETF
MATERIALS_ETF = MATERIALS_ETF
MIDCAP_GROWTH_ETF = MIDCAP_GROWTH_ETF
SMALLCAP_GROWTH_ETF = SMALLCAP_GROWTH_ETF
TECHNOLOGY_ETF = TECHNOLOGY_ETF
UTILITIES_ETF = UTILITIES_ETF
USD_CRYPTO = USD_CRYPTO
ALL_FOREX = ALL_FOREX
class CustomSecurityList:
symbols: List[str]
def addSymbol(self, symbol: str) -> None:
@staticmethod
def fromJson( json_dict: Dict[str, Any]) -> CustomSecurityList:
def toDict(self) -> Dict[str, Any]:
def validate(self) -> None:
class SecurityUniverseType(builtins.str, enum.Enum):

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

STANDARD_LIST = <SecurityUniverseType.STANDARD_LIST: 'STANDARD_LIST'>
CUSTOM_LIST = <SecurityUniverseType.CUSTOM_LIST: 'CUSTOM_LIST'>
FUNDAMENTAL_QUERY = <SecurityUniverseType.FUNDAMENTAL_QUERY: 'FUNDAMENTAL_QUERY'>
class ComparisonOperator(builtins.str, enum.Enum):

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

GREATER_THAN = <ComparisonOperator.GREATER_THAN: '>'>
LESS_THAN = <ComparisonOperator.LESS_THAN: '<'>
GREATER_OR_EQUAL = <ComparisonOperator.GREATER_OR_EQUAL: '>='>
LESS_OR_EQUAL = <ComparisonOperator.LESS_OR_EQUAL: '<='>
EQUAL_TO = <ComparisonOperator.EQUAL_TO: '=='>
class Sectors(builtins.str, enum.Enum):

Stock market sectors for fundamental queries.

INFORMATION_TECHNOLOGY = Information Technology
COMMUNICATION_SERVICES = Communication Services
UTILITIES = Utilities
ENERGY = Energy
CONSUMER_STAPLES = Consumer Staples
CONSUMER_DISCRETIONARY = Consumer Discretionary
MATERIALS = Materials
INDUSTRIALS = Industrials
FINANCIALS = Financials
REAL_ESTATE = Real Estate
HEALTH_CARE = Health Care
displayName: str

Get the display name of the sector.

@dataclass
class FinancialCondition:
operator: ComparisonOperator
@staticmethod
def fromDict( json_dict: Dict[str, Any]) -> FinancialCondition:
def toDict(self) -> Dict[str, Any]:
def validate(self) -> None:
class FinancialQuery:
queryConditions: List[FinancialCondition]
sectors: Set[str]
def addCondition( self, condition: FinancialCondition) -> None:
def addSector(self, sector: str) -> None:
@staticmethod
def fromDict( json_dict: Dict[str, Any]) -> FinancialQuery:
def toDict(self) -> Dict[str, Any]:
def validate(self) -> None:
@dataclass
class SecurityUniverseSelector:

This class is used to specify the set of stocks to use in trading strategy. You can pick one of the standard list (e.g SP100) that we provide, provide your own list with comma separated symbols list, or provide a query based on fundamental metrics like MarketCap, PE Ratio etc.

SecurityUniverseSelector( securityType: investfly.models.marketdata.SecurityType, universeType: SecurityUniverseType, standardList: StandardSymbolsList | None = None, customList: CustomSecurityList | None = None, financialQuery: FinancialQuery | None = None)

The security type for the universe selector

universeType: SecurityUniverseType

The approach used to specify the stocks. Depending on the universeType, one of the attribute below must be specified

standardList: StandardSymbolsList | None = None

Standard Symbol List (i.e SP500, SP100). Required if universeType is set to STANDARD_LIST

customList: CustomSecurityList | None = None
financialQuery: FinancialQuery | None = None
@staticmethod
def getValidSymbolLists( securityType: investfly.models.marketdata.SecurityType) -> List[StandardSymbolsList]:
@staticmethod
def fromDict( json_dict: Dict[str, Any]) -> SecurityUniverseSelector:
def toDict(self) -> Dict[str, Any]:
@staticmethod
def singleStock( symbol: str) -> SecurityUniverseSelector:
@staticmethod
def fromSecurity( security: investfly.models.marketdata.Security) -> SecurityUniverseSelector:
@staticmethod
def fromSymbols( securityType: investfly.models.marketdata.SecurityType, symbols: List[str]) -> SecurityUniverseSelector:
@staticmethod
def fromStandardList( standardListName: StandardSymbolsList) -> SecurityUniverseSelector:
@staticmethod
def fromFinancialQuery( financialQuery: FinancialQuery) -> SecurityUniverseSelector:
def validate(self) -> None: