# GetChip

## 函數

```
Inputs: 
	SYMBOL_NAME(StringSimple), 
	FIELD_DATE(NumericSimple), 
	FIELD_TIME(NumericSimple),
	TRADER_TYPE(NumericSimple), 
	FIELD_SIDE(NumericSimple), // 1:Long, 2:Short
	FIELD_TRADE(NumericSimple), 
	FIELD_VOLUME(NumericSimple); // 1:Contracts, 2:Amount

external: "MCExtendQuote64.dll", int, "Init", IEasyLanguageObject;
external: "MCExtendQuote64.dll", int, "Deinit", IEasyLanguageObject ;
external: "MCExtendQuote64.dll", double, "get_chip",  int, string, int, int, int, int, int, int;

#events
OnCreate = Init;
OnDestroy = Deinit;
#end ;

if TRADER_TYPE >=4 and FIELD_TRADE=2 and FIELD_VOLUME=2 then 
	GetChip = get_chip(1, SYMBOL_NAME, FIELD_DATE, FIELD_TIME, TRADER_TYPE, FIELD_SIDE, FIELD_TRADE, FIELD_VOLUME)*0.0001
else
	GetChip = get_chip(1, SYMBOL_NAME, FIELD_DATE, FIELD_TIME, TRADER_TYPE, FIELD_SIDE, FIELD_TRADE, FIELD_VOLUME);


```

## 函數使用語法

```
GetChip(SYMBOL_NAME, FIELD_DATE, FIELD_TIME, TRADER_TYPE, FIELD_SIDE, FIELD_TRADE, FIELD_VOLUME)
```

## 參數

| **名稱**        | **類型** | **說明**                                                                                                                                                                                                                                                                                                                                                      |
| ------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| SYMBOL\_NAME  | 字串型    | 指定商品的代號，須加上雙引號，如"TXF"                                                                                                                                                                                                                                                                                                                                       |
| FIELD\_DATE   | 數值型    | 查詢日期，如 20190625 或是 1190625                                                                                                                                                                                                                                                                                                                                  |
| FIELD\_TIME   | 數值型    | 查詢時間，精確到秒，如 time\_s 或150000                                                                                                                                                                                                                                                                                                                                 |
| TRADER\_TYPE  | 數值型    | <p>1.自營商<br>2.投信<br>3.外資</p><p>4.前五大交易人</p><p>5.前五大特定法人</p><p>6.前十大交易人</p><p>7.前十大特定法人</p><p>8.全市場 ( 買、賣方合計 )</p><p>9.前五大交易人(近月)</p><p>10.前五大特定法人 ( 近月 )</p><p>11.前十大交易人 ( 近月 )</p><p>12.前十大特定法人 ( 近月 )<br>13.前五大交易人 ( 周 ) <br>14.前五大特定法人 ( 周 ) <br>15.前十大交易人 ( 周 ) <br>16.前十大特定法人 ( 周 )<br>17.自營商(夜盤)</p><p>18.投信(夜盤)<br>19.外資(夜盤)<br>20.大台、小台、微台近月 OI</p> |
| FIELD\_SIDE   | 數值型    | <p>0: TRADER\_TYPE = 20 使用<br>1:買方<br>2:賣方</p>                                                                                                                                                                                                                                                                                                              |
| FIELD\_TRADE  | 數值型    | <p>0: TRADER\_TYPE = 20 使用<br>1:成交量 ( 大額交易人未提供 )<br>2:未平倉量</p>                                                                                                                                                                                                                                                                                              |
| FIELD\_VOLUME | 數值型    | <p>0: TRADER\_TYPE = 20 使用<br>1:口數<br>2:契約金額 ( 用於三大法人 ) 或百分比 ( 用於大額交易人 )</p>                                                                                                                                                                                                                                                                                |

## Trader Type 資料來源

依據 TraderType 分

1\~3 :

期貨 三大法人區分各期貨契約依日期 一般交易時段&#x20;

<https://www.taifex.com.tw/cht/3/futContractsDate>

選擇權 三大法人查詢區分各選擇權契約依日期 一般交易時段 <https://www.taifex.com.tw/cht/3/optContractsDate>

4\~7 & 9\~16:

期貨 期貨大額交易人未沖銷部位結構表&#x20;

<https://www.taifex.com.tw/cht/3/largeTraderFutQry>

選擇權 選擇權大額交易人未沖銷部位結構表

&#x20;<https://www.taifex.com.tw/cht/3/largeTraderOptQry>

8 & 20:

期貨 期貨每日交易行情查詢&#x20;

<https://www.taifex.com.tw/cht/3/futDailyMarketReport>

選擇權 選擇權每日交易行情查詢&#x20;

<https://www.taifex.com.tw/cht/3/optDailyMarketReport>

17\~19:

期貨 三大法人區分各期貨契約依日期 盤後交易時段&#x20;

<https://www.taifex.com.tw/cht/3/futContractsDate>

選擇權 三大法人查詢區分各選擇權契約依日期 盤後交易時段 <https://www.taifex.com.tw/cht/3/optContractsDate>

## 建立 GetChip 函數

![請先複製 GetChip 函數內容](/files/-LleuvaNOpOsj_3F01MH)

## 函數範例

```
getchip("TXF",20190621,150000,3,1,2,1)
台指期外資多單口數

getchip("TXF",20190621,150000,3,2,2,1)
台指期外資空單口數
```

## 期貨商品代碼表

期貨輸入代碼為三個英文字母，如臺灣50期貨="T5F"、小型臺指期貨="MXF"，\
以下為期貨商品代碼列表

{% hint style="warning" %}
商品代碼需使用英文大寫
{% endhint %}

| **商品**    | **代碼**                                     |
| --------- | ------------------------------------------ |
| 臺股期貨      | <p>TXF<br>TRADER\_TYPE = 20 使用 TXF.HOT</p> |
| 電子期貨      | EXF                                        |
| 金融期貨      | FXF                                        |
| 小型臺指期貨    | <p>MXF<br>TRADER\_TYPE = 20 使用 MXF.HOT</p> |
| 臺灣50期貨    | T5F                                        |
| 股票期貨      | STF                                        |
| ETF期貨     | ETF                                        |
| 櫃買指數期貨    | GTF                                        |
| 非金電期貨     | XIF                                        |
| 東證期貨      | TJF                                        |
| 美國標普500期貨 | SPF                                        |
| 美國道瓊期貨    | UDF                                        |
| 微臺指期貨     | <p>TMF<br>TRADER\_TYPE = 20 使用 TMF.HOT</p> |

## 選擇權商品代碼表

選擇權輸入代碼則將"F"改為"O"，並加上小數點及買賣權分類(C、P)，\
如查詢台灣50買權，輸入"T5O.C"

| **商品**       | **代碼** |
| ------------ | ------ |
| 臺指選擇權(CALL)  | TXO.C  |
| 臺指選擇權(PUT)   | TXO.P  |
| 電子選擇權(CALL)  | TEO.C  |
| 電子選擇權(PUT)   | TEO.P  |
| 金融選擇權(CALL)  | TFO.C  |
| 金融選擇權(PUT)   | TFO.P  |
| 股票選擇權(CALL)  | STO.C  |
| 股票選擇權(PUT)   | STO.P  |
| ETF選擇權(CALL) | ETC.C  |
| ETF選擇權(PUT)  | ETC.P  |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://touchance-1.gitbook.io/touchance/multicharts/chou-ma-han-shu-1/chou-ma-han-shu.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
