{"id":26322,"date":"2019-02-13T10:37:52","date_gmt":"2019-02-13T01:37:52","guid":{"rendered":"http:\/\/www.smallake.kr\/?p=26322"},"modified":"2019-02-13T10:37:52","modified_gmt":"2019-02-13T01:37:52","slug":"directional-change%ec%99%80-intrinsic-time","status":"publish","type":"post","link":"https:\/\/smallake.kr\/?p=26322","title":{"rendered":"Directional-Change\uc640  Intrinsic Time"},"content":{"rendered":"<p>1.<br \/>\nRichard Olsen\uc774\ub77c\ub294 \uc774\ub984\uc740 \uc0dd\uc18c\ud569\ub2c8\ub2e4. \uadf8\ub7f0\ub370 \uc774\ub825\uc740 \ubcf4\ub2c8\uae4c \uc5b4\ub5a4 \ubd84\uc778\uc9c0 \uc9d0\uc791\uc774 \uac11\ub2c8\ub2e4. Retail FX \uc2dc\uc7a5\uc5d0\uc11c \uc720\uba85\ud55c OANDA\uc758 \uacf5\ub3d9\ucc3d\uc5c5\uc790\uc774\uace0 \uc554\ud638\ud1b5\ud654\uac70\ub798\uc18c\uc640 \uad00\ub828\ud55c \ube44\uc9c0\ub2c8\uc2a4\ub97c \ud558\uace0 \uc788\ub294 <a href=\"https:\/\/www.lykke.com\/\" target=\"_blank\" rel=\"noopener\">Lykke Group<\/a>\uc758 \ucc3d\uc5c5\uc790\uc785\ub2c8\ub2e4. \ubb3c\ub860 \uad00\uc2ec\uc744 \uac00\uc9c4 \uc0ac\ub78c\uc740 \uc544\ub2d9\ub2c8\ub2e4. \uba87 \uc77c\uc804 Quantnews\uc5d0 \uc62c\ub77c\uc628 <a href=\"https:\/\/www.quantnews.com\/the-alpha-engine-designing-an-automated-trading-algorithm\/\" target=\"_blank\" rel=\"noopener\">The Alpha Engine: Designing an Automated Trading Algorithm<\/a>\uc744 \uc77d\uc73c\uba74\uc11c \uc811\ud588\uc2b5\ub2c8\ub2e4. \ucd08\ub85d\uc744 \ubcf4\uba74 30\uc5ec\ub144\uc804\ubd80\ud130 \uc5f0\uad6c\ud574\uc654\ub358 \ud2b8\ub808\uc774\ub529\ubaa8\ub378\uc774\ub77c\uace0 \ud569\ub2c8\ub2e4. 81\ub144 \ubc1c\ud45c\ud55c \uc878\uc5c5\ub17c\ubb38\uc774 \uc2dc\uc791\uc774\uace0 1993\ub144\uc5d0 \ubc1c\ud45c\ud55c <a href=\"https:\/\/www.sciencedirect.com\/science\/article\/pii\/026156069390004U\" target=\"_blank\" rel=\"noopener\">A geographical model for the daily and weekly seasonal volatility in the foreign exchange market<\/a> \uc5d0 \ubfcc\ub9ac\ub294 \ub450\uace0 \uc788\ub294 \ub4ef \ud569\ub2c8\ub2e4. <a href=\"https:\/\/ssrn.com\/abstract=2951348\" target=\"_blank\" rel=\"noopener\"> The Alpha Engine: Designing an Automated Trading Algorithm <\/a>\uc5d0 \uc62c\ub77c\uc628 \ub17c\ubb38\uc911 Alpha Engine\uc774 \uae30\ubc18\ud55c \ubaa8\ub378\uc785\ub2c8\ub2e4.<\/p>\n<blockquote><p>The building blocks of the efficient trading model include:<\/p>\n<p>&#8211; An endogenous time scale, also called <strong>intrinsic time<\/strong>, that dissects the price curve continuously and allows for determination of position sizes by identifying market activity that deviates from normal behavior. Rather that action based on a specific time, action is more accurately measured by events.<br \/>\n&#8211; Patterns, called scaling laws (also observed in physics, biology, earth and planetary sciences, economics, finance, etc.), that measure an immense number of natural processes and adjust for them.<br \/>\n&#8211; Skewing of cascading and de-cascading coastline innovation to mitigate the risk of large inventory size during trending markets.<br \/>\n&#8211; Introduction of asymmetric thresholds by eliminating static and rigid guide points that arbitrarily limit directional change thresholds.<\/p><\/blockquote>\n<iframe src=\"\/\/docs.google.com\/viewer?url=https%3A%2F%2Fwww.smallake.kr%2Fwp-content%2Fuploads%2F2019%2F02%2FSSRN-id2951348.pdf&hl=ko&embedded=true\" class=\"gde-frame\" style=\"width:100%; height:500px; border: none;\" scrolling=\"no\"><\/iframe>\n<p class=\"gde-text\"><a href=\"https:\/\/www.smallake.kr\/wp-content\/uploads\/2019\/02\/SSRN-id2951348.pdf\" class=\"gde-link\">Download (PDF, 1.2MB)<\/a><\/p>\n<p>\uc704 \ubaa8\ub378\uc744 \uc790\uc138\ud788 \uc124\uba85\ud55c 3\uc7a5 Guided by an Event-Based Framework\uc744 \ubcf4\uba74 \uc138\uac00\uc9c0 \uac1c\ub150\uc744 \uc124\uba85\ud569\ub2c8\ub2e4.<\/p>\n<p>\uccab\uc9f8\ub294 Intrinsic Time.<br \/>\n\ub458\uc9f8\ub294 Directional Change<br \/>\n\uc14b\uc9f8\ub294 Scaling Law<\/p>\n<p>\uc14b\uc911 \uac00\uc7a5 \uc0dd\uc18c\ud55c \uac1c\ub150\uc774 Intrinsic Time\uc785\ub2c8\ub2e4. Intrinsic\uc740 \ud30c\uc0dd\uc0c1\ud488\uc744 \uc124\uba85\ud560 \ub54c \uc790\uc8fc \ub4f1\uc7a5\ud558\ub294 \ub0b4\uc7ac\uc801 \uac00\uce58(Intrinsic value)\uc758 &#8216;\ub0b4\uc7ac\uc801&#8217;\uc73c\ub85c \ubc88\uc5ed\ud558\ub294 \ub2e8\uc5b4\uc785\ub2c8\ub2e4. \ub2e4\ub978 \ub17c\ubb38\uc5d0\uc11c \ubcf4\uc9c0 \ubabb\ud55c \uac1c\ub150\uc774 \ub4f1\uc7a5\uc785\ub2c8\ub2e4. \ub0b4\uc7ac\uc801 \uc2dc\uac04\uc73c\ub85c \ud574\uc11d\ud560 \uc218 \uc788\uc9c0\ub9cc \uc800\uc790\uac00 \ub9d0\ud558\uace0\uc790 \ud558\ub294 \ubc14\ub97c \uc628\uc804\ud788 \ub2f4\uc9c0 \ubabb\ud569\ub2c8\ub2e4. \uadf8\ub798\uc11c \uc2dc\uac04\uc744 \ud45c\ud604\ud560 \ub54c \uc0ac\ub78c\ub4e4\uc774 \uc5b8\uae09\ud558\ub294 \ub450\uac00\uc9c0 \uac1c\ub150, \uce74\uc774\ub85c\uc2a4\uc640 \ud06c\ub85c\ub178\uc2a4\ub85c \uc774\ud574\ud558\uba74 \uc5b4\ub5a8\uae4c \ud569\ub2c8\ub2e4.<\/p>\n<blockquote><p>\uadf8\ub9ac\uc2a4\uc5b4\uc5d0\ub294 &#8220;\uc2dc\uac04&#8221;\uc744 \ub73b\ud558\ub294 \ub2e8\uc5b4\uac00 \ub450 \uc885\ub958\uac00 \uc788\uc2b5\ub2c8\ub2e4. &#8220;\ud06c\ub85c\ub178\uc2a4 Chronos&#8221;\uc640 &#8220;\uce74\uc774\ub85c\uc2a4 Kairos&#8221;\uac00 \ubc14\ub85c \uadf8 \uac83\uc774\uc9c0\uc694. &#8220;\ud06c\ub85c\ub178\uc2a4&#8221;\ub294 \uc790\uc2e0\uc758 \uc790\ub140\ub97c \ub2e4 \uba39\uc5b4 \uce58\uc6e0\ub358 \uc6d0\uc2dc \uc2dc\ub300\uc758 \uc2e0\u795e\uc744 \uac00\ub974\ud0b5\ub2c8\ub2e4. \ub530\ub77c\uc11c &#8220;\ud06c\ub85c\ub178\uc2a4&#8221;\ub294 \uc6b0\ub9ac\ub97c \uc9d1\uc5b4\uc0bc\ud0a4\ub294 \uc2dc\uac04, \uace7 \uc6b0\ub9ac\uac00 \ucad3\uae30\ub4ef \ubcf4\ub0b4\ub294 \uc2dc\uac04, \uc774\ub7f0\uc800\ub7f0 \uc77c\uc744 \ub354 \ube68\ub9ac \ucc98\ub9ac\ud558\ub3c4\ub85d \uc7ac\ucd09\ubc1b\ub294 \uc2dc\uac04\uc774\ub77c \ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4. &#8220;\uc7ac\ucd09\ud558\ub2e4&#8221;\ub77c\ub294 \ub73b\uc744 \uc9c0\ub2cc \ub3c5\uc77c\uc5b4 \ub2e8\uc5b4 &#8220;\ud5f7\uccb8 hetzen&#8221;\uc740 &#8220;\ubbf8\uc6cc\ud558\ub2e4&#8221;\ub77c\ub294 \ub73b\uc744 \uc9c0\ub2cc \ub3c5\uc77c\uc5b4 \ub2e8\uc5b4 &#8220;\ud558\uc13c hassen&#8221;\uc5d0\uc11c \uc654\uc2b5\ub2c8\ub2e4. \uc774\ub7f0\uc800\ub7f0 \uc77c\uc744 \uae30\ud55c \ub0b4\uc5d0 \ucc98\ub9ac\ud558\ub3c4\ub85d \uc790\uc2e0\uc744 \uc7ac\ucd09\ud558\ub294 \uac83\uc740 \uacb0\uad6d \uc790\uae30 \uc790\uc2e0\uc744 \ubbf8\uc6cc\ud558\ub294 \ud589\uc704\ub85c, &#8220;\ud06c\ub85c\ub178\uc2a4&#8221;\ub294 \uace7 \uc790\uae30 \uc99d\uc624\uc758 \uc2dc\uac04\uc73c\ub85c \ud574\uc11d\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4&#8230;. \uc774\uc5d0 \ubc18\ud574 \uc720\ucf8c\ud55c \uc2dc\uac04\uc744 \uac00\ub9ac\ud0a4\ub294 &#8220;\uce74\uc774\ub85c\uc2a4&#8221;\uac00 \uc788\uc2b5\ub2c8\ub2e4&#8230;. \ub2e4\ub978 \ud55c \ud3b8\uc73c\ub85c, &#8220;\uce74\uc774\ub85c\uc2a4&#8221;\ub294 &#8220;\uaf2d \uc54c\ub9de\uc740 \uc21c\uac04&#8221;\uc744 \ub73b\ud569\ub2c8\ub2e4. \uce74\uc774\ub85c\uc2a4\ub294 \uc55e\uba38\ub9ac\uc5d0 \uba38\ub9ac\uce74\ub77d\uc774 \ud48d\uc131\ud558\uae30\uc5d0 \uc81c\ub54c\ub77c\uba74 \uc27d\uac8c \ubd99\uc7a1\uc744 \uc218 \uc788\uc9c0\ub9cc \ub4a4\ud1b5\uc218\uc5d0\ub294 \uba38\ub9ac\uce74\ub77d\uc774 \ud558\ub098\ub3c4 \uc5c6\uae30\uc5d0 \uc9c0\ub098\uac04 \ub4a4\uc5d0\ub294 \uc7a1\uc744 \uc218\uac00 \uc5c6\uc9c0\uc694. \uc774 \ube44\uc720\ub97c \ud1b5\ud574 \uadf8\ub9ac\uc2a4\uc778\ub4e4\uc740 \uae30\ud68c\ub97c \uc81c \ub54c \uc7a1\uc544\uc57c \ud55c\ub2e4\ub294 \uc810\uc744 \ub9d0\ud558\ub824 \ud588\uc2b5\ub2c8\ub2e4.<br \/>\n<a href=\"http:\/\/blog.aladin.co.kr\/winter_tiger\/9783336\" target=\"_blank\" rel=\"noopener\">\uc2dc\uac04\uc5d0 \ub300\ud55c \ub450 \uad00\uc810 : \uce74\uc774\ub85c\uc2a4 Kairos\uc640 \ud06c\ub85c\ub178\uc2a4 chronos<\/a>\uc911\uc5d0\uc11c<\/p><\/blockquote>\n<p>Intrinsic Time\uc740 \ud22c\uc790\uc790\ub97c \uc911\uc2ec\uc73c\ub85c \ud310\ub2e8\ud558\ub294 \uc2dc\uac04\uc785\ub2c8\ub2e4. \ud22c\uc790\ub77c\ub294 \ub0b4\uc801\uc778 \uac00\uce58\ub97c \uc628\uc804\ud788 \ub2f4\uc544\ub0b4\ub294 \uc2dc\uac04\uc774\ub77c\ub294 \ub73b\uc785\ub2c8\ub2e4. \uc804\ud1b5\uc801\uc73c\ub85c \ub9ce\uc774 \uc0ac\uc6a9\ud558\ub294 \uc2dc\uacc4\uc5f4 \ub370\uc774\ud0c0\ub294 \uc77c\uc815\ud55c \uae30\uc900\uc73c\ub85c \uc77c\uc815\ud55c \uc2dc\uac04(Interval)\ub2e8\uc704\ub85c \uc815\uc758\ud55c \ub370\uc774\ud0c0\uc778\ub370 Intinsic Time\uc740 \ud22c\uc790\uc790\uac00 \ubcf4\uc720\ud558\uace0 \uc788\ub294 \uc790\uc0b0\uc758 \uc190\uc775\uc5d0 \uc601\ud5a5\uc744 \uc8fc\ub294 \uc694\uc18c(Element, Event)\uc744 \uae30\uc900\uc73c\ub85c \ud55c \uc2dc\uac04\uc744 \uc0ac\uc6a9\ud558\uc790\uace0 \ud569\ub2c8\ub2e4.<\/p>\n<blockquote><p>A time series is a series of data points indexed (or listed or graphed) in time order. Most commonly, a time series is a sequence taken at successive equally spaced points in time. Thus it is a sequence of discrete-time data.<\/p><\/blockquote>\n<p>\ub17c\ubb38 3\uc7a5\uc744 \ubcf4\uba74 \uc544\ub798\uc640 \uac19\uc774 \uc124\uba85\ud569\ub2c8\ub2e4. \uc774\ubca4\ud2b8\uc5d0 \uae30\ubc18\ud55c \uc811\uadfc\ubc95\uc785\ub2c8\ub2e4.<\/p>\n<blockquote><p>We all experience time as a fundamental and unshakable part of reality. In stark contrast, the philosophy of time and the notion of time in fundamental physics challenges our mundane perception of it. In an operational definition, time is simply what instruments measure and register. In this vein, <strong>we understand the passage of time in financial time series as a set of events, i.e., system interactions. In this novel time ontology, time ceases to exist between events. In contrast to the continuity of physical time, now only interactions, or events, let a system\u2019s clock tick. Hence this new methodology is called intrinsic time. This event-based approach opens the door to a modelling framework that yields selfreferential behavior which does not rely on static building blocks and has a dynamic frame of reference<\/strong>.<\/p><\/blockquote>\n<p>\ub17c\ubb38\uc758 \uc800\uc790\uc778 Olsen\uc774 \ub300\ud45c\ub85c \uc788\ub294 Lykke\uc758 <a href=\"https:\/\/streams.lykke.com\/Project\/ProjectDetails\/pairs-trading-in-forex-market-with-respect-to-intrinsic-time\" target=\"_blank\" rel=\"noopener\">Pairs trading in forex market with respect to intrinsic time<\/a>\ub97c \ubcf4\uba74 Intrinsic Time\uc744 \uc774\ub807\uac8c \uc815\uc758\ud569\ub2c8\ub2e4.<\/p>\n<blockquote><p>Intrinsic Time<\/p>\n<p>At Lykke, we&#8217;re in the process of redefining the way how time is looked upon in financial markets. <strong>Leading to a long-needed paradigm change, namely from observed physical time to an activity based timescale, called intrinsic time<\/strong>. In contrast to the continuity of physical time, now only interactions, or events, let a system\u2019s clock tick. This event-driven paradigm defines focal points by blurring out irrelevant details of the price evolution with the help of defining fixed event thresholds of different sizes.<\/p>\n<p>With these events, every price curve can be dissected into components that represent a change in the price trend (Directional Change) and a trend component (Overshoot). For a Directional Change to be detected, \ufb01rst an initial direction mode needs to be chosen. As an example, in an up mode, an increasing price move will result in the extremal price being updated and continuously increased. If the price goes down, the di\ufb00erence between the extremal price and the current price is evaluated. If this distance (in percent) exceeds the prede\ufb01ned Directional Change threshold, a Directional Change is registered. Now the mode is switched to down and the algorithm continues correspondingly.<\/p><\/blockquote>\n<p>2011\ub144\uc5d0 \ubc1c\ud45c\ud55c <a href=\"https:\/\/papers.ssrn.com\/sol3\/papers.cfm?abstract_id=1973471\" target=\"_blank\" rel=\"noopener\">A Directional-Change Events Approach for Studying Financial Time Series<\/a>\uc740 Intrinsic Time\uc744 \ub2e4\uc74c\uacfc \uac19\uc774 \uc815\uc758\ud569\ub2c8\ub2e4.<\/p>\n<blockquote><p>Intrinsic time adopts an event-based system in contrast to physical time which adopts a point-based system. In intrinsic time, time is defined by events.<\/p><\/blockquote>\n<iframe src=\"\/\/docs.google.com\/viewer?url=https%3A%2F%2Fwww.smallake.kr%2Fwp-content%2Fuploads%2F2019%2F02%2FSSRN-id1973471-1.pdf&hl=ko&embedded=true\" class=\"gde-frame\" style=\"width:100%; height:500px; border: none;\" scrolling=\"no\"><\/iframe>\n<p class=\"gde-text\"><a href=\"https:\/\/www.smallake.kr\/wp-content\/uploads\/2019\/02\/SSRN-id1973471-1.pdf\" class=\"gde-link\">Download (PDF, 720KB)<\/a><\/p>\n<p>Intrinsic Time\uc744 \ucf54\ub4dc\ub85c \ud45c\ud604\ud558\uba74 \uc5b4\ub5bb\uac8c \ub420\uae4c\uc694? <a href=\"https:\/\/www.r-bloggers.com\/intrinsic-time-for-cryptocurrency-data\/\" target=\"_blank\" rel=\"noopener\">Intrinsic time for cryptocurrency data<\/a> \uc774 \uc18c\uac1c\ud55c Instrinic Time\uc758 \uac1c\ub150\uc744 R \ucf54\ub4dc\ud654\ud55c \uc18c\uc2a4\uc785\ub2c8\ub2e4. \uc774\ubca4\ud2b8\uc811\uadfc\ubc95\uc774\ub77c\uace0 \ud588\ub294\ub370 \ucf54\ub4dc\ub97c \ubcf4\uba74 \uc774\ubca4\ud2b8\ub97c 2%\uc758 \uac00\uaca9\ub4f1\ub77d\uc785\ub2c8\ub2e4. \uc774\ub97c \uae30\uc900\uc73c\ub85c \uc2dc\uacc4\uc5f4\ub370\uc774\ud0c0\ub97c \uc7ac\uc0dd\ud569\ub2c8\ub2e4.<\/p>\n<pre class=\"width:100 width-unit:1 lang:default decode:true \">dc_intervals &lt;- function(dat, threshold=0.02\/100, price=\"price\", time=\"time\", vol=\"amount\") {\r\n  # candidates for confirmed directional change\r\n  dcc_up_cand &lt;- c(FALSE, c(dat[2:nrow(dat), price]&lt;dat[1:(nrow(dat)-1), price]*(1-threshold)))\r\n  dcc_down_cand &lt;- c(FALSE, c(dat[2:nrow(dat), price]&gt;dat[1:(nrow(dat)-1), price]*(1+threshold)))\r\n  \r\n  # initialize new columns\r\n  dat[,\"interval\"] &lt;- NA  # 4 types of intervals: down, down_os, up, up_os (os=overshoot, NA means unknown)\r\n  dat[,\"point\"] &lt;- NA     # 3 types of points: dcc_up, dcc_down,  ep (NA means ignore)\r\n  \r\n  # threshold too large?\r\n  if(all(!dcc_up_cand)) stop(\"threshold=\",threshold, \" too large, no price moves above this threshold\")\r\n  if(all(!dcc_down_cand)) stop(\"threshold=\",threshold, \" too large, no price moves above this threshold\")\r\n  \r\n  # figure out if the first change is up or down\r\n  first_up &lt;- which.max(dcc_up_cand) \r\n  first_down &lt;- which.max(dcc_down_cand)\r\n  \r\n  if(first_up&lt;first_down) {\r\n    dat[first_up,\"point\"] &lt;- \"dcc_up\"\r\n    mode &lt;- \"dcc_up\"\r\n    i &lt;- first_up\r\n  } else {\r\n    dat[first_down, \"point\"] &lt;- \"dcc_down\"\r\n    mode &lt;- \"dcc_down\"\r\n    i &lt;- first_down\r\n  }\r\n  \r\n  # iterate till the end of the data\r\n  while (i&lt;nrow(dat)) {\r\n    if(mode==\"dcc_up\") {\r\n      j &lt;- which.max(dcc_down_cand[i+1:length(dcc_down_cand)])+i\r\n      if(!dcc_down_cand[j]) break # end of dataset\r\n      dat[i,\"point\"] &lt;- \"dcc_up\"\r\n      dat[i,\"interval\"] &lt;- \"uoi\"\r\n      if((j-1)-(i+1)&gt;0) { # if not changing direction immediately\r\n        ep_idx &lt;- which.min(dat[(i+1):(j-1), price])+i\r\n        dat[ep_idx, \"point\"] &lt;- \"ep\"\r\n        dat[i:ep_idx-1, \"interval\"] &lt;- \"uoi\"\r\n        dat[ep_idx:j,\"interval\"] &lt;- \"dei\"\r\n      } \r\n      i &lt;- j+1\r\n      mode &lt;- \"dcc_down\"\r\n    } else { # mode==\"dcc_down\"\r\n      j &lt;- which.max(dcc_up_cand[i+1:length(dcc_up_cand)])+i\r\n      if(!dcc_up_cand[j]) break # end of dataset\r\n      dat[i,\"point\"] &lt;- \"dcc_down\"\r\n      dat[i,\"interval\"] &lt;- \"doi\"\r\n      if((j-1)-(i+1)&gt;0) { # if not changing direction immediately\r\n        ep_idx &lt;- which.max(dat[(i+1):(j-1), price])+i\r\n        dat[ep_idx, \"point\"] &lt;- \"ep\"\r\n        dat[i:ep_idx-1, \"interval\"] &lt;- \"doi\"\r\n        dat[ep_idx:j,\"interval\"] &lt;- \"uei\"\r\n      }\r\n      i &lt;- j+1\r\n      mode &lt;- \"dcc_up\"      \r\n    }\r\n  }\r\n  \r\n  dat &lt;- dat[!is.na(dat[,\"point\"]),] # drop all points that are not dcc points\r\n  return(dat)\r\n}\r\n\r\nohlc_summary &lt;- function(dat, browse=TRUE, verbose=TRUE) {\r\n  dat$hour &lt;- strftime(dat$time, format=\"%Y-%m-%d %H\")\r\n  one_hour &lt;- function(dset) {\r\n    i1 &lt;- which.min(dset$time)\r\n    i2 &lt;- which.max(dset$time)\r\n    ans &lt;- data.frame(\r\n      time=strptime(dset[1,\"hour\"], format=\"%Y-%m-%d %H\"),\r\n      open=dset[i1, \"price\"],\r\n      hi=max(dset$price),\r\n      lo=min(dset$price),\r\n      close=dset[i2,\"price\"],\r\n      amount=sum(dset$amount)\r\n    )\r\n    return(ans)\r\n  }\r\n  ret &lt;- do.call(rbind, lapply(split(dat, dat$hour), FUN=one_hour))\r\n  if(verbose) message(\"ohlc summary built.\")\r\n  if(browse) browser()\r\n  return(ret)\r\n}\r\n\r\n# begin, end ... \"YYYY-MM-DD\"\r\nplot_dc &lt;- function(dc_dat=NULL, ohlc=NULL, ticks=NULL, begin=NULL, end=NULL, lwd=3, price=\"price\", time=\"time\", vol=\"amount\", ...) {\r\n  if(is.null(ohlc) &amp; !is.null(ticks)) ohlc &lt;- ohlc_summary(ticks) \r\n  if(is.null(dc_dat)  &amp; !is.null(ticks)) dc_dat &lt;- dc_intervals(dat=ticks, time=time, price=price, vol=vol)\r\n  if(is.null(dc_dat)) stop(\"missing dc data.\")\r\n  \r\n  if(is.null(end)) end &lt;- max(dc_dat[,time])\r\n  if(is.character(end)) end &lt;- as.POSIXct(strptime(end, \"%Y-%m-%d\"))\r\n  if(is.null(begin)) begin &lt;- min(dc_dat[,time])\r\n  if(is.character(begin)) begin &lt;- as.POSIXct(strptime(begin, \"%Y-%m-%d\"))\r\n  \r\n  plot(\r\n    dat=1, col=\"white\", dc_dat=dc_dat, xlab=\"\", \r\n    xlim=c(min(ohlc$time), max(ohlc$time)), ylim=c(min(ticks$price), max(ticks$price)),\r\n    main=sprintf(\"%.2f%% Direction Changes for BTC\", threshold*100),\r\n    cex.main=1\r\n  )\r\n  \r\n  if(!is.null(ohlc)) {\r\n    for (i in seq(1, nrow(ohlc))) {\r\n      segments(\r\n        x0=ohlc[i,\"time\"], y0=ohlc[i,\"lo\"],\r\n        x1=ohlc[i,\"time\"], y0=ohlc[i, \"hi\"],\r\n        col=\"darkgrey\", lwd=0.5\r\n      )\r\n    }\r\n  }\r\n  \r\n  dcc_idx &lt;- which(dc_dat$point==\"dcc_up\"|dc_dat$point==\"dcc_down\")\r\n  for (i in setdiff(dcc_idx,1)) {\r\n    segments(\r\n      x0=dc_dat[i-1,time], y0=dc_dat[i-1,price],\r\n      x1=dc_dat[i,time], y1=dc_dat[i,price],\r\n      col=\"red\", lwd=lwd\r\n    )\r\n  }\r\n  for (i in setdiff(dcc_idx,nrow(dc_dat))) {\r\n    segments(\r\n      x0=dc_dat[i,time], y0=dc_dat[i,price],\r\n      x1=dc_dat[i+1,time], y1=dc_dat[i+1,price],\r\n      col=\"darkgreen\", lwd=lwd\r\n    )\r\n  }\r\n  axis(1,at=dc_dat[dcc_idx, time],labels=FALSE)\r\n}<\/pre>\n<p>2.<br \/>\n<a href=\"http:\/\/www.bracil.net\/finance\/DirectionalChanges\/\" target=\"_blank\" rel=\"noopener\">Directional Change Project<\/a>\ub77c\uace0 \ud558\ub294 \uc0dd\uc18c\ud55c \ud504\ub85c\uc81d\ud2b8\uac00 \uc788\uc2b5\ub2c8\ub2e4. \ub17c\ubb38 \uc800\uc790\uc778 Olsen\uacfc Lykke\uac00 \ud6c4\uc6d0\ud558\ub294 \ud504\ub85c\uc81d\ud2b8\uc785\ub2c8\ub2e4. \uc5ec\uae30\uc11c \uc815\uc758\ud558\ub294 DC\uc785\ub2c8\ub2e4.<\/p>\n<blockquote><p>Market prices are traditionally sampled in fixed time-intervals to form time series. Directional change (DC) is an alternative approach to record price movements. DC is data-driven: price changes dictate when a price is sampled and recorded. DC allows us to observe features in data that may not be observable in time series. Time series and DC-based summaries should complement each other: they allow us to see data from two different angles (like seeing things with two eyes instead of one). Our research agenda is to develop ways under DC to turn data into information, knowledge and applications.<\/p><\/blockquote>\n<p><iframe loading=\"lazy\" width=\"100%\" height=\"450\" src=\"https:\/\/www.youtube.com\/embed\/WHTBT5eRx6U\" frameborder=\"0\" allow=\"accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n<p>\ub2e8\uc21c\ud788 \uc0dd\uac01\ud574 \ubcf4\uba74 Trend Following\uc774\ub77c\uace0 \ud560 \ub54c\uc758 Trend (Momentum)\uc640 \ud5f7\uac08\ub9bd\ub2c8\ub2e4. Event\uc640 Monemtum\uc758 \ucc28\uc774\uc778\ub370 \uc194\uc9c1\ud788 \ubbf8\ubb18\ud569\ub2c8\ub2e4.<\/p>\n<blockquote><p>What is Trend Trading<\/p>\n<p>Trend trading is a trading strategy that attempts to capture gains through the analysis of a security&#8217;s<strong> momentum <\/strong>in a particular direction.<\/p>\n<p>What Is Momentum?<\/p>\n<p><strong>Momentum is the rate of acceleration of a security&#8217;s price or volume \u2013 that is, the speed at which the price is changing<\/strong>. Simply put, it refers to the rate of change on price movements for a particular asset and is usually defined as a rate. In technical analysis, momentum is considered an oscillator and is used to help identify trend lines.<\/p><\/blockquote>\n<p>\uc55e\uc11c <a href=\"http:\/\/www.bracil.net\/finance\/DirectionalChanges\/\" target=\"_blank\" rel=\"noopener\">Directional Change Project<\/a>\uc640 SSRN\uc5d0 \uc62c\ub77c\uc628 R. Olsen\uc758 \ub17c\ubb38\uc744 \ubcf4\uba74 \uc624\ub79c \ub3d9\uc548 \ub2e4\uc591\ud55c \uc601\uc5ed\uc5d0\uc11c \uac80\uc99d\ud558\ub824\uace0 \ub178\ub825\ud55c \ud754\uc801\uc774 \uc5ed\ub825\ud569\ub2c8\ub2e4.<\/p>\n<p><a href=\"https:\/\/ssrn.com\/abstract=3240456\" target=\"_blank\" rel=\"noopener\"> Agent-Based Model in Directional-Change Intrinsic Time <\/a><br \/>\n<a href=\"https:\/\/papers.ssrn.com\/sol3\/papers.cfm?abstract_id=3243797\" target=\"_blank\" rel=\"noopener\">Instantaneous Volatility Seasonality of Bitcoin in Directional-Change Intrinsic Time<\/a><\/p>\n<p><iframe src=\"\/\/docs.google.com\/viewer?url=https%3A%2F%2Fwww.smallake.kr%2Fwp-content%2Fuploads%2F2019%2F02%2FSSRN-id3240456.pdf&hl=ko&embedded=true\" class=\"gde-frame\" style=\"width:100%; height:500px; border: none;\" scrolling=\"no\"><\/iframe>\n<p class=\"gde-text\"><a href=\"https:\/\/www.smallake.kr\/wp-content\/uploads\/2019\/02\/SSRN-id3240456.pdf\" class=\"gde-link\">Download (PDF, 6.02MB)<\/a><\/p><br \/>\n<iframe src=\"\/\/docs.google.com\/viewer?url=https%3A%2F%2Fwww.smallake.kr%2Fwp-content%2Fuploads%2F2019%2F02%2FSSRN-id3243797.pdf&hl=ko&embedded=true\" class=\"gde-frame\" style=\"width:100%; height:500px; border: none;\" scrolling=\"no\"><\/iframe>\n<p class=\"gde-text\"><a href=\"https:\/\/www.smallake.kr\/wp-content\/uploads\/2019\/02\/SSRN-id3243797.pdf\" class=\"gde-link\">Download (PDF, 1.25MB)<\/a><\/p><\/p>\n<p>\uc774\uc0c1\uc744 \ubcf4\uba74 Directional Change\ub294 Intrinsic Time\uacfc \uc9dd\uc744 \uc774\ub8e8\ub294 \uac1c\ub150\uc785\ub2c8\ub2e4. \uadf8\ub798\uc11c directional-change intrinsic time \ub77c\uace0 \ud45c\ud604\uc73c\ub85c \uc0ac\uc6a9\ud569\ub2c8\ub2e4.<\/p>\n<iframe src=\"\/\/docs.google.com\/viewer?url=https%3A%2F%2Fwww.smallake.kr%2Fwp-content%2Fuploads%2F2019%2F02%2FVladimir-Petrov_MultiD_poster.pdf&hl=ko&embedded=true\" class=\"gde-frame\" style=\"width:100%; height:500px; border: none;\" scrolling=\"no\"><\/iframe>\n<p class=\"gde-text\"><a href=\"https:\/\/www.smallake.kr\/wp-content\/uploads\/2019\/02\/Vladimir-Petrov_MultiD_poster.pdf\" class=\"gde-link\">Download (PDF, 830KB)<\/a><\/p>\n<p>3.<br \/>\n\ub9c8\uc9c0\ub9c9\uc73c\ub85c \uc81c\uc548\ud55c \uac1c\ub150\uc774 Scaling Law\uc785\ub2c8\ub2e4. <a href=\"http:\/\/www.bonhd.net\/news\/articleView.html?idxno=5264\" target=\"_blank\" rel=\"noopener\">\uc2a4\ucf00\uc77c(SCALE) : \uc0dd\ubb3c \ub3c4\uc2dc \uae30\uc5c5\uc758 \uc131\uc7a5\uacfc \uc8fd\uc74c\uc5d0 \uad00\ud55c \ubcf4\ud3b8 \ubc95\uce59<\/a>\uc774 \ub9d0\ud558\ub294 \uc2a4\ucf00\uc77c\uc758 \ubc95\uce59\uc785\ub2c8\ub2e4.<\/p>\n<blockquote><p>\uc800\uc790\ub294 \uc0dd\ubb3c\ud559\uc744 \uacf5\ubd80\ud558\ub2e4 \u2018\uc2a4\ucf00\uc77c\ub9c1\uc758 \ubc95\uce59\u2019\uc744 \ubc1c\uacac\ud588\ub2e4. \uc0dd\ubb3c\uc758 \ud06c\uae30 \ubcc0\ud654\uc5d0\uc11c \ubc1c\uacac\ub418\ub294 \uaddc\ubaa8 \uc99d\uac10\uc758 \ubc95\uce59\uc774\ub2e4. \uc5b4\ub5a4 \ub3d9\ubb3c\uc758 \ubab8\uc9d1\uc774 \ub2e4\ub978 \ub3d9\ubb3c\ubcf4\ub2e4 2\ubc30 \ud06c\ub2e4\uba74, \ud544\uc694\ub85c \ud558\ub294 \uc5d0\ub108\uc9c0\uc591\uc740 75% \ub298\uc5b4\ub09c\ub2e4. \uc989 \ud06c\uae30\uac00 2\ubc30 \ub298\uc5b4\ub0a0 \ub54c\ub9c8\ub2e4 25%\uc758 \uc5d0\ub108\uc9c0\uac00 \uc808\uc57d\ub41c\ub2e4. \ubab8\uc9d1\uc758 \ucc28\uac00 \ucee4\uc9c8\uc218\ub85d \uc5d0\ub108\uc9c0 \ud6a8\uc728\uc758 \uaca9\ucc28\ub294 \ub354 \ubc8c\uc5b4\uc9c4\ub2e4. \uc608\ub97c \ub4e4\uc5b4 \ucf54\ub07c\ub9ac\ub294 \uc950\ubcf4\ub2e4 1\ub9cc\ubc30 \ubb34\uac81\uc9c0\ub9cc, \ud544\uc694\ud55c \uc5d0\ub108\uc9c0\uc758 \uc591\uc740 \uc950\uc758 1000\ubc30\uba74 \ub41c\ub2e4. \ucf54\ub07c\ub9ac\uc758 \uc5d0\ub108\uc9c0 \ud6a8\uc728\uc774 \uc950\ubcf4\ub2e4 10\ubc30 \ub354 \uc88b\uc740 \uc148\uc774\ub2e4. \uc774\ub978\ubc14 \u2018\uaddc\ubaa8\uc758 \uacbd\uc81c\u2019\uac00 \ub098\ud0c0\ub098\ub294 \uac83\uc774\ub2e4.<\/p><\/blockquote>\n<p><iframe loading=\"lazy\" width=\"100%\" height=\"315\" src=\"https:\/\/www.youtube.com\/embed\/TxZ_clcYFA8\" frameborder=\"0\" allow=\"accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n<p>\uc55e\uc11c DC Intrinsic Time\uc744 \uc774\uc6a9\ud558\uc5ec \uc2a4\ucf00\uc77c\uc758 \ubc95\uce59\uc744 \ubc1c\uacac\ud558\ub294 \uac83\uc774\uace0 \uc774\uac83\uc774 \ud22c\uc790\uc804\ub7b5\uc758 \uae30\ucd08\ub97c \uc774\ub8f9\ub2c8\ub2e4.<\/p>\n<blockquote><p>Scaling-law relations characterize an immense number of natural processes, prominently in the form of<\/p>\n<p>1. scaling-law distributions;<br \/>\n2. scale-free networks;<br \/>\n3. cumulative relations of stochastic processes.<\/p>\n<p>Scaling-law relations display scale invariance because scaling the function\u2019s argument x preserves the shape of the function f(x) [27]. Measurements of scaling-law processes yield values distributed across an enormous dynamic range, and for any section analysed, the proportion of small to large events stays constant.<\/p><\/blockquote>\n<p>\uc774\ub97c FX\uc2dc\uc7a5\uc5d0 \uc801\uc6a9\ud55c <a href=\"https:\/\/arxiv.org\/pdf\/0809.1040.pdf\" target=\"_blank\" rel=\"noopener\">Patterns in high-frequency FX data:Discovery of 12 empirical scaling laws<\/a>\uc785\ub2c8\ub2e4. 12\uac00\uc9c0 \ud328\ud134\uc744 \ubc1c\uacac\ud588\ub2e4\uace0 \ud569\ub2c8\ub2e4.<\/p>\n<iframe src=\"\/\/docs.google.com\/viewer?url=https%3A%2F%2Fwww.smallake.kr%2Fwp-content%2Fuploads%2F2019%2F02%2F0809.1040.pdf&hl=ko&embedded=true\" class=\"gde-frame\" style=\"width:100%; height:500px; border: none;\" scrolling=\"no\"><\/iframe>\n<p class=\"gde-text\"><a href=\"https:\/\/www.smallake.kr\/wp-content\/uploads\/2019\/02\/0809.1040.pdf\" class=\"gde-link\">Download (PDF, 812KB)<\/a><\/p>\n<p>Olsen\uc774 \uc774\ub97c \uad50\uacfc\uc11c\uc2dd\uc73c\ub85c \uc815\ub9ac\ud55c <a href=\"http:\/\/www.olsendata.com\/fileadmin\/Publications\/Client_Papers\/201206-DupuisOlsen-HFFinScaLawTraMod.pdf\" target=\"_blank\" rel=\"noopener\">High Frequency Finance: Using Scaling Laws to Build Trading Models<\/a>\uc744<\/p>\n<iframe src=\"\/\/docs.google.com\/viewer?url=https%3A%2F%2Fwww.smallake.kr%2Fwp-content%2Fuploads%2F2019%2F02%2F201206-DupuisOlsen-HFFinScaLawTraMod.pdf&hl=ko&embedded=true\" class=\"gde-frame\" style=\"width:100%; height:500px; border: none;\" scrolling=\"no\"><\/iframe>\n<p class=\"gde-text\"><a href=\"https:\/\/www.smallake.kr\/wp-content\/uploads\/2019\/02\/201206-DupuisOlsen-HFFinScaLawTraMod.pdf\" class=\"gde-link\">Download (PDF, 1.91MB)<\/a><\/p>\n<p>4.<br \/>\n\uc774\uc0c1\uc5d0\uc11c \uc124\uba85\ud55c \ub17c\ubb38\uc758 \ubaa8\ub378 (Framework)\ub294 Github\uc5d0\uc11c \ud655\uc778\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4. \ub17c\ubb38\uc758 \uacf5\uc800\uc790\uc778 Anton Golub\uac00 \ub9cc\ub4e0 <a href=\"https:\/\/github.com\/AntonVonGolub\/Code\" target=\"_blank\" rel=\"noopener\">The Alpha Engine: Designing an Automated Trading Algorithm<\/a>\uc785\ub2c8\ub2e4.<\/p>\n<pre class=\"width:100 width-unit:1 lang:default decode:true \">\/*\r\n * The following code is intended to give the reader an overview of how the\r\n * trading model algorithm functions. However, the focus lies not on the framework\r\n * supporting the trading model. As a result, users are required to implement some\r\n * of their own code in order to get the trading model running. Specifically, this\r\n * concerns your price feed data and the take profit target. The only configuration\r\n * is the number and sizes of the thresholds on which the Coastline Traders live.\r\n * See all the TODO in the code. \u2014 *\/\r\n\r\nimport java.io.FileWriter;\r\nimport java.io.IOException;\r\nimport java.util.LinkedList;\r\nimport java.util.List;\r\nimport java.util.Random;\r\n\r\npublic class Code {\r\n\t\r\n\t\/\/ Main method\r\n\tpublic static void main(String[] args) {\r\n\t\tnew Code();\r\n\t}\r\n\t\r\n\t\/\/ Run algo\r\n\tpublic Code(){\r\n\t\t\/\/ TODO Currency configuration\r\n\t\tString[] ccyList = {\"AUD_CAD\"};\/* , \"AUD_JPY\", \"AUD_NZD\", \"AUD_USD\", \"CAD_JPY\", \"CHF_JPY\", \"EUR_AUD\", \"EUR_CAD\", \"EUR_CHF\",\r\n\t\t\t\t\"EUR_GBP\", \"EUR_JPY\", \"EUR_NZD\", \"EUR_USD\", \"GBP_AUD\", \"GBP_CAD\", \"GBP_CHF\", \"GBP_JPY\", \"GBP_USD\", \"NZD_CAD\",\r\n\t\t\t\t\"NZD_JPY\", \"NZD_USD\", \"USD_CAD\", \"USD_CHF\", \"USD_JPY\"}; *\/\r\n\t\tint length = ccyList.length;\r\n\t\t\r\n\t\tFXrateTrading[] trading = new FXrateTrading[length];\r\n\t\t\r\n\t\t\/\/ TODO Threshold configuration  (see below)\r\n\t\tdouble[] deltaS = {0.25\/100.0, 0.5\/100.0, 1.0\/100.0, 1.5\/100.0};\r\n\t\tfor( int i = 0; i &lt; length; ++i ){\r\n\t\t\ttrading[i] = new FXrateTrading(ccyList[i], deltaS.length, deltaS);\r\n\t\t}\r\n\t\t\r\n\t\t\/\/ Run\r\n\t\tPriceFeedData p = new PriceFeedData();\r\n\t\tfor( int i = 0; i &lt; length; ++i ){\r\n\t\t\ttrading[i].runTradingAsymm(p);\r\n\t\t}\r\n\t}\r\n\t\r\n\tpublic class Runner{\r\n\t\tpublic double prevExtreme;\r\n\t\tpublic long prevExtremeTime;\r\n\t\t\r\n\t\tpublic double prevDC;\r\n\t\tpublic long prevDCTime;\r\n\t\t\r\n\t\tpublic double extreme;\r\n\t\tpublic long extremeTime;\r\n\t\t\r\n\t\tpublic double deltaUp;\r\n\t\tpublic double deltaDown;\r\n\t\tpublic double deltaStarUp, deltaStarDown;\r\n\t\tpublic double osL;\r\n\t\tpublic int type;\r\n\t\tpublic boolean initalized;\r\n\t\tpublic double reference;\r\n\t\t\r\n\t\tpublic String fileName;\r\n\t\t\r\n\t\tpublic Runner(double threshUp, double threshDown, PriceFeedData price, String file, double dStarUp, double dStarDown){\r\n\t\t\tprevExtreme = price.elems.mid; prevExtremeTime = price.elems.time;\r\n\t\t\tprevDC = price.elems.mid; prevDCTime = price.elems.time;\r\n\t\t\textreme = price.elems.mid; extremeTime = price.elems.time;\r\n\t\t\treference = price.elems.mid;\r\n\t\t\t\r\n\t\t\ttype = -1; deltaUp = threshUp; deltaDown = threshDown; osL = 0.0; initalized = true;\r\n\t\t\tfileName = new String(file);\r\n\t\t\tdeltaStarUp = dStarUp; deltaStarDown = dStarDown;\r\n\t\t}\r\n\t\t\r\n\t\tpublic Runner(double threshUp, double threshDown, double price, String file, double dStarUp, double dStarDown){\r\n\t\t\tprevExtreme = price; prevExtremeTime = 0;\r\n\t\t\tprevDC = price; prevDCTime = 0;\r\n\t\t\textreme = price; extremeTime = 0;\r\n\t\t\treference = price; \r\n\t\t\tdeltaStarUp = dStarUp; deltaStarDown = dStarDown;\r\n\t\t\t\r\n\t\t\ttype = -1; deltaUp = threshUp; deltaDown = threshDown; osL = 0.0; initalized = true;\r\n\t\t\tfileName = new String(file);\r\n\t\t}\r\n\t\t\r\n\t\tpublic Runner(double threshUp, double threshDown, String file, double dStarUp, double dStarDown){\r\n\t\t\tdeltaUp = threshUp; deltaDown = threshDown;\r\n\t\t\tinitalized = false;\r\n\t\t\tfileName = new String(file);\r\n\t\t\tdeltaStarUp = dStarUp; deltaStarDown = dStarDown;\r\n\t\t}\r\n\t\t\r\n\t\tpublic int run(PriceFeedData price){\r\n\t\t\tif( price == null )\r\n\t\t\t\treturn 0;\r\n\t\t\t\r\n\t\t\tif( !initalized ){\r\n\t\t\t\ttype = -1; osL = 0.0; initalized = true;\r\n\t\t\t\tprevExtreme = price.elems.mid; prevExtremeTime = price.elems.time;\r\n\t\t\t\tprevDC = price.elems.mid; prevDCTime = price.elems.time;\r\n\t\t\t\textreme = price.elems.mid; extremeTime = price.elems.time;\r\n\t\t\t\treference = price.elems.mid;\r\n\t\t\t\t\r\n\t\t\t\treturn 0;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif( type == -1 ){\r\n\t\t\t\tif( Math.log(price.elems.bid\/extreme) &gt;= deltaUp ){\r\n\t\t\t\t\tprevExtreme = extreme;\r\n\t\t\t\t\tprevExtremeTime = extremeTime;\r\n\t\t\t\t\ttype = 1;\r\n\t\t\t\t\textreme = price.elems.ask; extremeTime = price.elems.time;\r\n\t\t\t\t\tprevDC = price.elems.ask; prevDCTime = price.elems.time;\r\n\t\t\t\t\treference = price.elems.ask;\t\t\r\n\t\t\t\t\treturn 1;\r\n\t\t\t\t}\r\n\t\t\t\tif( price.elems.ask &lt; extreme ){\r\n\t\t\t\t\textreme = price.elems.ask;\r\n\t\t\t\t\textremeTime = price.elems.time;\r\n\t\t\t\t\tosL = -Math.log(extreme\/prevDC)\/deltaDown;\r\n\t\t\t\t\t\r\n\t\t\t\t\tif( Math.log(extreme\/reference) &lt;= -deltaStarUp ){\r\n\t\t\t\t\t\treference = extreme;\r\n\t\t\t\t\t\treturn -2;\r\n\t\t\t\t\t}\r\n\t\t\t\t\treturn 0;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse if( type == 1 ){\r\n\t\t\t\tif( Math.log(price.elems.ask\/extreme) &lt;= -deltaDown ){\r\n\t\t\t\t\tprevExtreme = extreme; \r\n\t\t\t\t\tprevExtremeTime = extremeTime;\r\n\t\t\t\t\ttype = -1;\r\n\t\t\t\t\textreme = price.elems.bid; extremeTime = price.elems.time;\r\n\t\t\t\t\tprevDC = price.elems.bid; prevDCTime = price.elems.time;\r\n\t\t\t\t\treference = price.elems.bid;\r\n\t\t\t\t\treturn -1;\r\n\t\t\t\t}\r\n\t\t\t\tif( price.elems.bid &gt; extreme ){\r\n\t\t\t\t\textreme = price.elems.bid; \r\n\t\t\t\t\textremeTime = price.elems.time;\r\n\t\t\t\t\tosL = Math.log(extreme\/prevDC)\/deltaUp;\r\n\t\t\t\t\t\r\n\t\t\t\t\tif( Math.log(extreme\/reference) &gt;= deltaStarDown ){\r\n\t\t\t\t\t\treference = extreme;\r\n\t\t\t\t\t\treturn 2;\r\n\t\t\t\t\t}\r\n\t\t\t\t\treturn 0;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn 0;\r\n\t\t}\r\n\t\t\r\n\t\tpublic int run(double price){\r\n\t\t\tif( !initalized ){\r\n\t\t\t\ttype = -1; osL = 0.0; initalized = true;\r\n\t\t\t\tprevExtreme = price; prevExtremeTime = 0;\r\n\t\t\t\tprevDC = price; prevDCTime = 0;\r\n\t\t\t\textreme = price; extremeTime = 0;\r\n\t\t\t\treference = price;\r\n\t\t\t\treturn 0;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif( type == -1 ){\r\n\t\t\t\tif( price - extreme &gt;= deltaUp ){\r\n\t\t\t\t\tprevExtreme = extreme;\r\n\t\t\t\t\tprevExtremeTime = extremeTime;\r\n\t\t\t\t\ttype = 1;\r\n\t\t\t\t\textreme = price; extremeTime = 0;\r\n\t\t\t\t\tprevDC = price; prevDCTime = 0;\r\n\t\t\t\t\treference = price;\r\n\t\t\t\t\tosL = 0.0;\r\n\t\t\t\t\t\r\n\t\t\t\t\treturn 1;\r\n\t\t\t\t}\r\n\t\t\t\tif( price &lt; extreme ){\r\n\t\t\t\t\textreme = price;\r\n\t\t\t\t\textremeTime = 0;\r\n\t\t\t\t\tosL = -(extreme - prevDC);\r\n\t\t\t\t\tif( extreme - reference &lt;= -deltaStarUp ){\r\n\t\t\t\t\t\treference = extreme;\r\n\t\t\t\t\t\treturn -2;\r\n\t\t\t\t\t}\r\n\t\t\t\t\treturn 0;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse if( type == 1 ){\r\n\t\t\t\tif( price - extreme &lt;= -deltaDown ){\r\n\t\t\t\t\tprevExtreme = extreme; prevExtremeTime = extremeTime;\r\n\t\t\t\t\ttype = -1;\r\n\t\t\t\t\textreme = price; extremeTime = 0;\r\n\t\t\t\t\tprevDC = price; prevDCTime = 0;\r\n\t\t\t\t\treference = price;\r\n\t\t\t\t\tosL = 0.0;\r\n\t\t\t\t\t\r\n\t\t\t\t\treturn 1;\r\n\t\t\t\t}\r\n\t\t\t\tif( price &gt; extreme ){\r\n\t\t\t\t\textreme = price; extremeTime = 0;\r\n\t\t\t\t\tosL = (extreme -prevDC);\r\n\t\t\t\t\tif( extreme - reference &gt;= deltaStarDown ){\r\n\t\t\t\t\t\treference = extreme;\r\n\t\t\t\t\t\treturn 2;\r\n\t\t\t\t\t}\r\n\t\t\t\t\treturn 0;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn 0;\r\n\t\t}\r\n\t}\r\n\t\r\n\tpublic class Liquidity{\r\n\t\tpublic class Runner{\r\n\t\t\tpublic double prevDC;\r\n\t\t\tpublic double extreme;\r\n\t\t\t\r\n\t\t\tpublic double deltaUp;\r\n\t\t\tpublic double deltaDown;\r\n\t\t\tpublic int type;\r\n\t\t\tpublic boolean initalized;\r\n\t\t\t\r\n\t\t\tpublic String fileName;\r\n\t\t\t\r\n\t\t\tpublic Runner(double threshUp, double threshDown, PriceFeedData price, String file){\r\n\t\t\t\tprevDC = price.elems.mid; \r\n\t\t\t\textreme = price.elems.mid; \r\n\t\t\t\t\r\n\t\t\t\ttype = -1; deltaUp = threshUp; deltaDown = threshDown;initalized = true;\r\n\t\t\t\tfileName = new String(file);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tpublic Runner(double threshUp, double threshDown, double price, String file){\r\n\t\t\t\tprevDC = price; extreme = price; \r\n\t\t\t\t\r\n\t\t\t\ttype = -1; deltaUp = threshUp; deltaDown = threshDown;  initalized = true;\r\n\t\t\t\tfileName = new String(file);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tpublic Runner(double threshUp, double threshDown, String file){\r\n\t\t\t\tdeltaUp = threshUp; deltaDown = threshDown;\r\n\t\t\t\tinitalized = false;\r\n\t\t\t\tfileName = new String(file);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tpublic int run(PriceFeedData price){\r\n\t\t\t\tif( price == null )\r\n\t\t\t\t\treturn 0;\r\n\t\t\t\t\r\n\t\t\t\tif( !initalized ){\r\n\t\t\t\t\ttype = -1; initalized = true;\r\n\t\t\t\t\tprevDC = price.elems.mid;\r\n\t\t\t\t\textreme = price.elems.mid;\r\n\t\t\t\t\treturn 0;\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tif( type == -1 ){\r\n\t\t\t\t\tif( Math.log(price.elems.bid\/extreme) &gt;= deltaUp ){\r\n\t\t\t\t\t\ttype = 1;\r\n\t\t\t\t\t\textreme = price.elems.ask; \r\n\t\t\t\t\t\tprevDC = price.elems.ask;\t\r\n\t\t\t\t\t\treturn 1;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif( price.elems.ask &lt; extreme ){\r\n\t\t\t\t\t\textreme = price.elems.ask;\r\n\t\t\t\t\t\treturn 0;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\telse if( type == 1 ){\r\n\t\t\t\t\tif( Math.log(price.elems.ask\/extreme) &lt;= -deltaDown ){\r\n\t\t\t\t\t\ttype = -1;\r\n\t\t\t\t\t\textreme = price.elems.bid;\r\n\t\t\t\t\t\tprevDC = price.elems.bid; \r\n\t\t\t\t\t\treturn -1;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif( price.elems.bid &gt; extreme ){\r\n\t\t\t\t\t\textreme = price.elems.bid; \r\n\t\t\t\t\t\treturn 0;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\treturn 0;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tpublic int run(double price){\r\n\t\t\t\tif( !initalized ){\r\n\t\t\t\t\ttype = -1; initalized = true;\r\n\t\t\t\t\tprevDC = price;\r\n\t\t\t\t\textreme = price; \r\n\t\t\t\t\treturn 0;\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tif( type == -1 ){\r\n\t\t\t\t\tif( price - extreme &gt;= deltaUp ){\r\n\t\t\t\t\t\ttype = 1;\r\n\t\t\t\t\t\textreme = price; \r\n\t\t\t\t\t\tprevDC = price;\r\n\t\t\t\t\t\treturn 1;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif( price &lt; extreme ){\r\n\t\t\t\t\t\textreme = price;\r\n\t\t\t\t\t\treturn 0;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\telse if( type == 1 ){\r\n\t\t\t\t\tif( price - extreme &lt;= -deltaDown ){\r\n\t\t\t\t\t\ttype = -1;\r\n\t\t\t\t\t\textreme = price; \r\n\t\t\t\t\t\tprevDC = price; ;\r\n\t\t\t\t\t\treturn 1;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif( price &gt; extreme ){\r\n\t\t\t\t\t\textreme = price;\r\n\t\t\t\t\t\treturn 0;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\treturn 0;\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tpublic Runner[] runner;\r\n\t\tdouble[] prevState;\r\n\t\tdouble surp = 0.0, dSurp = 0.0, uSurp = 0.0;\r\n\t\tdouble liquidity, liquidityUp, liquidityDown; \r\n\t\tdouble liqEMA;\r\n\t\tdouble upLiq, downLiq, diffLiq, diffRaw;\r\n\t\tdouble H1 = 0.0, H2 = 0.0;\r\n\t\tdouble d1 = 0.0, d2 = 0.0;\r\n\t\tdouble alpha, alphaWeight;\r\n\t\tList&lt;Double&gt; mySurprise, downSurprise, upSurprise;\r\n\t\t\r\n\t\tpublic Liquidity(){};\r\n\t\t@SuppressWarnings(\"deprecation\")\r\n\t\tpublic Liquidity(PriceFeedData price, double delta1, double delta2, int lgt){\r\n\t\t\tdouble prob = Math.exp(-1.0);\r\n\t\t\tH1 = -(prob*Math.log(prob) + (1.0 - prob)*Math.log(1.0 - prob));\r\n\t\t\tH2 = prob*Math.pow(Math.log(prob), 2.0) + (1.0 - prob)*Math.pow(Math.log(1.0 - prob), 2.0) - H1*H1;\r\n\t\t\trunner = new Runner[lgt];\r\n\t\t\tprevState = new double[lgt];\r\n\t\t\td1 = delta1; d2 = delta2;\r\n\t\r\n\t\t\tgetH1nH2(); \/\/skip computation and assign!\r\n\t\t\t\r\n\t\t\trunner = new Runner[lgt];\r\n\t\t\tprevState = new double[lgt];\r\n\t\t\t\r\n\t\t\tfor( int i = 0; i &lt; runner.length; ++i ){\r\n\t\t\t\trunner[i] = new Runner(0.025\/100.0 + 0.05\/100.0*(double)i, 0.025\/100.0 + 0.05\/100.0*(double)i, price, \"JustFake\");\r\n\t\t\t\trunner[i].type = (i%2 == 0 ? 1 : -1);\r\n\t\t\t\tprevState[i] = (runner[i].type == 1 ? 1 : 0);\r\n\t\t\t}\r\n\t\t\tsurp = H1; dSurp = H1; uSurp = H1;\r\n\t\t\tliquidity = 0.5; \r\n\t\t\tliqEMA = 0.5;\r\n\t\t\t\r\n\t\t\tmySurprise = new LinkedList&lt;Double&gt;();\r\n\t\t\tdownSurprise = new LinkedList&lt;Double&gt;();\r\n\t\t\tupSurprise = new LinkedList&lt;Double&gt;();\r\n\t\t\tfor( int i = 0; i &lt; 100; ++i ){\r\n\t\t\t\tmySurprise.add(new Double(H1));\r\n\t\t\t\tdownSurprise.add(new Double(H1));\r\n\t\t\t\tupSurprise.add(new Double(H1));\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t\/\/computeLiquidity();\r\n\t\t\t\r\n\t\t\tdownLiq = 0.5; \r\n\t\t\tupLiq = 0.5; \r\n\t\t\tdiffLiq = 0.5; \r\n\t\t\tdiffRaw = 0.0;\r\n\t\t\talpha = 2.0\/(100.0 + 1.0); \r\n\t\t\talphaWeight = Math.exp(-alpha); \r\n\t\t}\r\n\t\t\r\n\t\tpublic void getH1nH2(){\r\n\t\t\tdouble price = 0.0; \r\n\t\t\talpha = 2.0\/(100.0 + 1.0);\r\n\t\t\talphaWeight = Math.exp(-alpha);\r\n\t\t\trunner = new Runner[runner.length];\r\n\t\t\tfor( int i = 0; i &lt; runner.length; ++i ){\r\n\t\t\t\trunner[i] = new Runner(0.025\/100.0 + 0.05\/100.0*(double)i, 0.025\/100.0 + 0.05\/100.0*(double)i, price, \"JustFake\");\r\n\t\t\t\trunner[i].type = (i%2 == 0 ? 1 : -1);\r\n\t\t\t\tprevState[i] = (runner[i].type == 1 ? 1 : 0);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tdouble total1 = 0.0, total2 = 0.0;\r\n\t\t\tRandom rand = new Random(1);\r\n\t\t\tdouble dt = 1.0\/Math.sqrt(1000000.0);\r\n\t\t\tdouble sigma = 0.25; \/\/ 25%\r\n\t\t\tfor( int i = 0; i &lt; 100000000; ++i ){\r\n\t\t\t\tprice += sigma*dt*rand.nextGaussian();\r\n\t\t\t\tfor( int j= 0; j &lt; runner.length; ++j ){\r\n\t\t\t\t\tif( Math.abs(runner[j].run(price)) == 1 ){ \/\/ this is OK for simulated prices\r\n\t\t\t\t\t\tdouble myProbs = getProbs(j);\r\n\t\t\t\t\t\ttotal1 = total1*alphaWeight + (1.0 - alphaWeight)*(-Math.log(myProbs));\r\n\t\t\t\t\t\ttotal2 = total2*alphaWeight + (1.0 - alphaWeight)*Math.pow(Math.log(myProbs), 2.0);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tH1 = total1;\r\n\t\t\tH2 = total2 - H1*H1;\r\n\t\t\tSystem.out.println(\"H1:\" + H1 + \" H2:\" + H2);\r\n\t\t}\r\n\t\t\r\n\t\t@SuppressWarnings(\"deprecation\")\r\n\t\tpublic boolean Trigger(PriceFeedData price){\r\n\t\t\t\/\/ -- update values -- \r\n\t\t\tboolean doComp = false;\r\n\t\t\tfor( int i = 0; i &lt; runner.length; ++i ){\r\n\t\t\t\tint value = runner[i].run(price);\r\n\t\t\t\tif( Math.abs(value) == 1 ){\r\n\t\t\t\t\t\/\/double alpha = 2.0\/(100.0 + 1.0);\r\n\t\t\t\t\tdouble myProbs = getProbs(i);\r\n\t\t\t\t\tsurp = surp*alphaWeight + (1.0 - alphaWeight)*(-Math.log(myProbs));\r\n\t\t\t\t\tmySurprise.remove(0); mySurprise.add(new Double(-Math.log(myProbs)));\r\n\t\t\t\t\tif( runner[i].type == -1 ){\r\n\t\t\t\t\t\tdSurp = dSurp*alphaWeight + (1.0 - alphaWeight)*(-Math.log(myProbs));\r\n\t\t\t\t\t\tdownSurprise.remove(0); downSurprise.add(new Double(-Math.log(myProbs)));\r\n\t\t\t\t\t}else if( runner[i].type == 1 ){\r\n\t\t\t\t\t\tuSurp = uSurp*alphaWeight + (1.0 - alphaWeight)*(-Math.log(myProbs));\r\n\t\t\t\t\t\tupSurprise.remove(0); upSurprise.add(new Double(-Math.log(myProbs)));\r\n\t\t\t\t\t}\r\n\t\t\t\t\tdoComp = true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif( doComp ){\r\n\t\t\t\tliqEMA = (1.0 - CumNorm(Math.sqrt(100.0)*(surp - H1)\/Math.sqrt(H2)));\r\n\t\t\t\tupLiq = (1.0 - CumNorm(Math.sqrt(100.0)*(uSurp - H1)\/Math.sqrt(H2)));\r\n\t\t\t\tdownLiq =  (1.0 - CumNorm(Math.sqrt(100.0)*(dSurp - H1)\/Math.sqrt(H2)));\r\n\t\t\t\tdiffLiq = CumNorm(Math.sqrt(100.0)*(uSurp - dSurp)\/Math.sqrt(H2));\r\n\t\t\t\tdiffRaw = Math.sqrt(100.0)*(uSurp-dSurp)\/Math.sqrt(H2);\r\n\t\t\t}\r\n\t\t\treturn doComp;\r\n\t\t}\r\n\t\t\r\n\t\tpublic double getProbs(int i){\r\n\t\t\tint where = -1;\r\n\t\t\tfor( int j = 1; j &lt; prevState.length; ++j ){\r\n\t\t\t\tif( prevState[j] != prevState[0] ){\r\n\t\t\t\t\twhere = j;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif( i &gt; 0 &amp;&amp; where != i ){\r\n\t\t\t\tSystem.out.println(\"This should not happen! \" + where);\r\n\t\t\t}\r\n\t\t\tprevState[i] = (prevState[i] == 1 ? 0 : 1);\r\n\t\t\t\r\n\t\t\tif( where == 1 ){\r\n\t\t\t\tif( i &gt; 0 ){\r\n\t\t\t\t\treturn Math.exp(-(runner[1].deltaDown - runner[0].deltaDown)\/runner[0].deltaDown);\r\n\t\t\t\t}else{\r\n\t\t\t\t\treturn (1.0 - Math.exp(-(runner[1].deltaDown - runner[0].deltaDown)\/runner[0].deltaDown));\r\n\t\t\t\t}\r\n\t\t\t}else if( where &gt; 1 ){\r\n\t\t\t\tdouble numerator = 0.0;\r\n\t\t\t\tfor( int k = 1; k &lt;= where; ++k ){\r\n\t\t\t\t\tnumerator -= (runner[k].deltaDown - runner[k-1].deltaDown)\/runner[k-1].deltaDown;\r\n\t\t\t\t}\r\n\t\t\t\tnumerator = Math.exp(numerator);\r\n\t\t\t\tdouble denominator = 0.0;\r\n\t\t\t\tfor( int k = 1; k &lt;= where - 1; ++k ){\r\n\t\t\t\t\tdouble secVal = 0.0;\r\n\t\t\t\t\tfor( int j  = k+1; j &lt;= where; ++j ){\r\n\t\t\t\t\t\tsecVal -=  (runner[j].deltaDown - runner[j-1].deltaDown)\/runner[j-1].deltaDown;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tdenominator += (1.0 - Math.exp(-(runner[k].deltaDown - runner[k-1].deltaDown)\/runner[k-1].deltaDown))*Math.exp(secVal);\r\n\t\t\t\t}\r\n\t\t\t\tif( i &gt; 0 ){\r\n\t\t\t\t\treturn numerator\/(1.0 - denominator);\r\n\t\t\t\t}else{\r\n\t\t\t\t\treturn (1.0 - numerator\/(1.0 - denominator));\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\treturn 1.0;\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t\/\/ Another implementation of the CNDF for a standard normal: N(0,1)\r\n\t\tdouble CumNorm(double x){\r\n\t\t\t\/\/ Protect against overflow\r\n\t\t\tif (x &gt; 6.0)\r\n\t\t\t\treturn 1.0;\r\n\t\t\tif (x &lt; -6.0)\r\n\t\t\t\treturn 0.0;\r\n\t\t \r\n\t\t\tdouble b1 = 0.31938153;\r\n\t\t\tdouble b2 = -0.356563782;\r\n\t\t\tdouble b3 = 1.781477937;\r\n\t\t\tdouble b4 = -1.821255978;\r\n\t\t\tdouble b5 = 1.330274429;\r\n\t\t\tdouble p = 0.2316419;\r\n\t\t\tdouble c2 = 0.3989423;\r\n\t\t \r\n\t\t\tdouble a = Math.abs(x);\r\n\t\t\tdouble t = 1.0 \/ (1.0 + a * p);\r\n\t\t\tdouble b = c2*Math.exp((-x)*(x\/2.0));\r\n\t\t\tdouble n = ((((b5*t+b4)*t+b3)*t+b2)*t+b1)*t;\r\n\t\t\tn = 1.0-b*n;\r\n\t\t\t\r\n\t\t\tif ( x &lt; 0.0 )\r\n\t\t\t\tn = 1.0 - n;\r\n\r\n\t\t\treturn n;\r\n\t\t}\r\n\t\t\r\n\t\tpublic boolean computeLiquidity(long deltaT){\r\n\t\t\tdouble surpT = 0.0;\r\n\t\t\tdouble downSurp = 0.0, upSurp = 0.0;\r\n\t\t\t\r\n\t\t\tfor( int i = 0; i &lt; mySurprise.size(); ++i ){\r\n\t\t\t\tsurpT += mySurprise.get(i).doubleValue();\r\n\t\t\t\tdownSurp += downSurprise.get(i).doubleValue();\r\n\t\t\t\tupSurp += upSurprise.get(i).doubleValue();\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tliquidity = 1.0 - CumNorm((surpT - H1*mySurprise.size())\/Math.sqrt(H2*mySurprise.size()));\r\n\t\t\tliquidityDown = 1.0 - CumNorm((downSurp - H1*downSurprise.size())\/Math.sqrt(H2*downSurprise.size()));\r\n\t\t\tliquidityUp = 1.0 - CumNorm((upSurp - H1*upSurprise.size())\/Math.sqrt(H2*upSurprise.size()));\r\n\t\t\t\r\n\t\t\treturn true;\r\n\t\t}\r\n\t};\r\n\t\r\n\tpublic class HelpClass{\r\n\t\tlong time;\r\n\t\tdouble price;\r\n\t\tdouble liq;\r\n\t\tpublic HelpClass(){};\r\n\t\tpublic HelpClass(long t, double p, double l){\r\n\t\t\ttime = t; price = p; liq = l;\r\n\t\t}\r\n\t};\r\n\t\r\n\tpublic class Prices{\r\n\t\tdouble bid;\r\n\t\tdouble ask;\r\n\t\tPrices(){};\r\n\t\tPrices(Prices p){\r\n\t\t\tbid = p.bid;\r\n\t\t\task = p.ask;\r\n\t\t}\r\n\t\tPrices(double b, double a){\r\n\t\t\tbid = b;\r\n\t\t\task = a;\r\n\t\t}\r\n\t};\r\n\t\r\n\tpublic class NbDcCounter{\r\n\t\tList&lt;Long&gt; eventList;\r\n\t\tdouble delta;\r\n\t\tlong timeWindow;\r\n\t\tRunner runner;\r\n\t\t\r\n\t\tNbDcCounter(){};\r\n\t\tNbDcCounter(double d, long tW){\r\n\t\t\teventList = new LinkedList&lt;Long&gt;();\r\n\t\t\tdelta = d;\r\n\t\t\trunner = new Runner(delta, delta, \"events\", delta, delta);\r\n\t\t\ttimeWindow = tW;\r\n\t\t}\r\n\t\t@SuppressWarnings(\"deprecation\")\r\n\t\tboolean run(PriceFeedData price){\r\n\t\t\tif( Math.abs(runner.run(price)) == 1 ){\r\n\t\t\t\teventList.add(new Long(price.elems.time));\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif( eventList.size() == 0 )\r\n\t\t\t\treturn true;\r\n\t\t\t\r\n\t\t\twhile( eventList.get(0).longValue() &lt; price.elems.time - timeWindow )\r\n\t\t\t\teventList.remove(0);\r\n\t\t\t\r\n\t\t\treturn true;\r\n\t\t}\r\n\t};\r\n\t\r\n\tpublic class LocalLiquidity{\r\n\t\tdouble deltaUp, deltaDown;\r\n\t\tdouble delta;\r\n\t\tdouble extreme, dStar, reference;\r\n\t\tint type;\r\n\t\tboolean initalized;\r\n\t\t\r\n\t\tdouble surp, upSurp, downSurp;\r\n\t\tdouble liq, upLiq, downLiq;\r\n\t\tdouble alpha, alphaWeight;\r\n\t\tdouble H1, H2;\r\n\t\t\r\n\t\tLocalLiquidity(){};\r\n\t\tLocalLiquidity(double d, double dUp, double dDown, double dS, double a){\r\n\t\t\ttype = -1; deltaUp = dUp; deltaDown = dDown; dStar = dS; delta = d;\r\n\t\t\tinitalized = false;\r\n\t\t\talpha = a;\r\n\t\t\talphaWeight = Math.exp(-2.0\/(a + 1.0));\r\n\t\t\tcomputeH1H2exp(dS);\r\n\t\t}\t\t\r\n\t\tLocalLiquidity(double d,double dUp, double dDown, PriceFeedData price, double dS, double a){\r\n\t\t\tdeltaUp = dUp; deltaDown = dDown; delta = d;\r\n\t\t\ttype = -1;\r\n\t\t\textreme = reference = price.elems.mid;\r\n\t\t\tdStar = dS;\r\n\t\t\tinitalized = true;\r\n\t\t\talpha = a;\r\n\t\t\talphaWeight = Math.exp(-2.0\/(a + 1.0));\r\n\t\t\tcomputeH1H2exp(dS);\r\n\t\t}\r\n\t\tboolean computeH1H2exp(double dS){\r\n\t\t\tH1 = -Math.exp(-dStar\/delta)*Math.log(Math.exp(-dStar\/delta)) - (1.0 - Math.exp(-dStar\/delta))*Math.log(1.0 - Math.exp(-dStar\/delta));\r\n\t\t\tH2 = Math.exp(-dStar\/delta)*Math.pow(Math.log(Math.exp(-dStar\/delta)), 2.0) - (1.0 - Math.exp(-dStar\/delta))*Math.pow(Math.log(1.0 - Math.exp(-dStar\/delta)), 2.0) - H1*H1;\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\t\/\/ Another implementation of the CNDF for a standard normal: N(0,1)\r\n\t\tdouble CumNorm(double x){\r\n\t\t\t\/\/ protect against overflow\r\n\t\t\tif (x &gt; 6.0)\r\n\t\t\t\treturn 1.0;\r\n\t\t\tif (x &lt; -6.0)\r\n\t\t\t\treturn 0.0;\r\n\t\t\t\t \r\n\t\t\tdouble b1 = 0.31938153;\r\n\t\t\tdouble b2 = -0.356563782;\r\n\t\t\tdouble b3 = 1.781477937;\r\n\t\t\tdouble b4 = -1.821255978;\r\n\t\t\tdouble b5 = 1.330274429;\r\n\t\t\tdouble p = 0.2316419;\r\n\t\t\tdouble c2 = 0.3989423;\r\n\t\t\t\t \r\n\t\t\tdouble a = Math.abs(x);\r\n\t\t\tdouble t = 1.0 \/ (1.0 + a * p);\r\n\t\t\tdouble b = c2*Math.exp((-x)*(x\/2.0));\r\n\t\t\tdouble n = ((((b5*t+b4)*t+b3)*t+b2)*t+b1)*t;\r\n\t\t\tn = 1.0-b*n;\r\n\t\t\t\t\t\r\n\t\t\tif ( x &lt; 0.0 )\r\n\t\t\t\tn = 1.0 - n;\r\n\r\n\t\t\treturn n;\r\n\t\t}\r\n\t\t\r\n\t\tpublic int run(PriceFeedData price){\r\n\t\t\tif( price == null )\r\n\t\t\t\treturn 0;\r\n\t\t\t\r\n\t\t\tif( !initalized ){\r\n\t\t\t\ttype = -1; initalized = true;\r\n\t\t\t\textreme = reference = price.elems.mid;\r\n\t\t\t\treturn 0;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif( type == -1 ){\r\n\t\t\t\tif( Math.log(price.elems.bid\/extreme) &gt;= deltaUp ){\r\n\t\t\t\t\ttype = 1;\r\n\t\t\t\t\textreme = price.elems.ask;\r\n\t\t\t\t\treference = price.elems.ask;\r\n\t\t\t\t\treturn 1;\r\n\t\t\t\t}\r\n\t\t\t\tif( price.elems.ask &lt; extreme ){\r\n\t\t\t\t\textreme = price.elems.ask;\r\n\t\t\t\t}\r\n\t\t\t\tif( Math.log(reference\/extreme) &gt;= dStar ){\r\n\t\t\t\t\treference = extreme;\r\n\t\t\t\t\treturn 2;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse if( type == 1 ){\r\n\t\t\t\tif( Math.log(price.elems.ask\/extreme) &lt;= -deltaDown ){\r\n\t\t\t\t\ttype = -1;\r\n\t\t\t\t\textreme = price.elems.bid; \r\n\t\t\t\t\treference = price.elems.bid;\r\n\t\t\t\t\treturn -1;\r\n\t\t\t\t}\r\n\t\t\t\tif( price.elems.bid &gt; extreme ){\r\n\t\t\t\t\textreme = price.elems.bid; \r\n\t\t\t\t}\r\n\t\t\t\tif( Math.log(reference\/extreme) &lt;= -dStar ){\r\n\t\t\t\t\treference = extreme;\r\n\t\t\t\t\treturn -2;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn 0;\r\n\t\t}\r\n\t\t\r\n\t\tpublic boolean computation(PriceFeedData price){\r\n\t\t\tif( price == null )\r\n\t\t\t\treturn false;\r\n\t\t\t\r\n\t\t\tint event = run(price);\r\n\t\t\tif( event != 0 ){\r\n\t\t\t\tsurp = alphaWeight*(Math.abs(event) == 1 ? 0.08338161 : 2.525729) + (1.0 - alphaWeight)*surp;\r\n\t\t\t\t\r\n\t\t\t\tif( event &gt; 0 ){ \/\/ down moves\r\n\t\t\t\t\tdownSurp = alphaWeight*(event == 1 ? 0.08338161 : 2.525729) + (1.0 - alphaWeight)*downSurp;\r\n\t\t\t\t}else if( event &lt; 0 ){ \/\/ up moves\r\n\t\t\t\t\tupSurp = alphaWeight*(event == -1 ? 0.08338161 : 2.525729) + (1.0 - alphaWeight)*upSurp;\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tliq = 1.0 - CumNorm(Math.sqrt(alpha)*(surp - H1)\/Math.sqrt(H2)); \r\n\t\t\t\tupLiq = 1.0 - CumNorm(Math.sqrt(alpha)*(upSurp - H1)\/Math.sqrt(H2)); \r\n\t\t\t\tdownLiq = 1.0 - CumNorm(Math.sqrt(alpha)*(downSurp - H1)\/Math.sqrt(H2)); \r\n\t\t\t}\r\n\t\t\treturn true;\r\n\t\t}\r\n\t};\r\n\t\r\n\tpublic class CoastlineTrader{\r\n\t\tdouble tP; \/* -- Total position -- *\/\r\n\t\tList&lt;Double&gt; prices;\r\n\t\tList&lt;Double&gt; sizes;\r\n\t\t\r\n\t\tdouble profitTarget;\r\n\t\tdouble pnl, tempPnl;\r\n\t\tdouble deltaUp, deltaDown, deltaLiq, deltaOriginal;\r\n\t\tdouble shrinkFlong, shrinkFshort;\r\n\t\t\r\n\t\tdouble pnlPerc;\r\n\t\t\r\n\t\tint longShort;\r\n\t\t\r\n\t\tboolean initalized;\r\n\t\tRunner runner;\r\n\t\tRunner[][] runnerG;\r\n\t\t\r\n\t\tdouble increaseLong, increaseShort;\r\n\t\t\r\n\t\tdouble lastPrice;\r\n\t\t\r\n\t\tdouble cashLimit;\r\n\t\tString fxRate;\r\n\t\t\r\n\t\tLocalLiquidity liquidity;\r\n\t\t\r\n\t\tCoastlineTrader(){};\r\n\t\tCoastlineTrader(double dOriginal, double dUp, double dDown, double profitT, String FxRate, int lS){\r\n\t\t\tprices = new LinkedList&lt;Double&gt;();\r\n\t\t\tsizes = new LinkedList&lt;Double&gt;();\r\n\t\t\ttP = 0.0; \/* -- Total position -- *\/\r\n\t\t\t\r\n\t\t\tprofitTarget = cashLimit = profitT;\r\n\t\t\tpnl = tempPnl = pnlPerc = 0.0;\r\n\t\t\tdeltaOriginal = dOriginal;\r\n\t\t\tdeltaUp = dUp; deltaDown = dDown;\r\n\t\t\tlongShort = lS; \/\/ 1 for only longs, -1 for only shorts\r\n\t\t\tshrinkFlong = shrinkFshort = 1.0;\r\n\t\t\tincreaseLong = increaseShort = 0.0;\r\n\t\t\t\r\n\t\t\tfxRate = new String(FxRate);\r\n\t\t}\r\n\t\t\r\n\t\tdouble computePnl(PriceFeedData price){\r\n\t\t\t\/\/ TODO:\r\n\t\t\t\/\/ Compute PnL with current price\r\n\t\t\treturn 0.0;\r\n\t\t}\r\n\t\t\r\n\t\tdouble computePnlLastPrice(){\r\n\t\t\t\/\/ TODO:\r\n\t\t\t\/\/ Compute PnL with last available price\r\n\t\t\treturn 0.0;\r\n\t\t}\r\n\t\tdouble getPercPnl(PriceFeedData price){\r\n\t\t\t\/\/ TODO:\r\n\t\t\t\/\/ Percentage PnL\r\n\t\t\treturn 0.0;\r\n\t\t}\r\n\t\t\r\n\t\tboolean tryToClose(PriceFeedData price){\r\n\t\t\t\/\/ TODO:\r\n\t\t\t\/\/ Check if PnL target hit implementation\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\tboolean assignCashTarget(){\r\n\t\t\t\/\/ TODO:\r\n\t\t\t\/\/ Compute cash value corresponding to percentage PnL \r\n\t\t\treturn true;\r\n\t\t}\r\n\t\t\r\n\t\t@SuppressWarnings(\"deprecation\")\r\n\t\tboolean runPriceAsymm(PriceFeedData price, double oppositeInv){\r\n\t\t\tif( !initalized ){\r\n\t\t\t\trunner = new Runner(deltaUp, deltaDown, price, fxRate, deltaUp, deltaDown);\r\n\t\t\t\t\r\n\t\t\t\trunnerG = new Runner[2][2];\r\n\t\t\t\t\r\n\t\t\t\trunnerG[0][0] = new Runner(0.75*deltaUp, 1.50*deltaDown, price, fxRate, 0.75*deltaUp, 0.75*deltaUp);\r\n\t\t\t\trunnerG[0][1] = new Runner(0.50*deltaUp, 2.00*deltaDown, price, fxRate, 0.50*deltaUp, 0.50*deltaUp);\r\n\t\t\t\t\r\n\t\t\t\trunnerG[1][0] = new Runner(1.50*deltaUp, 0.75*deltaDown, price, fxRate, 0.75*deltaDown, 0.75*deltaDown);\r\n\t\t\t\trunnerG[1][1] = new Runner(2.00*deltaUp, 0.50*deltaDown, price, fxRate, 0.50*deltaDown, 0.50*deltaDown);\r\n\t\t\t\t\r\n\t\t\t\tliquidity = new LocalLiquidity(deltaOriginal, deltaUp, deltaDown, price, deltaOriginal*2.525729, 50.0);\r\n\t\t\t\tinitalized = true;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif( !liquidity.computation(price) ){\r\n\t\t\t\tSystem.out.println(\"Didn't compute liquidity!\");\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif( tryToClose(price) ){ \/* -- Try to close position -- *\/\r\n\t\t\t\tSystem.out.println(\"Close\");\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tint event = 0;\r\n\t\t\t\r\n\t\t\tdouble fraction = 1.0;\r\n\t\t\tdouble size = (liquidity.liq &lt; 0.5 ? 0.5 : 1.0);\r\n\t\t\tsize = (liquidity.liq &lt; 0.1 ? 0.1 : size);\r\n\t\t\t\r\n\t\t\tif( longShort == 1 ){ \/\/ Long positions only\r\n\t\t\t\tevent = runner.run(price);\r\n\t\t\t\t\r\n\t\t\t\tif( 15.0 &lt;= tP &amp;&amp; tP &lt; 30.0 ){\r\n\t\t\t\t\tevent = runnerG[0][0].run(price);\r\n\t\t\t\t\trunnerG[0][1].run(price);\r\n\t\t\t\t\tfraction = 0.5;\r\n\t\t\t\t}else if( tP &gt;= 30.0 ){\r\n\t\t\t\t\tevent = runnerG[0][1].run(price);\r\n\t\t\t\t\trunnerG[0][0].run(price);\r\n\t\t\t\t\tfraction = 0.25;\r\n\t\t\t\t}else{\r\n\t\t\t\t\trunnerG[0][0].run(price); runnerG[0][1].run(price);\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tif( event &lt; 0 ){\r\n\t\t\t\t\tif( tP == 0.0 ){ \/\/ Open long position\r\n\t\t\t\t\t\tint sign = -runner.type;\r\n\t\t\t\t\t\tif( Math.abs(oppositeInv) &gt; 15.0 ){\r\n\t\t\t\t\t\t\tsize = 1.0;\r\n\t\t\t\t\t\t\tif( Math.abs(oppositeInv) &gt; 30.0 ){\r\n\t\t\t\t\t\t\t\tsize = 1.0;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tdouble sizeToAdd = sign*size; \r\n\t\t\t\t\t\ttP += sizeToAdd;\r\n\t\t\t\t\t\tsizes.add(new Double(sizeToAdd));\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tprices.add(new Double(sign == 1 ? price.elems.ask : price.elems.bid));\r\n\t\t\t\t\t\tassignCashTarget();\r\n\t\t\t\t\t\tSystem.out.println(\"Open long\");\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse if( tP &gt; 0.0 ){ \/\/ Increase long position (buy)\r\n\t\t\t\t\t\tint sign = -runner.type;\r\n\t\t\t\t\t\tdouble sizeToAdd = sign*size*fraction*shrinkFlong;\r\n\t\t\t\t\t\tif( sizeToAdd &lt; 0.0 ){\r\n\t\t\t\t\t\t\tSystem.out.println(\"How did this happen! increase position but neg size: \" + sizeToAdd);\r\n\t\t\t\t\t\t\tsizeToAdd = -sizeToAdd; \r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tincreaseLong += 1.0;\r\n\t\t\t\t\t\ttP += sizeToAdd;\t\t\t\t\t\t\r\n\t\t\t\t\t\tsizes.add(new Double(sizeToAdd));\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tprices.add(new Double(sign == 1 ? price.elems.ask : price.elems.bid));\r\n\t\t\t\t\t\tSystem.out.println(\"Cascade\");\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\telse if( event &gt; 0 &amp;&amp;  tP &gt; 0.0 ){ \/\/ Possibility to decrease long position only at intrinsic events\r\n\t\t\t\t\tdouble pricE = (tP &gt; 0.0 ? price.elems.bid : price.elems.ask);\r\n\t\t\t\t\t\r\n\t\t\t\t\tfor( int i = 1; i &lt; prices.size(); ++i ){\r\n\t\t\t\t\t\tdouble tempP = (tP &gt; 0.0 ? Math.log(pricE\/prices.get(i).doubleValue()) : Math.log(prices.get(i).doubleValue()\/pricE));\r\n\t\t\t\t\t\tif( tempP &gt;= (tP &gt; 0.0 ? deltaUp : deltaDown) ){\r\n\t\t\t\t\t\t\tdouble addPnl = (pricE - prices.get(i).doubleValue())*sizes.get(i).doubleValue();\r\n\t\t\t\t\t\t\tif( addPnl &lt; 0.0 ){\r\n\t\t\t\t\t\t\t\tSystem.out.println(\"Descascade with a loss: \" + addPnl);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\ttempPnl += addPnl;\r\n\t\t\t\t\t\t\ttP -= sizes.get(i).doubleValue();\r\n\t\t\t\t\t\t\tsizes.remove(i); prices.remove(i);\r\n\t\t\t\t\t\t\tincreaseLong += -1.0;\r\n\t\t\t\t\t\t\tSystem.out.println(\"Decascade\");\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse if( longShort == -1 ){ \/\/ Short positions only\r\n\t\t\t\tevent = runner.run(price);\r\n\t\t\t\tif( -30.0 &lt; tP &amp;&amp; tP &lt; -15.0 ){\r\n\t\t\t\t\tevent = runnerG[1][0].run(price);\r\n\t\t\t\t\trunnerG[1][1].run(price);\r\n\t\t\t\t\tfraction = 0.5;\r\n\t\t\t\t}else if( tP &lt;= -30.0 ){\r\n\t\t\t\t\tevent = runnerG[1][1].run(price);\r\n\t\t\t\t\trunnerG[1][0].run(price);\r\n\t\t\t\t\tfraction = 0.25;\r\n\t\t\t\t}else{\r\n\t\t\t\t\trunnerG[1][0].run(price); runnerG[1][1].run(price);\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tif( event &gt; 0 ){\r\n\t\t\t\t\tif( tP == 0.0 ){ \/\/ Open short position\r\n\t\t\t\t\t\tint sign = -runner.type;\r\n\t\t\t\t\t\tif( Math.abs(oppositeInv) &gt; 15.0 ){\r\n\t\t\t\t\t\t\tsize = 1.0;\r\n\t\t\t\t\t\t\tif( Math.abs(oppositeInv) &gt; 30.0 ){\r\n\t\t\t\t\t\t\t\tsize = 1.0;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tdouble sizeToAdd = sign*size;\r\n\t\t\t\t\t\tif( sizeToAdd &gt; 0.0 ){\r\n\t\t\t\t\t\t\tSystem.out.println(\"How did this happen! increase position but pos size: \" + sizeToAdd);\r\n\t\t\t\t\t\t\tsizeToAdd = -sizeToAdd;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\ttP += sizeToAdd;\r\n\t\t\t\t\t\tsizes.add(new Double(sizeToAdd));\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tprices.add(new Double(sign == 1 ? price.elems.bid : price.elems.ask));\r\n\t\t\t\t\t\tSystem.out.println(\"Open short\");\r\n\t\t\t\t\t\tassignCashTarget();\r\n\t\t\t\t\t}else if( tP &lt; 0.0 ){\r\n\t\t\t\t\t\tint sign = -runner.type;\r\n\t\t\t\t\t\tdouble sizeToAdd = sign*size*fraction*shrinkFshort;\r\n\t\t\t\t\t\tif( sizeToAdd &gt; 0.0 ){\r\n\t\t\t\t\t\t\tSystem.out.println(\"How did this happen! increase position but pos size: \" + sizeToAdd);\r\n\t\t\t\t\t\t\tsizeToAdd = -sizeToAdd;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\ttP += sizeToAdd;\r\n\t\t\t\t\t\tsizes.add(new Double(sizeToAdd));\r\n\t\t\t\t\t\tincreaseShort += 1.0;\r\n\t\t\t\t\t\tprices.add(new Double(sign == 1 ? price.elems.bid : price.elems.ask));\r\n\t\t\t\t\t\tSystem.out.println(\"Cascade\");\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\telse if( event &lt; 0.0 &amp;&amp; tP &lt; 0.0 ){\r\n\t\t\t\t\tdouble pricE = (tP &gt; 0.0 ? price.elems.bid : price.elems.ask);\r\n\t\t\t\t\t\r\n\t\t\t\t\tfor( int i = 1; i &lt; prices.size(); ++i ){\r\n\t\t\t\t\t\tdouble tempP = (tP &gt; 0.0 ? Math.log(pricE\/prices.get(i).doubleValue()) : Math.log(prices.get(i).doubleValue()\/pricE));\r\n\t\t\t\t\t\tif( tempP &gt;= (tP &gt; 0.0 ? deltaUp : deltaDown) ){\r\n\t\t\t\t\t\t\tdouble addPnl = (pricE - prices.get(i).doubleValue())*sizes.get(i).doubleValue();\r\n\t\t\t\t\t\t\tif( addPnl &lt; 0.0 ){\r\n\t\t\t\t\t\t\t\tSystem.out.println(\"Descascade with a loss: \" + addPnl);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\ttempPnl += (pricE - prices.get(i).doubleValue())*sizes.get(i).doubleValue();\r\n\t\t\t\t\t\t\ttP -= sizes.get(i).doubleValue();\r\n\t\t\t\t\t\t\tsizes.remove(i); prices.remove(i);\r\n\t\t\t\t\t\t\tincreaseShort += -1.0;\r\n\t\t\t\t\t\t\tSystem.out.println(\"Decascade\");\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\tSystem.out.println(\"Should never happen! \" + longShort);\r\n\t\t\t}\r\n\t\t\treturn true;\r\n\t\t}\r\n\t};\r\n\t\r\n\tpublic class FXrateTrading{\r\n\t\tCoastlineTrader[] coastTraderLong, coastTraderShort;\r\n\t\tString FXrate;\r\n\t\tLiquidity liquidity;\r\n\t\tdouble currentTime, oneDay;\r\n\t\t\r\n\t\tFXrateTrading(){};\r\n\t\tFXrateTrading(String rate, int nbOfCoastTraders, double[] deltas){\r\n\t\t\tcurrentTime = 1136073600000.0;\r\n\t\t\toneDay = 24.0*60.0*60.0*1000.0;\r\n\t\t\tFXrate = new String(rate);\r\n\t\t\tcoastTraderLong = new CoastlineTrader[nbOfCoastTraders];\r\n\t\t\tcoastTraderShort = new CoastlineTrader[nbOfCoastTraders];\r\n\t\t\t\r\n\t\t\tfor( int i = 0; i &lt; coastTraderLong.length; ++i ){\r\n\t\t\t\tcoastTraderLong[i] = new CoastlineTrader(deltas[i], deltas[i], deltas[i], deltas[i], rate.toString(), 1);\r\n\t\t\t\tcoastTraderShort[i] =  new CoastlineTrader(deltas[i], deltas[i], deltas[i], deltas[i], rate.toString(), -1);\r\n\t\t\t}\r\n\t\t};\r\n\t\t\r\n\t\tboolean runTradingAsymm(PriceFeedData price){\r\n\t\t\tfor( int i = 0; i &lt; coastTraderLong.length; ++i ){\r\n\t\t\t\tcoastTraderLong[i].runPriceAsymm(price, coastTraderShort[i].tP);\r\n\t\t\t\tcoastTraderShort[i].runPriceAsymm(price, coastTraderLong[i].tP);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif( price.elems.time &gt;= currentTime + oneDay ){\r\n\t\t\t\twhile( currentTime &lt;= price.elems.time )\r\n\t\t\t\t\tcurrentTime += oneDay;\r\n\t\t\t\t\r\n\t\t\t\tprintDataAsymm(currentTime);\r\n\t\t\t}\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\t\r\n\t\tboolean printDataAsymm(double time){\r\n\t\t\tString sep = new String(System.getProperty(\"file.separator\"));\r\n\t\t\tString folder = new String(sep + \"home\" + sep + \"agolub\" + sep + \"workspace\" + sep + \"InvestmentStrategy\" + sep + FXrate.toString() + \"DataAsymmLiq.dat\");\r\n\t\t\tFileWriter fw = null;\r\n\t\t\t\r\n\t\t\ttry{\r\n\t\t\t\tdouble totalPos = 0.0, totalShort = 0.0, totalLong = 0.0; double totalPnl = 0.0; double totalPnlPerc = 0.0;  \r\n\t\t\t\tfw = new FileWriter(folder, true);\r\n\t\t\t\tdouble price = -1.0;\r\n\t\t\t\tfor( int i = 0; i &lt; coastTraderLong.length; ++i ){\r\n\t\t\t\t\tif( i == 0 ){\r\n\t\t\t\t\t\tprice = coastTraderLong[i].lastPrice;\r\n\t\t\t\t\t}\r\n\t\t\t\t\ttotalLong += coastTraderLong[i].tP;\r\n\t\t\t\t\ttotalShort += coastTraderShort[i].tP;\r\n\t\t\t\t\ttotalPos += (coastTraderLong[i].tP + coastTraderShort[i].tP);\r\n\t\t\t\t\ttotalPnl += (coastTraderLong[i].pnl + coastTraderLong[i].tempPnl + coastTraderLong[i].computePnlLastPrice()\r\n\t\t\t\t\t\t\t+ coastTraderShort[i].pnl + coastTraderShort[i].tempPnl + coastTraderShort[i].computePnlLastPrice());\r\n\t\t\t\t\ttotalPnlPerc += (coastTraderLong[i].pnlPerc + (coastTraderLong[i].tempPnl + coastTraderLong[i].computePnlLastPrice())\/coastTraderLong[i].cashLimit*coastTraderLong[i].profitTarget\r\n\t\t\t\t\t\t\t+ coastTraderShort[i].pnlPerc + (coastTraderShort[i].tempPnl + coastTraderShort[i].computePnlLastPrice())\/coastTraderShort[i].cashLimit*coastTraderShort[i].profitTarget);\r\n\t\t\t\t}\r\n\t\t\t\tfw.append((long)time + \",\" + totalPnl + \",\" + totalPnlPerc + \",\" + totalPos + \",\" + totalLong + \",\" + totalShort + \",\" + price + \"\\n\");\r\n\t\t\t\tfw.close();\r\n\t\t\t}\r\n\t\t\tcatch(IOException e){\r\n\t\t\t\tSystem.out.println(\"Failed opening DC thresh file! \" + e.getMessage());\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t\treturn true;\r\n\t\t};\r\n\t};\r\n\t\r\n\t\/* -- Price feed -- *\/\r\n\t\/\/ Simple\r\n\tpublic class PriceFeedData{\r\n\t\t\/\/ TODO Implement your feed\r\n\t\tElems elems;\r\n\t\tdouble ask;\r\n\t\tPriceFeedData(){\r\n\t\t\telems = new Elems();\r\n\t\t};\r\n\t\t\r\n\t\tpublic class Elems{\r\n\t\t\tdouble mid = 1.1;\r\n\t\t\tdouble ask = 1.1;\r\n\t\t\tdouble bid = 1.0;\r\n\t\t\tlong time = System.currentTimeMillis();\r\n\t\t}\r\n\t};\r\n\t\r\n\t\/* -- Configuration\r\n\t\/\/ TODO\r\n\tpublic static class Configuration{\r\n\t\tpublic double startThreshold;\r\n\t\tpublic int numberOf;\r\n\t\tpublic double endThreshold;\r\n\t\t\r\n\t\tpublic Configuration() {\r\n\t\t\tstartThreshold = 0.001;\r\n\t\t\tnumberOf = 10;\r\n\t\t\tendThreshold = 0.05;\r\n\t\t}\r\n\t}\r\n\t*\/\r\n}\r\n<\/pre>\n<p>\uadf8\ub9ac\uace0 \uc774\uc0c1\uc758 DC Intrinsic Time\uc744 \uc124\uba85\ud55c \ub17c\ubb38\ub4e4\uc774 \ub2e4\ub978 \ub17c\ubb38\ub4e4\uacfc \ube44\uad50\ud558\uc5ec \uc88b\uc740 \uc810\uc740 \uad00\ub828\ud55c \ub17c\ubb38\uc5d0 \uc0ac\uc6a9\ud55c \ubc29\ubc95\uc744 Java \uc18c\uc2a4\ub85c \uacf5\uac1c\ud55c \uc810\uc785\ub2c8\ub2e4. Vladimir Petrov\uc758 <a href=\"https:\/\/github.com\/VladUZH\/VlPetrov\" target=\"_blank\" rel=\"noopener\">Risk management Tools based on Intrinsic Time and Scaling Laws<\/a>\uc744 \ubcf4\uba74 \uc544\ub798\uc640 \uac19\uc774 \uacf5\uac1c\ud558\uace0 \uc788\uc2b5\ub2c8\ub2e4.  \uad6c\uae00\ub9c1\uc744 \ud574\ubcf4\uba74 DC Intrinsic Time\uc744 \uc8fc\uc81c\ub85c \ud55c \ud2b8\ub808\uc774\ub529\ubaa8\ub378\uc744 \ub9ce\uc774 \ubcfc \uc218 \uc788\uc2b5\ub2c8\ub2e4.  ZeroAOS\ub97c \uc774\uc6a9\ud558\uc5ec \uad6c\ucd95\ud574\ubcf4\uba74 \uc5b4\ub5a8\uae4c \uc0c1\uc0c1\ud574\ubd05\ub2c8\ub2e4.<\/p>\n<blockquote>\n<h3>The root directory contains several methods which can be directly employed for high-frequency real-time data analysis:<\/h3>\n<ul>\n<li><strong><a href=\"https:\/\/github.com\/VladUZH\/VlPetrov\/blob\/master\/src\/LiquidityIndicator_Analysis.java\">LiquidityIndicator_Analysis.java<\/a><\/strong> &#8211; computes liquidity of historical time series represented by tick-by-tick price data using the multiscale interpretation of liquidity based on the directional change and scaling laws. It is a wrapper for the &#8220;LiquidityIndicator&#8221; class from the &#8220;ievent&#8221; folder. To run the program one needs to specify the path to the analysed file and set up several parameters described at the header of the code.<\/li>\n<li><strong><a href=\"https:\/\/github.com\/VladUZH\/VlPetrov\/blob\/master\/src\/InstantaneousVolatilityActivity_Analisys.java\">InstantaneousVolatilityActivity_Analisys.java<\/a><\/strong> &#8211; this class is the extension of the &#8220;ievents\/VolatilitySeasonality&#8221; class modifies to be applicable to the set of historical or real-time high-frequency price data.<\/li>\n<li><strong><a href=\"https:\/\/github.com\/VladUZH\/VlPetrov\/blob\/master\/src\/VolatilityEstimatorMovingWindow_Analysis.java\">VolatilityEstimatorMovingWindow_Analysis.java<\/a><\/strong> &#8211; this class is designed to perform the volatility analysis of high-frequency data computed in two ways: using the sum of squared return function which calculates the aggregated standard deviation of the time series over fixed and equal intervals and using the method based on the directional-change intrinsic time approach in detail described in the <a href=\"https:\/\/github.com\/VladUZH\/VlPetrov\/blob\/master\/src\/ievents\/RealizedVolatility.java\">RealizedVolatility.java<\/a> class.<\/li>\n<\/ul>\n<h3><\/h3>\n<h3>The <em><a href=\"https:\/\/github.com\/VladUZH\/VlPetrov\/tree\/master\/src\/ievents\">ievents<\/a><\/em> folder contains classes and methods related to the directional-change intrinsic time concept proposed and described in work &#8220;A geographical model for the daily and weekly seasonal volatility in the foreign exchange market&#8221; (available <a href=\"https:\/\/www.sciencedirect.com\/science\/article\/pii\/026156069390004U\" rel=\"nofollow\">online<\/a>):<\/h3>\n<ul>\n<li><strong><a href=\"https:\/\/github.com\/VladUZH\/VlPetrov\/blob\/master\/src\/ievents\/DcOS.java\">DcOS.java<\/a><\/strong> &#8211; Directional-Change dissection algorithm splits a historical price time series into a collection of directional-change and overshoot points defined as the sequence of alternating trend changes of selected size.<\/li>\n<li><strong><a href=\"https:\/\/github.com\/VladUZH\/VlPetrov\/blob\/master\/src\/ievents\/IE.java\">IE.java<\/a><\/strong> &#8211; is an auxiliary class to keep information on the properties of each observed intrinsic event such as time and price levels.<\/li>\n<li><strong><a href=\"https:\/\/github.com\/VladUZH\/VlPetrov\/blob\/master\/src\/ievents\/IntrinsicNetwork.java\">IntrinsicNetwork.java<\/a><\/strong> &#8211; is an example of the Intrinsic Network introduced in the &#8220;Multi-scale Representation of High Frequency Market Liquidity&#8221; paper (available <a href=\"https:\/\/content.iospress.com\/articles\/algorithmic-finance\/af054\" rel=\"nofollow\">online<\/a>).<\/li>\n<li><strong><a href=\"https:\/\/github.com\/VladUZH\/VlPetrov\/blob\/master\/src\/ievents\/LiquidityIndicator.java\">LiquidityIndicator.java<\/a><\/strong> &#8211; is a realization of the liquidity indicator proposed in the research work &#8220;Multi-scale Representation of High Frequency Market Liquidity&#8221; (available <a href=\"https:\/\/content.iospress.com\/articles\/algorithmic-finance\/af054\" rel=\"nofollow\">online<\/a>).<\/li>\n<li><strong><a href=\"https:\/\/github.com\/VladUZH\/VlPetrov\/blob\/master\/src\/ievents\/InstantaneousVolatility.java\">InstantaneousVolatility.java<\/a><\/strong> &#8211; is the method used to translate the number of observed directional-change intrinsic events into the value of the instantaneous volatility. The approach is outlined in the research paper &#8220;Instantaneous Volatility Seasonality of Bitcoin in Directional-Change Intrinsic Time&#8221; (available <a href=\"https:\/\/papers.ssrn.com\/sol3\/papers.cfm?abstract_id=3243797\" rel=\"nofollow\">online<\/a>).<\/li>\n<li><strong><a href=\"https:\/\/github.com\/VladUZH\/VlPetrov\/blob\/master\/src\/ievents\/MovingWindowVolatilityEstimator.java\">MovingWindowVolatilityEstimator.java<\/a><\/strong> &#8211; is the instantaneous volatility estimator based on the number of Directional Changes observed over given period of time (set as a parameter of the method) and described in the paper &#8220;Instantaneous Volatility Seasonality of Bitcoin in Directional-Change Intrinsic Time&#8221; (<a href=\"https:\/\/papers.ssrn.com\/sol3\/papers.cfm?abstract_id=3243797\" rel=\"nofollow\">available online<\/a>).<\/li>\n<li><strong><a href=\"https:\/\/github.com\/VladUZH\/VlPetrov\/blob\/master\/src\/ievents\/RealizedVolatility.java\">RealizedVolatility.java<\/a><\/strong> &#8211; is the class where the realized volatility is computed using the number of observed directional-change intrinsic events combined with the variability of overshoots proceeding each directional change. The main idea of the approach is in details described in the paper &#8220;Bridging the gap between physical and intrinsic time&#8221; (work in progress).<\/li>\n<li><strong><a href=\"https:\/\/github.com\/VladUZH\/VlPetrov\/blob\/master\/src\/ievents\/RealizedVolatilitySeasonality.java\">RealizedVolatilitySeasonality.java<\/a><\/strong> &#8211; based on the <a href=\"https:\/\/github.com\/VladUZH\/VlPetrov\/blob\/master\/src\/ievents\/RealizedVolatility.java\">RealizedVolatility.java<\/a> method this class provides a novel way of computing weekly seasonality of the realized volatility considering the evolution of the price curve from the point of view of directional-change intrinsic events.<\/li>\n<li><strong><a href=\"https:\/\/github.com\/VladUZH\/VlPetrov\/blob\/master\/src\/ievents\/InstantaneousVolatilitySeasonality.java\">InatantaneousVolatilitySeasonality.java<\/a><\/strong> &#8211; based on the <a href=\"https:\/\/github.com\/VladUZH\/VlPetrov\/blob\/master\/src\/ievents\/InstantaneousVolatility.java\">InstantaneousVolatility.java<\/a> method this class provides a novel way of computing weekly seasonality of the instantaneous volatility considering the evolution of the price curve from the point of view of directional-change intrinsic events.<\/li>\n<li><strong><a href=\"https:\/\/github.com\/VladUZH\/VlPetrov\/blob\/master\/src\/ievents\/DcOSmultD.java\">DcOSmultiD.java<\/a><\/strong> &#8211; is the extension of the originally one-dimensional version of the directional-change intrinsic time algorithm (class <a href=\"https:\/\/github.com\/VladUZH\/VlPetrov\/blob\/master\/src\/ievents\/DcOS.java\">DcOS.java<\/a>) to the multidimensional space. The space is formed by orthogonally placed independent exchange rates. The description of the multidimensional approach is provided in the paper &#8220;Multidimensional Directional-Change Intrinsic Time&#8221; (work in progress).<\/li>\n<\/ul>\n<h3><\/h3>\n<h3>Folder <em><a href=\"https:\/\/github.com\/VladUZH\/VlPetrov\/tree\/master\/src\/scalinglaws\">scalinglaws<\/a><\/em> contains tools which allow extracting scaling laws based on the directional-change intrinsic time as described in the paper &#8220;Patterns in high-frequency FX data: Discovery of 12 empirical scaling laws&#8221; (available <a href=\"https:\/\/www.tandfonline.com\/doi\/full\/10.1080\/14697688.2010.481632?casa_token=m2x82H9VNj0AAAAA:HxxRW0hHJb9vwtkg5S3ukhfglI58AzSWAND89y7JXRY5VIGprfGcuQvoR6VTPkgV4yP_lhogrPVsbg\" rel=\"nofollow\">online<\/a>). Numbers of scaling laws follow the same order selected in the paper. The code has been validated using high-frequency data from Forex and Bitcoin markets (work in progress):<\/h3>\n<ul>\n<li><strong><a href=\"https:\/\/github.com\/VladUZH\/VlPetrov\/blob\/master\/src\/scalinglaws\/MeanPriceMoveScalingLaw.java\">MeanPriceMoveScalingLaw.java<\/a><\/strong> &#8211; &#8220;Mean price move scaling law&#8221;, Law 0a, p=1.<\/li>\n<li><strong><a href=\"https:\/\/github.com\/VladUZH\/VlPetrov\/blob\/master\/src\/scalinglaws\/QuadraticMeanPriceMoveScalingLaw.java\">QuadraticMeanPriceMoveScalingLaw.java<\/a><\/strong> &#8211; &#8220;Quadratic mean price move scaling law&#8221;, Law 0a, p=2.<\/li>\n<li><strong><a href=\"https:\/\/github.com\/VladUZH\/VlPetrov\/blob\/master\/src\/scalinglaws\/DCcountScalingLaw.java\">DCcountScalingLaw.java<\/a><\/strong> &#8211; &#8220;Number of Directional-Changes scaling law&#8221;, Law 0b.<\/li>\n<li><strong><a href=\"https:\/\/github.com\/VladUZH\/VlPetrov\/blob\/master\/src\/scalinglaws\/PriceMoveCountScalingLaw.java\">PriceMoveCountScalingLaw.java<\/a><\/strong> &#8211; &#8220;Price move count scaling law&#8221;, Law 2.<\/li>\n<li><strong><a href=\"https:\/\/github.com\/VladUZH\/VlPetrov\/blob\/master\/src\/scalinglaws\/MaxPriceMoveScalingLaw.java\">MaxPriceMoveScalingLaw.java<\/a><\/strong> &#8211; &#8220;Maximal price move during scaling law&#8221;, Law 3, p=1.<\/li>\n<li><strong><a href=\"https:\/\/github.com\/VladUZH\/VlPetrov\/blob\/master\/src\/scalinglaws\/QuadraticMeanMaxPriceMoveScalingLaw.java\">QuadraticMeanMaxPriceMoveScalingLaw.java<\/a><\/strong> &#8211; &#8220;Maximal price move during scaling law&#8221;, Law 3, p=2.<\/li>\n<li><strong><a href=\"https:\/\/github.com\/VladUZH\/VlPetrov\/blob\/master\/src\/scalinglaws\/MeanTimePriceMoveScalingLaw.java\">MeanTimePriceMoveScalingLaw.java<\/a><\/strong> &#8211; &#8220;Mean time of price move scaling law&#8221;, Law 4.<\/li>\n<li><strong><a href=\"https:\/\/github.com\/VladUZH\/VlPetrov\/blob\/master\/src\/scalinglaws\/TimeDuringDCScalingLaw.java\">TimeDuringDCScalingLaw.java<\/a><\/strong> &#8211; &#8220;Time during directional-change scaling law&#8221;, Law 5.<\/li>\n<li><strong><a href=\"https:\/\/github.com\/VladUZH\/VlPetrov\/blob\/master\/src\/scalinglaws\/TotalMoveScalingLaw.java\">TotalMoveScalingLaw.java<\/a><\/strong> &#8211; &#8220;Total move scaling law&#8221;, Law 9(tm).<\/li>\n<li><strong><a href=\"https:\/\/github.com\/VladUZH\/VlPetrov\/blob\/master\/src\/scalinglaws\/OSmoveScalingLaw.java\">OSmoveScalingLaw.java<\/a><\/strong> &#8211; &#8220;Overshoot scaling law&#8221;, Law 9(os).<\/li>\n<li><strong><a href=\"https:\/\/github.com\/VladUZH\/VlPetrov\/blob\/master\/src\/scalinglaws\/DCmoveScalingLaw.java\">DCmoveScalingLaw.java<\/a><\/strong> &#8211; &#8220;Directional-change move scaling law&#8221;, Law 9(dc).<\/li>\n<li><strong><a href=\"https:\/\/github.com\/VladUZH\/VlPetrov\/blob\/master\/src\/scalinglaws\/TimeTotMoveScalLaw.java\">TimeTotMoveScalLaw.java<\/a><\/strong> &#8211; &#8220;Time total-move scaling law&#8221;, Law 10(tm).<\/li>\n<li><strong><a href=\"https:\/\/github.com\/VladUZH\/VlPetrov\/blob\/master\/src\/scalinglaws\/TimeDCScalingLaw.java\">TimeDCScalingLaw.java<\/a><\/strong> &#8211; &#8220;Time of directional change scaling law&#8221;, Law 10(dc).<\/li>\n<li><strong><a href=\"https:\/\/github.com\/VladUZH\/VlPetrov\/blob\/master\/src\/scalinglaws\/TimeOSScalingLaw.java\">TimeOSScalingLaw.java<\/a><\/strong> &#8211; &#8220;Time of overshoot scaling law&#8221;, Law 10(os).<\/li>\n<li><strong><a href=\"https:\/\/github.com\/VladUZH\/VlPetrov\/blob\/master\/src\/scalinglaws\/TMtickCountScalingLaw.java\">TMtickCountScalingLaw.java<\/a><\/strong> &#8211; &#8220;Total move tick count scaling law&#8221;, Law 11(tm).<\/li>\n<li><strong><a href=\"https:\/\/github.com\/VladUZH\/VlPetrov\/blob\/master\/src\/scalinglaws\/DCtickCountScalingLaw.java\">DCtickCountScalingLaw.java<\/a><\/strong> &#8211; &#8220;Directional change tick count scaling law&#8221;, Law 11(dc).<\/li>\n<li><strong><a href=\"https:\/\/github.com\/VladUZH\/VlPetrov\/blob\/master\/src\/scalinglaws\/OStickCountScalingLaw.java\">OStickCountScalingLaw.java<\/a><\/strong> &#8211; &#8220;Overshoot tick count scaling law&#8221;, Law 11(os).<\/li>\n<li><strong><a href=\"https:\/\/github.com\/VladUZH\/VlPetrov\/blob\/master\/src\/scalinglaws\/CumulTMScalingLaw.java\">CumulTMScalingLaw.java<\/a><\/strong> &#8211; &#8220;Cumulative total move scaling law&#8221; (coastline), Law 12(tm).<\/li>\n<li><strong><a href=\"https:\/\/github.com\/VladUZH\/VlPetrov\/blob\/master\/src\/scalinglaws\/CumulOSScalingLaw.java\">CumulOSScalingLaw.java<\/a><\/strong> &#8211; &#8220;Cumulative overshoot scaling law&#8221;, Law 12(os).<\/li>\n<li><strong><a href=\"https:\/\/github.com\/VladUZH\/VlPetrov\/blob\/master\/src\/scalinglaws\/CumulDCScalingLaw.java\">CumulDCScalingLaw.java<\/a><\/strong> &#8211; &#8220;Cumulative directional change scaling law&#8221;, Law 12(dc).<\/li>\n<\/ul>\n<h3><\/h3>\n<h3>Folder <em><a href=\"https:\/\/github.com\/VladUZH\/VlPetrov\/tree\/master\/src\/market\">market<\/a><\/em> contains a set of auxiliary tools nucessarily to perform the real application of risk management tools presented in the repository:<\/h3>\n<ul>\n<li><strong><a href=\"https:\/\/github.com\/VladUZH\/VlPetrov\/blob\/master\/src\/market\/Price.java\">Price.java<\/a><\/strong> &#8211; is a simple class for elementary prices corresponding to some given moment of time. These are tick prices by default. Each class instance holds information on the bid and ask price levels as well as the time of when the new tick was registered.<\/li>\n<li><strong><a href=\"https:\/\/github.com\/VladUZH\/VlPetrov\/blob\/master\/src\/market\/SpreadInfo.java\">SpreadInfo.java<\/a><\/strong> &#8211; this method, applied to a historical (or real-time streamed) time series, returns Median, Mean, Min and Max spread characteristics characterised some given period of time.<\/li>\n<li><strong><a href=\"https:\/\/github.com\/VladUZH\/VlPetrov\/blob\/master\/src\/market\/PriceMultiD.java\">PriceMultiD.java<\/a><\/strong> &#8211; is the class to keep information on the multidimensional structure of prices used for the multidimensional version of the directional-change intrinsic time <a href=\"https:\/\/github.com\/VladUZH\/VlPetrov\/blob\/master\/src\/ievents\/DcOSmultD.java\">algorithm<\/a>. Collections of bid and ask prices composing each instance of the class are formed by individual components of exchange rates used in an experiment.<\/li>\n<\/ul>\n<h3><\/h3>\n<h3>Folder <em><a href=\"https:\/\/github.com\/VladUZH\/VlPetrov\/tree\/master\/src\/tools\">tools<\/a><\/em> is a collection of some traditional data management tools employed to analyse historical and real-time streams of high-frequency data:<\/h3>\n<ul>\n<li><strong><a href=\"https:\/\/github.com\/VladUZH\/VlPetrov\/blob\/master\/src\/tools\/BM.java\">BM.java<\/a><\/strong> &#8211; is the class used to generate time series of given lengths properties of which coincide with properties of simple Brownian Motion process.<\/li>\n<li><strong><a href=\"https:\/\/github.com\/VladUZH\/VlPetrov\/blob\/master\/src\/tools\/GBM.java\">GBM.java<\/a><\/strong> &#8211; is the class used to generate time series of given lengths following Geometrical Brownian Motion process.<\/li>\n<li><strong><a href=\"https:\/\/github.com\/VladUZH\/VlPetrov\/blob\/master\/src\/tools\/TraditionalVolatility.java\">TraditionalVolatility.java<\/a><\/strong> &#8211; this class is traditional volatility estimator. Computes volatility of a given time series using the sum of squared returns.<\/li>\n<li><strong><a href=\"https:\/\/github.com\/VladUZH\/VlPetrov\/blob\/master\/src\/tools\/MovingWindowVolatilityEstimator.java\">MovingWindowVolatilityEstimator.java<\/a><\/strong> &#8211; is the classical volatility estimator which performs over a moving window the length of which is defined as a parameter of the code. The algorithm is based on the sum of squared returns computed over equal time intervals.<\/li>\n<li><strong><a href=\"https:\/\/github.com\/VladUZH\/VlPetrov\/blob\/master\/src\/tools\/Tools.java\">Tools.java<\/a><\/strong> &#8211; is a class containing a subset of simple methods used over the whole research work on the scaling laws and intrinsic time risk-management tools. The class is crucial for the stable work of almost all related experiments.<\/li>\n<li><strong><a href=\"https:\/\/github.com\/VladUZH\/VlPetrov\/blob\/master\/src\/tools\/ThetaTime.java\">ThetaTime.java<\/a><\/strong> &#8211; is the class the idea of which is to perform as theta-time presented in work of &#8220;A geographical model for the daily and weekly seasonal volatility in the foreign exchange market&#8221; (available <a href=\"https:\/\/www.sciencedirect.com\/science\/article\/pii\/026156069390004U\" rel=\"nofollow\">online<\/a>).<\/li>\n<\/ul>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>1. Richard Olsen\uc774\ub77c\ub294 \uc774\ub984\uc740 \uc0dd\uc18c\ud569\ub2c8\ub2e4. \uadf8\ub7f0\ub370 \uc774\ub825\uc740 \ubcf4\ub2c8\uae4c \uc5b4\ub5a4 \ubd84\uc778\uc9c0 \uc9d0\uc791\uc774 \uac11\ub2c8\ub2e4. Retail FX \uc2dc\uc7a5\uc5d0\uc11c \uc720\uba85\ud55c OANDA\uc758 \uacf5\ub3d9\ucc3d\uc5c5\uc790\uc774\uace0 \uc554\ud638\ud1b5\ud654\uac70\ub798\uc18c\uc640 \uad00\ub828\ud55c \ube44\uc9c0\ub2c8\uc2a4\ub97c \ud558\uace0 \uc788\ub294 Lykke Group\uc758 \ucc3d\uc5c5\uc790\uc785\ub2c8\ub2e4. \ubb3c\ub860 \uad00\uc2ec\uc744 \uac00\uc9c4 \uc0ac\ub78c\uc740 \uc544\ub2d9\ub2c8\ub2e4. \uba87 \uc77c\uc804 Quantnews\uc5d0 \uc62c\ub77c\uc628 The Alpha Engine: Designing an Automated Trading Algorithm\uc744 \uc77d\uc73c\uba74\uc11c \uc811\ud588\uc2b5\ub2c8\ub2e4. \ucd08\ub85d\uc744 \ubcf4\uba74 30\uc5ec\ub144\uc804\ubd80\ud130 \uc5f0\uad6c\ud574\uc654\ub358 \ud2b8\ub808\uc774\ub529\ubaa8\ub378\uc774\ub77c\uace0 \ud569\ub2c8\ub2e4. 81\ub144 \ubc1c\ud45c\ud55c \uc878\uc5c5\ub17c\ubb38\uc774 \uc2dc\uc791\uc774\uace0 1993\ub144\uc5d0 \ubc1c\ud45c\ud55c A geographical model&#8230;<br \/><a class=\"read-more-button\" href=\"https:\/\/smallake.kr\/?p=26322\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":27238,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"nf_dc_page":"","om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"Directional-Change Intrinsic Time\ub77c\ub294 \uac1c\ub150\uc744 \uc774\uc6a9\ud55c \ud2b8\ub808\uc774\ub529\ubaa8\ub378 \uad6c\ucd95 \ubc29\ubc95\ub860\uc785\ub2c8\ub2e4. OANDA \uc124\ub9bd\uc790\uc778 Olsen\uc774 \uc624\ub79c\ub3d9\uc548 \uc5f0\uad6c\ud55c \ubaa8\ub378\uc785\ub2c8\ub2e4. \ubc29\ub300\ud55c \uc18c\uc2a4\ub294 \ub364\uc785\ub2c8\ub2e4.","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[7],"tags":[3310,3307,3309,3308],"class_list":["post-26322","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-7","tag-direction-change","tag-intrinsic-time","tag-olsen","tag-3308"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.8 - aioseo.com -->\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"smallake\"\/>\n\t<meta name=\"keywords\" content=\"direction change,intrinsic time,olsen,\ud2b8\ub808\uc774\ub529\ubaa8\ub378\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/smallake.kr\/?p=26322\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.8\" \/>\n\t\t<meta property=\"og:locale\" content=\"ko_KR\" \/>\n\t\t<meta property=\"og:site_name\" content=\"\uadf8\ub300\uc548\uc758\uc791\uc740\ud638\uc218 | \uc0b4\uc544\uc628 \ub0a0\uc758 \ud754\uc801, \uc0b4\uc544\uac08 \ub0a0\uc758 \uae30\ub85d\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Directional-Change\uc640 Intrinsic Time | \uadf8\ub300\uc548\uc758\uc791\uc740\ud638\uc218\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/smallake.kr\/?p=26322\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2019-02-13T01:37:52+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2019-02-13T01:37:52+00:00\" \/>\n\t\t<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/iumgroup\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:site\" content=\"@smallake\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Directional-Change\uc640 Intrinsic Time | \uadf8\ub300\uc548\uc758\uc791\uc740\ud638\uc218\" \/>\n\t\t<meta name=\"twitter:creator\" content=\"@smallake\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/smallake.kr\\\/?p=26322#article\",\"name\":\"Directional-Change\\uc640 Intrinsic Time | \\uadf8\\ub300\\uc548\\uc758\\uc791\\uc740\\ud638\\uc218\",\"headline\":\"Directional-Change\\uc640  Intrinsic Time\",\"author\":{\"@id\":\"https:\\\/\\\/smallake.kr\\\/?author=1#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/smallake.kr\\\/#person\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/smallake.kr\\\/wp-content\\\/uploads\\\/2019\\\/02\\\/c34ee5557f8ef00287074df6be28a5feb0fa5bc0.jpg?fit=2105%2C1600&ssl=1\",\"width\":2105,\"height\":1600},\"datePublished\":\"2019-02-13T10:37:52+09:00\",\"dateModified\":\"2019-02-13T10:37:52+09:00\",\"inLanguage\":\"ko-KR\",\"commentCount\":2,\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/smallake.kr\\\/?p=26322#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/smallake.kr\\\/?p=26322#webpage\"},\"articleSection\":\"\\ud2b8\\ub808\\uc774\\ub529\\uc804\\ub7b5, Direction Change, Intrinsic Time, Olsen, \\ud2b8\\ub808\\uc774\\ub529\\ubaa8\\ub378\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/smallake.kr\\\/?p=26322#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/smallake.kr#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/smallake.kr\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/smallake.kr\\\/?cat=7#listItem\",\"name\":\"\\ud2b8\\ub808\\uc774\\ub529\\uc804\\ub7b5\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/smallake.kr\\\/?cat=7#listItem\",\"position\":2,\"name\":\"\\ud2b8\\ub808\\uc774\\ub529\\uc804\\ub7b5\",\"item\":\"https:\\\/\\\/smallake.kr\\\/?cat=7\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/smallake.kr\\\/?p=26322#listItem\",\"name\":\"Directional-Change\\uc640  Intrinsic Time\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/smallake.kr#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/smallake.kr\\\/?p=26322#listItem\",\"position\":3,\"name\":\"Directional-Change\\uc640  Intrinsic Time\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/smallake.kr\\\/?cat=7#listItem\",\"name\":\"\\ud2b8\\ub808\\uc774\\ub529\\uc804\\ub7b5\"}}]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/smallake.kr\\\/#person\",\"name\":\"smallake\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/smallake.kr\\\/?p=26322#personImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/85bc072c859f1b0c21b1f8ac82394cf817695e7d0f250d2dcfabf8ce7217b415?s=96&r=g\",\"width\":96,\"height\":96,\"caption\":\"smallake\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/smallake.kr\\\/?author=1#author\",\"url\":\"https:\\\/\\\/smallake.kr\\\/?author=1\",\"name\":\"smallake\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/smallake.kr\\\/?p=26322#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/85bc072c859f1b0c21b1f8ac82394cf817695e7d0f250d2dcfabf8ce7217b415?s=96&r=g\",\"width\":96,\"height\":96,\"caption\":\"smallake\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/smallake.kr\\\/?p=26322#webpage\",\"url\":\"https:\\\/\\\/smallake.kr\\\/?p=26322\",\"name\":\"Directional-Change\\uc640 Intrinsic Time | \\uadf8\\ub300\\uc548\\uc758\\uc791\\uc740\\ud638\\uc218\",\"inLanguage\":\"ko-KR\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/smallake.kr\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/smallake.kr\\\/?p=26322#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/smallake.kr\\\/?author=1#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/smallake.kr\\\/?author=1#author\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/smallake.kr\\\/wp-content\\\/uploads\\\/2019\\\/02\\\/c34ee5557f8ef00287074df6be28a5feb0fa5bc0.jpg?fit=2105%2C1600&ssl=1\",\"@id\":\"https:\\\/\\\/smallake.kr\\\/?p=26322\\\/#mainImage\",\"width\":2105,\"height\":1600},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/smallake.kr\\\/?p=26322#mainImage\"},\"datePublished\":\"2019-02-13T10:37:52+09:00\",\"dateModified\":\"2019-02-13T10:37:52+09:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/smallake.kr\\\/#website\",\"url\":\"https:\\\/\\\/smallake.kr\\\/\",\"name\":\"\\uadf8\\ub300\\uc548\\uc758 \\uc791\\uc740 \\ud638\\uc218\",\"description\":\"\\uc0b4\\uc544\\uc628 \\ub0a0\\uc758 \\ud754\\uc801, \\uc0b4\\uc544\\uac08 \\ub0a0\\uc758 \\uae30\\ub85d\",\"inLanguage\":\"ko-KR\",\"publisher\":{\"@id\":\"https:\\\/\\\/smallake.kr\\\/#person\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Directional-Change\uc640 Intrinsic Time | \uadf8\ub300\uc548\uc758\uc791\uc740\ud638\uc218","description":"","canonical_url":"https:\/\/smallake.kr\/?p=26322","robots":"max-image-preview:large","keywords":"direction change,intrinsic time,olsen,\ud2b8\ub808\uc774\ub529\ubaa8\ub378","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/smallake.kr\/?p=26322#article","name":"Directional-Change\uc640 Intrinsic Time | \uadf8\ub300\uc548\uc758\uc791\uc740\ud638\uc218","headline":"Directional-Change\uc640  Intrinsic Time","author":{"@id":"https:\/\/smallake.kr\/?author=1#author"},"publisher":{"@id":"https:\/\/smallake.kr\/#person"},"image":{"@type":"ImageObject","url":"https:\/\/i0.wp.com\/smallake.kr\/wp-content\/uploads\/2019\/02\/c34ee5557f8ef00287074df6be28a5feb0fa5bc0.jpg?fit=2105%2C1600&ssl=1","width":2105,"height":1600},"datePublished":"2019-02-13T10:37:52+09:00","dateModified":"2019-02-13T10:37:52+09:00","inLanguage":"ko-KR","commentCount":2,"mainEntityOfPage":{"@id":"https:\/\/smallake.kr\/?p=26322#webpage"},"isPartOf":{"@id":"https:\/\/smallake.kr\/?p=26322#webpage"},"articleSection":"\ud2b8\ub808\uc774\ub529\uc804\ub7b5, Direction Change, Intrinsic Time, Olsen, \ud2b8\ub808\uc774\ub529\ubaa8\ub378"},{"@type":"BreadcrumbList","@id":"https:\/\/smallake.kr\/?p=26322#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/smallake.kr#listItem","position":1,"name":"Home","item":"https:\/\/smallake.kr","nextItem":{"@type":"ListItem","@id":"https:\/\/smallake.kr\/?cat=7#listItem","name":"\ud2b8\ub808\uc774\ub529\uc804\ub7b5"}},{"@type":"ListItem","@id":"https:\/\/smallake.kr\/?cat=7#listItem","position":2,"name":"\ud2b8\ub808\uc774\ub529\uc804\ub7b5","item":"https:\/\/smallake.kr\/?cat=7","nextItem":{"@type":"ListItem","@id":"https:\/\/smallake.kr\/?p=26322#listItem","name":"Directional-Change\uc640  Intrinsic Time"},"previousItem":{"@type":"ListItem","@id":"https:\/\/smallake.kr#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/smallake.kr\/?p=26322#listItem","position":3,"name":"Directional-Change\uc640  Intrinsic Time","previousItem":{"@type":"ListItem","@id":"https:\/\/smallake.kr\/?cat=7#listItem","name":"\ud2b8\ub808\uc774\ub529\uc804\ub7b5"}}]},{"@type":"Person","@id":"https:\/\/smallake.kr\/#person","name":"smallake","image":{"@type":"ImageObject","@id":"https:\/\/smallake.kr\/?p=26322#personImage","url":"https:\/\/secure.gravatar.com\/avatar\/85bc072c859f1b0c21b1f8ac82394cf817695e7d0f250d2dcfabf8ce7217b415?s=96&r=g","width":96,"height":96,"caption":"smallake"}},{"@type":"Person","@id":"https:\/\/smallake.kr\/?author=1#author","url":"https:\/\/smallake.kr\/?author=1","name":"smallake","image":{"@type":"ImageObject","@id":"https:\/\/smallake.kr\/?p=26322#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/85bc072c859f1b0c21b1f8ac82394cf817695e7d0f250d2dcfabf8ce7217b415?s=96&r=g","width":96,"height":96,"caption":"smallake"}},{"@type":"WebPage","@id":"https:\/\/smallake.kr\/?p=26322#webpage","url":"https:\/\/smallake.kr\/?p=26322","name":"Directional-Change\uc640 Intrinsic Time | \uadf8\ub300\uc548\uc758\uc791\uc740\ud638\uc218","inLanguage":"ko-KR","isPartOf":{"@id":"https:\/\/smallake.kr\/#website"},"breadcrumb":{"@id":"https:\/\/smallake.kr\/?p=26322#breadcrumblist"},"author":{"@id":"https:\/\/smallake.kr\/?author=1#author"},"creator":{"@id":"https:\/\/smallake.kr\/?author=1#author"},"image":{"@type":"ImageObject","url":"https:\/\/i0.wp.com\/smallake.kr\/wp-content\/uploads\/2019\/02\/c34ee5557f8ef00287074df6be28a5feb0fa5bc0.jpg?fit=2105%2C1600&ssl=1","@id":"https:\/\/smallake.kr\/?p=26322\/#mainImage","width":2105,"height":1600},"primaryImageOfPage":{"@id":"https:\/\/smallake.kr\/?p=26322#mainImage"},"datePublished":"2019-02-13T10:37:52+09:00","dateModified":"2019-02-13T10:37:52+09:00"},{"@type":"WebSite","@id":"https:\/\/smallake.kr\/#website","url":"https:\/\/smallake.kr\/","name":"\uadf8\ub300\uc548\uc758 \uc791\uc740 \ud638\uc218","description":"\uc0b4\uc544\uc628 \ub0a0\uc758 \ud754\uc801, \uc0b4\uc544\uac08 \ub0a0\uc758 \uae30\ub85d","inLanguage":"ko-KR","publisher":{"@id":"https:\/\/smallake.kr\/#person"}}]},"og:locale":"ko_KR","og:site_name":"\uadf8\ub300\uc548\uc758\uc791\uc740\ud638\uc218 | \uc0b4\uc544\uc628 \ub0a0\uc758 \ud754\uc801, \uc0b4\uc544\uac08 \ub0a0\uc758 \uae30\ub85d","og:type":"article","og:title":"Directional-Change\uc640 Intrinsic Time | \uadf8\ub300\uc548\uc758\uc791\uc740\ud638\uc218","og:url":"https:\/\/smallake.kr\/?p=26322","article:published_time":"2019-02-13T01:37:52+00:00","article:modified_time":"2019-02-13T01:37:52+00:00","article:publisher":"https:\/\/www.facebook.com\/iumgroup","twitter:card":"summary","twitter:site":"@smallake","twitter:title":"Directional-Change\uc640 Intrinsic Time | \uadf8\ub300\uc548\uc758\uc791\uc740\ud638\uc218","twitter:creator":"@smallake"},"aioseo_meta_data":{"post_id":"26322","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"location":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2020-12-21 05:24:52","updated":"2025-06-05 13:38:41","seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/smallake.kr\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/smallake.kr\/?cat=7\" title=\"\ud2b8\ub808\uc774\ub529\uc804\ub7b5\">\ud2b8\ub808\uc774\ub529\uc804\ub7b5<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tDirectional-Change\uc640  Intrinsic Time\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/smallake.kr"},{"label":"\ud2b8\ub808\uc774\ub529\uc804\ub7b5","link":"https:\/\/smallake.kr\/?cat=7"},{"label":"Directional-Change\uc640  Intrinsic Time","link":"https:\/\/smallake.kr\/?p=26322"}],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/smallake.kr\/wp-content\/uploads\/2019\/02\/c34ee5557f8ef00287074df6be28a5feb0fa5bc0.jpg?fit=2105%2C1600&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/p2yULC-6Qy","jetpack_sharing_enabled":true,"jetpack_likes_enabled":false,"_links":{"self":[{"href":"https:\/\/smallake.kr\/index.php?rest_route=\/wp\/v2\/posts\/26322","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/smallake.kr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/smallake.kr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/smallake.kr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/smallake.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=26322"}],"version-history":[{"count":0,"href":"https:\/\/smallake.kr\/index.php?rest_route=\/wp\/v2\/posts\/26322\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/smallake.kr\/index.php?rest_route=\/wp\/v2\/media\/27238"}],"wp:attachment":[{"href":"https:\/\/smallake.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=26322"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/smallake.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=26322"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/smallake.kr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=26322"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}