Git Product home page Git Product logo

oanda-api-v20's Introduction

Hi there ๐Ÿ‘‹

I'm a software developer with strong finance roots from the early eighties. (Stocks, options, Forex, ...). I am also a huge fan of REST-API's and author of some Python libraries to enable trading by algorithm and have easy access to the REST-API's of OANDA and SAXO Bank, to make trading 24 hrs/day possible (Forex). Check the repositories for details:

  • oanda-api-v20 (pypi: oandapyV20)
  • saxo_openapi (pypi: saxo_openapi)

Recently I've created the virtual_finance_api library to have easy access to financial data from multiple sources on the web.

When it comes to development, I like to see the full picture, so components like Redis, Postgesql, Docker, ... are key products for me as well.

Further more I love Pandas to deal with data.

Beside development I also have a strong background in unix/linux system administration. Though I use mostly Ubuntu these days, I'm also familiar with CentOS, RedHat, OpenBSD, FreeBSD and a bit SuSE and of course: virtualisation using KVM and Proxmox

oanda-api-v20's People

Contributors

hootnot avatar mirac7 avatar rdeknijf avatar ricfaith avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

oanda-api-v20's Issues

I tested the API but error

Please help me fix the problem.
I tried below code

get a list of trades

from oandapyV20 import API
import oandapyV20.endpoints.trades as trades

api = API(access_token="blah blah blah")
accountID = "001-011-1926632-001"

r = trades.TradesList(accountID)

show the endpoint as it is constructed for this call

print("REQUEST:{}".format(r))
rv = api.request(r)
print("RESPONSE:\n{}".format(json.dumps(rv, indent=2)))

And I got this error message.

REQUEST:v3/accounts/001-011-1926632-001/trades

V20Error Traceback (most recent call last)
in ()
9 # show the endpoint as it is constructed for this call
10 print("REQUEST:{}".format(r))
---> 11 rv = api.request(r)
12 print("RESPONSE:\n{}".format(json.dumps(rv, indent=2)))

~\Anaconda3\lib\site-packages\oandapyV20\oandapyV20.py in request(self, endpoint)
304
305 response = self.__request(method, url,
--> 306 request_args, headers=headers)
307 content = response.content.decode('utf-8')
308 content = json.loads(content)

~\Anaconda3\lib\site-packages\oandapyV20\oandapyV20.py in __request(self, method, url, request_args, headers, stream)
241 response.content.decode('utf-8'))
242 raise V20Error(response.status_code,
--> 243 response.content.decode('utf-8'))
244 return response
245

V20Error: {"errorMessage":"Insufficient authorization to perform request."}

Issue with sending requests

Hi,

I am new to Python and I am getting the following error when sending a request through the wrapper. Can you walk me through how I can diagnose the problem?

Traceback (most recent call last):
File "<pyshell#12>", line 1, in
rv = api.request(r)
File "C:\Python36\lib\site-packages\oandapyV20\oandapyV20.py", line 306, in request
request_args, headers=headers)
File "C:\Python36\lib\site-packages\oandapyV20\oandapyV20.py", line 243, in __request
response.content.decode('utf-8'))
oandapyV20.exceptions.V20Error

I ran the following codes;

access_token = "My own token"
client = API(access_token=access_token)
r = accounts.AccountList()
response = client.request(r)

Question [email protected]

The /v3/instrument/{instrument}/candles endpoint gives in the response:
(when called with instrument = EUR_USD)

{
  "candles": [
    {
      "complete": true, 
      "mid": {
        "c": "1.09946", 
        "h": "1.09949", 
        "l": "1.09946", 
        "o": "1.09949"
      }, 
      "time": "2016-10-17T15:16:40.000000000Z", 
      "volume": 2
    }, 
  ],
  "granularity": "S5", 
  "instrument": "EUR/USD"
}

Personally I would like to see the instrument back in the response as EUR_USD and not as EUR/USD, which is considered to be a displayName .

I've dropped a question / suggestion regarding this at [email protected]

I would like to see:

