ラベル

AI Forecast 8306MUFG (287) Social (77) life (75) Financial (67) IT (60) Proposal (56) idea (50) Fund Management (49) AI (43) Trading (43) economics (43) Covid-19 (40) Hedge Fund (37) Risk (36) Culture (31) BOJ (29) Science (28) hobby (25) accounting (17) Apps (16) Travel (14) career (11) job (7) Hiking (5) emotion (5) music (3) Statarb (2) piano (2)

2019年6月22日土曜日

妙義山石門巡りハイキング Mt. Myohgi Stone Gate Trail Hiking

妙義山石門巡りハイキング

Mt. Myohgi Stone Gate Trail Hiking 


子供と妙義山の石門巡りを日帰りハイキングしてきた。Went down to day hiking to Myohgi-san (Mt.Myohgi) stone gate trail with kids.

東京から電車で2時間で高崎。そこからレンタカー妙義公園駐車場へ1時間。Two hours by train from Tokyo to Takasaki.   Another one hour rental car drive up to Myohgi-san park parking.

JR信越本線の松井田駅からのバスは妙義神社へしか行かないので、妙義公園駐車場へはレンタカーがベター。 Bus from JR Matsuida station (Shinetsu-Honsen) goes only to Myohgi-shrine hence rental car is better to go Myohgi-san park parking.



妙義山が遠くに見えてきた。Myohgi-san started to look afar. 


ノコギリ状の山々がかなりはっきり見えてきた。Zigzag mountain top started to look  very much distinct.


妙義公園駐車場へ到着。石門巡りは駐車場のすぐ上。Arrived at Myohgi-san park parking. Stone gate trail is right above the parking space.


来た道を若干戻ると、Backtracking the road a bit, 


登り口が見えてくる。You will see the entrance to the trail.


案内図があちこちにあり迷子にはならない。No chance to get lost since signs are everywhere. 



上の地図の緑ラインをすべて歩いて戻ってくるコースにした。Decided to take all green line trails on the map above.



多くのクサリ場があり、子供は大喜びだが、危険なのは間違いない。注意して登る。Lots of climbing chain works. Kids were excited but definitely dangerous.  Keep climbing carefully.




大砲岩近く。Near cannon rock.





やっと帰り道。無事でよかった。Finally way back to start point. Happy to be safe. 




中之獄神社の階段。Stairs of shrine Nakanogoku.



境内を通って駐車場へ。To the parking lot through shrine. 


電車+レンタで日帰りハイキングができた。ただ、正直な感想として、このコースは経験者向けで、体力に自信がない場合は避けるのが賢明だと思った。実際、重大事故も起きているようだ。One day trip hiking completed by train & rental car.  However, honestly speaking, I felt this trail is for experienced person, hence it is better to avoid if not really confident about oneself physically. Looks there were actually some serious accidents happened in the past. 

2019年6月21日金曜日

秦野ー鶴巻温泉ハイキング Hatano-Tsurumaki Hotspring Hiking

秦野ー鶴巻温泉ハイキング 

Hatano-Tsurumaki Hot-spring Hiking


 東京中心から1時間半ぐらいの秦野丹沢の麓町だ。Hatano city. An hour and a half train ride from central Tokyo. This is a town at the foot of Tanzawa mountain area.


水はきれい。秦野の町中を流れる水無川は整備された上下水道のせいか透明度が高い。Water is clear. Mizunashi-river running through center of Hatano is clean probably due to well build sewage system. 


小田急電鉄の「小田急沿線 自然ふれあい歩道 コースマップ」を秦野の駅舎でもらい、弘法山経由、鶴巻温泉への1時間半のコース確認。Got hiking map `Odakyu-line Nature walking course map` at Hatano-station and confirmed 1 and a half hour hiking course to Tsurumaki-hotspring through mount Kohboh. 


 急坂を20分ほど登って、弘法山山頂へ到着。Arrived at the top of Kohbo mountain after climbing steep trail 20 minutes.


 江の島、伊豆半島、富士山が一望できる。一休みしてお弁当。 Panorama covering Enoshima-island, Izu-peninsula, mount-Fuji. Rested for lunch. 


帰りは里山の水田に降りると、オタマジャクシがいっぱい。Went down to rice paddy and found lots of tadpoles.


水田の横にはシオカラトンボも。Also found Shiokara-dragonfly by the rice paddy.


あとは、急行でひと眠りすると新宿到着! Woke up from short nap on the train to find arrived at Shinjuku-station.

VaR変化の要因分析 VaR Change Attribute Analysis

VaR変化の要因分析

English Follows


銀行の市場リスク管理部に勤めるあなたが、ある日会社に行ってシステムを見ると、あれあれ? VaRが突然増えた!なにが起こったんだ? なにも新規のトレードはしていないのに。

もし、金利系商品を扱っているなら、まず、金利レベルの変化に注目。それは、方法は問わず、金利系の場合のvolatilityは、年率%換算のvolatility表示に、現在の金利レベルを掛けて計算されるからだ。

金利が1%近辺で5bp動いてもVaR変動は5%だが、金利が5bp近辺の場合、5bp動くとVaRの変動は100%(2倍)になってしまう。

VaRの計算方法にはいくつかある。また、対象商品によって計算方法が若干異なる。ざっくり言って、
  • VCVの場合
       FixedIncomeの場合 
       VaR
  = BPV X 2.33(C.I.99%) X Vola(%pa) / sqrt(240) X Current MarketLevel(bp)
  Equityの場合 
         VaR = Position X 2.33(C.I.99%) X Vola(%pa) / sqrt(240)

  • Historicalの場合
   FixedIncomeの場合 
        VaR =
          Percentile ( BPV X  HistoricalDailyChange(%) X Current MarketLevel(bp) )
     Equityの場合 
          VaR = Percentile (Current Position amt X HistoricalDailyChange(%) )

  • MonteCarloの場合
      FixedIncomeの場合 
         VaR = BPV X SimulationChange(%)  X Current MarketLevel(bp)
  Equityの場合 
         VaR = Position X SimulationChange(%)   

この他、チェックポイントとしては、

1)為替変動がベース通貨に対し再評価による変動を与えていないか?
2)Historicalの場合、シナリオの変化で説明できないか?
3)マーケットデータ採取は適切か?Bidしかない場合、Bidを使っていないか?

VaR Change Attribute Analysis


 One day, you , as a market risk manager of bank, go to office and open up system then find out that VaR increased suddenly! Oh my god, what is going on? No new trade done.

If you deal with fixed income products, check the level change of interest rate 1st. It is because, irrespective of methodologies, the volatility of fixed income products is calculated as a product of interest rate level and annualized % based volatility quote.

If interest rate of the market is around 1% and it increased 5bp, then VaR will increase 5% however, if interest rate is around 5bp and it increased 5bp, VaR will increase for 100%(doubles).

