Skip to content

Commit

Permalink
renamed, authentication from config
Browse files Browse the repository at this point in the history
  • Loading branch information
hootnot committed Oct 12, 2016
1 parent 001cac4 commit 776d3b5
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions examples/streaming.py → examples/streaming_prices.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
from oandapyV20 import API
from oandapyV20.exceptions import V20Error
from oandapyV20.endpoints.pricing import PricingStream
from exampleauth import exampleAuth

accountID = "..."
access_token="..."
accountID, access_token = exampleAuth()

api = API(access_token=access_token, environment="practice")

instruments = "DE30_EUR,EUR_USD,EUR_JPY"
s = PricingStream(accountID=accountID, params={"instruments":instruments})
# fetch MAXREQ stream records
MAXREQ = 10
try:
n = 0
for R in api.request(s):
print R
n += 1
if n > 10:
if n >= MAXREQ:
api.disconnect()
except V20Error as e:
print("Error: {}".format(e))

0 comments on commit 776d3b5

Please sign in to comment.