On Fri, Nov 6, 2020 at 6:29 PM Daniele Nicolodi <dani...@grinta.net> wrote:
> Hello, > > despite living a life in multiple currencies, my approach for getting > current and historical currency exchange rates is not systematic at all > and I have been using different sources at different times for different > applications. > > I would like to standardize and automate the retrieval of currency > exchange rates. However, I haven't been able to find a service that > offers easy and free access at historical data. I am not even sure that > different sources agree on what is the mid market daily average exchange > rate. I am almost ashamed of my ignorance int his field. Is there a > think like an "official" number? Which sources does people use? > - There is no price. There are only bids and offers, on various platforms. Bids and offers change 6 days per week 24hr/day, microsecond by microsecond. The closest to the "best" price is the one you can get from the institutional platform that carries the most liquidity, and that depends on the currency pair, e.g., you would find the best price on USD/NZD on Reuters. - These markets aren't regulated like the stock markets, so there is no official "close" price (they don't close 6 days / week anyway, and what time zone would you use?). - The closest to an official price you'll find is a price published by a central bank for the day, with the purpose of establishing official numbers to use for government business and taxes. These are typically published in tables on their websites (e.g. https://www.bankofcanada.ca/rates/exchange/legacy-noon-and-closing-rates/). FYI, there are a few levels of markets where the stuff gets traded: - Institutional market. The major triad of these are the EUR/USD, USD/JPY and EUR/JPY on the EBS platform, and Reuters carries the commonwealth pairs through USD (e.g., USD/AUD, USD/NZD, USD/CAD, etc.). These are where the banks trade the big blocks. Then there are a number of second tier institutional platforms, such as Currenex, FXAll, and many more, largely competing with better technology. Large platforms have the tightest spreads, but typically require having a prime broker and ISDA agreements, and their clients are banks, hedge funds, and trading shops. They're typically not for individuals (though some of the second tier places will allow you access if you can put up a reasonable amount to get started ($XXXk)). This is where the big boys trade spot contracts in large increments. Market data is a valuable commodity for the exchanges, and they charge for access, which is why you will never see a recently updated price source that's accurate. Even if you had access to this market data you're not allowed to publish it. - Banks will trade directly with funds and other banks using custom quote systems ("RFQ"), e.g. you can trade spot contracts with Goldman Sachs. You can't do this and don't see those prices either. Those prices get folded in some internal common book of spot prices from other sources. This market is indirectly reflected through the rates the bank can quote you when they do currency conversions for you (typically at outrageous spreads (commissions) of 3-5%). If you call your bank and ask to speak to a trader to make a conversion on a large-ish amount (e.g., $200k), you can get a better rate (it's still going to be bad). Never use prices from a bank, never convert currencies through a bank, you always get the short end of the stick, and prices from banks will have too much of a spread. - Retail market. This is what you as an individual can do to trade leveraged long/short positions in FX. A number of institutions will allow you to open an account and take positions against their own published market. These platforms make markets based on the institutional ones (they monitor the institutional markets and compute a market they offer for you, that you can trade against). These platforms include reputable ones like OANDA's FXTrade, Saxobank, but there are also a large number of sketchy ones with offices in dubious locations; probably best to stay away from those (they may use your trade flow in ways that aren't beneficial to you, and the spreads they publish aren't in your favor). Basically, when you send a trade, there's a question of trust between you and their execution. Prices from the better of these platforms are pretty tight and close enough to those seen on the institutional platforms. If they provide free currency prices, those are probably the best free ones you can get. I like OANDA and their innovations. - Discount brokerages also include optional access to FX trading via one of the second-tier institutional platforms, e.g. on Ameritrade you used to be able to put positions on Hotspot. I'm not sure where Interactive Brokers is backed, but it must be similar. You can probably get quotes from these with a small spread if you have an API account there. The problem with these platforms is that holding positions across days involves an expensive rolling process. You're almost always better with a retail platform to do this, e.g. OANDA has no explicit rolling of positions and pays the interest differential daily. But to get prices, probably okay. e.g., https://developer.tdameritrade.com/apis But this is all nothing but fun and entertainment, because Beancount only supports one price per day anyway. You can get 20min delayed quotes for free on some services (e..g, Yahoo!), which IMO is plenty good enough IMO. For example, OANDA https://www1.oanda.com and fxtop https://fxtop.com/ > have web data sources that could be easily scraped for data. However, > the numbers do they report do not agree. In the case of OANDA the > numbers reported are different depending on which tool is used to query > the exchange rates, with the most simple one actually reporting the > rates for the day before the requested day. Does anyone know what's the > reason for doing something like this? > Just poor definitions and well, it's free. And the prices they see on their markets legitimately differ between platforms, due to technical details, delays and varying market access, but also how they construct the market that they offer to you to avoid losing on execution. They should be close enough though. If you care about precision in time and want something free, I would use a price from a retail FX place. If for Beancount, you'll have to choose a time of day. If you want something good enough and close to what your taxes will require, download prices from the central banks. If you don't care that much, get the historical prices from Yahoo. > Thank you. > > Best, > Daniele > > -- > You received this message because you are subscribed to the Google Groups > "Beancount" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to beancount+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/beancount/959a7fe0-6d45-f1ba-1d93-fc90a3d0a615%40grinta.net > . > -- You received this message because you are subscribed to the Google Groups "Beancount" group. To unsubscribe from this group and stop receiving emails from it, send an email to beancount+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/CAK21%2BhNQoDbYO-AEOkpnQNNF6N1_cOL8E0dx6KxTvhzcNumDvw%40mail.gmail.com.