The Manual states that swap is not available via the Oanda V20 API.
However, the Python script which has been posted in the Forum and uses the V20 API returns RollLong and RollShort values, and these values change when the script is run at different times.
Is the Manual incorrect?
Re: Oanda Roll (swap) Actually Available?
[Re: DdlV]
#483262 05/13/2111:1805/13/2111:18
@jcl, would appreciate your thoughts. There seem to be 3 possibilities:
- The manual is incorrect and the API V20 does have swap values. - The manual is correct and the Python script is incorrect - what it's returning for swap is invalid. - The Python script is correct and the manual is sort of correct - something like swap is in the API V20 but the plugin isn't coded to capture it?
Thanks.
Re: Oanda Roll (swap) Actually Available?
[Re: DdlV]
#483267 05/13/2116:0905/13/2116:09
If the API provides it, the documentation does not say how.
If I had to guess, it's probably secretly output via the /v3/accounts/{accountID}/instruments endpoint, probably supplying the InstrumentFianancing primitive for each instrument.
Thanks @AndrewAMD. This bit of the Python code would seem to support your guess:
Code
# Calculate RollLong and RollShort in account currency, for the quantities used by Zorro
financing_pos_size = defaultdict(lambda: 1, {'CURRENCY': 10000}) # Everything but CURRENCY defaults to 1
data['RollLong'] = data['financing.longRate']/365 * \
data['Price'] * \
data['type'].map(financing_pos_size) * \
(data['currency']+'/'+ACCOUNT_CURRENCY).map(conversion_rate)
data['RollShort'] = data['financing.shortRate']/365 * \
data['Price'] * \
data['type'].map(financing_pos_size) * \
(data['currency']+'/'+ACCOUNT_CURRENCY).map(conversion_rate)
Would still appreciate @jcl's thoughts. Of course "we don't code to undocumented things" is an appropriate response, but perhaps the plug-in could handle these via a "use at your own risk" option?
Thanks.
Re: Oanda Roll (swap) Actually Available?
[Re: DdlV]
#483313 05/18/2114:4505/18/2114:45
I would like to answer "we don't code undocumented things", but in fact we do that. We'll check if we can implement the rollover on the next Oanda plugin revision.
Re: Oanda Roll (swap) Actually Available?
[Re: DdlV]
#483317 05/19/2100:2005/19/2100:20