Navigation

    Backtrader Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/

    Oanda v20 API

    General Code/Help
    13
    23
    5705
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      Matthias Janssen last edited by

      Hi Guys,

      yes again this topic. I have already tried the solution mentioned in a other topic just to ask for a other version.
      I have ask and here the answer and here for all that are properly not prepared:

      Thank you for contacting OANDA.
      Unfortunately that is not possible , our V1 API will be phasing out by the end of the year.

      The documentation of the Rest v20 API seams to be complete like the v1 API.

      Maybe its time to work on a port.

      1 Reply Last reply Reply Quote 1
      • chuka
        chuka last edited by

        @matthias-janssen said in Oanda v20 API:

        Thank you for contacting OANDA.
        Unfortunately that is not possible , our V1 API will be phasing out by the end of the ye

        @backtrader

        1 Reply Last reply Reply Quote 0
        • C
          cgd last edited by

          @backtrader

          Any feedback, with regard to this?

          1 Reply Last reply Reply Quote 0
          • B
            backtrader administrators last edited by

            A project is being considered now, that would imply adding support. To be decided in the next days

            ? 1 Reply Last reply Reply Quote 3
            • ?
              A Former User @backtrader last edited by

              @backtrader This and Interactive Brokers please.

              1 Reply Last reply Reply Quote 0
              • S
                suvretta last edited by

                I am also in need of support for Oanda V20 API and would very much appreciate any work done on adding this feature.

                1 Reply Last reply Reply Quote 0
                • jamespeterschinner
                  jamespeterschinner last edited by jamespeterschinner

                  I believe my package async_v20 may be of use here.

                  As the name suggests, it is implemented using asyncio and aiohttp. Which allows users to simultaneously send multiple requests. I realize that backtrader likely isn't interested in supporting this ability, due to python 3.6 only compatibility.

                  Though it would be simple enough so swap out requests for aiohttp, if it were desired. Maybe a new branch could be created.

                  some features of async_v20 include:

                  • Create pandas dataframe from any data sent in a JSON array. Useful when wanting to process candle stick data
                  • Automatically keeps track of the LastTransactionID
                  • Automatically provides AccountID and LastTransactionID to
                    v20 API endpoints
                  • Implements the restful features of the V20 API. Via the OandaClient.account() method
                  • Correctly handles decimal point accuracy.
                  • Responses directly reflect OANDA's v20 documentation

                  docs

                  1 Reply Last reply Reply Quote 0
                  • ftomassetti
                    ftomassetti last edited by

                    Is someone willing to collaborate to get support for OANDA v20?

                    1 Reply Last reply Reply Quote 0
                    • ftomassetti
                      ftomassetti last edited by

                      We got started and created a repository where to collaborate to implemente the OandaV20 support for backtrader. We are looking for more collaborators to join: https://github.com/ftomassetti/backtrader-oandav20

                      Of course if there is interest for this we would be happy to contribute the result back to backtrader

                      1 Reply Last reply Reply Quote 3
                      • S
                        shieldman last edited by

                        @ftomassetti Great, would love to contribute though I'm new to trading and python.

                        @backtrader Any update on this?

                        1 Reply Last reply Reply Quote 0
                        • D
                          dasch last edited by

                          @shieldman the version in github can be used for live trading with oanda v20. We have it running since today, it is not that well tested, so any feedback and testing is welcome.

                          1 Reply Last reply Reply Quote 1
                          • M
                            mula29 last edited by

                            I downloaded the latest version today to test it and got this error in the example
                            File "oandav20test.py", line 38, in <module>
                            StoreCls = btoandav20.stores.OandaV20Stores
                            AttributeError: module 'btoandav20.stores' has no attribute 'OandaV20Stores'
                            Am I missing a package?

                            D 1 Reply Last reply Reply Quote 0
                            • D
                              dasch @mula29 last edited by

                              @mula29 you need to install the btoandav20 package by yourself.

                              Either copy the folder btoandav20 into the example directory or
                              copy the folder btoandav20 into your python packages directory or
                              add the package path to your script:

                              import sys
                              sys.path.insert(0, 'PATH_WHERE_btoandav20_IS_IN')
                              
                              M 1 Reply Last reply Reply Quote 0
                              • M
                                mula29 @dasch last edited by mula29

                                @dasch Thanks. Been testing it today and the only issue I encountered was with Limit Orders. It gets rejected with an unknown situation error. The valid date needs to be added to the order and then it works.

                                valid=datetime.datetime.now() + datetime.timedelta(days=3))

                                D 1 Reply Last reply Reply Quote 0
                                • M
                                  monoid last edited by

                                  @ftomassetti Thank you for taking this on. I noticed your code uses python 3.6 in development. Is the plan to support the same versions of python as backtrader does? It seems they test against 2.7 and 3.5 (https://pypi.python.org/pypi/backtrader)

                                  1 Reply Last reply Reply Quote 0
                                  • D
                                    dasch @mula29 last edited by

                                    @mula29 Thanks for the info. Could you provide me with an example of the order creation? I understand the missing valid value, but would like to test the complete flow of this order type.

                                    1 Reply Last reply Reply Quote 0
                                    • M
                                      mula29 last edited by

                                      @dasch This is a sample of my buy order
                                      lprice = Decimal(miround(self.data0.close[0]*1.01)).quantize(FIVEPLACES)
                                      price = Decimal(miround(self.data0.close[0])).quantize(FIVEPLACES)
                                      self.order = self.buy(size=self.p.stake,
                                      exectype=self.p.exectype,
                                      price=price,
                                      plimit=lprice,
                                      valid=datetime.datetime.now() + datetime.timedelta(days=1)

                                      Per Oanda support, the price needs to have not more than 5 decimal precision. In a market order, it works fine but requires more testing for Stoplimit and limit orders.

                                      D 1 Reply Last reply Reply Quote 0
                                      • D
                                        dasch @mula29 last edited by dasch

                                        @mula29 said in Oanda v20 API:

                                        Per Oanda support, the price needs to have not more than 5 decimal precision. In a market order, it works fine but requires more testing for Stoplimit and limit orders.

                                        I have commited today some updates. I hope, your issues are gone now. If not, please open a issue on github.

                                        For the precision, we have details for the traded instrument, so the price precision is known. We use these details for calculting position sizes. Thanks for the code!

                                        Adis Ojeda 1 Reply Last reply Reply Quote 0
                                        • Adis Ojeda
                                          Adis Ojeda @dasch last edited by

                                          @dasch Hello I would like to contribute to the oanda v20 api. I have been coding for about 5 years in Python and am looking to use it as well

                                          D 1 Reply Last reply Reply Quote 0
                                          • D
                                            dasch last edited by

                                            Sure, go ahead.

                                            Just create a pull-request on https://github.com/ftomassetti/backtrader-oandav20/

                                            Also you can create issues there.

                                            Adis Ojeda 1 Reply Last reply Reply Quote 0
                                            • 1
                                            • 2
                                            • 1 / 2
                                            • First post
                                              Last post
                                            Copyright © 2016, 2017, 2018 NodeBB Forums | Contributors
                                            $(document).ready(function () { app.coldLoad(); }); }