File Exchange

image thumbnail

QuinnSys/QuinnSys-OAPI

version 1.0.0.0 (2.82 MB) by Quinn
A function suite for accessing OANDA's REST API with MatLab

1 Download

Updated 16 Feb 2017

GitHub view license on GitHub

The aim of this project is to unlock as much as possible of the functionality of OANDA's REST API for use in MatLab and to eventually provide a back-testing and strategy development utility that will use all the same function names and function I/O as the other modules.
This design philosophy is based on the words of the great Dr. Ernest P. Chan:
"This ease of switching between backtesting and live execution is more than just convenience: It eliminates any possibility of discrepancies or errors in transcribing a backtest strategy into a live strategy, discrepancies that often plague strategies written in a general programming language whether it is C++ or MATLAB."
It allows you to check prices, retrieve instrument history, place or modify orders and open or close trades in just one line each.

The final suite will consist of three parts:

1: OAPI: Human
This module is designed to be the most user friendly, intuitive and easy to use, it outputs a lot of human-readable information and asks for user input to decide what it should do with data it has collected.
The drawback of this is a lack of efficiency and the requirement of a human supervisor during operation, this makes it's best use for running experiments or debugging code.

2: OAPI: Bot
This module has the same functions as OAPI Human with the exact same inputs, this is so once you have developed code carefully in the human module, the same code can be applied to the bot module with no re-design or testing required, allowing a strategy to run without supervision.

3: OAPI: Backtester
This module again has identically named functions with identical input requirements as module 1 and 2.
It will allow for simulations to be ran on historical or simulated data much faster than forward tests.
The strategies created in the back-tester will run live with no re-design required allowing you to take a strategy from backtesting to live trading with minimal effort.

Cite As

Quinn (2019). QuinnSys/QuinnSys-OAPI (https://www.github.com/QuinnSys/QuinnSys-OAPI), GitHub. Retrieved .

Comments and Ratings (10)

Kaden Foy

I'm having issues accessing the any of the functions. the apiStart.m runs fine but then if I run any of the other functions I get:

Error using urlread2>getURLConnection (line 355)
Failure to parse URL or protocol not supported for:
URL: practicev1/instruments?accountId=4444444

I've opened the function and I believer it has to do with the header variable because the protocol = 1×0 empty char array. but I am not sure. also will these functions still work even if Oanda is deprecating REST v1 and replacing it with Rest v20

Charles

Ok I am having some success with getting some functions to work, so I am satisfied I am connected. I am excited about streaming prices. I want an data structure to update live once i assign the stream function to a variable

EXAMPLE
TEST = StreamPrices('EUR_USD','100','data')

However the variable only appears once the stream has ended.

Essentially i want to apply algorithms to the live updates.

Secondly I would love this to work for multiple pairs strings.

Essentially I would like a cell array output with selected currency pairs updating live.

Any thoughts on how i might achieve this?

Charles

I get an error message upon execution of a function. What does this mean and how can i resolve?

Output argument "RawAccountInfo" (and maybe others) not assigned during call to "api/GetAccountInfo".

Error in GetAccountInfo (line 8)
RawAccountInfo = GetAccountInfo(api,accountId);

Excellent work.
It can be added here these functions?
http://developer.oanda.com/rest-live/forex-labs/?utm_source=forex-labs&utm_medium=link&utm_campaign=forex-labs

In particular, very much interested "Orderbook"
Thanks

...make sure to restart MATLAB after updating the cacert file. It works now, looking forward to trying it out.

This will not work on R2013b. There is a java error, "unable to find valid certification path to requested
target". I think this is due to the fact that the R2013b cacert file is not completely up-to-date with correct certification. I tried adding the certifications manually with no luck. I'll try testing it on a newer version of MATLAB to confirm.

Charles

Let me say in fact the code is fantastic!!! Its something I have wanted for a while, that is to stream prices It will be a real game changer once I incorporate it into my algorithmic trading workflow. Presumably one can stream Open High Low and Close, and volume metrics?

Nelson Mok

Nelson Mok

it is a brilliant idea to implement an automated fx trading system. There are two directories only, I don't see "3: OAPI: Backtested" which is enclosed in the archive.

MATLAB Release Compatibility
Created with R2015b
Compatible with any release
Platform Compatibility
Windows macOS Linux