There are couple of approach to calculate VaR.  Calculation method will differ a bit by products. In nutshell, roughly,
  • VCV`s case  
      FixedIncome's case 
       VaR
  = BPV X 2.33(C.I.99%) X Vola(%pa) / sqrt(240) X Current MarketLevel(bp)
  Equity's case 
         VaR = Position X 2.33(C.I.99%) X Vola(%pa) / sqrt(240)

  • Historical's case
   FixedIncome's case 
        VaR =
          Percentile ( BPV X  HistoricalDailyChange(%) X Current MarketLevel(bp) )
     Equity's case 
       VaR = Percentile (Current Position amt X HistoricalDailyChange(%) )

  • MonteCarlo's case
      FixedIncome's case 
         VaR = BPV X SimulationChange(%)  X Current MarketLevel(bp)
  Equity's case 
         VaR = Position X SimulationChange(%)   

Other check points are,

1) FX change might have impact against denominating base currency used
2) Scenario transition might have impact when historical simulation is used
3) Check if market data is taken properly such as taking only bid when only bid is available etc.

2019年6月20日木曜日

統計的裁定(StatArb)ポートフォリオの例 StatArb (Statistical Arbitrage) Sample Portfolio

統計的裁定(StatArb)

ポートフォリオの例

English follows


統計的裁定ポートフォリオの簡単な例を見てみよう。

下図のように、東京証券取引所(TSE)上場の1812鹿島(建設)6103オークマ(工作機械)7951ヤマハ( 民生機械)を取り上げてみる。


ここで、この時系列の株価の共分散行列は次のようになる。 


固有値、固有ベクトルは、次のようになる。


固有値が最大の有為なモードの固有ベクトルを見ると、(0.32, 0.46, 0.83)と、同一方向への振れとなっている。これは、株1812が0.32動くと、株7951が0.83動く、即ち2.6倍動く(=0.83/0.32)ことが多いことを示唆している。散布図(下図)を見ても、傾きがおおよそ2.6倍になっていることが確認できる。


ここで注意するべきは、この固有ベクトルに時間軸はないことだ。解析対象は観測した母集団全体の平均値からの偏差のみである。この結果から周期性は分からない。よって時間軸の情報はないので、相場の時間軸上のタイミングも分からない。

一つの単純なペアトレードのスキームとして、株1812の一日の動きの2.6倍だけ株7951が動くことが多いことを利用して、乖離が激しい場合、さやが開いたと判定し、ポジションを立てる(取引を開始する)。2次元以上の場合も同様である。

この例だと、1月18日に株1812が57円下がっているため、株7951は151円下がるはずなのが、実際は10円上がっている。なので、乖離は161円で、仮に設定した閾値100円を超過している。よって、株1812は、株7951から見ると下がりすぎ(本当は上昇してほしい)だ。結果として作るポジションは下がりすぎの株1812を買って、見合いの株7951を売るものになる。1単位買った株1812のCF(キャッシュフロー)はマイナス、空売りした株7951のCFはプラスである(証拠金は省略)。空売りする株7951の単位数は、株7951の相対感度2.6で割ることで作ったポジションを市場中立にする。立てたポジションの反対売買執行条件は、乖離が逆方向に閾値-100円を超えて動いた場合である。

リスク量はシステミックリスクをオフセットする市場中立型であるため、アウトライトよりシステミックリスク部分だけ少ないスプレッドリスクのみである。

なお、ここで考慮していない事項をランダムに列記した。

1)証拠金の金利コスト、もろもろの市場・決済規制
2)流動性チェック(ポジション量は一日当たり平均取引高の1/100程度など)
3)注文タイミング(終値ベースで注文翌日成り行きなど)
4)時間軸(ミリ秒か、1時間か、1日か、観察時間など)
5)複数銘柄、複数資産からテストランを行い、有為な資産の組み合わせを選択する処理
6)システム対応(グローバルリアルタイムモニタリング&自動運用など)
7)閾値および損切レベルのシミュレーションによる最適化
8)ファンダメンタルズ分析(固有ベクトルの論理的理由がもし分かれば)
9)市場価格の正規化(価格が桁違いの商品の組み合わせの場合など)



Stat Arb (Statistical Arbitrage)  Sample Portfolio


Let's look at a simple portfolio of Stat Arb.

As shown below, we take TSE(Tokyo Stock Exchange) listed stock 1812 Kajima (construction), stock 6103 Ohkuma (mother machinery) and stock 7951 Yamaha (retail electronics/machine).


Here, co-variance matrix of stock price is calculated as below.


Corresponding eigen values and eigen vectors are shown below.


If we look at the eigen vector with maximum eigen value with maximum significance, (0.32, 0.46, 0.83) indicates the variation to same direction. This means if stock 1812 moves times 0.32, then stock 7951 moves times 0.83, i.e., tends to move 2.6 times (= 0.83/0.32).  Same can be observed in scatter plot below indicating gradient of around 2.6 times.


Need to be careful here that there is no time axis context to this eigen vector.  Object of analysis is a deviation from average only in the observed population. Thus, there is no time axis information, nor market entry timing information. 

One simple trade scheme on pair trade basis here is to trade by making use of 2.6 times bigger sensitivity of stock 1812 compared to stock 7951. If deviation of real price change from statistical change is bigger, judge that spread is widened, then create position (start trading). All these apply the same for the case where dimensions are higher than two here. 

In this example, stock 1812 dropped JPY57 on Jan 18th, hence stock 7951 should have dropped JPY151 (=57*2.637) however, it has gone up JPY10 instead. Hence deviation is JPY161 and exceeding the temporal threshold set as JPY100.  Thus, position to be created is to buy oversold stock 1812 and short-sell corresponding stock 7951. The CF (Cash Flow) for 1 unit buy of stock 1812 is minus, while CF for short sold stock 7951 is plus (ignoring margin). The units of short sold stock 7951 should be divided by relative sensitivity of 2.6 to make final position(portfolio) to be market neutral. The condition for portfolio unwinds is the deviation of market to opposite direction over threshold level of -JPY100.

Risk amount is less than outright portfolio for systemic risk due to offsetting nature of portfolio leaving only spread risk.

Put some notes below in random to be considered but not touched here.

1) Interest rate cost for margins, rules and regulations of market
2) Market liquidity check (such as position size limit < 1/100 of daily volume)
3) Order timing (use end of day price to decide, then trade next morning etc)
4) Scope of time span (millisecond or hour or day, observation period etc)
5) Workflow to choose multiple assets, names, and test to decide portfolio
6) System development (such as for global real time monitoring & auto trading)
7) Threshold to judge buy/sell as well as threshold to decide loss cut
8) Fundamental analysis (on the composition of eigen vector)
9) Normalization of market price (when combining numbers in different scale)


2019年6月12日水曜日

廃校小学校の幼稚園、保育園への無償開放/小子化問題への切り札 Re-Use of Closed Public Schools for Day Nursery - How to Stop Declining Birth Rate -

廃校小中学校の幼稚園、保育園への無償開放
ー小子化問題への切り札ー

(English Follows)




現在、小子化により、公立小中学校の統廃合が進んでいる。廃校になった校舎が都内に散見され、長期にわたり放置されている。一方、子供を持つ女性の社会進出は、幼稚園、保育園の不足により、阻まれている。

これを、少ないコストで一気に解決するのが、廃校となった公立小中学校の、幼稚園、保育園への無償開放である。

予算をかけずに、頭を使って社会の新しい仕組みを作り出すのが、真の政治の使命である。


利点
  • 事業者にとってコストが抑えられ、進出意欲が増す
  • 新規事業により新規雇用も生まれる
  • 幼稚園、保育園の環境が改善できる
  • 公共財を無駄に寝かせておかず、真に必要な目的のために活用できる
  • 女性の社会進出が大幅に支援される
  • 子育ての障壁が減った女性は一人であきらめていた子供を二人以上産むようになる
  • 結果的に小子化問題は解消する

Re-Use of Closed Public Schools for Day Nursery 
- How to Stop Declining Birth Rate - 



Due to declining kids population, number of public elementary and junior high schools are closed or consolidated. There are lots of closed school buildings in Tokyo metropolitan area left deserted for no use. Meanwhile lots of women with kids cannot go to work due to lack of day nursery.

Offering this unused public facility free to nursery industry will solve the problem with minimum cost.

It is a mission of politics to create social frameworks with minimal expenditure.

Advantages

  • Higher cost reduction incentive for nursery enterprise
  • New job creation in nursery industry
  • Can improve squeezing infrastructure of nursery in Tokyo metropolitan area
  • Can stop public assets left deserted and unused
  • Great assistance for women with kids to go work
  • Woman who gave up to have two kid can afford extra kid
  • As a result, can stop declining birth rate

歴史を繰り返すな/裸の資本主義の終わり Don't Repeat History/End of Naked Capitalism

歴史を繰り返すな/裸の資本主義の終わり 
English Follows




資本主義は便利で合理的なツールだ。

でも、裸で適用すると、社会の二分化・不安定化をもたらし、共産主義、社会主義を生んだ。

この失敗からの反省で、資本主義にも、組合、累進課税、さまざまな工夫がされた。

一方、共産主義、社会主義は、非効率(と、独裁による腐敗の蔓延)で失敗した。この反省で、共産党は市場・資本原理を取り入れた。


歴史は証明した。裸の資本主義も、裸の共産主義、社会主義もうまくいかないのだ。


もう、歴史を繰り返すのはやめよう。 均衡点を探そう。


Don't Repeat History/End of Naked Capitalism



Capitalism is a convenient and efficient vehicle.

But its straight forward application made society dichotomized then unstable, eventually invited communism/socialism.

Lesson learned from this failure resulted in lots of amendments on capitalism such as union, progressive tax etc.

Meanwhile, communism and socialism failed by inefficiency(and corruption due to dictatorship), then later incorporated market&capital mechanism.

History proved. Neither naked capitalism nor naked communism/socialism works.

Let`s not repeat history. But look for point of equilibrium.

