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
402 stars 107 forks source link

TrailingStopLossDetails's example is inconsistent with its parameters #131

Closed KBJIYU closed 5 years ago

KBJIYU commented 6 years ago

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"
            }
hootnot commented 6 years ago

@KBJIYU : it should be distance, I'll fix it. Thx!

KBJIYU commented 6 years ago

Thank you!

hootnot commented 5 years ago

closed by #140