Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update v2_example.py to add paper credentials instruction comment #391

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nickjohnson22
Copy link

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

@@ -2,6 +2,9 @@

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

@@ -20,7 +23,8 @@ async def print_trade_update(tu):
def main():
logging.basicConfig(level=logging.INFO)
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.

None yet

2 participants