Initially wrote on 2015/04/26 16:19

2019年6月11日火曜日

マイナンバーの全面展開 National ID number Full Application to Japan

マイナンバーの全面展開

English follows


マイナンバーが徐々に導入されつつある。

効率的であることはわかっていても、様々な理由で導入は遅れた。

結果、年金は管理不能となり、土地は相続で細分化され所有者も不明になった。

誕生、結婚、離婚、転居、戸籍、登記、課税、出入国、医療情報 などなど、個人を特定する通し番号なしに、別々に管理してきた。

コンピューターとかデータベースを少しでもかじったことがある人なら、これは統一キーなしに複数のデータベースシステムを整合性を維持するように設計しろと言われているのと同じことが分かる。ミッションインポッシブルだ。

役所では、類似の情報を何度も記載する。病院では、何度も同じ検査をする。年金管理は不能になる、未利用の土地が増殖する、徴税が難航する等々。

時代遅れの冗長な情報管理に、国民は膨大なコストを払っているとも言える。

ただ、冗長性は一方、安全性を担保することも事実だ。なりすまし犯は、整合性を維持するため、冗長なすべての全く互いに異なる古いシステムを一つ一つ改竄する必要がある。だが、個人を特定する通し番号によるシステムだと、最初のなりすましに犯人が成功すればすべてを一挙に改竄されてしまうため、工夫が必要だろう。

