---
description: 獲取指定商品的即時最佳買賣價、成交價與成交量等價量資訊
---

# GetRealTimeValue

## 語法

```
GetRealTimeValue(Symbol_Name,Quote_Field);
```

## 範例

列印商品 CME.GC HOT 的報價資訊

```
once cleardebug;
array:aGetRealTimeValue[100,1](0);
var:indexQ(0);

for indexQ = 2 to 60 begin
	aGetRealTimeValue[indexQ,0] = indexQ;
	aGetRealTimeValue[indexQ,1] = GetRealTimeValue("CME.GC HOT",indexQ);
end;

for indexQ = 2 to 60 begin
switch(indexQ)
begin
case 2:
	print(d," ",t,",Index=",indexQ,", QTime   = ",aGetRealTimeValue[indexQ,1]+8*10000);
case 4,6,16,40,60:
	print(d," ",t,",Index=",indexQ,", Qvolume = ",aGetRealTimeValue[indexQ,1]);
case 3,5,8,9,10,12,15,16,30,50:
	print(d," ",t,",Index=",indexQ,", Qprice  = ",aGetRealTimeValue[indexQ,1]);
end;
end;

```

輸出結果

```
1200214.00 1800.00,Index=   2.00, QTime   = 170433.00
1200214.00 1800.00,Index=   3.00, Qprice  = 1578.60
1200214.00 1800.00,Index=   4.00, Qvolume =    3.00
1200214.00 1800.00,Index=   5.00, Qprice  =   -0.20
1200214.00 1800.00,Index=   6.00, Qvolume = 55362.00
1200214.00 1800.00,Index=   8.00, Qprice  = 1579.00
1200214.00 1800.00,Index=   9.00, Qprice  = 1581.20
1200214.00 1800.00,Index=  10.00, Qprice  = 1576.00
1200214.00 1800.00,Index=  12.00, Qprice  = 1578.80
1200214.00 1800.00,Index=  15.00, Qprice  = 1578.80
1200214.00 1800.00,Index=  16.00, Qvolume = 264293.00
1200214.00 1800.00,Index=  30.00, Qprice  = 1578.50
1200214.00 1800.00,Index=  40.00, Qvolume =   32.00
1200214.00 1800.00,Index=  50.00, Qprice  = 1578.60
1200214.00 1800.00,Index=  60.00, Qvolume =    5.00
```

## **參數**

| **名稱**       | **類型** | **說明**               |
| ------------ | ------ | -------------------- |
| Symbol\_Name | 字串型    | 商品合約代號，如”CME.GC HOT” |
| Quote\_Field | 數值型    | 請參考【**欄位代碼表**】       |

#### 欄位代碼表

| **類型** | **代碼**   | **說明**                                         |
| -----: | -------- | ---------------------------------------------- |
| **時間** | 2        | <p>成交時間</p><p>（預設是 GTC+0 時區，需要根據交易所時區進行轉換）</p> |
| **價格** | 3        | 成交價                                            |
|        | 5        | 漲跌                                             |
|        | 8        | 當日開盤價                                          |
|        | 9        | 當日最高價                                          |
|        | 10       | 當日最低價                                          |
|        | 12       | 參考價(昨結算價)                                      |
|        | 13       | 漲停價                                            |
|        | 14       | 跌停價                                            |
|        | 15       | 昨收價                                            |
|        | 30 \~ 34 | 買一價 \~ 買五價                                     |
|        | 50 \~ 54 | 賣一價 \~ 賣五價                                     |
|  **量** | 4        | 現量                                             |
|        | 6        | 成交量                                            |
|        | 16       | 昨成交量                                           |
|        | 40 \~ 44 | 買一量 \~ 買五量                                     |
|        | 60 \~ 64 | 賣一量 \~ 賣五量                                     |

{% hint style="warning" %}
僅限即時報價獲取，無歷史資料。
{% endhint %}

