# Start can not be after end

**URL:** <https://forum.alpaca.markets/t/start-can-not-be-after-end/6878>\
**Category:** Alpaca Market Data\
**Created:** [September 16, 2021, 12:57am UTC](https://forum.alpaca.markets/t/start-can-not-be-after-end/6878 "2021-09-16T00:57:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nateroskelley](https://avatars.discourse-cdn.com/v4/letter/n/f05b48/32.png) [@nateroskelley](https://forum.alpaca.markets/u/nateroskelley)\
**Post date:** [September 16, 2021, 12:57am UTC](https://forum.alpaca.markets/t/start-can-not-be-after-end/6878/1 "2021-09-16T00:57:49Z")

</div>

Hello! I am using Python to try to get the market data for yesterday, however it keeps returning an error. My code is

```auto
DATA_URL = "https://data.alpaca.markets/v2/stocks/{}/bars".format(symbol)

starttime = pd.Timestamp('2021-09-14 09:30', tz=pytz.timezone('America/New_York'))
endtime = pd.Timestamp('2021-09-14 10:30', tz=pytz.timezone('America/New_York'))

data = {
    "start":starttime.isoformat(),
    "end":endtime.isoformat(),
    "timeframe": "1Min"
}

print(starttime.isoformat())
print(endtime.isoformat())

r = requests.get(DATA_URL, json=data, headers=HEADERS)
return_content = json.loads(r.content)
print(return_content)

```

where HEADERS is simply my api key and secret key, and work on other parts of my application. Whenever I run this, it prints

2021-09-14T09:30:00-04:00  
2021-09-14T10:30:00-04:00  
{‘code’: 42210000, ‘message’: ‘start can not be after end’}

When I swap the start and end, it gives me the exact same error. Any advice on how to solve this?

---

<div class="post-metadata">

**Author:** ![Abel\_Alpaca](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/abel_alpaca/32/2431_2.png) [@Abel\_Alpaca](https://forum.alpaca.markets/u/Abel_Alpaca)\
**Post date:** [September 22, 2021, 1:12pm UTC](https://forum.alpaca.markets/t/start-can-not-be-after-end/6878/2 "2021-09-22T13:12:28Z")

</div>

Hi @nateroskelley,

The problem is in this line:

`requests.get(DATA_URL, json=data, headers=HEADERS)`

You are sending the parameters as an HTTP body, instead of query parameters.

The fix is:

`requests.get(DATA_URL, params=data, headers=HEADERS)`

Let us know if you have any other questions.
