# Can't get Streamconn to work

**URL:** https://forum.alpaca.markets/t/cant-get-streamconn-to-work/2925
**Category:** Getting Started with Alpaca
**Created:** [October 7, 2020, 10:49pm UTC](https://forum.alpaca.markets/t/cant-get-streamconn-to-work/2925 "2020-10-07T22:49:58Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Matthew](https://avatars.discourse-cdn.com/v4/letter/m/ed655f/32.png) [@Matthew](https://forum.alpaca.markets/u/Matthew)
#### Post date: [October 7, 2020, 10:49pm UTC](https://forum.alpaca.markets/t/cant-get-streamconn-to-work/2925/1 "2020-10-07T22:49:58Z")

</div>

I’m trying to just get a basic example working with Streamconn

```auto
from alpaca_trade_api import StreamConn
from alpaca_trade_api.common import URL
import config
import logging

logging.basicConfig(format='%(asctime)s %(message)s', level=logging.INFO)
conn = StreamConn(
        config.API_KEY, 
        config.SECRET_KEY,
        base_url=URL('https://paper-api.alpaca.markets'),
        data_url=URL('https://data.alpaca.markets'),
        #data_stream='alpacadatav1'
    )

@conn.on(r'^AM\..+$')
async def on_minute_bars(conn, channel, bar):
    print('bars', bar)

quote_count = 0 # don't print too much quotes
@conn.on(r'Q\..+', ['AAPL'])
async def on_quotes(conn, channel, quote):
    global quote_count
    if quote_count % 10 == 0:
        print('bars', quote)
    quote_count += 1

@conn.on(r'T\..+', ['AAPL'])
async def on_trades(conn, channel, trade):
    print('trade', trade)

conn.run(['trade_updates', 'AM.AAPL'])

```

When I run it, I get this:

```auto
2020-10-07 18:44:43,025 connected to: wss://paper-api.alpaca.markets/stream
2020-10-07 18:44:43,227 connected to: wss://data.alpaca.markets/stream

```

and that’s it, nothing else. What am I doing wrong, I’m sure it’s something stupid.

---

<div class="post-metadata">

### Author: ![Phil\_Ber](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/phil_ber/32/1471_2.png) [@Phil\_Ber](https://forum.alpaca.markets/u/Phil_Ber)
#### Post date: [October 23, 2020, 8:36pm UTC](https://forum.alpaca.markets/t/cant-get-streamconn-to-work/2925/2 "2020-10-23T20:36:55Z")

</div>

Did you figure this out? I’m having the same problem.

---

<div class="post-metadata">

### Author: ![Shlomik](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/shlomik/32/793_2.png) [@Shlomik](https://forum.alpaca.markets/u/Shlomik)
#### Post date: [October 26, 2020, 2:59pm UTC](https://forum.alpaca.markets/t/cant-get-streamconn-to-work/2925/3 "2020-10-26T14:59:00Z")

</div>

Hi, this example code is a template for using the StreamConn object.  
work with it:

> <https://github.com/alpacahq/alpaca-trade-api-python/blob/master/examples/websocket_example.py>
