Oanda Roll (swap) Actually Available?

Posted By: DdlV

Oanda Roll (swap) Actually Available? - 05/10/21 16:26

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?
Posted By: DdlV

Re: Oanda Roll (swap) Actually Available? - 05/13/21 11: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.
Posted By: kzhao

Re: Oanda Roll (swap) Actually Available? - 05/13/21 16:09

Which Python script are you referring to? It would be great to the swap values.
Posted By: DdlV

Re: Oanda Roll (swap) Actually Available? - 05/13/21 17:56

@kzhao: https://opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=480394
Posted By: kzhao

Re: Oanda Roll (swap) Actually Available? - 05/13/21 23:19

@DdIV Thanks.
Posted By: AndrewAMD

Re: Oanda Roll (swap) Actually Available? - 05/14/21 15:16

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.
Posted By: DdlV

Re: Oanda Roll (swap) Actually Available? - 05/17/21 12:13

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.
Posted By: jcl

Re: Oanda Roll (swap) Actually Available? - 05/18/21 14: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.
Posted By: DdlV

Re: Oanda Roll (swap) Actually Available? - 05/19/21 00:20

Thanks @jcl!
© 2024 lite-C Forums