Repository contains one (1) Python wrapper for the Oanda REST v20 API implemented primarily as a proof of concept and secondarily as an educational medium to further my Python education.
python 3.x(Documentation)
json(Documentation)ssl(Documentation)smtplib(Documentation)MIMEMultipartofmail.mime.multipart(Documentation)MIMETextofemail.mime.text(Documentation)
requests(Documentation)websocket-client(Documentation)
-
Ensure Python 3 is installed, if not visit the download page.
-
Clone or download all files from this repository.
$ git clone https://github.com/jgulickson/Oanda-REST-v20 -
Install
requestspackage via:$ pip install requests -
Install
websocket-clientpackage via:$ pip install websocket-client
Default configuration is included in file config-example.txt. Note that only a single parameter is applicable per line.
account-idapi-tokentrading-hostname: must be either api-fxpractice.oanda.com or api-fxtrade.oanda.comstatus-hostname: must be api-status.oanda.comstatus-type: must be either fxtrade-practice-rest-api or fxtrade-rest-apirequest-timeout-in-seconds: suggested default 5email-sender: formatted as email@domainemail-recipient: formatted as email@domainsmtp-passwordsmtp-addresssmtp-port: typically 443 or 587datetime-format: must be RFC3339 or UNIX
101-001-xxxxxx-xxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
api-fxpractice.oanda.com
api-status.oanda.com
fxtrade-practice-rest-api
5
email@domain.com
email@domain.com
xxxxxxxxxxx
587
smtp.provider.com
RFC3339
-
Modify
config-example.txtwith the required information as described above. -
Update the variable
_CONFIG_FILENAMEin filetest-oanda.pyas needed. -
Navigate to the relevant directory and execute
test-oanda.py.$ python test-oanda.py -
Review the console log.
$ python3 test-oanda.py get_config completed set_config completed validate_config completed get_account_summary completed set_account_summary completed validate_account_summary completed get_account_instruments completed set_account_instruments completed validate_account_instruments completed get_open_positions completed set_account_summary completed validate_open_positions completed get_pricing completed set_account_summary completed validate_pricing completed get_pricing completed set_account_summary completed get_account_instruments completed set_account_instruments completed set_bounds completed set_order_syntax completed post_order completed compose_email completed send_email completed
See Oanda's documentation for further potential use cases.
- Improve validation logic across all validation functions.
- Consider adding docstrings to relevant functions.
- Consider supporting additional Oanda endpoints.
- Initial release