Status
Get the past, present, or future status for a stock market. The endpoint will respond with "open" for trading days or "closed" for weekends or market holidays.
Endpoint
https://api.marketdata.app/v1/markets/status/
Method
GET
Request Example
- HTTP
- NodeJS
- Python
- Go
GET https://api.marketdata.app/v1/markets/status/?from=2020-01-01&to=2020-12-31
GET https://api.marketdata.app/v1/markets/status/?date=yesterday
fetch(
"https://api.marketdata.app/v1/markets/status/?from=2020-01-01&to=2020-12-31"
)
.then((res) => {
console.log(res);
})
.catch((err) => {
console.log(err);
});
fetch("https://api.marketdata.app/v1/markets/status/?date=yesterday")
.then((res) => {
console.log(res);
})
.catch((err) => {
console.log(err);
});
import requests
url1 = "https://api.marketdata.app/v1/markets/status/?from=2020-01-01&to=2020-12-31"
url2 = "https://api.marketdata.app/v1/markets/status/?date=yesterday"
response1 = requests.request("GET", url1)
response2 = requests.request("GET", url2)
print(response1.text)
print(response2.text)
import (
"fmt"
api "github.com/MarketDataApp/sdk-go"
)
func ExampleMarketStatus() {
msr, err := api.MarketStatus().From("2020-01-01").To("2020-12-31").Get()
if err != nil {
fmt.Print(err)
return
}
for _, report := range msr {
fmt.Println(report)
}
}
func ExampleMarketStatus_relativeDates() {
msr, err := api.MarketStatus().Date("yesterday").Get()
if err != nil {
fmt.Print(err)
return
}
for _, report := range msr {
fmt.Println(report)
}
}
Response Example
{
"s": "ok",
"date": [1680580800],
"status": ["open"]
}
Request Parameters
- Required
- Optional
- There are no required parameters for
status
. If no parameter is given, the request will return the market status in the United States for the current day.
-
country
string
Use to specify the country. Use the two digit ISO 3166 country code. If no country is specified,
US
will be assumed. Only countries that Market Data supports for stock price data are available (currently only the United States). -
date
date
Consult whether the market was open or closed on the specified date. Accepted timestamp inputs: ISO 8601, unix, spreadsheet, relative date strings.
-
from
date
The earliest date (inclusive). If you use countback, from is not required. Accepted timestamp inputs: ISO 8601, unix, spreadsheet, relative date strings.
-
to
date
The last date (inclusive). Accepted timestamp inputs: ISO 8601, unix, spreadsheet, relative date strings.
-
countback
number
Countback will fetch a number of dates before
to
If you use from, countback is not required.
Response Attributes
- Success
- No Data
- Error
-
s
string
ll always be
ok
when there is data for the dates requested. -
date
array[dates]
The date.
-
status
array[string]
The market status. This will always be
open
orclosed
ornull
. Half days or partial trading days are reported asopen
. Requests for days further in the past or further in the future than our data will be returned asnull
.
-
s
string
Status will be
no_data
if no data is found for the request.
-
s
string
Status will be
error
if the request produces an error response. -
errmsg
string
An error message.