import pandas as pd
import oandapyV20
import oandapyV20.endpoints.accounts as accounts
import configparser

config = configparser.ConfigParser()
config.read('../config/config_v20.ini')
accountID = config['oanda']['account_id']
access_token = config['oanda']['api_key']

client = oandapyV20.API(access_token=access_token)
r = accounts.AccountDetails(accountID)

client.request(r)

print(r.response)

pd.Series(r.response['account'])

"""
Explanation: <!--NAVIGATION-->
< Rates Information | Contents | Order Management >
Account Information
OANDA REST-V20 API Wrapper Doc on Account
OANDA API Getting Started
OANDA API Account
Account Details
End of explanation
"""


r = accounts.AccountList()

client.request(r)

print(r.response)

"""
Explanation: Account List
End of explanation
"""


r = accounts.AccountSummary(accountID)

client.request(r)

print(r.response)

pd.Series(r.response['account'])

"""
Explanation: Account Summary
End of explanation
"""


r = accounts.AccountInstruments(accountID=accountID, params = "EUR_USD")

client.request(r)

pd.DataFrame(r.response['instruments'])

"""
Explanation: Account Instruments
End of explanation
"""


