котировки форекс в excel / Валюты Forex | RusBonds

Котировки Форекс В Excel

котировки форекс в excel

FX Spots, Forwards, Swaps and Curves in Excel

cover

​Assume you possess Nd units of a currency DOM regarded as domestic currency. For example, you live in the US and hold 1,USD, ie. Nd = 1, and DOM = USD.

For whatever reasons, you want to replace this money with their equivalent number of units Nf of another currency FOR regarded as foreign currency. For concreteness think of FOR like if it were the currency EUR.

All you would have to do is going to a bank and exchange your 1,USDwith whatever amount the bank would be willing to give you at that time. If the bank gave you EUR(i.e. Nf= ), you would have just entered into a spot fxtransaction with the bank as a counterparty on the currency pair EUR/USDinvolving the fx rateof 1,/ = . The exact same transaction may be also described in terms of the inverse currency pair USD/EURwith the corresponding fx rateof /1, = .

Table Of Contents 

Recommended for Deriscope starters: The Overview and Quick Guide pages.

Understanding Spot FX Transactions

When referring to a currency pair FOR/DOM, the numerator FOR is referred as the base currency, while the denominator DOM is referred as the quote or account currency.

The spot fx rate of the pair FOR/DOM at a given time t is simply the ratio Nd/Nf of the notional amounts Nd (number of DOM units) and Nf (number of FOR units) that are changing hands … as soon as possible after time t. Contrary to the above example of consumer finance, the actual exchange of currencies between banks is never conducted immediately after the agreement to the exchange. In wholesale transactions a typical settlement delay of two business days applies, which makes the spot transaction being - in reality - forward in nature. Nevertheless, it is still regarded as spot and not as forward, due to the fact that – contrary to a forward fx contract – the spot fx transaction cannot be replicated with a same-currency borrowing (lending) of funds followed by a future spot fx transaction that converts the borrowed (lent) funds to the final desired currency. The net effect is that the spot fx rate cannot be derived from the domestic and foreign interest rates, even though the currency settlement occurs in the future. It forms an additional stochastic factor – usually correlated with the interest rates – that needs to be modelled on a fundamental level along the other risk factors of the economy.

As we will see, fx rates related to currency exchanges that settle later than the usual two business days can be derived - to a certain degree – from the spot fx rate and the prevailing domestic and foreign interest rates.

Most currency transactions carry very little risk because they are instantly collateralized by the fact that the two involved currencies exchange hands at the same time. This fact allows the banks to transact in huge notional amounts that necessitate accurate treatment of the various settlement dates. While, when dealing with stock options, it may be sufficient to identify the spot stock price with a single number, we should not do the same with the spotfx rate in our dealings with fx products. The devil is in the detail and one needs to properly account for the settlement period associated with a given fx rate.

The Deriscope Excel add-in supports an accurate fx rate representation by employing an object of type FXValue, the structure of which is shown below: 

In the image above, the fx rate is represented as an object of type FX Value that includes a few additional keys beyond the usual Base Currency=, Quote Currency= and Spot Rate=. The interpretation of these extra keys is as follows:

Under the assumption that two counterparties agree to exchange EUR for USD at some date T referred as trade date, notional amounts of NEUR units of EUR and NUSD units of USD will be credited (settled) in the respective bank accounts 2business days later due to the entry Settlement Days=2. The identification of the settlement date requires knowledge of the applicable calendar(s), the date bump convention and a rule that specifies how all these are used. The choice Settlement Rule=Joint means that the two given calendars must be merged into one by merging the two holiday sets and then move T forward by 2business days according to the merged calendar. This ensures that the produced settlement date is a business date with respect to both calendars. The Cross Calendar= entry in this case is empty. It could play a role in cross fx rates between non-USD currencies, in which case it would be normally set to the US (New York) calendar. 

Understanding Forward FX Transactions

It is often the case that you do not need a foreign currency right now, but at some specified future date. For example, you may be a New Yorker who plans to visit Paris on a future date T, which falls for concreteness exactly one year from now. You currently have 1, USD at your disposal, but you fear the euro might become so expensive that you will not be able to buy enough of it in a few months' time. What you really want is using your 1, USD now to secure the possession of a fixed number of euros by the date T. You have two (almost) equivalent choices on how to proceed:

Strategy 1: Enter a spot fx transaction now with the spot fx rateEUR/USD= whereby you give your 1, USD and receive 1,/ = EUR. Then you deposit the received EUR at a special EUR-denominated account for one year that earns the EUR interest rate of 1%. At maturity, i.e. on date T, the deposited EUR will have grown to + 1%*(1 year)* = + = EUR

Strategy 2: Enter into a zero-cost agreement with a willing counterparty to rceive EUR on T by paying the fixed amount *x USD also on T. This agreement is by definition a forward fx transaction now on a EUR notional of with maturity T and forward fx rateEUR/USD= x. This transaction guarantees you the receipt of EUR on T (just like strategy 1), but also obligates you to pay *x USD on T. In order to feel safe that you will be able to meet this obligation on T, you deposit now your available amount of 1, USD at a USD-denominated account for one year that happens to earn the USD interest rate of 2%. At maturity, i.e. on date T, the deposited 1, USD will have grown to 1, + 2%*(1 year)* 1, = 1, + 20 = 1, USD. Since the forward fx contract obliges you to a payment of *x USD on T, it turns out that: *x = 1, => x = 1,/ =  

Generalizing the above argument by replacing the USD (domestic) interest rate of 2% with rd and the EUR (foreign) interest rate of 1% with rf, we derive the following formula that relates the spot fx rates and forward fx ratef with maturity T of a currency pair FOR/DOM:

f = s(1+ rd)/ (1+ rf)

where rd and rf are the non-annualized domestic and foreign, respectively, interest rates from 0 to T.

This formula is known as the Interest Rate Parity (IRP) relation and unfortunately is … wrong, in a certain sense at least! More on that below.

Note that both s and f are the rates of the currency pair FOR/DOM. Under this precaution, we infer that f moves in the same direction with the domestic interest raterd and in the opposite direction with the foreign interest raterf. This is the reason why in our example the rd = 2% being higher than rf = 1% results to a forward fx rate of that is higher than the spot fx rate of .

If you sometimes see the different formula f = s(1+ rf)/ (1+ rd), this is because the rates s and f are defined to refer to the inverse currency pair DOM/FOR. 

Creating FX Forwards in Excel

Deriscope has functions that create special objects representing fx forward contracts. It also has functions that calculate both the price and the fair forward fx rate of these contracts.

You may wonder what the need is for a sophisticated Excel add-in in a situation where the involved formulas are as simple as the IRP formula above.

Three reasons can be cited:

  • eunic-brussels.eu incorporation of calendar and date bump conventions in determining the involved settlement dates cannot be easily carried out without an add-in support.
  • eunic-brussels.eu required input interest rates rd and rf are normally unknown. They depend on the maturity of the forward contract and must be derived out of a set of known market prices of interest rate instruments. The latter process is too complex to be properly done with simple Excel formulas or vb code.
  • eunic-brussels.eu briefly noted above, the IRP relation is not exact, at least when rd, rf are interpreted as the actual domestic and foreign interest rates. An exact treatment does need an add-in.

The following short video shows how I can use the Deriscope wizard to create an Excel object of type FX Forward

The wizard pasted the formula =ds(A2:B7) in cell A1 that takes as input the single range A2:B7 and returns the text &FxFwd_A which is the handle name of a newly created object of type FX Forward.

The input data are arranged as key/value pairs, where the keys are on the first column and carry the = suffix and the values are on the second column. The two top keys

Type= and Function= are universal (apply in all contexts), whereas the remaining four keysDom Ccy=, For Ccy=, Maturity= and Strike= pertain only to objects of type FX Forward.

The wizard has generated the defaults Dom Ccy= %USD and For Ccy= %EUR because my pc is set with the US locale, but I can obviously change them to any other currencies I want.

The image below shows both this spreadsheet formula and the wizard on the right, which displays the in-memory-held contents of the object referenced by the handle name &FxFwd_A 

Simple Pricing

Creating a simple formula that calculates the price of this product is straightforward, as the next video demonstrates:  

Below you see the two formulas as pasted by the wizard in cells D1 and D6. All market data are grouped together in a separate object of type FX Forward Mkt created in cell D6. This object is then fed into the formula in cell D1 that returns the price of 0, as it should, given the fact that our fx forward product in cell A1 has been constructed with a strike of that happens to match exactly the forward fx rate implied by the input interest rates in cells D9 and G10. You may also have noticed that the wizard has created flat yield curves with the same rate of 4%. (Don't worry about the unrealistically high value of EUR rate. It may soon reach such levels!) It is up to me now to substitute each 4% with the actual interest rate that applies to the maturity and currencies I am dealing with. I can even replace these two flat curves with other more realistic curves that bootstrap market data as described in my articles about yield curves. 

Setting up a Rate-Price Dependency Table 

Deriscope's Price Simple function may also be used to calculate the price after one or more of the inputs have changed. This can be done in one single step without the need to reconstruct the input block ranges. For example, I could be interested in making a plot of the fx forward price versus the EUR interest rate. I would then start with a column of assumed EUR rates, as below: 

My next step would be to enter a formula in cell B15 that would return the fx forward price taking into account the EUR Rate supplied in cell A15. The next video shows how I may use the wizard to create such a formula:  

Finally I copy the formula in B15 and paste it to the cells below to get the price dependence on the EUR rate:  

Why is the Interest Rate Parity Relation Wrong?

I mentioned earlier that the IRP relation f = s(1+ rd)/ (1+ rf) between the spot fx ratesand the forward fx ratef with maturity T of a currency pair FOR/DOM is wrong.

It is very simple to see why this is the case.

The IRP relation is derived from the assumption that the two mentioned strategies that end up with the possession of a certain fixed amount of foreign currency FOR at maturity T are equivalent. It turns out this assumption is wrong. Here is why:

The first strategy involved the immediate acquisition of FOR through a spot fx transaction, followed by a FOR-denominated deposit with maturity T of the acquired FOR amount.

The implicit assumption that the FOR-denominated deposit will survive all the way until T is clearly not vindicated by the recent credit deterioration of several banking and sovereign institutions. For example, if FOR equaled EUR and the deposit was with a Greek bank shortly before Sunday the 28th of June , the day Greece introduced capital controls, you might have faced serious problems with getting access to your money at time T.

The second strategy involved an initial DOM-denominated deposit, followed by an fx conversion from DOM to FOR at time T, with the applicable currency conversion rate fixed at time 0.

Here the risks are completely different:

The first obvious risk is similar in nature with the one mentioned at the first strategy, namely the risk that the DOM-denominated deposit will not survive to a happy end by time T. Being "similar in nature" does not mean the two risks are equal. For example, if DOM were USD, one could perhaps think that the US bank where the USDdeposit were to be held would be more trustworthy than the European bank where the EUR deposit would normally sit.

Then there is also the risk that the final conversion between DOM and FOR at T would not be possible, due to whatever reasons. For example, President Trump could ban, shortly before T, all USD-EUR conversions carried out by US-based commercial banks to protect the US dollar. Utterly unlikely of course, but it serves to make the point.

In summary, both strategies lead to a final FOR-denominated uncertain amount, but with a different risk profile. Therefore, the two strategies cannot be considered as being equivalent

The Correct Pricing of FX Forwards

Since we cannot use the no-arbitrage argument between two equivalent strategies to derive the forward fx ratef out of a given spot fx rates, we accept the observed rates fi, i = 1, …, n of n actively traded forward fx contracts with various maturities Ti as exogenous primitives. In other words, we do not try to compute the observed rates fi as the result of a mathematical formula.

Our next step is to assume the existence of a fictitious foreign interest rate market that allows us to enter into deposit contracts denominated in FOR that pay the deposited amount at their respective maturity Tiwith the exact same uncertainty profile as the corresponding real-world domestic deposit contracts denominated in DOM. If we then denote with Rfi, i = 1, …, n the non-annualized interest rates of these fictitious FOR-denominated deposits, then the two strategies would be % equivalent and the ensuing no-arbitrage argument would lead to the relation:

fi = s(1+ rdi)/ (1+ Rfi) , i = 1, …, n

where rdi is the real-world domestic interest rate for the maturity Ti.

In the above formula, all except Rfi are market observables. Therefore, we can use this formula to derive Rfi for each i and refer to it as the fx-implied foreign interest rate for maturity Ti.

The collection of all Rfi for i = 1, …, n constitutes a yield curve of fictitious foreign interest rates – referred as the fx-implied foreign yield curve - that is different than the yield curve of real-world observed foreign rates rf.

We may now calculate the fx forward ratef associated with any maturity T that does not necessarily coincide with one of the market maturities Ti by using the formula:

f = s(1+ rd)/ (1+ Rf)

where rd and Rf are found through the real-world domestic and fictitious fx-implied foreign yield curve respectively, using common interpolation techniques. 

Creating the FX-Implied Foreign Yield Curve out of FX Forwards

The next video shows how I can use the wizard to paste in the spreadsheet the formula that creates an object of type Yield Curve out of market fx forward rates. The interest rates associated with the produced curve will be exactly the rates Rf that must be used as input wherever foreign interest rates are needed in the price calculation of various fx products, such as fx forwards.  

The following image shows the formula =ds(G2:K5) pasted by the wizard in cell G1, which returns the handle name &YldCrv_G that represents an object of type Yield Curve.  

The denomination currency is set by the key-value pair Currency=%EUR.

The key-value pair Market Data=&YldCrvFxf_G is the most important element.

Its value &YldCrvFxf_G is the handle name of an object of type Yield Curve Fxf created below in cell G7.

The latter object is constructed out of the domestic Yield Curve object &YldCrv_G and FX Value object &FXVal_G that have already been created earlier in cells G19 and G25 respectively.

It is also set with Quoting= Spread, which means the forward fx rates in the table further below are entered as differences f-s (forward – spot).

The wizard generates a simple table of input fx forward rates consisting of only two tenors - %1M and %2M - with a flat spread of , i.e. 20basis points. I can obviously insert additional rows and edit the #Quote column so that the actual market rates are included.

I can see the exact dates of the included forwards by selecting the cell G7 that contains the handle &YldCrvFxf_G Then the contents of the respective object are displayed in the wizard as follows: 

Next, I click on the lens sign next to the key _Details= and I can see the exact start and end dates of each forward contract as well as the fx forward rate in natural quotation:  

As betrayed by the IRP relation f = s(1+ rd)/ (1+ Rf), the possession of an fx forward contract exposes its holder to three different sources of risk: Domestic interest rates, foreign interest rates and fx rate.

It is possible to remove the currency risk and limit the exposure to interest rates alone by adding a spot fx transaction with reverse movement of currency funds. The portfolio consisting of an fx forward contract together with a spot currency exchange is termed fx swap.

You should not confuse an fx swap with a currency swap – also termed as cross currency swap -, which is a completely different product explained in detail in my Currency Swaps and Basis Curves post.

An fx swap can be also regarded as a simultaneous borrowing and lending transaction, whereby one of the two swap participants, borrows in one currency and lends in another currency.

Deriscope allows you to create an object of type FX Swap as the next video shows. By default, the wizard generates a formula that creates an FX Swap of the Borrower type, which is a swap, where the foreign currency is borrowed and the domestic currency is lent. In other words, a Borrower FX Swap with maturity T entails a spot fx transaction whereby FOR is received today against DOM and a reverse forward fx contract whereby FOR is scheduled to be paid at T against DOM. 

Below is the spreadsheet formula created by the wizard:  

Due to the cell J1 being selected, the contents of the referred object are displayed by the wizard on the right.

The exact definitions of the various key-value pairs can be displayed by selecting the respective key cells.

The special keyIn parent: Multi Leg Swap= appears because the type FX Swap inherits from the more general type Multi Leg Swap. Putting it simply, the created object with handle name &FxSwp_J is of type FX Swap, but is also of type Multi Leg Swap.

In fact, an FX Swap is modelled as a Multi Leg Swap consisting of 2 legs, whereby the first leg contains all domestic currency cash flows and the second leg contains all foreign currency cash flows. I will soon post an article that describes the Multi Leg Swap in more detail.

For now, an interesting read-only key is the _CashFlows= appearing at the bottom of the wizard. If I click on its lens sign, the wizard displays all cash flows in chronological order, as shown below: 

Each row corresponds to a separate cash flow.

The meaning of each column is self-evident from the respective title.

The cell in last column contains an object that describes the associated cash flow in full detail.

I have already explained here how I may transfer these data in the spreadsheet.

I can easily price my fx swap as the next video demonstrates: 

The produced spreadsheet formula is pasted in cell M1 as shown below:  

The green-colored cells in rows 2 and 4 contain simple spreadsheet links to the cells where the respective objects are created. This is because the wizard notices that the objects already exist somewhere in the spreadsheet, so it does not bother to recreate them!

The price of the fx swap is calculated as E, which is practically equal to 0.  This is because the notionals in cells K5, K6, K8 and K9 have been set by the wizard in accordance with the forward fx rateEUR/USD of in cell N11

Additional output data

During the price calculation, QuantLib/ORE also computes certain values that can be of interest.

The Info Area of the wizard in the image above displays the sentence "To display extra pricing data click here". If I click on the herehyperlink, I see the following: 

Advanced Topic: Following the pricing algorithm step-by-step

It is also possible to track the pricing algorithm that has been run in order to produce the observed output and also see the actually used intermediate QuantLib and ORE structures and numerical outputs as described in the respective section of my Interest Rate Swap article.  

Click on eunic-brussels.eu to download the spreadsheet produced with the above steps.

Feel free to contact me if you want to share any thoughts with regard to this product or if you want to request any particular features. Contact info and social media links are available at my web site eunic-brussels.eu 

Download Historical Forex Data

How the Historical Forex Data service works

There are several steps performed for providing forex data. First, we collect the initial raw tick data from DukasCopy. The process is lengthy and takes hours. Once it is done, we parse the raw tick data into bar data in binary format. Then we compose the base data series for periods: M1, M5, M15, and M30 and cut them up to bars.

We periodically download the new data and update the local base files. After that, we upload the precompiled data to our online server.

The Historical Forex Data application loads the precompiled data fix the timezone and compose the necessary files for download. This process guarantees forex data availability and excellent user experience.

Forex Trading Journal

There are lots of free spreadsheet journals already available online and there are quite a few professional stand-alone or web-based logging solutions. However, there are lots of reasons to prefer the simplicity and versatility of an Excel spreadsheet. Meanwhile, its customizability means that the journal only calculates and shows the stuff that you need the most.

The resulting trading journal unites approaches to logging three different macro-strategies — chart pattern trading, news trading, and fundamental analysis trading. It allows easy customization (most non-essential columns can be hidden if they aren't needed) while also providing an in-depth analysis of the trades. The only serious disadvantage such a journal has is slow performance because Excel, albeit a great software, does lots of unnecessary calculations each time you change something in a spreadsheet.

Features

Here are some of the features of the trading journal that you can download further below:

  • A Welcome sheet with some basic information (you can safely delete it after reading).
  • A Currency Pairs sheet that serves to put in your currency pair settings for quick referencing and for decimal place counts. You can ignore it, but then you won't be able to benefit from decimal places formatting; also you won't be able to just enter a small number instead of typing in the entire currency pair name each time.
  • The number of pips for profit and loss is calculated automatically.
  • A Commission column that can also be used to record rebates if you receive them from your broker.
  • A Swap column to record the swaps you pay or get from the broker.
  • An Analysis sheet to provide detailed analysis of your trading performance.
  • Scalpers and intraday traders wouldn't probably need some of the columns (Close date or Swaps for example) but they would maybe want to track the trade length.
  • You can hide Entry, SL, TP, Exit Price fields completely and just enter pip and $ gains/losses manually if they are more relevant to your strategy than exact price levels.
  • Only first 1, rows are filled with formulas. If you hit the limit, just copy and paste formulas from the final row as far down as you need. However, the more filled rows you have, the slower the journal will work. It is recommended to create a new trading journal file for each new year (or for each new month if you are scalping).

Explaining the columns

Let's look at the example journal that has been filled with some random trades.

The first columns include: a trade number (clear it when logging non-trading transactions), open date (you can change it to time if it is more relevant to your trading strategy), strategy (the reason for entry), number of the currency pair (you define it via the Currency Pairs spreadsheet), currency pair name (you can enter it manually or have it filled automatically after you fill the currency pair number), trade direction (the choice of Long/Short).

The basic columns of the trading journal

Then follow the price-related parameters of the trade: entry price, initial stop-loss, initial take-profit, IRR (initial risk-to-reward ratio), position size (you can enter it in lots or in units, or you can just hide the column if you don't want to recored this parameter), exit price, close date.

Price-related columns of the trading journal

After that, you notice the columns that mostly involve the post-trade stuff: profit/loss in pips (calculated automatically based on the difference between the entry and exit price, and the decimal places defined in the Currency Pairs sheet), profit/loss in % (calculated automatically using the currency profit you enter and your previous account balance), profit/loss in USD (you can change the currency name to whatever you use), swap, commission, trade length (it can be either Intraday or the number of days between the entry and the exit).

Profit-related columns of the trading journal

The final columns of the trading journal include: open comment (what you had thought about the trade when you just opened it), close comment (what you think about the trade after closing it), end balance (calculated automatically), chart link (you can insert a link to a local file on your computer, or a URL to some website where you store your trading screenshots, or you can hide this column entirely).

The final columns of the trading journal

Currency Pairs sheet

This is where you define your currency pairs with a quick reference number and a number of decimal places. There are two number fields but the second one is filled automatically when you enter something in the first one. The second column is required for technical reasons:

Analysis

The Analysis sheet becomes the most interesting one after you log some trades. It lets you analyze your performance using a number of metrics and charts.

Metrics

First, come the various basic metrics (totals) and the ratios/indices: net profit (shows your total net profit, which is probably the most important result to look at), trades (for a total number of trades), wins, losses, short trades, long trades, swap (total swap for all trades), commission (total commission paid for all trades), win rate (number wins divided by the total number of trades), ROI (return on investment — how much you would increase/decrease a starting balance in percentage term), expected payoff (how much you can expect to earn/lose from one trade on average), profit factor (how much your winning trades are bigger than your losing trades), standard deviation (the volatility of your returns), Sharpe ratio (how your ROI compares to the volatility of your returns), Ulcer index (how much negative volatility is in your returns).

Analyzing the strategy's totals and essential metrics via the trading journal

Then follow the metrics of averages: profit/loss per trade, profitable trade, losing trade, R/R ratio (average risk-to-reward ratio):

Average trade performance in the trading journal

The table ends with the columns that show the metrics of the "maximum" parameters of your strategy: profit, loss, winning streak (longest sequence of uninterrupted profitable trades), losing streak (longest sequence of uninterrupted losing trades), absolute drawdown (how much your balance declined below its starting point), maximum drawdown (largest peak-to-through percentage decline).

Max/min parameters of your trades in the trading journal

Charts

The Analysis sheet also features two charts:

Profit/loss per Trade

Charting profit per trade in the trading journal

Total Accumulated Profit/Loss

Charting total accumulated profit in the trading journal

Important note: Enable iterative calculations via File->Options->Formulas. Otherwise, you won't able to reference currency pairs both by their name and number. You can set the maximum iterations value to 1:

How to enable iterative calculation in Excel for Trading Journal

If you have any suggestions or if you find any bugs in this Forex trading journal spreadsheet, please report them on our forum.

Changelog

  • Fixed Long/Short trades headings in the Analysis sheet.
  • Fixed an error in currency pair formulas on lines

  • Fixed an error in ROI formula.
  • Fixed some errors in descriptions.

If you want to get news of the most recent updates to our guides or anything else related to Forex trading, you can subscribe to our monthly newsletter.

nest...

аналитика форекс gbp кaртa мирa форекс вспомогательные индикаторы форекс как платят налоги трейдеры валютного рынка форекс лучшие индикаторы для входа индикаторы измерения температуры щитовые дмитрий котенко форекс клипaрт для форекс имхо на форексе дц форекс брокер отзывы безрисковая комбинация форекс индикаторы рынка ферросплавов