API functions: Stock Factors

API functions for stock factor operations

Marco Salerno
Written by Marco SalernoLast update 10 days ago

You can create and store a custom stock factor on the website which consists of a list of dates, tickers and their associated values.

Stock Factors Functions

stock_factor_create_update

Create or update a new stock factor.

stock_factor_delete

Delete a stock factor.

stock_factor_upload

Upload data from a csv file into an existing stock factor.

stock_factor_create_update()

Wrapper for POST ​/stockFactor

Create or update a new stock factor. When the id is omitted a new factor will be created and the new id is returned.

p123api.Client().stock_factor_create_update({
    'name': 'FactorName',
    # Omit the id to create a new factor 
    'id' : id
    # Optional parameters
    'description': 'Description'
})

stock_factor_delete()

Wrapper for DELETE​ /stockFactor​/{id}

Delete a stock factor.

p123api.Client().stock_factor_delete(
     factor_id = id
)

stock_factor_upload()

Wrapper for POST ​/stockFactor​/upload​/{id}

Upload data from a csv file into an existing stock factor

p123api.Client().stock_factor_upload(
    file = 'C:/MyPath/Factors.csv',
    factor_id = id,
    column_separator = 'comma' | 'semicolon' | 'tab',
    existing_data = 'overwrite' | 'skip' | 'delete',
    date_format = 'yyyy-mm-dd' | 'yyyy/mm/dd' | 'mm/dd/yyyy' |
                  'mm-dd-yyyy' | 'dd/mm/yyyy' | 'dd-mm-yyyy' | 'dd.mm.yyyy',
    decimal_separator = '.' | ',',
    ignore_errors = False | True,
    ignore_duplicates = True | False
)

 

Go to:

Did this answer your question?