Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion oandapy/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def __init__(self, error_response):


class BadEnvironment(Exception):
"""environment should be: sandbox, practice or live."""
"""environment should be: practice or live."""
def __init__(self, environment):
msg = "Environment '%s' does not exist" % environment
super(BadEnvironment, self).__init__(msg)
21 changes: 5 additions & 16 deletions oandapy/oandapy.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,6 @@ def get_history(self, **params):

"""Accounts"""

def create_account(self, **params):
""" Create an account. Valid only in sandbox.
Docs: http://developer.oanda.com/rest-live/accounts
"""
endpoint = 'v1/accounts'
return self.request(endpoint, "POST", params=params)

def get_accounts(self, **params):
""" Get accounts for a user.
Docs: http://developer.oanda.com/rest-live/accounts
Expand Down Expand Up @@ -209,18 +202,14 @@ def get_orderbook(self, **params):


class API(EndpointsMixin, object):
def __init__(self,
environment="practice", access_token=None, headers=None):
def __init__(self, environment, access_token, headers=None):
"""Instantiates an instance of OandaPy's API wrapper
:param environment: (optional) Provide the environment for oanda's
REST api, either 'sandbox', 'practice', or 'live'. Default: practice
:param access_token: (optional) Provide a valid access token if you
have one. This is required if the environment is not sandbox.
:param environment: (required) Provide the environment for oanda's
REST api, either 'practice' or 'live'.
:param access_token: (required) Provide a valid access token
"""

if environment == 'sandbox':
self.api_url = 'http://api-sandbox.oanda.com'
elif environment == 'practice':
if environment == 'practice':
self.api_url = 'https://api-fxpractice.oanda.com'
elif environment == 'live':
self.api_url = 'https://api-fxtrade.oanda.com'
Expand Down