Skip to content

Conversation

@nickjohnson22
Copy link

This stumped me for a while. Hopefully, the comment helps others who want to test with their paper credentials.

from alpaca_trade_api.stream import Stream

# Uncomment URL import to test with paper credentials
# from alpaca_trade_api.common import URL
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for this import, you can simply use a string for base_url

feed = 'iex' # <- replace to SIP if you have PRO subscription
stream = Stream(data_feed=feed, raw_data=True)

stream = Stream(data_feed=feed, raw_data=True) # <- add base_url=URL('https://paper-api.alpaca.markets') for paper
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would wrap it like this:

Suggested change
stream = Stream(data_feed=feed, raw_data=True) # <- add base_url=URL('https://paper-api.alpaca.markets') for paper
stream = Stream(
data_feed=feed,
# base_url='https://paper-api.alpaca.markets', # uncomment for paper
raw_data=True)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants