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_create_update | 1 | Create or update a new stock factor. |
stock_factor_delete | 1 | Delete a stock factor. |
stock_factor_download | 1 | |
stock_factor_info | 1 | Retrieve basic stock factor info by ID or name. |
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(id | name)
Create or update a new stock factor. When the id is omitted a new factor will be created and the new id is returned.
Args:
factor_id: factor ID
or
name: factor name
Returns:
An object containing the basic stock factor info.
Examples:
>>> client.stock_factor_info(name='Stock factor name')
StockFactorInfoResult(factorId=123, name='Stock factor name')stock_factor_create_update(params)
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
Returns:
{
factorId : int
cost : int # API quota cost of the operation.
quotaRemaining : int # Remaining API quota after the operation.
}stock_factor_delete(id)
Delete a stock factor.
Args:
id: id of the factor
Returns:
{
cost : int # API quota cost of the operation.
quotaRemaining : int # Remaining API quota after the operation.
}stock_factor_download(id)
Download stock factor data
Args:
id: id of the factor
Returns:
Factor datastock_factor_upload(id, data, [ column_separator, existing_data, date_format, decimal_separator, ignore_errors, ignore_duplicates )
Upload data from a csv file into an existing stock factor
Args:
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,
Returns:
{
cost : int # API quota cost of the operation.
quotaRemaining : int # Remaining API quota after the operation.
}
Go to:
All p123api functions
Technical API reference