akaszynski/keepa

Timestamps do not make sense

ronpatel916 opened this issue · 1 comments

Hello,

I am trying to retrieve BSR (Seller Rank) history for a list of ASINs, but the timestamps provided and a few other datapoints do not make sense.

Here is my code:

import keepa
import asyncio

accesskey = 'xxx' # enter real access key here
api = keepa.Keepa(accesskey)


asins = ['B07P7QDJZX',
         'B076DK947N',
         'B076C164HD',
         'B01MRGIZE9',
         'B072Z4SBN9']

product = api.query(asins, offers=20, stats=90)

product[0]['salesRanks']

Here is a screenshot of the output:

image

My questions are:

  1. What is the value "914434" referring to? Is it a category group number? If so, how can I find the category name?
  2. How do I interpret the timestamp 4828968 into an actual date/time? I have tried unix converters but I am getting 1970 as the year associated with this time stamp, which is definitely wrong. Any help here?

Hello,

  1. 914434 is indeed a category number. You can look up the corresponding information with:
>>> api.category_lookup(914434)
{'914434': {'domainId': 1,
  'catId': 914434,
  'name': 'Thermal Carafes',
  'children': [],
  'parent': 289743,
  'highestRank': 14197176,
  'productCount': 8422,
  'contextFreeName': 'Thermal Carafes',
  'lowestRank': 3296}}
  1. The timestamps are the number of minutes from "KEEPA_ST_ORDINAL" which is 01-01-2011. You can convert these times with:
>>> from keepa.interface import keepa_minutes_to_time
>>> keepa_minutes_to_time(4828968)
datetime.datetime(2020, 3, 7, 10, 48)