{
  "candles": [
    {
      "complete": true, 
      "mid": {
        "c": "1.09946", 
        "h": "1.09949", 
        "l": "1.09946", 
        "o": "1.09949"
      }, 
      "time": "2016-10-17T15:16:40.000000000Z", 
      "volume": 2
    }, 
  ],
  "granularity": "S5", 
  "instrument": "EUR_USD",
  "displayName": "EUR/USD"   <-- optionally
}

Insufficient authorization to perform request

I've cloned this jupyter notebook file, but running the following snippet leads to an error:

import configparser

# v20 OANDA API - 3rd party
import json
from oandapyV20 import API    # the client
import oandapyV20.endpoints.trades as trades

config = configparser.ConfigParser()
config.read('oanda.cfg')

client = API(environment='practice',access_token=config['oanda']['access_token'])

import datetime
from dateutil import parser
import oandapyV20.endpoints.instruments as instruments

params={"from": parser.parse("2016-12-07 18:00:00 EDT").strftime('%s'),
        "to": parser.parse("2016-12-10 00:000:00 EDT").strftime('%s'),
        "granularity":'M1',
        "price":'A'}
r = instruments.InstrumentsCandles(instrument="EUR_USD",params=params)
data = client.request(r)
print(json.dumps(data, indent=2))    # <----- add this line to show the data

V20Error: {"errorMessage":"Insufficient authorization to perform request."}

My access token is correct and works fine with v1 api.

Time is in the future

Hi hootnot,

I have recently been getting the following error from the wrapper:

ERROR : 12/10/2017 12:34:57 PM : {"errorMessage":"Invalid value specified for 'to'. Time is in the future"}

My code for getting the 'to':

now = datetime.datetime.utcnow().isoformat('T')+'Z'
now = str(now[:-8] + 'Z')

I did notice you fixed this issue in version 0.4.2 - Am I doing something I shouldnt?

Thanks again so much!

Download data is missing

Hi,

i used the API to download data for GBP/USD and i found some data is missing.

qq 20180308185304

I specified the period as 10min, but there is one row data missing as you can see from above picture. Could anyone can give me a solution?

Thank you !

Jupyter exampleAuth error

I'm getting an error in this line of code under accounts.ipynb

import json
import oandapyV20
import oandapyV20.endpoints.accounts as accounts
from exampleauth import exampleauth

accountID, access_token = exampleauth.exampleAuth()
client = oandapyV20.API(access_token=access_token)

r = accounts.AccountList()
response = client.request(r)
print(json.dumps(response, indent=2))

ModuleNotFoundError Traceback (most recent call last)
in ()
2 import oandapyV20
3 import oandapyV20.endpoints.accounts as accounts
----> 4 from exampleauth import exampleauth
5
6 accountID, access_token = exampleauth.exampleAuth()

ModuleNotFoundError: No module named 'exampleauth'

Issue with market orders

Hi I'm a python beginner trying to issue some oanda orders with python. I'm stuck and would like some further illustration:

from exampleauth import exampleAuth
+ 
r = orders.OrderCreate(accountID, data=mktOrder.data)
  1. my question is: what should i do with the first part? What should I replace it with for it to work?

  2. Do I have to replace accountID in the second part with my oanda login?

I tried reading the thread with the same question but couldn't figure this problem out.

Thanks

Direction of the trade is not available

Thanks for the amazing library.

However, I just ran the sample code for fetching the list of open trades and noticed that the response does not include the direction of the trade (i.e BUY or SELL).

Is this how it is supposed to be or a bug?
Are there any other workarounds to find whether a trade is a sell trade or a buy trade?

Version 0.2.2

  • increase coverage for: /oandapyV20/contrib/requests/{positionclose.py, marketorder.py}
  • contrib.requests classes timeInForce parameter add and/or verify against allowed values
  • types: add AccountID + test
  • make oandapyV20.definitions classes return key values also

Version 0.2.1

  • fix missing requirement
  • fix examples: candle-data.py

Get Instrument Candles in Unix Time

Sorry, this is more a question than an Issue, but it's because I do not find the answer. According to the documentation about instrument candles, you can request the time to be in Unix time by setting the header Accept-Datetime-Format as UNIX. Howerver in the implementation of this nice package, I'm unable to find this.

