This object is in archive! 

close_price as a metric code for Excel/API

Kyle Geers shared this idea 7 years ago
Completed

I have an API client (Eric Bergerson $10,000) that is very bent out of shape over the fact that he can't simply pull the close price. He currently has to use the price metric and run a test to see if the open/high/low are in, which he is not happy about. He typed out a detail explanation below, which I discussed a bit with John O before he left.

Would it take much to create a metric code for close price?

"Kyle,

As you know I have analytics that run daily on closing prices and also as we discussed there is no metric_code to get a closing price. Instead, I was told to get the price and then it is up to me to determine if that is a closing price, the most recent traded price, or possible an after hours trading price. All this seems predicated on both when during the day you ask for the data and if some back end file that you parse that contains the closing prices from the exchanges has already been processed internally.

Below I have included the task we have on our Agile board to fix this in our code. As I was attacking this today and a bit frustrated, I thought it might be valuable to your architects to understand what a difficult position they have put the developer in when using the API.

The solution you suggested to determine if the closing price for a day was yet available was to request an open_price for the same day. You had said if the magic file had been processed then it would come back otherwise it would error. However, it turns out, at least with the get_points() method, the data returned for a request of an open price on 3/29/18 during the trading day will not return an error because the market is still open, but rather will return the open price from 3/28/18. So, I will be able to detect if the closing prices for 3/29 are available by determining that the open price for 3/29 is returned with another price associated with 3/28.

While this will work, it is so incredibly convoluted I think you should rethink your approach.

Why not simply have an close_price metric code that returns the closing_price for the requested day if and when it becomes available, otherwise returns an appropriate error message?

Sincerely,


Eric Bergerson

Objective Technologies, Inc.

Phone: 718 997 9741


"... progress is made by lazy men looking for easier ways to do things."

- Lazarus Long


Rewrite Closing Price Availability Detection

The historical analysis app can be used to determine what the latest state of the DRI is. When run, it has to determine if the current moment in the day is late enough to get closing prices for that day (imagine 11pm at night) or the most recent closing price is from yesterday (imagine middle of the trading day). It was doing this based on time, assuming 4:30pm EST a reasonable cutoff after trading is done.

However, it turns out that YCharts pricing policies make dangerous assumptions. They have no data type to request closing price. They only have one request for price and that request will give you different values depending on the state of their internal process, which they do not expose. These states are:

  • During the trading day, a request for a price on any previous day will return the closing price from that day.
  • During the same trading dayWhile the market is open, a request will return the current intraday priceAfter the market is closed and before they have received an official closing day file from someone, a request will return the after-hours market price.After they have received this much lauded file and processed it, a request will return the official closing price.

We have been informed by them that the best way to detect if the official closing day file has been received and processed is to ask for an open price. If this request fails, either having no data or an error message, then the closing day file has not yet been received and processed. However, if the open price data is available, then the closing day price will be available as well.

We need to change the decision making in historical analysis, as to what day is the most recent closed day to utilize this logic."

Leave a Comment
 
Attach a file