UKLooneyJr / kc-discord-bot

KC Discord Bot
MIT License
3 stars 1 forks source link

fix: get the proper date for close price #27

Closed cyosam closed 3 years ago

cyosam commented 3 years ago

Two problems - Without specifying an interval for getHistory it defaults to monthly. What this ends up doing is getting the open/close/high/low for a whole month of data, and presenting that as if it were the day we ask for. Setting that to Daily fixes the issue, but also: The first object in the collection is not reliably for the startDate we ask for, and the collection may not contain any entry for that date. So, to that end, we filter for a match on the date, and only if there's nothing there do we use the first item in the collection.