What you are probably seeing as a discrepancy is the fact that HK prioritizes step data. So, sometimes it will prioritize steps from the watch over the phone or vice versa. This is an unknown internal process that apple uses to exclude step data. We compared days of steps data and mapped it out as much as possible trying to reverse engineer this process with no success.
If you look at "all data" for steps you will see records written by phone and watch. Sometimes the record start and end times overlap or one record is completely inside the timeframe of another record. Apple does something to prioritize those scenarios to not double count records. If your app simply gets all steps from a point in time you will have data that is all over the place.
What worked for us was redesigning our app so that users choose the phone or the watch as step source. Then in our HK query we simply make a predicate that includes either "Watch" or "Phone". We found this to be the way to get the most accurate steps and not end up with inflated numbers due to double counting phone and watch.
Hope this helps a little.
Topic:
App & System Services
SubTopic:
Hardware
Tags: