---
title: Status
sidebar_position: 1
---
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.
import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";
## Endpoint
```
https://api.marketdata.app/v1/markets/status/
```
#### Method
```
GET
```
## Request Example
**GET** [https://api.marketdata.app/v1/markets/status/?from=2020-01-01&to=2020-12-31](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](https://api.marketdata.app/v1/markets/status/?date=yesterday)
```js title="app.js"
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);
});
```
```python title="app.py"
from marketdata.client import MarketDataClient
client = MarketDataClient()
status1 = client.markets.status(from_date="2020-01-01", to_date="2020-12-31")
status2 = client.markets.status(date="yesterday")
print(status1)
print(status2)
```
```go title="marketstatus.go"
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
```json
{
"s": "ok",
"date": [1680580800],
"status": ["open"]
}
```
## Request Parameters
- 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
- **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` or `closed` or `null`. Half days or partial trading days are reported as `open`. Requests for days further in the past or further in the future than our data will be returned as `null`.
- **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.