マイナンバーは、本人認証技術的があるレベルに達しないと、運用は難しいだろうが、銀行の生体認証が実用化されている現在では、条件は満たされている。

日本を国民番号で最も成功した国に変えてみてはどうだろうか。

National ID number Full Application to Japan




Japanese National ID (called 'My Number') is under gradual implementation. 

Everybody knew that it was efficient but implementation has been delayed due to various reasons. 

As a result, pension management became impossible, while lands ownership were split into pieces as inheritance goes on, then eventually became hard to track. 

Birth, marriage, divorce, moving, national registration, notarization, taxing, immigration, medical info, etc., have been managed without the use of serial number to identify individuals. 

If someone with even a little bit of knowledge on computer or data base, it is easy to see that such setup is similar to design multiple data base systems keeping consistency in-between without the use of uniform 'key'.  This is mission impossible. 

Government office requests multiple identical information over and over. Hospital performs identical medical examination many times. Pension tracking become impossible. Unused land increases. Taxing become difficult, etc. 

Japanese are paying tremendous cost due to redundant and old-fashioned information management. 

However, we also should aware that such redundancy sometimes provides safety of the system. It is because spoofers need to falsify consistently all redundant old systems to avoid detection.  However, in the case of optimized uniform unique national ID adoption, spoofers only need to falsity one unified number.  Hence, we need enhanced security to stop that to happen.  

National ID may be hard to put in production unless personal identification technology develops to certain level, but I believe such condition is already satisfied by looking at bio-metrics identification done for bank ATM today. 

Japan can be the most successful country for national ID implementation. 

2019年6月10日月曜日

株主の手に、監査法人の選定権限を Stock Holders to choose Auditor

株主の手に、監査法人の選定権限を

English Follows



監査法人の選定権限は、現在、世界的に、監査される側の会社にある。

相互牽制の観点から、合理性を欠いた慣習が、未だ続いている。

会社は自分に都合の良い監査報告を行う監査法人を選ぶことができる。

監査法人が株主に対し重要な未公開の事実を発見したものの、その発表を拒まれた時できる唯一の抵抗は、辞任だ。

これは、あまりにも弱い相互牽制の枠組みだ。

解決策は、監査法人の選択権限を、会社から株主、債権者へ移管することだ。

監査法人の顧客は会社でなく、株主、債権者となる。

監査法人は様々な縛りから解放され、より良い資本主義の発展に資する。

日本は世界に先駆けて、新しい仕組みを採用してはどうだろうか?

Stock Holders to choose Auditor 




The authority to choose auditor sits globally, on the side of company that is audited. 

Irrational custom has been kept going from check and balance point of view. 

Company can choose "convenient" accounting firm that publish audit report as company wish.

