# Retrieving pre-market quote

**URL:** <https://forum.alpaca.markets/t/retrieving-pre-market-quote/4984>\
**Category:** Alpaca Market Data\
**Created:** [March 16, 2021, 4:34pm UTC](https://forum.alpaca.markets/t/retrieving-pre-market-quote/4984 "2021-03-16T16:34:23Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Julian\_Cook](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/julian_cook/32/269_2.png) [@Julian\_Cook](https://forum.alpaca.markets/u/Julian_Cook)\
**Post date:** [March 16, 2021, 4:34pm UTC](https://forum.alpaca.markets/t/retrieving-pre-market-quote/4984/1 "2021-03-16T16:34:23Z")

</div>

I have typed in “premarket” and “pre-market” in the search box but I just wasn’t able to find any directions on how to obtain a premarket quote on, say “AAPL”, at 9:20am Eastern time. I have had great success so far with scalping on the open ( as much as a small investor can I suppose ) and I have almost my entire process automated in Python3 except for this part.  
If I wanted a quote on AAPL ( or any other stock ) at 9:20am Eastern time ( for example ) is that a current quote or a specific API reference to “pre-market” ? So many thanks folks. I have tried every API and Alpaca is truly wonderful

---

<div class="post-metadata">

**Author:** ![kris](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/kris/32/163_2.png) [@kris](https://forum.alpaca.markets/u/kris)\
**Post date:** [March 17, 2021, 4:19am UTC](https://forum.alpaca.markets/t/retrieving-pre-market-quote/4984/2 "2021-03-17T04:19:30Z")

</div>

have you looked in the docs?

---

<div class="post-metadata">

**Author:** ![Julian\_Cook](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/julian_cook/32/269_2.png) [@Julian\_Cook](https://forum.alpaca.markets/u/Julian_Cook)\
**Post date:** [March 17, 2021, 4:33am UTC](https://forum.alpaca.markets/t/retrieving-pre-market-quote/4984/3 "2021-03-17T04:33:34Z")

</div>

Yes. That’s how I got the other aspects coded without a problem ( entry, trailing, etc )… I’m going to test just requesting the bar data before 930a and verify it against another resource. It’s quite possibly just the last quoted price in that case. If I solve it I’ll update this question for others that may have this same question.

---

<div class="post-metadata">

**Author:** ![Julian\_Cook](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/julian_cook/32/269_2.png) [@Julian\_Cook](https://forum.alpaca.markets/u/Julian_Cook)\
**Post date:** [March 17, 2021, 1:17pm UTC](https://forum.alpaca.markets/t/retrieving-pre-market-quote/4984/4 "2021-03-17T13:17:58Z")

</div>

OK, the digging continues. At 9:15a, the pre-market on PLTR is 24.60 . When I get the latest quote using the code below I get… If I find an answer to this I will post it for future posterity. ( FYI: not on the premium plan but that’s my next step )

```
python3 get_last_quote
Quote({ 'askexchange': 15,
    'askprice': 25,
    'asksize': 1,
    'bidexchange': 15,
    'bidprice': 23.9,
    'bidsize': 1,
    'timestamp': 1615986783532253365})

#API endpoint URL
url = "https://paper-api.alpaca.markets"

#api_version v2 refers to the version that we'll use
#very important for the documentation
api = tradeapi.REST(key, sec, url, api_version='v2')

positions = api.get_last_quote("PLTR")
print(positions)
```

---

<div class="post-metadata">

**Author:** ![Julian\_Cook](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/julian_cook/32/269_2.png) [@Julian\_Cook](https://forum.alpaca.markets/u/Julian_Cook)\
**Post date:** [March 17, 2021, 2:00pm UTC](https://forum.alpaca.markets/t/retrieving-pre-market-quote/4984/5 "2021-03-17T14:00:36Z")

</div>

OK folks ( again just trying to solve this problem in case someone else has this question in the future )…

I was thinking that retrieving the one minute bars may yield a pre-market result but grepping the epoch seconds settings shows a jump from 4p/EDT to 935a/EDT ( line numbers at the beginning are a grep -n artifact ) when grabbing bar data shortly after the open using aapl = api.get\_barset(‘AAPL’, ‘1Min’, limit=30)

```
70: 't': 1615924740,
75: 't': 1615987800
```

---

<div class="post-metadata">

**Author:** ![Soren\_Rood](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/soren_rood/32/2397_2.png) [@Soren\_Rood](https://forum.alpaca.markets/u/Soren_Rood)\
**Post date:** [March 26, 2021, 1:51am UTC](https://forum.alpaca.markets/t/retrieving-pre-market-quote/4984/6 "2021-03-26T01:51:53Z")

</div>

Hey, I’m also trying to figure this out. Hrm.

---

<div class="post-metadata">

**Author:** ![Julian\_Cook](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/julian_cook/32/269_2.png) [@Julian\_Cook](https://forum.alpaca.markets/u/Julian_Cook)\
**Post date:** [March 26, 2021, 2:11am UTC](https://forum.alpaca.markets/t/retrieving-pre-market-quote/4984/7 "2021-03-26T02:11:01Z")

</div>

It only occurred to me after that since I also have an Interactive Brokers account that I can very easily get the pre-market gainers/losers very easily from their market scanner. In the meantime I also wrote some python code that would scrape Yahoo Finance pages like if you wanted a list of most actives and wanted to parse out those stocks or wanted to scrape a particular stock. I am more than happy to post that somewhere and just give it away.

---

<div class="post-metadata">

**Author:** ![tanchao](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/tanchao/32/3054_2.png) [@tanchao](https://forum.alpaca.markets/u/tanchao)\
**Post date:** [November 16, 2021, 5:02pm UTC](https://forum.alpaca.markets/t/retrieving-pre-market-quote/4984/8 "2021-11-16T17:02:35Z")

</div>

`get_bars` support a time period, my way to quote pre market data is to set start\_time=8:30 and end\_time = 9:29.
