# How do you find the current price of a stock?(Python)

**URL:** <https://forum.alpaca.markets/t/how-do-you-find-the-current-price-of-a-stock-python/5972>\
**Category:** Examples\
**Created:** [June 17, 2021, 1:53pm UTC](https://forum.alpaca.markets/t/how-do-you-find-the-current-price-of-a-stock-python/5972 "2021-06-17T13:53:34Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![ineedhelp](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/ineedhelp/32/2736_2.png) [@ineedhelp](https://forum.alpaca.markets/u/ineedhelp)\
**Post date:** [June 17, 2021, 1:53pm UTC](https://forum.alpaca.markets/t/how-do-you-find-the-current-price-of-a-stock-python/5972/1 "2021-06-17T13:53:34Z")

</div>

How do you find the current price of a stock? I have been trying to find an answer on the docs, but it isn’t very user friendly. I want to find the current price, not the open or close price.

---

<div class="post-metadata">

**Author:** ![Brian\_Rowe](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/brian_rowe/32/2322_2.png) [@Brian\_Rowe](https://forum.alpaca.markets/u/Brian_Rowe)\
**Post date:** [June 18, 2021, 12:45am UTC](https://forum.alpaca.markets/t/how-do-you-find-the-current-price-of-a-stock-python/5972/2 "2021-06-18T00:45:28Z")

</div>

Its going to be hard to answer because you need to be more specific and the documentation is terrible. There is no ‘current’ price in stock trading. So that maybe some of the problem.  
There is the current BID and ASK and there is the Last Trade. Anyone of those might be what you want for current.

> **[Historical data - Documentation | Alpaca](https://alpaca.markets/docs/api-documentation/api-v2/market-data/alpaca-data-api-v2/historical/#quotes)**
>
> Alpaca API lets you build and trade with real-time market data for free.

This page in the docs may help. This is a query for Latest quote that might be what you want.

---

<div class="post-metadata">

**Author:** ![ineedhelp](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/ineedhelp/32/2736_2.png) [@ineedhelp](https://forum.alpaca.markets/u/ineedhelp)\
**Post date:** [June 18, 2021, 2:50pm UTC](https://forum.alpaca.markets/t/how-do-you-find-the-current-price-of-a-stock-python/5972/3 "2021-06-18T14:50:52Z")

</div>

Let’s say it is 10 am est, and I want to check the current price of the stock. Is there a way to do that? Or do I have to use last quote?

---

<div class="post-metadata">

**Author:** ![Brian\_Rowe](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/brian_rowe/32/2322_2.png) [@Brian\_Rowe](https://forum.alpaca.markets/u/Brian_Rowe)\
**Post date:** [June 18, 2021, 3:15pm UTC](https://forum.alpaca.markets/t/how-do-you-find-the-current-price-of-a-stock-python/5972/4 "2021-06-18T15:15:20Z")

</div>

I think you are you wanting Last Trade - that is the last price the stock traded at. It is not the ‘Current’ price. If you were to execute a market trade you are going to get the last quote - ASK price - which could be significantly different. Hope that helps.

---

<div class="post-metadata">

**Author:** ![Tron](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/tron/32/2964_2.png) [@Tron](https://forum.alpaca.markets/u/Tron)\
**Post date:** [August 11, 2021, 7:07pm UTC](https://forum.alpaca.markets/t/how-do-you-find-the-current-price-of-a-stock-python/5972/5 "2021-08-11T19:07:05Z")

</div>

@Brian_Rowe and @ineedhelp  
Might seem like a basic question but is the “current” price (that number we see when we google a ticker symbol) just an average price that’s between the bid price and ask price? I’m still learning a ton about the API and the document you shared doesn’t explain the outputs well. I had to google the difference between quotes and trades and I think this is what the original question could be answered with:

#In python if you were looking for the latest info on the Robinhood stock  
api.get\_last\_quote(‘HOOD’)

#The output looks like this:  
Quote({ ‘askexchange’: 15,  
‘askprice’: 51.22,  
‘asksize’: 1,  
‘bidexchange’: 15,  
‘bidprice’: 50.25,  
‘bidsize’: 1,  
‘timestamp’: 1628708348916325270})

I appreciate any help or insight you can give me!

---

<div class="post-metadata">

**Author:** ![ineedhelp](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/ineedhelp/32/2736_2.png) [@ineedhelp](https://forum.alpaca.markets/u/ineedhelp)\
**Post date:** [August 11, 2021, 11:20pm UTC](https://forum.alpaca.markets/t/how-do-you-find-the-current-price-of-a-stock-python/5972/6 "2021-08-11T23:20:47Z")

</div>

Please don’t ask a question on my question.

---

<div class="post-metadata">

**Author:** ![Tron](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/tron/32/2964_2.png) [@Tron](https://forum.alpaca.markets/u/Tron)\
**Post date:** [August 12, 2021, 12:03am UTC](https://forum.alpaca.markets/t/how-do-you-find-the-current-price-of-a-stock-python/5972/7 "2021-08-12T00:03:22Z")

</div>

… i thought i was helping you

---

<div class="post-metadata">

**Author:** ![Brian\_Rowe](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/brian_rowe/32/2322_2.png) [@Brian\_Rowe](https://forum.alpaca.markets/u/Brian_Rowe)\
**Post date:** [August 17, 2021, 8:54pm UTC](https://forum.alpaca.markets/t/how-do-you-find-the-current-price-of-a-stock-python/5972/8 "2021-08-17T20:54:11Z")

</div>

usually the price you see in a ticker is the Last traded price.

---

<div class="post-metadata">

**Author:** ![datskat](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/datskat/32/7552_2.png) [@datskat](https://forum.alpaca.markets/u/datskat)\
**Post date:** [August 23, 2021, 12:51pm UTC](https://forum.alpaca.markets/t/how-do-you-find-the-current-price-of-a-stock-python/5972/9 "2021-08-23T12:51:27Z")

</div>

Hello, I think you could use a tutorial on youtube by parttimelarry on using websockets to stream real time data. It worked for me, so maybe it’ll satisfy your needs also. Let me know if that was what you were looking for

---

<div class="post-metadata">

**Author:** ![jmisiuk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/jmisiuk/32/4303_2.png) [@jmisiuk](https://forum.alpaca.markets/u/jmisiuk)\
**Post date:** [June 8, 2022, 3:47am UTC](https://forum.alpaca.markets/t/how-do-you-find-the-current-price-of-a-stock-python/5972/10 "2022-06-08T03:47:10Z")

</div>

> [@Tron](#):
>
> api.get\_last\_quote

Can you share more on that? I am trying to use real time data to retrieve latest trade price, and I am struggling with it.

---

<div class="post-metadata">

**Author:** ![johnglen244](https://avatars.discourse-cdn.com/v4/letter/j/51bf81/32.png) [@johnglen244](https://forum.alpaca.markets/u/johnglen244)\
**Post date:** [September 4, 2022, 4:50pm UTC](https://forum.alpaca.markets/t/how-do-you-find-the-current-price-of-a-stock-python/5972/11 "2022-09-04T16:50:31Z")

</div>

Seems like there is no way to get current stock price when the market is closed

---

<div class="post-metadata">

**Author:** ![sam91](https://avatars.discourse-cdn.com/v4/letter/s/848f3c/32.png) [@sam91](https://forum.alpaca.markets/u/sam91)\
**Post date:** [May 28, 2023, 11:58pm UTC](https://forum.alpaca.markets/t/how-do-you-find-the-current-price-of-a-stock-python/5972/12 "2023-05-28T23:58:34Z")

</div>

Hello,

You can use FMP data API, and they have excel add-on as well very easy to use and track stock prices

> **[Financial Modeling Prep - FinancialModelingPrep](https://site.financialmodelingprep.com/developer)**
>
> Access all stocks discounted cash flow statements, market price, stock markets news, and learn more about Financial Modeling. Learn M&A, LBO, DCF, Comps, and Financial Statement Modeling thought concrete examples

> **[Excel Add-on - FinancialModelingPrep](https://site.financialmodelingprep.com/developer/docs/excel-add-on/)**
>
> Excel Add-on

---

<div class="post-metadata">

**Author:** ![JeremyWhittaker](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/jeremywhittaker/32/3239_2.png) [@JeremyWhittaker](https://forum.alpaca.markets/u/JeremyWhittaker)\
**Post date:** [June 8, 2023, 4:55am UTC](https://forum.alpaca.markets/t/how-do-you-find-the-current-price-of-a-stock-python/5972/13 "2023-06-08T04:55:55Z")

</div>

This should help guide you:But you need to research or know the difference between bid/ask quotes, close prices, and trade prices. They all seem the same but they’re not exactly the same thing.

```auto
live_api = tradeapi.REST(LIVE_API_KEY, LIVE_SECRET_KEY, LIVE_BASE_URL, api_version='v2')

def get_alpaca_bid_ask(symbol, global_variables=True):
    global no_quote_available_symbols

    try:
        # Get the bid and ask prices for the symbol
        quote = live_api.get_latest_quote(symbol.replace('-', '.'))
        bid_price = quote.bp
        ask_price = quote.ap

    except Exception as e:
        no_quote_available_symbols.append(symbol)
        if 'no quote found for' in str(e):
            logging.warning(f"{symbol}: get_alpaca_bid_ask: Error for symbol: {e}")
        else:
            logging.warning(f"{symbol}: get_alpaca_bid_ask: Error retrieving bid/ask prices: {e}")
        return [None, None]

    if bid_price == 0 or ask_price == 0:
        no_quote_available_symbols.append(symbol)
        logging.warning(f"{symbol}: get_alpaca_bid_ask: Bid or ask price is zero")
        return [None, None]

    logging.debug(f'{symbol}: get_alpaca_bid_ask: bid: {bid_price} ask: {ask_price}')

    if global_variables:
        update_global_variables(symbol, ask_price, bid_price)

    return [bid_price, ask_price]

```

or this

```auto
def fetch_historical_data(symbol, start_date, end_date, timeframe='1Min'):
    data = []

    # print(f'input data: {symbol}, {start_date}, {end_date}, {timeframe}')

    for bar in live_api.get_bars(symbol, start=start_date, end=end_date, limit=10000, timeframe=timeframe):
        data.append({
            'c': bar.c,
            'h': bar.h,
            'l': bar.l,
            'n': bar.n,
            'o': bar.o,
            't': bar.t,
            'v': bar.v,
            'vw': bar.vw
        })

    historical_data = pd.DataFrame(data)

    # print('historical data')
    # print(historical_data.tail(20))

    historical_data['t'] = pd.to_datetime(historical_data['t'])
    historical_data.set_index('t', inplace=True)

    # print(historical_data.head(20))
    # print(historical_data.tail(20))

    return historical_data

```
