Skip to content

Commit

Permalink
docfix price/distance
Browse files Browse the repository at this point in the history
  • Loading branch information
hootnot committed Jun 26, 2018
1 parent 36772d2 commit ca0525b
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions oandapyV20/contrib/requests/onfill.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,20 +235,19 @@ def __init__(self,
>>> 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)
>>> # add a trailing stoploss, at 50 pips GoodTillCancel (default)
>>> sld = 1.0740 - 1.0690
>>> trailingStopLossOnFill = TrailingStopLossDetails(distance=sld)
>>> print(trailingStopLossOnFill)
{
"timeInForce": "GTC",
"price": "1.10000"
"distance": "0.00500"
}
>>> ordr = MarketOrderRequest(
>>> instrument="EUR_USD",
>>> units=10000,
>>> trailingStopLossOnFill=trailingStopLossOnFill.data
>>> )
>>> # or as shortcut ...
>>> # ...OnFill=trailingStopLossDetails(price=1.06).data
>>> print(json.dumps(ordr.data, indent=4))
>>> r = orders.OrderCreate(accountID, data=ordr.data)
>>> rv = client.request(r)
Expand Down

0 comments on commit ca0525b

Please sign in to comment.