These functions let you create and manage your own stock factors which consists of a list of dates, tickers and their associated values. You can also manage your factors on the website in Research→Imported Factors. You can read more about Imported Factors here: Imported Stock Factors.
Functions
Name | API credits | |
|---|---|---|
stock_factor_info | 1 | Retrieve the id of a factor |
stock_factor_create_update | 1 | Create or update a new stock factor. |
stock_factor_delete | 1 | Delete a stock factor. |
stock_factor_upload | 1 | Upload data from a csv file into an existing stock factor. |
Google Colab Examples
Import Stock Factors From a Table
Import multiple factors from a single table. The column names are used to create a new factor.
Imported Stock Factor CRUD (Create Read Update Delete)
Examples of all the imported factor functions to manage a single factor.
Other examples. Please let us know what you'd like to see here.
stock_factor_info()
Create or update a new stock factor. When the id is omitted a new factor will be created and the new id is returned.
stock_factor_info(
factor_id: Optional[int] = None,
name: Optional[str] = None
) -> dict
Return dict
factorId : int
name : string
description : string
cost : int # API quota cost of the operation.
quotaRemaining : int # Remaining API quota after the operation.stock_factor_create_update()
Create or update a new stock factor. When the id is omitted a new factor will be created and the new id is returned.
stock_factor_create_update(params: dict) -> dict
params: dict
id : int # Use 0 to create a new factor.
name : str
description : str
Return dict
factorId : int
cost : int # API quota cost of the operation.
quotaRemaining : int # Remaining API quota after the operation.stock_factor_delete()
Delete a stock factor.
stock_factor_delete(factor_id = id) -> dict
Return dict
cost : int # API quota cost of the operation.
quotaRemaining : int # Remaining API quota after the operation.stock_factor_upload()
Upload data from a csv file into an existing stock factor
stock_factor_upload(
factor_id: int,
data: Union[str, IO[str]],
column_separator: str = None,
'comma' | 'semicolon' | 'tab'
existing_data: str = None,
'overwrite' | 'skip' | 'delete'
date_format: str = None,
'yyyy-mm-dd' | 'yyyy/mm/dd' | 'mm/dd/yyyy' |
'mm-dd-yyyy' | 'dd/mm/yyyy' | 'dd-mm-yyyy' |
decimal_separator: str = None,
'.' | ','
ignore_errors: bool = None,
ignore_duplicates: bool = None,
) -> dict
Return dict
cost : int # API quota cost of the operation.
quotaRemaining : int # Remaining API quota after the operation.
Go to:
All p123api functions
Technical API reference