Skip to content

Conversation

@hootnot
Copy link
Contributor

@hootnot hootnot commented Mar 7, 2016

import oandapy
from datetime import datetime, timedelta
import json

oanda = oandapy.API(environment="practice", access_token="...")

instrument = 'AU200_AUD'
start = datetime(2010, 4, 1, 16, 0, 1)
end =   datetime(2010, 4, 4, 3, 20, 1)

try:
    candles = oanda.get_history(
       instrument = instrument,
       granularity = 'M1',
       candleFormat = 'midpoint',
       alignmentTimezone = 'GMT',
       start = start.isoformat(),
       end = end.isoformat()
    )
except oandapy.OandaError as e:
    print "%s" % e
except oandapy.ClientError as e:
    print "%s" % e
else:
    print json.dumps(candles, indent=2)

$ python issue27.py
client error: No data
changing end to datetime(2010, 4, 15, 3, 20, 1) will return a response with candle data

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.

1 participant