Skip to content

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.

License

Notifications You must be signed in to change notification settings

jgulickson/Oanda-REST-v20

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Oanda-REST-v20

Overview

Summary

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.

Requirements

Native Dependencies

External Dependencies

Installation

  1. Ensure Python 3 is installed, if not visit the download page.

  2. Clone or download all files from this repository.

     $ git clone https://github.com/jgulickson/Oanda-REST-v20
    
  3. Install requests package via:

     $ pip install requests
    
  4. Install websocket-client package via:

     $ pip install websocket-client
    

Configuration

Default configuration is included in file config-example.txt. Note that only a single parameter is applicable per line.

Parameters Key

  1. account-id
  2. api-token
  3. trading-hostname: must be either api-fxpractice.oanda.com or api-fxtrade.oanda.com
  4. status-hostname: must be api-status.oanda.com
  5. status-type: must be either fxtrade-practice-rest-api or fxtrade-rest-api
  6. request-timeout-in-seconds: suggested default 5
  7. email-sender: formatted as email@domain
  8. email-recipient: formatted as email@domain
  9. smtp-password
  10. smtp-address
  11. smtp-port: typically 443 or 587
  12. datetime-format: must be RFC3339 or UNIX

Example File

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

Usage

  1. Modify config-example.txt with the required information as described above.

  2. Update the variable _CONFIG_FILENAME in file test-oanda.py as needed.

  3. Navigate to the relevant directory and execute test-oanda.py.

     $ python test-oanda.py
    
  4. 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.

TODO

  1. Improve validation logic across all validation functions.
  2. Consider adding docstrings to relevant functions.
  3. Consider supporting additional Oanda endpoints.

Version History

Oanda-REST-v20

1.0.08242017
  • Initial release

About

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.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages