Total Pageviews

2015/02/28

2015/02 Travel

故宮

嘉義市立棒球場

大林車站一隅

Figure out how to start investing.

What it means to buy a company's stock



Bonds vs Stocks

2015/02/13

How to hide column in ng-grid AngularJS

If we are using ng-grid to display data as bellows:

And want to hide issueSeqNo column as bellows:

All you need to do is add visible:false in  issueSeqNo column as bellows:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
  $scope.itemGrid = {
      data : 'itemData',
      selectedItems: $scope.selectedRow,
      columnDefs : [
          { field : 'issueSeqNo', 
            displayName : 'issueSeqNo', 
            width: 120, 
            cellClass: 'text-left', 
            visible:false},
          { field : 'issueSerial', 
            displayName : '公債代號', 
            width: 150, 
            cellClass: 'text-left'}, 
          { field : 'issueDate',   
            displayName : '發行日期', 
            width: 150, 
            cellClass: 'text-left'}, 
          { field : 'debtName',    
            displayName : '公債名稱', 
            width: 600, 
            cellClass: 'text-left'}],
      enableColumnResize :true,
      i18n:'zh-tw',
      multiSelect : false,
      showFooter: true,
      afterSelectionChange: function () {
          if(!angular.isUndefined($scope.selectedRow[0])){
              alert($scope.selectedRow[0].issueSeqNo);
          }
       }
  };


Reference

How to get selected row's value from ng-grid AngularJS in click event

If we are using ng-grid to display data as bellows:


As user click specific row, it should get this row's issueSeqNo and show alert message



 We have a ng-grid like below:
1
2
3
4
5
6
7
 <div class="row text-center">
  <div class="col-sm-12">
    <div class="grid-style" data-ng-grid="itemGrid"
         style="display: inline-block; height: 300px; width: 80%;">
    </div>
  </div>
 /div>

 and our javascript would be
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
   $scope.itemGrid = {
     data : 'itemData',
     selectedItems: $scope.selectedRow,
     columnDefs : [
         { field : 'issueSeqNo', displayName : 'issueSeqNo', width: 120, cellClass: 'text-left'},
         { field : 'issueSerial', displayName : '公債代號', width: 150, cellClass: 'text-left'}, 
         { field : 'issueDate',   displayName : '發行日期', width: 150, cellClass: 'text-left'}, 
         { field : 'debtName',    displayName : '公債名稱', width: 600, cellClass: 'text-left'}],
     enableColumnResize :true,
     i18n:'zh-tw',
     multiSelect : false,
     showFooter: true
 };


If we would like to get selected row's value from ng-grid, just add afterSelectionChange event as bellow:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
  $scope.itemGrid = {
     data : 'itemData',
     selectedItems: $scope.selectedRow,
     columnDefs : [
         { field : 'issueSeqNo', displayName : 'issueSeqNo', width: 120, cellClass: 'text-left'},
         { field : 'issueSerial', displayName : '公債代號', width: 150, cellClass: 'text-left'}, 
         { field : 'issueDate',   displayName : '發行日期', width: 150, cellClass: 'text-left'}, 
         { field : 'debtName',    displayName : '公債名稱', width: 600, cellClass: 'text-left'}],
     enableColumnResize :true,
     i18n:'zh-tw',
     multiSelect : false,
     showFooter: true,
     afterSelectionChange: function () {
         if(!angular.isUndefined($scope.selectedRow[0])){
             alert($scope.selectedRow[0].issueSeqNo);
         }
      }
 };



Reference
[1] http://stackoverflow.com/questions/16911156/how-to-get-the-cell-value-from-ng-grid

2015/02/03

透過信用評等來判斷債券基金的風險

當我們在判斷要購買哪檔債券的時候,第一個會想到風險,風險的大小則是要看該筆債券的投資組合中,各個信用評等的比例

信用評等的目的是顯示受評對象信貸違約風險的大小,一般由某些專門信用評估機構進行。 評估機構針對受評對象金融狀況和有關歷史的數據進行調查、分析,從而對受評對象的金融信用狀況給出一個總體的評價,以下是各個等級:

由下圖可以得知

  • 信用評等越差,違約率越高(但是利差越大)
  • 信用評等越好,違約率越低(但是利差較小)


以「富蘭克林坦伯頓全球投資系列-全球債券總報酬基金美元A(acc)股」這檔債券來說,可以從晨星網站中的投資組合一窺端倪

信用評等又有分屬於投資等級或是非投資等級


由於投資組合中,有一定的比率屬於非投資等級的債券,故有加上此警語「本基金有相當比重投資於非投資等級之高風險債券」


當大部分的投資組合都是信用等級較佳的投資標的,利差可能就會較小,若是信用等級較差的投資標的比較多的話,就有可能賺到比較多的利差。

第一次領薪水就該懂的理財方法書中說的,選擇債券型基金,一定要根據自己期望的投資報酬率與可以忍受的風險,找出最適合自己的投資標的,沒有所謂的對錯,就看你晚上好不好睡。


Reference
[1] http://zh.wikipedia.org/wiki/%E4%BF%A1%E7%94%A8%E8%AF%84%E7%BA%A7
[2] http://tw.morningstar.com/ap/quicktake/portfolio.aspx?PerformanceId=0P00000HPA&activetab=Portfolio
[3] http://www.masterhsiao.com.tw/CatBonds/CreditRating/CreditRating.htm
[4] http://www.books.com.tw/products/0010493110




2015/02/02

Generating entities from tables in Eclipse


Using this following procedure to generate Java persistent entities from database tables. 

1.  File => New => JPA Project => Click Next

2. Assign Project Name => Click Next


3. Click Next


4. Assign Platform and configure database connection => Click Finish


5. The sample JPA project, JPA_Project, had been created


6. Click src => Right Click => New => JPA Entities from Tables


7. Checked the tables which you would like to generate entities => Click Next


8. Click Next


9. Assign package name where your entities would like to place => Click Next


10. Click Finish


11. Check Result


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
package gov.nta.entity.fms;

import java.io.Serializable;
import java.sql.Timestamp;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQuery;

/**
 * The persistent class for the FMS406FF database table.
 * 
 */
@Entity
@NamedQuery(name = "Fms406ff.findAll", query = "SELECT f FROM Fms406ff f")
public class Fms406ff implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @Column(name = "YYY_MM")
    private String yyyMm;

    @Column(name = "REMARKS1")
    private String remarks1;

    @Column(name = "REMARKS2")
    private String remarks2;

    @Column(name = "REMARKS3")
    private String remarks3;

    @Column(name = "UPDATE_DATE")
    private Timestamp updateDate;

    @Column(name = "USER_ID")
    private String userId;

    public Fms406ff() {
    }

    public String getYyyMm() {
        return this.yyyMm;
    }

    public void setYyyMm(String yyyMm) {
        this.yyyMm = yyyMm;
    }

    public String getRemarks1() {
        return this.remarks1;
    }

    public void setRemarks1(String remarks1) {
        this.remarks1 = remarks1;
    }

    public String getRemarks2() {
        return this.remarks2;
    }

    public void setRemarks2(String remarks2) {
        this.remarks2 = remarks2;
    }

    public String getRemarks3() {
        return this.remarks3;
    }

    public void setRemarks3(String remarks3) {
        this.remarks3 = remarks3;
    }

    public Timestamp getUpdateDate() {
        return this.updateDate;
    }

    public void setUpdateDate(Timestamp updateDate) {
        this.updateDate = updateDate;
    }

    public String getUserId() {
        return this.userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

}

2015/02/01

[閱讀筆記] 華爾街刺蝟投資客之投資啟示錄


  1. 一檔好股票是你所能想像的最棒的財富製造機,但是,股市要求你具備勇氣與耐心
  2. 牛市時,誰需要分析師?熊市時,誰需要股票?
  3. 回歸平均值,才是最強大的趨勢;偏差,最終必然會得到修正
  4. 看待投資的正確方法是,看你扣除包括稅負在內所有成本後的報酬率,但是大部分人都不這樣看
  5. 所羅斯曾說: 人類社會財富創造和財富摧毀的週期總是交替循環。財富創造的循環大約延續兩代,也就是延續六十年,隨後無可避免的是三十年的財富摧毀循環期間
  6. 不要以為你的分析模型永遠有用
  7. 絕對不要融資做投資
  8. 複雜系統失敗的原因就是本身的複雜性,失敗的鐵則顯示,大部分事物最後都會失敗。複雜的系統在看來無足輕重的獨立事件發生時會失敗,並透過滾雪球效應,造成慘劇
  9. 測驗一個人是否有一流智慧,就看有沒有能力同時在心理堅持兩種嚴重背離的觀念,卻仍然保持行動能力
  10. 凱因斯曾說:對於完全沒有賭性的人來說,專業投資遊戲極為枯燥、極為可怕;有賭性的人卻必須為自己的天賦,付出代價
  11. 融資源自於人性的貪婪,當失敗時,就會放大其財務損失
  12. Samuel Coleridge曾說: 如果人們能以史為鑑,那我們將得到多少的教訓 ! 但是激情和黨派之見蒙蔽了我們的雙眼;經驗啟示的智慧猶如船尾燈,照亮的,只有身後的波浪