kikki-san’s blog

公開備忘録。間違っていることもあるので参考程度にご覧ください。

金利先物の価格表示

金利先物の価格は

100-年利率

で表現されます。

例えば、全銀協のユーロ円TIBOR3ヵ月金利先物は、

「100から年利率(%,90/360日ベース)を差し引いた数値」

が表示価格になると記載があります。

ユーロ円3ヵ月金利先物|法人のお客様へのご案内 |株式会社 東京金融取引所

ユーロ円TIBOR3ヵ月金利先物は価格が0.5ベーシスポイント(0.005)動いた場合に

1250円の損益が発生するようになっています。

要は、金利が0.5ベーシスポイント動いたときに額面1億円に対し、1250円の損益が発生するということです。

100,000,000×0.5/10000×90/360=1,250

実際の例で金利が固定されている様子を見ると以下のようになります。

・96円で5枚ユーロ円TIBOR3ヵ月先物を購入(3か月金利4%、額面5億円)

・決済日に97円になった(3か月金利が3%になった)

この場合の先物の差金決済の利益は、5枚×1250円×100ベーシスポイント÷0.5ベーシスポイント

5×1,250×(9,700-9,600)/0.5=1,250,000

また、5億円を決済日から3%で3か月間運用した場合の金利

500,000,000×0.03×90/360=3,750,000

合計で5百万円になります。

つまり、金利を4%で固定したのと同じことになっています。

500,000,000×0.04×90/360=5,000,000

あまりまとまっていないので、そのうち書き直すかも。

リモートデスクトップ先でリモートデスクトップしたときにctrl+alt+deleteする方法

多重にリモートデスクトップした先でctrl+alt+deleteしたいときに、

キーボードでctrl+alt+deleteすると、

一番最初にログインした(ローカル)環境でctrl+alt+deleteされてしまいます。

リモート先でする場合には、以下のようにします。

ローカルの1つ先のリモートデスクトップ環境

⇒リモート環境でctrl+alt+end

ローカルの2つ以上先のリモートデスクトップ環境

⇒ctrl+alt+endしたい環境の1つ手前のリモート環境でソフトウェアキーボードを起動

⇒ctrl+alt+endしたい環境でソフトウェアキーボードでctrl+alt+end

ソフトウェキーボード(スクリーンキーボード)は、コントロールパネルの簡単操作から有効にできます。

javaでbitflyer apiを使ってみた

javabitflyerのPublic APIを使ってみたのでメモ。

ビットコイン取引所【bitFlyer Lightning】

BTC_JPYのTicker情報を取得して表示しているだけですが。

URLのproduct_code=BTC_JPYのBTC_JPYを書き換えると、他の通貨の情報も取れます。

User-Agentを指定しないと、なぜか403エラーになるので、Dummyを設定しています。

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class GetTicker {
    public static void main(String[] args) {

        String getTickerUrlStr ="https://api.bitflyer.jp/v1/getticker?product_code=BTC_JPY";
        HttpURLConnection connection = null;
        StringBuffer result = new StringBuffer();

        try {

            URL getTickerUrl = new URL(getTickerUrlStr);
            connection = (HttpURLConnection)getTickerUrl.openConnection();
            connection.setRequestProperty("User-Agent", "Dummy");
            connection.setRequestMethod("GET");
            int status = connection.getResponseCode();

            if (status == HttpURLConnection.HTTP_OK) {

                InputStream in =  connection.getInputStream();
                String encoding = connection.getContentEncoding();

                if(encoding == null) {encoding = "UTF-8";}

                InputStreamReader inReader = new InputStreamReader(in, encoding);
                BufferedReader bufReader = new BufferedReader(inReader);
                String line =null;

                while((line = bufReader.readLine()) != null) {
                    result.append(line);
                }
                bufReader.close();
                inReader.close();
                in.close();

            }else{
                System.out.println(status);

                InputStream in =  connection.getErrorStream();
                String encoding = connection.getContentEncoding();
                if(encoding == null) {encoding = "UTF-8";}
                InputStreamReader inReader = new InputStreamReader(in, encoding);
                BufferedReader bufReader = new BufferedReader(inReader);
                String line =null;

                while((line = bufReader.readLine()) != null) {
                    result.append(line);
                }
                bufReader.close();
                inReader.close();
                in.close();

            }

        }catch (Exception e) {
            e.printStackTrace();

        }finally {
            if (connection != null) {
                connection.disconnect();
            }
        }
        System.out.println(result);
    }
}