In the documentation the following example is given:

oandapyV20.endpoints.instruments.InstrumentsCandles(instrument, params=None)

The parameters for the query are well accepted but nothing about the header. Could somebody guide me with this?

Note: I can totally convert the data to Unix time myself, but since it is one of the parameters given, I think it would be nice to get it directly from oanda.

Closing Data

Thank you for the example on opening a trade. But how would you close a trade? Also the documentation on readthedocs seems to be all out of date. When running some of the examples I get an error on parsing TRADE_DATA. It seems that this is outdated. Is there any way we could get some up to date documentation?

import error.

yes i am facing import error....

(oan) najeeb@najeeb:~/Music/repo/oandapyV20-examples/src$ pip install oandapyV20 Collecting oandapyV20 Using cached https://files.pythonhosted.org/packages/0d/d5/f69c978f485db3048886c447398e39c6ec18041e689656e6d31697ea4e7f/oandapyV20-0.6.3.tar.gz Building wheels for collected packages: oandapyV20 Running setup.py bdist_wheel for oandapyV20 ... done Stored in directory: /home/najeeb/.cache/pip/wheels/2c/b0/cd/49054320a6cc51db0ff4f1ee15d8840375f16cef57b81ebfc0 Successfully built oandapyV20 Installing collected packages: oandapyV20 Successfully installed oandapyV20-0.6.3

`(oan) najeeb@najeeb:~$ ipython
Python 3.6.5 |Anaconda, Inc.| (default, Apr 29 2018, 16:14:56)
Type 'copyright', 'credits' or 'license' for more information
IPython 6.4.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import oandapyV20

ModuleNotFoundError Traceback (most recent call last)
in ()
----> 1 import oandapyV20

ModuleNotFoundError: No module named 'oandapyV20'

In [2]:
`

TrailingStopLossDetails's example is inconsistent with its parameters

Hi,

In the file oanda-api-v20/oandapyV20/contrib/requests/onfill.py,
the function TrailingStopLossDetails() has parameter distance, but the example code shows the price?

I also check the test code of this function, it should be ... distance ?
Thank you.

