Delay in rank_ranks after updating a stock factor via api

Hi all,

I've been using the API to upload a stock factor for a company, like this:

What I've noticed is that when I upload the stock factor and choose to delete the existing data (that contains 'old' values for an other company or other companies) and then run a ranking api call, the new data is indeed uploaded (I can see it under uploaded stock factors). However, the ranking system output shows a ranking as if the new data belongs to the 'old' company - that is: it impacts the rank value of the old company, not the 'new' company.

Only after 5 minutes or so, I see the right ranking system. So currently, I would have to wait a few minutes before calling the rank_ranks api.

LTRY is the 'old' company. As you can see, the values are in red and hence it should not rank this high.

VINO is the 'new' company for which the data was uploaded. It ranks lowest, while looking at the factor rankings should rank higher.

Could someone take a look at it?

Thanks,

Victor

Victor,

When dependencies, such as stock factors are updated, cached ranks are not currently discarded, so you are able to see stale results. We intend to improve this behavior so it happens automatically, but until then, you'll have to perform a ranking system update to force it to rank. Currently, that means using the /rank endpoint, which involves overwriting the ranking system nodes.

We're going to add a /rank/{id}/touch endpoint in the coming days, available hopefully this week, including in the Python client, which will directly allow users to force ranking in scenarios like this until the automatic behavior is in place. It won't cost API credits to call.

The endpoint is now available both on API and p123api-py.

Thanks, In the meantime I used a little hack to get the right data. But the addition you mentioned is way better. Great!

I've tried using the rank_touch endpoint by calling:

def rank_touch(client):
    """Touch ranking system"""

    try:
        response = client.rank_touch(rank_id = const.CONST_RANKING_SYSTEM_ID)
        return response
    except ValueError as e:
        raise ValueError(f"API request failed: {str(e)}")

However, I do not get a string response when calling. Response is a NoneType object. Am I missing something?

On success, the server will not send a response. It makes a modification on our end in the database which will ensure subsequent rank requests will not use stale cached results.