hootnot / oanda-api-v20

OANDA REST-V20 API wrapper. Easy access to OANDA's REST v20 API with oandapyV20 package. Checkout the Jupyter notebooks!
MIT License
397 stars 107 forks source link

Get account instruments available to place orders / Add this function for this wrapper #128

Closed rockscripts closed 6 years ago

rockscripts commented 6 years ago
OandaAdapter.prototype.getInstrumentsList = function (accountID,callback) {

    this._sendRESTRequest({
        method: "GET",
        path: "/v3/accounts/"+accountID+"/instruments"     
        },
    function (error, body, statusCode) {
        console.log(body)
        if (error) {
            if (body && body.message) {
                console.error("[ERROR] Response from Oanda", statusCode + " Error: " + body.message + " (OANDA error code " + body.code + ")");
                return callback(body.message);
            }
            return callback(error);
        }
        if (body.instruments) {
            callback(null, body.instruments);
        } else {
            callback("Unexpected instruments response");
        }
    });
  };
hootnot commented 6 years ago

Hi,

this code has nothing to do with oanda-api-v20 / oandapyV20, so I will close this issue