The strongest measure auditors can take, when they are rejected to publish important findings to be disclosed to stock holders and lenders, is resignation. 

This is too weak check and balance framework. 

Solution is to move authority to choose auditor, from company to stock holders and lenders.

Then customer of audit firm will not be the company anymore but stock holders and lenders.

Auditor will be released from all stress/pressures to contribute further development of capitalism. 

Why not Japan to be the 1st country to adopt such new framework? 

2019年6月8日土曜日

商業銀行の市場リスクと流動性リスクの関係 Link between Market Risk and Liquidity Risk of commercial banks

商業銀行の市場リスクと流動性リスクの関係

English Follows



商業銀行の収益源として、銀行勘定での長短ギャッピングがある。

長短ギャッピングとは、長期の高金利貸出を短期の低金利預金の借換えで賄うことで、(長期金利ー短期金利)=金利差が利益となる。ここで、イールドカーブは順イールドを前提とする(長期金利>短期金利)。

長短ギャッピングによる市場リスクと流動性リスクの関係はちょっとだけ面白い。

ここで、市場リスクは、持っている資産の値洗い価値が減額し、損失が資本を超過する債務超過になるリスク。

一方、流動性リスクは、支払い当日になっても、資金不足で債務不履行になるリスク。(流動性リスクにはもう一つ別の意味があって、板が薄くて売ろうにも売れないリスクがあるが、これは今は考えない。)

市場リスクと流動性リスクとも倒産につながるところは同じだが、性質上、市場リスクと流動性リスクはあまり関係ないように思える。ところが、銀行勘定のリスク管理においては、密接な関係がある。

それは、長期の債権投資を短期の調達でファンディンクすればするほど、金利リスクPV01およびVaR(市場リスク)は増大し、かつ、流動性リスクも増大し、逆に、長期の債権投資を仮に同一満期の長期調達でファンディングする場合(Matched Funding)、金利リスクは打消し合い、流動性リスクもなくなるからだ。

リスクリターンの側面からは、長短ギャップリスクを最大化すると、利益は最大化するがリスクも最大化する。逆に長短ギャップを最小化すると、リスクは最小化されるが利益も最小となるのだ。

ここで実際に計算をした例を見てみる。

今日現在の時点で、1年までのキャッシュフローと、対応する累積CFと金利感応度PV01およびVaRが次のようになるとする。1M時点での累積キャッシュフローがー100なので、1Mの時点ですでに流動性リスクがある(1Mまでに手当しないと倒産する)ことが分かる。


ここで、D1(翌日)のキャッシュのインフローは、D1満期の諸々の決済分に加え、Nostroからのインフローも含む。1Yのキャッシュフローがプラス900になっているのは、投資が満期になるためである。

さて、3Mのキャッシュフローを変化させることで、累積流動性リスク量と、市場リスク量(PV01、VaR)の関係を見てみる。 Min Cumulative CF($mn)とあるのは、D1-1Yの間の最大のギャッピング量(累積キャッシュフロー)を示している。ギャッピング量が増えるに連れ、市場リスク量も増大しているのが分かる。






Link between Market Risk and Liquidity Risk of Commercial Banks 





One of income source for commercial bank is a long-short tenor gapping on banking account.

Long/short term gapping means to fund long tenor high interest rate asset by short low interest rate deposits, generating income (long term interest rate - short term interest rate) = interest rate difference become profit. Here assuming normal yield curve (i.e., long term interest rate > short term interest rate).

Under long/short term gapping, there is a little bit interesting relationship between market risk and liquidity risk.

Here, market risk means a risk of going default as a result of excessive loss over equity after market to market loss recognition of holding assets.

Meanwhile, liquidity risk means going insolvent at payment date due to lack of funds. ( Liquidity risk has another meaning, i.e., too thin market to sell assets, however it is out of our scope now in this discussion.)

Both market and liquidity risk leads to default however, at a 1st glance, they do not look relating to each other.  But actually, there is a close relationship between those at banking risk management.

It is because, the longer tenor placement is funded by shorter deposits, market risk PV01 as well as VaR increases as well as liquidity risk, meanwhile however, if matched funding(same tenor for both placement and funding) is used, both market and liquidity risk disappears due to offsetting of placement and funding.

