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

Differences between oanda and metatrader data #134

Closed vtandrea closed 5 years ago

vtandrea commented 5 years ago

I cannot figure out why there is a difference between data retrieved from metatrader and data retrieved from oanda api.

Example, I want last close price for EUR_USD M1. Here's data from Oanda:

REQUEST: v3/instruments/EUR_USD/candles InstrumentsCandles {'granularity': 'M1', 'price': 'A', 'includeFirst': True, 'from': '2018-10-16T18:04:00Z', 'to': '2018-10-16T18:14:18Z'} MODE: ask 2018-10-16T18:13:00 1.15785 2018-10-16T18:12:00 1.15777 2018-10-16T18:11:00 1.15774 2018-10-16T18:10:00 1.15765 2018-10-16T18:09:00 1.15765 2018-10-16T18:08:00 1.15762 2018-10-16T18:07:00 1.15752 2018-10-16T18:06:00 1.15752 2018-10-16T18:05:00 1.15756 2018-10-16T18:04:00 1.15757

REQUEST: v3/instruments/EUR_USD/candles InstrumentsCandles {'granularity': 'M1', 'price': 'B', 'includeFirst': True, 'from': '2018-10-16T18:04:00Z', 'to': '2018-10-16T18:14:18Z'} MODE: bid 2018-10-16T18:13:00 1.15771 2018-10-16T18:12:00 1.15765 2018-10-16T18:11:00 1.15762 2018-10-16T18:10:00 1.15751 2018-10-16T18:09:00 1.15752 2018-10-16T18:08:00 1.15751 2018-10-16T18:07:00 1.15738 2018-10-16T18:06:00 1.15740 2018-10-16T18:05:00 1.15742 2018-10-16T18:04:00 1.15744

REQUEST: v3/instruments/EUR_USD/candles InstrumentsCandles {'granularity': 'M1', 'price': 'M', 'includeFirst': True, 'from': '2018-10-16T18:04:00Z', 'to': '2018-10-16T18:14:18Z'} MODE: mid 2018-10-16T18:13:00 1.15778 2018-10-16T18:12:00 1.15771 2018-10-16T18:11:00 1.15768 2018-10-16T18:10:00 1.15758 2018-10-16T18:09:00 1.15758 2018-10-16T18:08:00 1.15756 2018-10-16T18:07:00 1.15745 2018-10-16T18:06:00 1.15746 2018-10-16T18:05:00 1.15749 2018-10-16T18:04:00 1.15750

Here's data from metatrader:

2018-10-16T18:13:00 1.15787 2018-10-16T18:12:00 1.15792 2018-10-16T18:11:00 1.15806 2018-10-16T18:10:00 1.15807 2018-10-16T18:09:00 1.15799 2018-10-16T18:08:00 1.15811 2018-10-16T18:07:00 1.15803 2018-10-16T18:06:00 1.15801 2018-10-16T18:05:00 1.15800 2018-10-16T18:04:00 1.15787

hootnot commented 5 years ago

hi @vtandrea , during the transition from v1 to v20 I saw differences in streamingquotes. too. I asked them about this and it had to do with aggregating prices over 0.25 of a second in v20 vs. no aggregating in v1. V20 gives a lot less ticks compared to v1. You talk historical data here. I would say that it should be equal. The impression I have from it is that there are different datasources. Questions that rise: which one is right ? or are both wrong?

Since this is not a question regarding my code, you really should drop it at OANDA. If they gave you the answer, pls. post it here too