Skip to content

Instantly share code, notes, and snippets.

@thstarshine
Created October 15, 2019 04:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thstarshine/86285d35bca474231c54208d5aa9b281 to your computer and use it in GitHub Desktop.
Save thstarshine/86285d35bca474231c54208d5aa9b281 to your computer and use it in GitHub Desktop.
{
"openapi" : "3.0.0",
"info" : {
"title" : "Taiwan Stock Market Real-time Quotes API",
"description" : "### 相關說明:\n* 所有日期格式(date, time)皆以 ISO 8601 格式傳輸及實作 \n* 回傳格式參照 google json guide \n* 所有 Success Response 包含 apiVersion, { data: { info: {}}} \n* 所有 Error Response property code 同 http status code \n* 所有 Error Response Format 相同\n",
"contact" : {
"email" : "development@fugle.tw"
},
"license" : {
"name" : "Apache 2.0",
"url" : "http://www.apache.org/licenses/LICENSE-2.0.html"
},
"version" : "0.1.0"
},
"servers" : [ {
"url" : "https://api.fintechspace.com.tw/realtime/v0"
} ],
"tags" : [ {
"name" : "Intraday"
}, {
"name" : "SymbolIds"
} ],
"paths" : {
"/intraday/chart" : {
"get" : {
"tags" : [ "Intraday" ],
"summary" : "取得繪製 個股/指數 線圖時所需的各項即時資訊",
"description" : "回傳參數設定範圍內所有的開高低收價量資訊",
"parameters" : [ {
"name" : "symbolId",
"in" : "query",
"description" : "個股、指數、商品識別代碼",
"required" : true,
"style" : "form",
"explode" : true,
"schema" : {
"type" : "string"
}
}, {
"name" : "mode",
"in" : "query",
"description" : "交易種類",
"required" : false,
"style" : "form",
"explode" : true,
"schema" : {
"type" : "string",
"enum" : [ "twse-sem", "tpex-otc", "taifex-fut" ]
}
}, {
"name" : "apiToken",
"in" : "query",
"description" : "realtime api token",
"required" : true,
"style" : "form",
"explode" : true,
"schema" : {
"type" : "string",
"default" : "demo"
}
} ],
"responses" : {
"200" : {
"description" : "Chart Response Success",
"content" : {
"*/*" : {
"schema" : {
"$ref" : "#/components/schemas/ChartSchema"
}
}
}
},
"400" : {
"description" : "general purpose error, \n ex: \n * invalid parameters (apiVersion/mode/symbolId) - 帶入參數錯誤時回傳\n * quota exceeded - 當使用者發送 request 超出配額時回傳"
},
"401" : {
"description" : "invalid apiToken - 當 token 沒帶入或不正確時回傳"
},
"404" : {
"description" : "The specified resource was not found"
},
"default" : {
"description" : "預設 Error 回傳格式",
"content" : {
"*/*" : {
"schema" : {
"$ref" : "#/components/schemas/Error"
}
}
}
}
},
"security" : [ {
"bearerAuth" : [ ]
} ]
}
},
"/intraday/quote" : {
"get" : {
"tags" : [ "Intraday" ],
"summary" : "取得 個股/指數 逐筆交易金額、狀態、統計資訊",
"description" : "回傳參數設定日期內所有的開高低收價量資訊",
"parameters" : [ {
"name" : "symbolId",
"in" : "query",
"description" : "個股、指數、商品識別代碼",
"required" : true,
"style" : "form",
"explode" : true,
"schema" : {
"type" : "string"
}
}, {
"name" : "mode",
"in" : "query",
"description" : "交易種類",
"required" : false,
"style" : "form",
"explode" : true,
"schema" : {
"type" : "string",
"enum" : [ "twse-sem", "tpex-otc", "taifex-fut" ]
}
}, {
"name" : "apiToken",
"in" : "query",
"description" : "realtime api token",
"required" : true,
"style" : "form",
"explode" : true,
"schema" : {
"type" : "string",
"default" : "demo"
}
} ],
"responses" : {
"200" : {
"description" : "Quote Response Success",
"content" : {
"*/*" : {
"schema" : {
"$ref" : "#/components/schemas/QuoteSchema"
}
}
}
},
"400" : {
"description" : "general purpose error, \n ex: \n * invalid parameters (apiVersion/mode/symbolId) - 帶入參數錯誤時回傳\n * quota exceeded - 當使用者發送 request 超出配額時回傳"
},
"401" : {
"description" : "invalid apiToken - 當 token 沒帶入或不正確時回傳"
},
"404" : {
"description" : "The specified resource was not found"
},
"default" : {
"description" : "預設 Error 回傳格式",
"content" : {
"*/*" : {
"schema" : {
"$ref" : "#/components/schemas/Error"
}
}
}
}
},
"security" : [ {
"bearerAuth" : [ ]
} ]
}
},
"/intraday/meta" : {
"get" : {
"tags" : [ "Intraday" ],
"summary" : "取得 個股/指數 當日基本資訊",
"description" : "回傳參數設定範圍內所有的開高低收價量資訊",
"parameters" : [ {
"name" : "symbolId",
"in" : "query",
"description" : "個股、指數、商品識別代碼",
"required" : true,
"style" : "form",
"explode" : true,
"schema" : {
"type" : "string"
}
}, {
"name" : "mode",
"in" : "query",
"description" : "交易種類",
"required" : false,
"style" : "form",
"explode" : true,
"schema" : {
"type" : "string",
"enum" : [ "twse-sem", "tpex-otc", "taifex-fut" ]
}
}, {
"name" : "apiToken",
"in" : "query",
"description" : "realtime api token",
"required" : true,
"style" : "form",
"explode" : true,
"schema" : {
"type" : "string",
"default" : "demo"
}
} ],
"responses" : {
"200" : {
"description" : "Meta Response Success",
"content" : {
"*/*" : {
"schema" : {
"$ref" : "#/components/schemas/MetaSchema"
}
}
}
},
"400" : {
"description" : "general purpose error, \n ex: \n * invalid parameters (apiVersion/mode/symbolId) - 帶入參數錯誤時回傳\n * quota exceeded - 當使用者發送 request 超出配額時回傳"
},
"401" : {
"description" : "invalid apiToken - 當 token 沒帶入或不正確時回傳"
},
"404" : {
"description" : "The specified resource was not found"
},
"default" : {
"description" : "預設 Error 回傳格式",
"content" : {
"*/*" : {
"schema" : {
"$ref" : "#/components/schemas/Error"
}
}
}
}
},
"security" : [ {
"bearerAuth" : [ ]
} ]
}
},
"/intraday/trades" : {
"get" : {
"tags" : [ "Intraday" ],
"summary" : "取得個股當日所有成交資訊(ex: 個股價量、大盤總量)",
"description" : "回傳參數設定範圍內所有的成交價量資訊",
"parameters" : [ {
"name" : "symbolId",
"in" : "query",
"description" : "個股、指數、商品識別代碼",
"required" : true,
"style" : "form",
"explode" : true,
"schema" : {
"type" : "string"
}
}, {
"name" : "mode",
"in" : "query",
"description" : "交易種類",
"required" : false,
"style" : "form",
"explode" : true,
"schema" : {
"type" : "string",
"enum" : [ "twse-sem", "tpex-otc", "taifex-fut" ]
}
}, {
"name" : "apiToken",
"in" : "query",
"description" : "realtime api token",
"required" : true,
"style" : "form",
"explode" : true,
"schema" : {
"type" : "string",
"default" : "demo"
}
} ],
"responses" : {
"200" : {
"description" : "Trades Response Success",
"content" : {
"*/*" : {
"schema" : {
"$ref" : "#/components/schemas/TradesSchema"
}
}
}
},
"400" : {
"description" : "general purpose error, \n ex: \n * invalid parameters (apiVersion/mode/symbolId) - 帶入參數錯誤時回傳\n * quota exceeded - 當使用者發送 request 超出配額時回傳"
},
"401" : {
"description" : "invalid apiToken - 當 token 沒帶入或不正確時回傳"
},
"404" : {
"description" : "The specified resource was not found"
},
"default" : {
"description" : "預設 Error 回傳格式",
"content" : {
"*/*" : {
"schema" : {
"$ref" : "#/components/schemas/Error"
}
}
}
}
},
"security" : [ {
"bearerAuth" : [ ]
} ]
}
},
"/intraday/future-quote" : {
"get" : {
"tags" : [ "Intraday" ],
"summary" : "取得商品交易金額、狀態、統計資訊",
"description" : "回傳參數設定日期內所有的交易狀態資訊",
"parameters" : [ {
"name" : "symbolId",
"in" : "query",
"description" : "個股、指數、商品識別代碼",
"required" : true,
"style" : "form",
"explode" : true,
"schema" : {
"type" : "string"
}
}, {
"name" : "apiToken",
"in" : "query",
"description" : "realtime api token",
"required" : true,
"style" : "form",
"explode" : true,
"schema" : {
"type" : "string",
"default" : "demo"
}
} ],
"responses" : {
"200" : {
"description" : "FutureQuote Response Success",
"content" : {
"*/*" : {
"schema" : {
"$ref" : "#/components/schemas/FutureQuoteSchema"
}
}
}
},
"400" : {
"description" : "general purpose error, \n ex: \n * invalid parameters (apiVersion/mode/symbolId) - 帶入參數錯誤時回傳\n * quota exceeded - 當使用者發送 request 超出配額時回傳"
},
"401" : {
"description" : "invalid apiToken - 當 token 沒帶入或不正確時回傳"
},
"404" : {
"description" : "The specified resource was not found"
},
"default" : {
"description" : "預設 Error 回傳格式",
"content" : {
"*/*" : {
"schema" : {
"$ref" : "#/components/schemas/Error"
}
}
}
}
},
"security" : [ {
"bearerAuth" : [ ]
} ]
}
},
"/intraday/future-meta" : {
"get" : {
"tags" : [ "Intraday" ],
"summary" : "取得期貨當日基本資訊",
"description" : "回傳參數設定範圍內的基本資訊",
"parameters" : [ {
"name" : "symbolId",
"in" : "query",
"description" : "個股、指數、商品識別代碼",
"required" : true,
"style" : "form",
"explode" : true,
"schema" : {
"type" : "string"
}
}, {
"name" : "apiToken",
"in" : "query",
"description" : "realtime api token",
"required" : true,
"style" : "form",
"explode" : true,
"schema" : {
"type" : "string",
"default" : "demo"
}
} ],
"responses" : {
"200" : {
"description" : "FutureMeta Response Success",
"content" : {
"*/*" : {
"schema" : {
"$ref" : "#/components/schemas/FutureMetaSchema"
}
}
}
},
"400" : {
"description" : "general purpose error, \n ex: \n * invalid parameters (apiVersion/mode/symbolId) - 帶入參數錯誤時回傳\n * quota exceeded - 當使用者發送 request 超出配額時回傳"
},
"401" : {
"description" : "invalid apiToken - 當 token 沒帶入或不正確時回傳"
},
"404" : {
"description" : "The specified resource was not found"
},
"default" : {
"description" : "預設 Error 回傳格式",
"content" : {
"*/*" : {
"schema" : {
"$ref" : "#/components/schemas/Error"
}
}
}
}
},
"security" : [ {
"bearerAuth" : [ ]
} ]
}
},
"/intraday/future-trades" : {
"get" : {
"tags" : [ "Intraday" ],
"summary" : "取得期貨當日所有成交資訊(ex: 台指期價量)",
"description" : "回傳參數設定範圍內所有的成交價量資訊",
"parameters" : [ {
"name" : "symbolId",
"in" : "query",
"description" : "個股、指數、商品識別代碼",
"required" : true,
"style" : "form",
"explode" : true,
"schema" : {
"type" : "string"
}
}, {
"name" : "apiToken",
"in" : "query",
"description" : "realtime api token",
"required" : true,
"style" : "form",
"explode" : true,
"schema" : {
"type" : "string",
"default" : "demo"
}
} ],
"responses" : {
"200" : {
"description" : "FutureTrades Response Success",
"content" : {
"*/*" : {
"schema" : {
"$ref" : "#/components/schemas/FutureTradesSchema"
}
}
}
},
"400" : {
"description" : "general purpose error, \n ex: \n * invalid parameters (apiVersion/mode/symbolId) - 帶入參數錯誤時回傳\n * quota exceeded - 當使用者發送 request 超出配額時回傳"
},
"401" : {
"description" : "invalid apiToken - 當 token 沒帶入或不正確時回傳"
},
"404" : {
"description" : "The specified resource was not found"
},
"default" : {
"description" : "預設 Error 回傳格式",
"content" : {
"*/*" : {
"schema" : {
"$ref" : "#/components/schemas/Error"
}
}
}
}
},
"security" : [ {
"bearerAuth" : [ ]
} ]
}
},
"/symbolIds" : {
"get" : {
"tags" : [ "SymbolIds" ],
"summary" : "取得商品代碼及名稱列表",
"description" : "回傳參數設定範圍內所有的商品代碼及名稱資訊",
"parameters" : [ {
"name" : "mode",
"in" : "query",
"description" : "交易種類",
"required" : false,
"style" : "form",
"explode" : true,
"schema" : {
"type" : "string",
"enum" : [ "twse-sem", "tpex-otc", "taifex-fut" ]
}
}, {
"name" : "apiToken",
"in" : "query",
"description" : "realtime api token",
"required" : true,
"style" : "form",
"explode" : true,
"schema" : {
"type" : "string",
"default" : "demo"
}
} ],
"responses" : {
"200" : {
"description" : "SymbolIds Response Success",
"content" : {
"*/*" : {
"schema" : {
"$ref" : "#/components/schemas/SymbolIdsSchema"
}
}
}
},
"400" : {
"description" : "general purpose error, \n ex: \n * invalid parameters (apiVersion/mode/symbolId) - 帶入參數錯誤時回傳\n * quota exceeded - 當使用者發送 request 超出配額時回傳"
},
"401" : {
"description" : "invalid apiToken - 當 token 沒帶入或不正確時回傳"
},
"404" : {
"description" : "The specified resource was not found"
},
"default" : {
"description" : "預設 Error 回傳格式",
"content" : {
"*/*" : {
"schema" : {
"$ref" : "#/components/schemas/Error"
}
}
}
}
},
"security" : [ {
"bearerAuth" : [ ]
} ]
}
}
},
"components" : {
"schemas" : {
"InfoSchema" : {
"type" : "object",
"properties" : {
"date" : {
"type" : "string",
"format" : "date"
},
"mode" : {
"type" : "string",
"enum" : [ "twse-sem", "tpex-otc", "tpex-emg" ]
},
"symbolId" : {
"type" : "string"
},
"countryCode" : {
"type" : "string"
},
"timeZone" : {
"type" : "string"
},
"lastUpdatedAt" : {
"type" : "string",
"format" : "date-time"
}
}
},
"ChartSchema" : {
"required" : [ "apiVersion", "chart", "data", "info" ],
"type" : "object",
"properties" : {
"apiVersion" : {
"type" : "string"
},
"data" : {
"$ref" : "#/components/schemas/ChartSchema_data"
}
},
"example" : {
"apiVersion" : "0.1.0",
"data" : {
"info" : {
"lastUpdatedAt" : "2018-07-10T23:33:02.690Z // 本筆資料最後更新時間",
"date" : "20180711 // 本筆資料所屬日期",
"mode" : "twse-sem // 交易所-交易市場",
"symbolId" : "2330 // 股票代號",
"countryCode" : "TW // 股票所屬國家ISO2代碼",
"timeZone" : "Asia/Taipei // 股票所屬時區"
},
"chart" : {
"2018-07-11T05:30:00.000Z" : {
"open" : "102.12 // 開盤價",
"high" : "102.15 // 當日到 key 時間的最高價",
"low" : "102.02 // 當日到 key 時間的最高價",
"close" : "102.12 // 當日到 key 時間的現價",
"volume" : "2493811 // 此分鐘交易量"
},
"2018-07-11T05:29:00.000Z" : {
"open" : 102.12,
"high" : 102.15,
"low" : 102.02,
"close" : 102.12,
"volume" : 222733
},
"2018-07-11T05:28:00.000Z" : {
"open" : 102.12,
"high" : 102.15,
"low" : 102.02,
"close" : 102.12,
"volume" : 493725
},
"2018-07-11T05:27:00.000Z" : {
"open" : 102.12,
"high" : 102.15,
"low" : 102.02,
"close" : 102.12,
"volume" : 1693134
}
}
}
}
},
"QuoteSchema" : {
"required" : [ "apiVersion", "data", "info", "quote" ],
"type" : "object",
"properties" : {
"apiVersion" : {
"type" : "string"
},
"data" : {
"$ref" : "#/components/schemas/QuoteSchema_data"
}
},
"example" : {
"apiVersion" : "0.1.0",
"data" : {
"info" : {
"lastUpdatedAt" : "2018-07-10T23:33:02.690Z // 本筆資料最後更新時間",
"date" : "20180711 // 本筆資料所屬日期",
"mode" : "twse-sem // 交易所-交易市場",
"symbolId" : "2330 // 股票代號",
"countryCode" : "TW // 股票所屬國家ISO2代碼",
"timeZone" : "Asia/Taipei // 股票所屬時區"
},
"quote" : {
"isCurbing" : "false // 最近一次更新是否為熔斷",
"isTrial" : "false // 最近一次更新是否為試算",
"isOpenDelayed" : "false // 當日是否曾發生延後開盤",
"isCloseDelayed" : "false // 當日是否曾發生延後收盤",
"isClosed" : "false // 當日是否為已收盤",
"total" : {
"order" : "-1 // 總成交委託, 負數表示無 order",
"price" : "-1 // 總成交價, 負數表示無 price",
"volume" : "19816000 // 總成交量"
},
"trial" : {
"at" : "2018-07-11T05:29:58.269Z // 總成交委託",
"price" : 220,
"volume" : 4304000
},
"trade" : {
"at" : "2018-07-11T05:30:00.000Z // 總成交委託",
"price" : 220,
"volume" : 4304000
},
"order" : {
"at" : "2018-07-11T05:30:00.000Z",
"bestBids" : [ {
"price" : 217.5,
"volume" : 734000
}, {
"price" : 218,
"volume" : 1232000
}, {
"price" : 218.5,
"volume" : 703000
}, {
"price" : 219,
"volume" : 216000
}, {
"price" : 219.5,
"volume" : 1400000
} ],
"bestAsks" : [ {
"price" : 220,
"volume" : 411000
}, {
"price" : 220.5,
"volume" : 593000
}, {
"price" : 221,
"volume" : 677000
}, {
"price" : 221.5,
"volume" : 281000
}, {
"price" : 222,
"volume" : 541000
} ]
},
"priceHigh" : "220 // 最高價",
"priceLow" : "218 // 最低價",
"priceOpen" : "220 // 開盤價,開盤定義:當天第一筆成交時才開盤",
"isHalting" : "false // 最近一次更新是否為暫停交易"
}
}
}
},
"MetaSchema" : {
"required" : [ "apiVersion", "data", "info", "meta" ],
"type" : "object",
"properties" : {
"apiVersion" : {
"type" : "string"
},
"data" : {
"$ref" : "#/components/schemas/MetaSchema_data"
}
},
"example" : {
"apiVersion" : "0.1.0",
"data" : {
"info" : {
"lastUpdatedAt" : "2018-07-10T23:33:02.690Z // 本筆資料最後更新時間",
"date" : "20180711 // 本筆資料所屬日期",
"mode" : "twse-sem // 交易所-交易市場",
"symbolId" : "2330 // 股票代號",
"countryCode" : "TW // 股票所屬國家ISO2代碼",
"timeZone" : "Asia/Taipei // 股票所屬時區"
},
"meta" : {
"isIndex" : "false // symbolId是否為指數",
"nameZhTw" : "台積電 // 股票中文簡稱",
"industry" : "半導體業 // 產業別",
"abnormal" : " // 股票異常資訊,正常時回傳空字串",
"priceReference" : "222 // 今日參考價",
"priceHighLimit" : "244 // 漲停價",
"priceLowLimit" : "200 // 跌停價",
"canDayBuySell" : "true // 是否可先買後賣現股當沖",
"canDaySellBuy" : "true // 是否可先賣後買現股當沖",
"canShortMargin" : "true // 是否豁免平盤下融券賣出",
"canShortLend" : "true // 是否豁免平盤下借券賣出",
"volumePerUnit" : "1000 // 交易單位:股/張",
"currency" : "TWD // 交易幣別代號",
"isTerminated" : "false // 今日是否已終止上市",
"isSuspended" : "false // 今日是否暫停買賣"
}
}
}
},
"TradesSchema" : {
"required" : [ "apiVersion", "data", "info" ],
"type" : "object",
"properties" : {
"apiVersion" : {
"type" : "string"
},
"data" : {
"$ref" : "#/components/schemas/TradesSchema_data"
}
},
"example" : {
"apiVersion" : "0.1.0",
"data" : {
"info" : {
"lastUpdatedAt" : "2018-07-10T23:33:02.690Z // 本筆資料最後更新時間",
"date" : "20180711 // 本筆資料所屬日期",
"mode" : "twse-sem // 交易所-交易市場",
"symbolId" : "2330 // 股票代號",
"countryCode" : "TW // 股票所屬國家ISO2代碼",
"timeZone" : "Asia/Taipei // 股票所屬時區"
},
"trades" : [ {
"at" : "2018-07-11T13:30:00.000Z",
"price" : 220,
"volume" : 4304000
}, {
"at" : "2018-07-11T13:24:55.003Z",
"price" : 219,
"volume" : 4000
}, {
"at" : "2018-07-11T13:24:49.968Z",
"price" : 219,
"volume" : 10000
}, {
"at" : "2018-07-11T13:30:00.000Z",
"price" : 219,
"volume" : 6000
} ]
}
}
},
"FutureQuoteSchema" : {
"required" : [ "apiVersion", "data", "info", "quote" ],
"type" : "object",
"properties" : {
"apiVersion" : {
"type" : "string"
},
"data" : {
"$ref" : "#/components/schemas/FutureQuoteSchema_data"
}
},
"example" : {
"apiVersion" : "0.1.0",
"data" : {
"info" : {
"lastUpdatedAt" : "2018-07-10T23:33:02.690Z // 本筆資料最後更新時間",
"date" : "20180711 // 本筆資料所屬日期",
"mode" : "taifex-fut // 交易所-交易市場",
"symbolId" : "TXFJ9 // 商品代號",
"countryCode" : "TW // 股票所屬國家ISO2代碼",
"timeZone" : "Asia/Taipei // 股票所屬時區"
},
"quote" : {
"trade" : {
"at" : "2018-07-11T05:30:00.000Z",
"price" : 220,
"volume" : 4304000
},
"priceHigh" : "220 // 最高價",
"priceLow" : "218 // 最低價",
"priceOpen" : "220 // 開盤價,開盤定義:當天第一筆成交時才開盤"
}
}
}
},
"FutureMetaSchema" : {
"required" : [ "apiVersion", "data", "info", "meta" ],
"type" : "object",
"properties" : {
"apiVersion" : {
"type" : "string"
},
"data" : {
"$ref" : "#/components/schemas/FutureMetaSchema_data"
}
},
"example" : {
"apiVersion" : "0.1.0",
"data" : {
"info" : {
"lastUpdatedAt" : "2018-07-10T23:33:02.690Z // 本筆資料最後更新時間",
"date" : "20180711 // 本筆資料所屬日期",
"mode" : "taifex-fut // 交易所-交易市場",
"symbolId" : "TXFJ9 // 股票代號",
"countryCode" : "TW // 股票所屬國家ISO2代碼",
"timeZone" : "Asia/Taipei // 股票所屬時區"
},
"meta" : {
"nameZhTw" : "台積電 // 股票中文簡稱",
"priceReference" : "222 // 今日參考價",
"currency" : "TWD // 交易幣別代號",
"beginDate" : "20190718 // 開始日期",
"deliveryDate" : "20191016 // 結算日期",
"endDate" : "20191016 // 結束日期",
"fallLimitPrice1" : "9900 // 跌停價",
"riseLimitPrice1" : "12100 // 漲停價"
}
}
}
},
"FutureTradesSchema" : {
"required" : [ "apiVersion", "data", "info" ],
"type" : "object",
"properties" : {
"apiVersion" : {
"type" : "string"
},
"data" : {
"$ref" : "#/components/schemas/TradesSchema_data"
}
},
"example" : {
"apiVersion" : "0.1.0",
"data" : {
"info" : {
"lastUpdatedAt" : "2018-07-10T23:33:02.690Z // 本筆資料最後更新時間",
"date" : "20180711 // 本筆資料所屬日期",
"mode" : "taifex-fut // 交易所-交易市場",
"symbolId" : "TXFJ9 // 商品代號",
"countryCode" : "TW // 股票所屬國家ISO2代碼",
"timeZone" : "Asia/Taipei // 股票所屬時區"
},
"trades" : [ {
"at" : "2018-07-11T13:30:00.000Z",
"price" : 220,
"volume" : 4304000
}, {
"at" : "2018-07-11T13:24:55.003Z",
"price" : 219,
"volume" : 4000
}, {
"at" : "2018-07-11T13:24:49.968Z",
"price" : 219,
"volume" : 10000
}, {
"at" : "2018-07-11T13:10:00.000Z",
"price" : 219,
"volume" : 6000
} ]
}
}
},
"SymbolIdsSchema" : {
"required" : [ "apiVersion", "data", "info" ],
"type" : "object",
"properties" : {
"apiVersion" : {
"type" : "string"
},
"data" : {
"$ref" : "#/components/schemas/SymbolIdsSchema_data"
}
},
"example" : {
"apiVersion" : "0.1.0",
"data" : {
"info" : {
"date" : "20180711 // 本筆資料所屬日期",
"mode" : "taifex-fut // 交易所-交易市場",
"countryCode" : "TW // 股票所屬國家ISO2代碼",
"timeZone" : "Asia/Taipei // 股票所屬時區"
},
"symbolIds" : [ {
"symbolId" : "0050 SFC0",
"name" : "元大台灣50ETF期貨"
}, {
"symbolId" : "0056 SFC0",
"name" : "元大高股息ETF期貨"
} ]
}
}
},
"Error" : {
"required" : [ "code", "message" ],
"type" : "object",
"properties" : {
"error" : {
"$ref" : "#/components/schemas/Error_error"
}
},
"example" : {
"code" : 400,
"message" : "unknown error"
}
},
"ChartSchema_data_chart_datetime" : {
"type" : "object",
"properties" : {
"open" : {
"type" : "number",
"format" : "double"
},
"high" : {
"type" : "number",
"format" : "double"
},
"low" : {
"type" : "number",
"format" : "double"
},
"close" : {
"type" : "number",
"format" : "double"
},
"volume" : {
"type" : "integer",
"format" : "int32"
}
}
},
"ChartSchema_data_chart" : {
"type" : "object",
"properties" : {
"date-time" : {
"$ref" : "#/components/schemas/ChartSchema_data_chart_datetime"
}
}
},
"ChartSchema_data" : {
"type" : "object",
"properties" : {
"info" : {
"$ref" : "#/components/schemas/InfoSchema"
},
"chart" : {
"$ref" : "#/components/schemas/ChartSchema_data_chart"
}
}
},
"QuoteSchema_data_quote_total" : {
"type" : "object",
"properties" : {
"order" : {
"type" : "integer",
"format" : "int32"
},
"price" : {
"type" : "number",
"format" : "double"
},
"volume" : {
"type" : "integer",
"format" : "int32"
}
}
},
"QuoteSchema_data_quote_trial" : {
"type" : "object",
"properties" : {
"at" : {
"type" : "string",
"format" : "date-time"
},
"price" : {
"type" : "number",
"format" : "double"
},
"volume" : {
"type" : "integer",
"format" : "int32"
}
}
},
"QuoteSchema_data_quote_order_bestBids" : {
"type" : "object",
"properties" : {
"price" : {
"type" : "number",
"format" : "double"
},
"volume" : {
"type" : "integer"
}
}
},
"QuoteSchema_data_quote_order" : {
"type" : "object",
"properties" : {
"at" : {
"type" : "string"
},
"bestBids" : {
"type" : "array",
"items" : {
"$ref" : "#/components/schemas/QuoteSchema_data_quote_order_bestBids"
}
},
"bestAsks" : {
"type" : "array",
"items" : {
"$ref" : "#/components/schemas/QuoteSchema_data_quote_order_bestBids"
}
}
}
},
"QuoteSchema_data_quote" : {
"type" : "object",
"properties" : {
"isCurbing" : {
"type" : "boolean"
},
"isTrial" : {
"type" : "boolean"
},
"isOpenDelayed" : {
"type" : "boolean"
},
"isCloseDelayed" : {
"type" : "boolean"
},
"isClosed" : {
"type" : "boolean"
},
"total" : {
"$ref" : "#/components/schemas/QuoteSchema_data_quote_total"
},
"trial" : {
"$ref" : "#/components/schemas/QuoteSchema_data_quote_trial"
},
"trade" : {
"$ref" : "#/components/schemas/QuoteSchema_data_quote_trial"
},
"order" : {
"$ref" : "#/components/schemas/QuoteSchema_data_quote_order"
},
"priceHigh" : {
"type" : "number",
"format" : "double"
},
"priceLow" : {
"type" : "number",
"format" : "double"
},
"priceOpen" : {
"type" : "number",
"format" : "double"
},
"isHalting" : {
"type" : "boolean"
}
}
},
"QuoteSchema_data" : {
"type" : "object",
"properties" : {
"info" : {
"$ref" : "#/components/schemas/InfoSchema"
},
"quote" : {
"$ref" : "#/components/schemas/QuoteSchema_data_quote"
}
}
},
"MetaSchema_data_meta" : {
"type" : "object",
"properties" : {
"isIndex" : {
"type" : "boolean"
},
"nameZhTw" : {
"type" : "string"
},
"industry" : {
"type" : "string"
},
"abnormal" : {
"type" : "string"
},
"priceReference" : {
"type" : "number",
"format" : "double"
},
"priceHighLimit" : {
"type" : "number",
"format" : "double"
},
"priceLowLimit" : {
"type" : "number",
"format" : "double"
},
"canDayBuySell" : {
"type" : "boolean"
},
"canDaySellBuy" : {
"type" : "boolean"
},
"canShortMargin" : {
"type" : "boolean"
},
"canShortLend" : {
"type" : "boolean"
},
"volumePerUnit" : {
"type" : "integer",
"format" : "int32"
},
"currency" : {
"type" : "string"
},
"isTerminated" : {
"type" : "boolean"
},
"isSuspended" : {
"type" : "boolean"
}
}
},
"MetaSchema_data" : {
"type" : "object",
"properties" : {
"info" : {
"$ref" : "#/components/schemas/InfoSchema"
},
"meta" : {
"$ref" : "#/components/schemas/MetaSchema_data_meta"
}
}
},
"TradesSchema_data_trades" : {
"type" : "object",
"properties" : {
"at" : {
"type" : "string",
"format" : "date-time"
},
"price" : {
"type" : "number",
"format" : "double"
},
"volume" : {
"type" : "integer"
}
}
},
"TradesSchema_data" : {
"type" : "object",
"properties" : {
"info" : {
"$ref" : "#/components/schemas/InfoSchema"
},
"trades" : {
"type" : "array",
"items" : {
"$ref" : "#/components/schemas/TradesSchema_data_trades"
}
}
}
},
"FutureQuoteSchema_data_quote_total" : {
"type" : "object",
"properties" : {
"price" : {
"type" : "number",
"format" : "double"
},
"unit" : {
"type" : "integer",
"format" : "int32"
}
}
},
"FutureQuoteSchema_data_quote" : {
"type" : "object",
"properties" : {
"total" : {
"$ref" : "#/components/schemas/FutureQuoteSchema_data_quote_total"
},
"trade" : {
"$ref" : "#/components/schemas/QuoteSchema_data_quote_trial"
},
"priceHigh" : {
"type" : "number",
"format" : "double"
},
"priceLow" : {
"type" : "number",
"format" : "double"
},
"priceOpen" : {
"type" : "number",
"format" : "double"
}
}
},
"FutureQuoteSchema_data" : {
"type" : "object",
"properties" : {
"info" : {
"$ref" : "#/components/schemas/InfoSchema"
},
"quote" : {
"$ref" : "#/components/schemas/FutureQuoteSchema_data_quote"
}
}
},
"FutureMetaSchema_data_meta" : {
"type" : "object",
"properties" : {
"nameZhTw" : {
"type" : "string"
},
"priceReference" : {
"type" : "number",
"format" : "double"
},
"riseLimitPrice1" : {
"type" : "number",
"format" : "double"
},
"fallLimitPrice1" : {
"type" : "number",
"format" : "double"
},
"riseLimitPrice2" : {
"type" : "number",
"format" : "double"
},
"fallLimitPrice2" : {
"type" : "number",
"format" : "double"
},
"riseLimitPrice3" : {
"type" : "number",
"format" : "double"
},
"fallLimitPrice3" : {
"type" : "number",
"format" : "double"
},
"prodKind" : {
"type" : "string"
},
"decimalLocator" : {
"type" : "number",
"format" : "double"
},
"strikePriceDecimalLocator" : {
"type" : "number",
"format" : "double"
},
"beginDate" : {
"type" : "string"
},
"endDate" : {
"type" : "string"
},
"flowGroup" : {
"type" : "number"
},
"deliveryDate" : {
"type" : "string"
},
"dynamicBanding" : {
"type" : "string"
},
"expiryType" : {
"type" : "string"
},
"currency" : {
"type" : "string"
}
}
},
"FutureMetaSchema_data" : {
"type" : "object",
"properties" : {
"info" : {
"$ref" : "#/components/schemas/InfoSchema"
},
"meta" : {
"$ref" : "#/components/schemas/FutureMetaSchema_data_meta"
}
}
},
"SymbolIdsSchema_data_symbolIds" : {
"type" : "object",
"properties" : {
"symbolId" : {
"type" : "string"
},
"name" : {
"type" : "string"
}
}
},
"SymbolIdsSchema_data" : {
"type" : "object",
"properties" : {
"info" : {
"$ref" : "#/components/schemas/InfoSchema"
},
"symbolIds" : {
"type" : "array",
"items" : {
"$ref" : "#/components/schemas/SymbolIdsSchema_data_symbolIds"
}
}
}
},
"Error_error" : {
"type" : "object",
"properties" : {
"code" : {
"type" : "integer",
"format" : "int32"
},
"message" : {
"type" : "string"
}
}
}
},
"responses" : {
"ChartResponse" : {
"description" : "Chart Response Success",
"content" : {
"*/*" : {
"schema" : {
"$ref" : "#/components/schemas/ChartSchema"
}
}
}
},
"QuoteResponse" : {
"description" : "Quote Response Success",
"content" : {
"*/*" : {
"schema" : {
"$ref" : "#/components/schemas/QuoteSchema"
}
}
}
},
"MetaResponse" : {
"description" : "Meta Response Success",
"content" : {
"*/*" : {
"schema" : {
"$ref" : "#/components/schemas/MetaSchema"
}
}
}
},
"TradesResponse" : {
"description" : "Trades Response Success",
"content" : {
"*/*" : {
"schema" : {
"$ref" : "#/components/schemas/TradesSchema"
}
}
}
},
"FutureQuoteResponse" : {
"description" : "FutureQuote Response Success",
"content" : {
"*/*" : {
"schema" : {
"$ref" : "#/components/schemas/FutureQuoteSchema"
}
}
}
},
"FutureMetaResponse" : {
"description" : "FutureMeta Response Success",
"content" : {
"*/*" : {
"schema" : {
"$ref" : "#/components/schemas/FutureMetaSchema"
}
}
}
},
"FutureTradesResponse" : {
"description" : "FutureTrades Response Success",
"content" : {
"*/*" : {
"schema" : {
"$ref" : "#/components/schemas/FutureTradesSchema"
}
}
}
},
"SymbolIdsResponse" : {
"description" : "SymbolIds Response Success",
"content" : {
"*/*" : {
"schema" : {
"$ref" : "#/components/schemas/SymbolIdsSchema"
}
}
}
},
"BadRequest" : {
"description" : "general purpose error, \n ex: \n * invalid parameters (apiVersion/mode/symbolId) - 帶入參數錯誤時回傳\n * quota exceeded - 當使用者發送 request 超出配額時回傳"
},
"Unauthorized" : {
"description" : "invalid apiToken - 當 token 沒帶入或不正確時回傳"
},
"NotFound" : {
"description" : "The specified resource was not found"
},
"DefaultError" : {
"description" : "預設 Error 回傳格式",
"content" : {
"*/*" : {
"schema" : {
"$ref" : "#/components/schemas/Error"
}
}
}
}
},
"parameters" : {
"SymbolID" : {
"name" : "symbolId",
"in" : "query",
"description" : "個股、指數、商品識別代碼",
"required" : true,
"style" : "form",
"explode" : true,
"schema" : {
"type" : "string"
}
},
"Mode" : {
"name" : "mode",
"in" : "query",
"description" : "交易種類",
"required" : false,
"style" : "form",
"explode" : true,
"schema" : {
"type" : "string",
"enum" : [ "twse-sem", "tpex-otc", "taifex-fut" ]
}
},
"APIToken" : {
"name" : "apiToken",
"in" : "query",
"description" : "realtime api token",
"required" : true,
"style" : "form",
"explode" : true,
"schema" : {
"type" : "string",
"default" : "demo"
}
}
},
"securitySchemes" : {
"bearerAuth" : {
"type" : "http",
"scheme" : "bearer",
"bearerFormat" : "JWT"
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment