---
# System prepended metadata

title: homework

---

# homework

- 2022/08/19，以單價33.45元買進1張味王（1203）股票，委託單號CB001
- 2022/08/19，以單價57.6元買進3張聯華（1229）股票，委託單號CB002
- 2022/08/19，以單價9.83元買進7張愛之味（1217）股票，委託單號CB003
- 2022/08/19，以單價352元買進10張瑞昱（2379）股票，委託單號CB004
- 2022/08/19，以單價90.7元買進5張陽明（2609）股票，委託單號CB005
## HCMIO

```SQL=
INSERT INTO `hcmio` (`TradeDate`, `BranchNo`,
`CustSeq`, `DocSeq`, `Stock`, `BsType`, `Price`, 
`Qty`, `Amt`, `Fee`, `Tax`, `StinTax`, `NetAmt`, 
`ModDate`, `ModTime`, `ModUser`) 
VALUES ('20220819', 'F62W', '06', 'CB001', '1203', 'B', 33.4500, 1000, 33450.00, 48, NULL, NULL, -33498.00, '20220823', '114512', 'DAVID'),
('20220819', 'F62W', '06', 'CB002', '1229', 'B', 57.6000, 3000, 172800.00, 246, NULL, NULL, -173046.00, '20220823', '115912', 'DAVID'),
('20220819', 'F62W', '06', 'CB003', '1217', 'B', 9.8300, 7000, 68810.00, 98, NULL, NULL, -68908.00, '20220823', '134112', 'DAVID'),
('20220819', 'F62W', '06', 'CB004', '2379', 'B', 352.0000, 10000, 3520000.00, 5016, NULL, NULL, -3525016.00, '20220823', '134212', 'DAVID'),
('20220819', 'F62W', '06', 'CB005', '2609', 'B', 90.7000, 5000, 453500.00, 646, NULL, NULL, 454146.00, '20220823', '134258', 'DAVID');
```

## TCNUD

```SQL=
INSERT INTO `tcnud` (`TradeDate`, `BranchNo`, `CustSeq`, `DocSeq`, `Stock`, `Price`, `Qty`, `RemainQty`, `Fee`, `Cost`, `ModDate`, `ModTime`, `ModUser`) 
VALUES ('20220819', 'F62W', '06', 'CB001', '1203', 33.4500, 1000, 1000, 48, 33498.00, '20220823', '135012', 'DAVID'),
('20220819', 'F62W', '06', 'CB002', '1229', 57.6000, 3000, 3000, 246, 173046.00, '20220823', '135023', 'DAVID'),
('20220819', 'F62W', '06', 'CB003', '1217', 9.8300, 7000, 7000, 98, 68908.00, '20220823', '135045', 'DAVID'),
('20220819', 'F62W', '06', 'CB004', '2379', 352.0000, 10000, 10000, 5016, 3525016.00, '20220823', '135055', 'DAVID'),
('20220819', 'F62W', '06', 'CB005', '2609', 90.7000, 5000, 5000, 646, 454146.00, '20220823', '135059', 'DAVID');
```
## 請依下列賣出價格，計算前部分作業寫入的餘額的未實現損益：

1.味王:未實現收益=1347
```java
(35*1000)-((35*1000)*0.1425%)-((35*1000)*0.3%)-(33.45*1000)*(1+0.1425%)=1347
```
2.聯華:未實現收益=-3698
```java
(56.7*3000)-((56.7*3000)*0.1425%)-((56.7*3000)*0.3%)-(57.6*3000)*(1+0.1425%)=-3698
```
3.愛之味:未實現收益=1549
```java
(10.11*7000)-((10.11*7000)*0.1425%)-((10.11*7000)*0.3%)-(9.83*7000)*(1+0.1425%)=1549
```
4.瑞昱:未實現收益=9275
```java
(355*10000)-((355*10000)*0.1425%)-((355*10000)*0.3%)-(352*10000)*(1+0.1425%)=9275
```
5.陽明:未實現收益=-10618
```java
(89.1*5000)-((89.1*5000)*0.1425%)-((89.1*5000)*0.3%)-(90.7*5000)*(1+0.1425%)=-10618
```