Also from risk/return perspective, if we maximize long/short gapping risk, profit is maximized but risk will also become maximum. In opposite, if long/short gapping is minimized, risk is minimized but profit will also go minimum.

Let's take a look at some sample I made up.

Let's assume that, as of today, cash flow up to 1yr and corresponding cumulative cash flow, interest rate sensitivity PV01 and VaR will go as in below table. 1M cumulative cash flow is -100, hence 1M point already has liquidity risk, i.e., if nothing is done before 1M comes, we go default. 


Here, D1 (next day) cash inflow includes both settlement on that day as well as inflow from nostro.  1Y cash flow of plus 900 shows maturity of investment (placement). 

By varying 3M cash flow, we can see relationship between cumulative liquidity risk amount and market risk amounts (PV01, VaR). Minimum Cumulative CF ($mn) indicates maximum gapping (cumulative cash flow) between D1-1Y period. It is observed that as gapping increase, market risk increases. 






2019年6月7日金曜日

遺伝的アルゴリズム 5分で理解 Genetic Algorithm 5 min Real Understanding

遺伝的アルゴリズム 5分で理解

English Follows



遺伝的アルゴリズムは、生命の進化のメカニズムを模した、最適化問題を解くための手順である。具体的な適用例についてはすでに多くのサイトで紹介されているので、ここでは、遺伝的アルゴリズムが一体何をやっているのか?なんで答えがでるのか?について簡略に説明したい。

一般的に、最適化問題の解法にはN次元ニュートンラプソン(再急降下法)が用いられてきたが、不連続な関数には対応できないし、ローカルミニマムに陥るなど、汎用性を欠いていた。

遺伝的アルゴリズムは、結婚、突然変異、継承、適者生存という進化の仕組みを模倣することで、N次元の解の空間を効率的に絞り込み、グローバルミニマムの探索を可能にした。

遺伝子記号は、A・G・C・Tという4進数の塩基配列の組み合わせからなる。生物の個体の多様性はこの塩基配列の違いだけだ。そしてその配列は、結婚、突然変異により個体ごとに変わり、自然環境が適応しない個体を淘汰する。

遺伝的アルゴリズムではこれを真似て、解の空間を有限個数に細分化し、n進法の数のベクトルで表わす。まず、第一世代は多数の個体を乱数で発生させ生成、その後、その個体同士を結婚(n進法数の桁の上半分と下半分の交換)、突然変異(乱数で数字をわざと乱す)、継承(そのまま引き継ぐ)し、結果を目的関数にかけて、結果が悪いものを淘汰することで、第二世代を作る。

第一世代はN次元空間に一様に散布された状態だが、世代を経るごとに、グローバルミニマムに集中してくる。十分に集中した時点で解が求められたことになる。

余談だが、この出来すぎた生命の進化の仕組みを見て、背筋が寒くなるのは私だけだろうか?

Genetic Algorithm 

5 min Real Understanding




Genetic algorithm is a procedure to solve optimize problem mimicking mechanism of life evolution.  Since practical applications are already introduced extensive in other sites, here I wish to focus what it is all about and why we can get solution out of this procedure.

In general, N-dimensional Newton Raphson method (steepest gradient method) has been used for optimization problem however, it could not cope with noncontinuous function and also easy to fall into local minimum, thus lacked robustness.

Genetic algorithm made search of global minimum possible by mimicking the mechanism of evolution, i.e., marriage, mutation, inheritance and survival of fittest, then narrow the solution of N dimensional space efficiently.

Genetic code is composed of combination of quaternary (A, G, C, T) base sequence.  Individual variation comes only from the difference of sequence.  Then the sequence differs by individual due to marriage, mutation while keeping only fittest.

Mimicking this framework, Genetic Algorithm makes finite discretization of the solution space representing in vector of n-ary system. 1st generation is made randomly, then let them get married (exchanging upper-half/lower-half digits), mutated (disturb digits randomly), inherit (no change), then apply to objective function to keep better fit ones mainly to be the 2nd generation.

1st generation looks uniformly spread over population in N-dimensional space, while as generation goes by, population will converge concentrating close to global minimum.  Solution is obtained once we see sufficient convergence.

By the way, is it only me who feel a bit shivering by revisiting this too-well-made mechanism of life evolution? 

2019年6月3日月曜日

未来の科学者たちへ To Future Scientists

未来の科学者たちへ

English Follows



 未来の科学者の挑戦課題はなんだろう? ここにいくつかの提案がある。


1)遺伝子の仕組み完全解明
  
  今、遺伝子の塩基配列は解明できたものの、いったいそれが何を意味するのか、部分的にしかわかっていない。あまりにも良く出来すぎた生命・遺伝の仕組み。 解明に挑戦しない手はないだろう。

2)脳の仕組みの完全解読

  精神とはなんだろう?脳の仕組みを完全解明することで、人間が見えてくる。 そして完成した脳のシミュレータは、精神をも生むのだろうか?

3)物質、時空の解明

  物理学は現状の物質・時空の仕組みを解明する。しかし、だれが何の意図でその仕組みを作ったか?仕組みを作ったものを作った物はだれか? 謎は永遠に続く。


以上、諸君の検討を祈る!


To Future Scientists





What will be the agenda for young scientist. Here are some proposals.


1)Complete understanding of gene codes
  
  Nowadays we know order of gene codes however, we only partially know what those codes means. Too well-made mechanism of life/gene. You cannot wait to challenge to find out what that is. 

2)Complete understanding of brain mechanism

  What is the spirit?  We start to see what is human being through complete analysis of brain mechanism. The brain simulator will have spirit? 

3)Complete understanding of time-space mechanism

  Physics explains how time space & material are build but does not explains who made it for what purpose.  Also, nobody knows who made those who made our world? Mystery continues. 

I wish your best of luck!

2019年6月2日日曜日

ニューラルネット 実験環境で遊ぶ Play on Neural Net Playground

ニューラルネット 実験環境で遊ぶ

English Follows

テンソルフローが提供しているニューラルネットで遊べる環境があるので、遊んでみよう。推定するテスト関数(教師データ)は次の4つから選ぶ。


ここで一番難しい渦巻き(上図4)を選んでみる。入力を前処理(下図では2乗、積、SIN/COSなど)した関数を与えると、非線形部分を関数が受け持ってくれるので、前処理関数がテスト関数に当たっていればニューロン数は少なくて済む。当たるというのは、渦巻きに関係ある関数かどうかという意味である。

下の例では、収束計算8,027回後に、オレンジと水色が概ね入力データを正しく包み収束していることが分かる。


ただ、このような前処理の関数を与えてしまうと、問題が特定されている場合はより少ない負荷で収束することができるが、これは人が関数選択に介入しているため、ニューラルネットの価値が半減している。

では、ニューラルネットにガチで学習させるとどうなるだろうか?下図の例では、前処理の関数を無くし、入力はXのダイレクトのみ。その代わりに、中間層のニューロンを4つ増やしている(因みに中間層を増やさないと収束しない)。収束計算6,788回後に、オレンジと水色が概ね入力データを正しく包み収束していることが分かる。


以上の実験で、ニューラルネットはニューロンおよび層の数を増やせば、どのような関数でも近似的にエミュレートできるであろうことがわかる。


Play on Neural Net Playground


Let's play on neural net playground that Tensoflow provides. Choose test function (teacher data) to learn from four functions provided as below.



Let's choose most difficult function here, i.e., swirl (see 4 in above figure). If pre-processing functions (square, product, sin/cos as in below picture) is provided, since non-linear parts are taken care of by those, if such pre-processing function well hit test function, then less neurons are required. Hit means that pre-processing functions are relevant to the target test function.

In below example, after 8,027 iterations, orange and blue zones correctly wrapped up input data, i.e., convergence was achieved.



However, although such pre-processing function can optimize convergence process when target function is known, it means a human interaction to decide target function, then it makes less value on neural net.

By the way, what will happen if we let neural net makes serious outright challenge?  In below example, pre-processing functions were eliminated, leaving only direct inputs of X. Instead however, neurons were increased by four in hidden layer (unless otherwise it will not converge). After 6,788 iterations, orange and blue zones correctly wrapped up input data, i.e., convergence was achieved.


Above experiment shows neural net can make approximate emulation on any kind of function by increasing number of neurons and hidden layers.