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)MIMEMultipart
ofmail.mime.multipart
(Documentation)MIMEText
ofemail.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
requests
package via:$ pip install requests
-
Install
websocket-client
package 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-id
api-token
trading-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-password
smtp-address
smtp-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 protected]
[email protected]
xxxxxxxxxxx
587
smtp.provider.com
RFC3339
-
Modify
config-example.txt
with the required information as described above. -
Update the variable
_CONFIG_FILENAME
in filetest-oanda.py
as 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