def __init__(self,
                 distance,
                 timeInForce=OD.TimeInForce.GTC,
                 gtdTime=None,
                 clientExtensions=None):
        """Instantiate TrailingStopLossDetails.
        Parameters
        ----------
        distance : float or string (required)
            the price to trigger trailing stop loss order
        timeInForce : TimeInForce (required), default TimeInForce.GTC
            the time in force
        gtdTime : DateTime (optional)
            gtdTime is required in case timeInForce == TimeInForce.GTD
        clientExtensions : ClientExtensions (optional)
        Example
        -------
            >>> import json
            >>> from oandapyV20 import API
            >>> import oandapyV20.endpoints.orders as orders
            >>> from oandapyV20.contrib.requests import (
            >>>     MarketOrderRequest, TrailingStopLossDetails)
            >>>
            >>> accountID = "..."
            >>> client = API(access_token=...)
            >>> # at time of writing EUR_USD = 1.0740
            >>> # let us take profit at 1.10, GoodTillCancel (default)
            >>> trailingStopLossOnFill = TrailingStopLossDetails(price=1.06)
            >>> print(trailingStopLossOnFill)
            {
                "timeInForce": "GTC",
                "price": "1.10000"
            }

instruments.InstrumentsOrderBook fails for some instruments

When I try to call instruments.InstrumentsOrderBook, it does not work for many instruments(for example 'NAS100_USD' or 'SPX500_USD'). The error message is "NAS100_USD is not a valid instrument".
All the other endpoints work fine. The code snippet I am using is:

request = instruments.InstrumentsOrderBook(instrument = "NAS100_USD") 
orderbook = client.request(request)

How could this be fixed? Just in case, I tried calling instruments.InstrumentsOrderBook with instrument by name (instrument = "US Nas 100"), but this of course does not work as well.

Setting `expiry` on LimitOrderRequest

Hi all,

I'm trying to figure out how to place an expiry date on all the limit orders I place.

Has anyone had any luck with this? I don't see anything in the documentation about it.

Thanks for your reply.

New endpoints

New endpoints to add:

  • /v3/instruments/{instrument}/orderBook
  • /v3/instruments/{instrument}/positionBook

Note: these endpoints seem only take currency_pairs as instruments

Errors in Code

In the second example in your README file there are two syntax mistakes in the code. Line 15 and 20 are missing another closing parentheses.

InstrumentsCandlesFactory skips last request

The InstrumentsCandlesFactory skips the request that should get the last N-records, where N is less than the standard count of 500 or the specified count.

The loop used to determine the number of requests and request parameters exits 1 request to early. So the request for last N records is not generated.

This is corrected.

neworder.py syntax issue

Line 35 is currently: "api = API(access_token=token)" but it should be: "api = API(access_token=token, headers={"Content-Type": "application/json"})

It also might be a good idea to add: "environment="practice"" so that if somebody executed this program and doesn't notice that it is in a live environment they don't get financially hurt.

Differences between oanda and metatrader data

I cannot figure out why there is a difference between data retrieved from metatrader and data retrieved from oanda api.

Example, I want last close price for EUR_USD M1. Here's data from Oanda:

REQUEST: v3/instruments/EUR_USD/candles InstrumentsCandles {'granularity': 'M1', 'price': 'A', 'includeFirst': True, 'from': '2018-10-16T18:04:00Z', 'to': '2018-10-16T18:14:18Z'}
MODE: ask
2018-10-16T18:13:00 1.15785
2018-10-16T18:12:00 1.15777
2018-10-16T18:11:00 1.15774
2018-10-16T18:10:00 1.15765
2018-10-16T18:09:00 1.15765
2018-10-16T18:08:00 1.15762
2018-10-16T18:07:00 1.15752
2018-10-16T18:06:00 1.15752
2018-10-16T18:05:00 1.15756
2018-10-16T18:04:00 1.15757

REQUEST: v3/instruments/EUR_USD/candles InstrumentsCandles {'granularity': 'M1', 'price': 'B', 'includeFirst': True, 'from': '2018-10-16T18:04:00Z', 'to': '2018-10-16T18:14:18Z'}
MODE: bid
2018-10-16T18:13:00 1.15771
2018-10-16T18:12:00 1.15765
2018-10-16T18:11:00 1.15762
2018-10-16T18:10:00 1.15751
2018-10-16T18:09:00 1.15752
2018-10-16T18:08:00 1.15751
2018-10-16T18:07:00 1.15738
2018-10-16T18:06:00 1.15740
2018-10-16T18:05:00 1.15742
2018-10-16T18:04:00 1.15744

REQUEST: v3/instruments/EUR_USD/candles InstrumentsCandles {'granularity': 'M1', 'price': 'M', 'includeFirst': True, 'from': '2018-10-16T18:04:00Z', 'to': '2018-10-16T18:14:18Z'}
MODE: mid
2018-10-16T18:13:00 1.15778
2018-10-16T18:12:00 1.15771
2018-10-16T18:11:00 1.15768
2018-10-16T18:10:00 1.15758
2018-10-16T18:09:00 1.15758
2018-10-16T18:08:00 1.15756
2018-10-16T18:07:00 1.15745
2018-10-16T18:06:00 1.15746
2018-10-16T18:05:00 1.15749
2018-10-16T18:04:00 1.15750

Here's data from metatrader:

2018-10-16T18:13:00 1.15787
2018-10-16T18:12:00 1.15792
2018-10-16T18:11:00 1.15806
2018-10-16T18:10:00 1.15807
2018-10-16T18:09:00 1.15799
2018-10-16T18:08:00 1.15811
2018-10-16T18:07:00 1.15803
2018-10-16T18:06:00 1.15801
2018-10-16T18:05:00 1.15800
2018-10-16T18:04:00 1.15787

tick frequency difference between API v1 and API v3

At october 10th I've asked OANDA the following question (which was answered some days later):

Q:
... I did a few tests and noticed a considerable difference between both streams regarding quotes received. Is that possible ?

From 09:01:01 to 09:15:58 I count for DE30_EUR ..
on the v1 REST interface 1132 ticks and
on the v3 REST interface 643 ticks.

a few hours later I find:
v1 2536 versus v3 1565 ticks

Are there less ticks published for the v3 REST pricing stream ?

A:
Case Number: 00259195
Case Subject: streaming quotes question

Yes, the price stream for the v20 API uses a different sampling algorithm than that of the v1 API. This was done to ensure the v20 streaming components can reliably scale to the projected demands that we anticipate.

trades.TradesList missing setting params attribute

I believe there is a bug in trades.TradesList endpoint, in __init__ method:

class TradesList(Trades):
    def __init__(self, accountID, params=None):
        super(TradesList, self).__init__(accountID)
        self.params = params  # this line is missing

Integrate forexlabs endpoint

Recently OANDA stopped supporting the v1 interface. The only pending endpoint to complete the V20-interface, was the forexlabs endpoint. They now seem to have choosen to support that endpoint under the V20 accounts as an endpoint from the legacy v1 interface.

The forexlabs-endpoint will be implemented according the specs of the v1 forexlabs endpoint.

Couldnot modify Trades' Extensions

As you can see below, I have one trade of EUR_USD.

[IN]

instrument = "EUR_USD"

params = {"instrument" : instrument}
r = trades.TradesList(accountID=accountID, params=params)
client.request(r)

[OUT]

{'lastTransactionID': '191',
 'trades': [{'currentUnits': '300',
   'financing': '-0.0034',
   'id': '160',
   'initialMarginRequired': '3.3922',
   'initialUnits': '300',
   'instrument': 'EUR_USD',
   'marginUsed': '3.3946',
   'openTime': '2018-11-30T18:25:27.729105653Z',
   'price': '1.13079',
   'realizedPL': '0.0000',
   'state': 'OPEN',
   'stopLossOrder': {'createTime': '2018-11-30T18:32:46.972901259Z',
    'guaranteed': False,
    'id': '166',
    'price': '1.10000',
    'state': 'PENDING',
    'timeInForce': 'GTC',
    'tradeID': '160',
    'triggerCondition': 'DEFAULT',
    'type': 'STOP_LOSS'},
   'takeProfitOrder': {'createTime': '2018-11-30T18:32:46.972901259Z',
    'id': '165',
    'price': '1.15000',
    'state': 'PENDING',
    'timeInForce': 'GTC',
    'tradeID': '160',
    'triggerCondition': 'DEFAULT',
    'type': 'TAKE_PROFIT'},
   'unrealizedPL': '0.0750'}]}

Then, Iย would like to modify above trades' extension with trade id : 160, right?

[IN]

data =  {"clientExtensions" : {
                               "comment": "myComment",
                               "id": "myxxxxx"
                              }
        }

r = trades.TradeClientExtensions(accountID=accountID,tradeID=160,data=data)
client.request(r)

And what I got was:

[OUT]

V20Error: {"tradeClientExtensionsModifyRejectTransaction":{"type":"TRADE_CLIENT_EXTENSIONS_MODIFY_REJECT","rejectReason":"CLIENT_TRADE_ID_ALREADY_EXISTS","tradeID":"160","tradeClientExtensionsModify":{"id":"myxxxxx","comment":"myComment"},"id":"192","accountID":"101-011-8015835-002","userID":8015835,"batchID":"192","requestID":"78532062367077888","time":"2018-12-01T03:05:39.625695065Z"},"relatedTransactionIDs":["192"],"lastTransactionID":"192","errorMessage":"The client Trade ID specifed is already assigned to another open Trade","errorCode":"CLIENT_TRADE_ID_ALREADY_EXISTS"}

It said "CLIENT_TRADE_ID_ALREADY_EXISTS".

I understood it but if I would like to modify some trades' extensions, the trade should be exist, right?

I think I must lose in some point.

Please kindly advise me.

Thank you very much.

Add health API

Add the health-API, as under http://developer.oanda.com/rest-live-v20/health/, to have additional information regarding the status of the services offered by OANDA.

Sept 2, 2017:
The URL to the health-page suggests that both v1 and v20 are covered.
In contradiction to earlier information, OANDA informed me yesterday that this health-API only covers the v1-API.
Therefore this health-API code will not be merged into oandapyV20

Bug in streaming_prices.py example

currently only the last of a --instruments list gets passed as instrument

the instruments parameter needs to be:

params={"instruments": ",".join(clargs.instruments)}

Version 0.2

Endpoints:

  • coverage of the accounts endpoint
  • coverage of the instruments endpoint
  • coverage of the orders endpoint
  • coverage of the positions endpoint
  • coverage of the pricing endpoint
  • coverage of the trades endpoint
  • coverage of the transactions endpoint
  • coverage of the forexlabs endpoint ( waiting for specs to be released )

Definitions:

  • definitions: classes with definitions that represent the key/value definitions as in the dev. docs
  • types: classes representing data types as in the dev. docs: OrderID, TradeID, ClientTag etc.

Contrib:

  • contrib.requests : classes representing (optional) data to be passed via request bodies

Examples for limit orders with GTD?

I'm trying to figure out limit orders with take profit and time limits. Here's an example of my code:

     lmtOrder = LimitOrderRequest(
                            instrument = "USD_CHR",
                            units = 100,
                            price = 1.234,
                            takeProfitOnFill = TakeProfitDetails(price=1.345).data,
                            timeInForce = "GTD"
                            )

I'm not sure where/how to put the time in for the GTD portion of the limit order. I don't see anything called out in the docs.

Here's the error I get.

oandapyV20.exceptions.V20Error:
 {"orderRejectTransaction": {
    "type":"LIMIT_ORDER_REJECT",
    "instrument":"USD_CHF",
    "units":"828",
    "price":"0.97325",
    "timeInForce":"GTD",
    "triggerCondition":"DEFAULT",
    "partialFill":"DEFAULT",
    "positionFill":"DEFAULT",
    "takeProfitOnFill":    {
        "price":"0.97525",
        "timeInForce":"GTC"},
    "reason":"CLIENT_ORDER",
    "rejectReason":"TIME_IN_FORCE_GTD_TIMESTAMP_MISSING",
    "id":"15513",
    "userID":1485009,
    "accountID":"001-001-1485009-001",
    "batchID":"15513",
    "requestID":"24314887390732863",
    "time":"2017-08-08T00:53:26.992772654Z"},
"relatedTransactionIDs":["15513"],"lastTransactionID":"15513",

"errorMessage":"The TimeInForce is GTD but no GTD timestamp is provided","errorCode":"TIME_IN_FORCE_GTD_TIMESTAMP_MISSING"}

Thanks!

Historical data

Hi
How can i set datetime in params and get historical data from X to Y ?

Release 0.3.0

  • [x] restructure documentation (readthedocs) (released in 0.2.3 #71)
  • [ ] coverage of the forexlabs endpoint
  • [ ] contrib.factories (to generate requests)
  • [x] extend types with DateTime ( released in 0.2.3 #71)

Release 0.3.0

  • /v3/instruments/{instrument}/orderBook endpoint
  • /v3/instruments/{instrument}/positionBook endpoint

Missing Trading Documentation

So where is the documentation for your package? Some of the links give me a 404. I found the examples in streaming rates and historic prices. Do you have any docs or examples an actually placing trades?

live account

Hi,
I can connect successfully to practice account , can not authenticate with live account.

How i can define endpoint for api call to be live account not practice account?
Thanks

contrib.factories.history.InstrumentCandleFactory ignoring 'params' incorrectly using 'yparams'

If running something like below. it ignores the granularity.

for r in InstrumentsCandlesFactory('EUR_USD', params={'granularity': 'D'}):

Seems that below should be using params not yparams (as its empty anyway)

    yparams = dict()
    if not params or 'from' not in params:
        yield instruments.InstrumentsCandles(instrument=instrument,
                                             params=yparams)   # should use params if  'from' not supplied
    else:

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

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");
        }
    });
  };

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.