{"id":2737,"date":"2021-07-13T02:30:52","date_gmt":"2021-07-13T02:30:52","guid":{"rendered":"https:\/\/www.tejwin.com\/en\/insights\/starting-using-tej-trial-database\/"},"modified":"2021-07-13T02:30:52","modified_gmt":"2021-07-13T02:30:52","slug":"starting-using-tej-trial-database","status":"publish","type":"insight","link":"https:\/\/www.tejwin.com\/en\/insights\/starting-using-tej-trial-database\/","title":{"rendered":"Starting Using TEJ Trial Database"},"content":{"rendered":"<p class=\"wp-block-paragraph\">The application and usage of TEJ API trial database<\/p>\n<figure class=\"wp-block-image size-full is-resized caption-align-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" class=\"wp-image-16022\" height=\"561\" src=\"https:\/\/www.tejwin.com\/en\/wp-content\/uploads\/2026\/08\/image-245.png\" width=\"842\"\/><figcaption class=\"wp-element-caption\">Photo Creds:\u00a0<a class=\"ek-link\" href=\"https:\/\/unsplash.com\/\" rel=\"noreferrer noopener\" target=\"_blank\">Unsplash<\/a><\/figcaption><\/figure>\n<h2 class=\"wp-block-heading\" id=\"141e\"><strong>Preface<\/strong><\/h2>\n<p class=\"wp-block-paragraph\" id=\"8d30\">With the increase of the calculation power of chips, Big Data has become more and more important, especially in the field of the financial markets. How to analyze a specific industry or company precisely? It always comes bias if we analyze by our intuition. Therefore, we could analyze based on numerous pieces of data to get more objective insight.<\/p>\n<p class=\"wp-block-paragraph\" id=\"2c67\">TEJ built the free database which provided variable financial data in recent one year. It includes operation, trade, finance, fund, future, option and real estate. This database is high cost-performance ratio for beginners to start coding. Let\u2019s get started now!<\/p>\n<h2 class=\"wp-block-heading\" id=\"1fb5\"><strong>The Editing Environment and Modules Required<\/strong><\/h2>\n<p class=\"wp-block-paragraph\" id=\"1402\">We use Mac OS and Jupyter Notebook in this article<\/p>\n<pre class=\"wp-block-code\"><code>import tejapi\nimport pandas as pd\nimport numpy as np<\/code><\/pre>\n<p class=\"wp-block-paragraph\"><em>Note: Please install tejapi by command prompt(Windows)\/Terminal (Mac) and then type<\/em><\/p>\n<pre class=\"wp-block-code\"><code>pip install tejapi<\/code><\/pre>\n<h2 class=\"wp-block-heading\" id=\"97bc\"><strong>The Highlights of the Article<\/strong><\/h2>\n<ul class=\"wp-block-list\">\n<li>Apply for the key of database<\/li>\n<li>Get the data we need<\/li>\n<\/ul>\n<h2 class=\"wp-block-heading\" id=\"05e9\"><strong>Key Application<\/strong><\/h2>\n<p class=\"wp-block-paragraph\" id=\"e893\"><strong>Step 1.<\/strong>\u00a0Click the\u00a0<a href=\"https:\/\/api.tej.com.tw\/index.html\" rel=\"noreferrer noopener\" target=\"_blank\">TEJ API<\/a>\u00a0link.<\/p>\n<figure class=\"wp-block-image aligncenter caption-align-center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.tejwin.com\/en\/wp-content\/uploads\/2026\/08\/1_19juDf9m33K1l8k7-XB1GGA.png\"\/><figcaption class=\"wp-element-caption\">TEJ API home page<\/figcaption><\/figure>\n<p class=\"wp-block-paragraph\" id=\"6b6e\"><strong>Step 2.<\/strong>\u00a0Click Apply for Trial.<\/p>\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.tejwin.com\/en\/wp-content\/uploads\/2026\/08\/1_1whLQ6KNmKRQxAg3VqPGdrw.png\"\/><\/figure>\n<p class=\"wp-block-paragraph\" id=\"e9e7\"><strong>Step 3.\u00a0<\/strong>Check the message and get the verification code.<\/p>\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.tejwin.com\/en\/wp-content\/uploads\/2026\/08\/1Czk0Qy163lUnvmJ5RHGUyg.png\"\/><\/figure>\n<p class=\"wp-block-paragraph\" id=\"9495\"><strong>Step 4.\u00a0<\/strong>Type the verification code<\/p>\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.tejwin.com\/en\/wp-content\/uploads\/2026\/08\/1_1qnMut5c6B6YksY_tU2Texw.png\"\/><\/figure>\n<p class=\"wp-block-paragraph\" id=\"ad89\"><strong>Step 5.\u00a0<\/strong>Success<\/p>\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.tejwin.com\/en\/wp-content\/uploads\/2026\/08\/1_1eOhyEL6eWCvdF9OyRZMURw.png\"\/><\/figure>\n<p class=\"wp-block-paragraph\" id=\"3a86\"><strong>Step 6.\u00a0<\/strong>Check the email<\/p>\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.tejwin.com\/en\/wp-content\/uploads\/2026\/08\/1_1FV5lE-oaT4TXsXqu5MtEYg.png\"\/><\/figure>\n<h2 class=\"wp-block-heading\" id=\"78cf\"><strong>Usage of Database<\/strong><\/h2>\n<p class=\"wp-block-paragraph\" id=\"048d\">We can see the\u00a0<a href=\"https:\/\/api.tej.com.tw\/datatables.html?db=TRAIL&amp;t=%E8%A9%A6%E7%94%A8%E8%B3%87%E6%96%99%E5%BA%AB\" rel=\"noreferrer noopener\" target=\"_blank\">trial database<\/a>\u00a0in the TEJ API list. There is abundant data on this page.<\/p>\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.tejwin.com\/en\/wp-content\/uploads\/2026\/08\/1_1gRfmKX36ROnbDeCIqZbanA.png\"\/><\/figure>\n<p class=\"wp-block-paragraph\" id=\"fa37\">Let\u2019s try to get the daily price and volume of Evergreen Marine Corporation 2603. Click the<a href=\"https:\/\/api.tej.com.tw\/columns.html?idCode=TRAIL%2FTAPRCD\" rel=\"noreferrer noopener\" target=\"_blank\">\u00a0<strong>Detailed description<\/strong><\/a>\u00a0which is next to the listed unadjusted price.<\/p>\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.tejwin.com\/en\/wp-content\/uploads\/2026\/08\/1_1jDDh4M5cPXpOPt3wcdmb1A.png\"\/><\/figure>\n<p class=\"wp-block-paragraph\" id=\"6b43\">Open the Jupyter Notebook.<\/p>\n<pre class=\"wp-block-code\"><code>tejapi.ApiConfig.api_key = \"your key\"<\/code><\/pre>\n<p class=\"wp-block-paragraph\" id=\"5f95\">Replace \u2018 your key \u2019 with the key we just applied for.<\/p>\n<pre class=\"wp-block-code\"><code>data = tejapi.get('TRAIL\/TAPRCD')<\/code><\/pre>\n<p class=\"wp-block-paragraph\" id=\"455c\">Each database has its specific code. TRAIL\/TAPRCD is code of database containing daily stock price and volume. We use attribution of tejapi \u2018get\u2019, and assign data to the variable\u00a0<code><em>data<\/em><\/code>.<\/p>\n<p class=\"wp-block-paragraph\" id=\"20c1\">This method will download whole data. But we only need the data of 2603. Therefore, we have to filter the data by altering the column description to choose the data we need.<\/p>\n<p class=\"wp-block-paragraph\" id=\"2dcc\"><strong>Filter<\/strong><\/p>\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\" id=\"f695\"><em>coid, ticker<br \/>mdate date, (gte : start date\u3001lte : the last day)<br \/>opts columns, (date\u3001close price\u3001volumn)<br \/>chinese_column_name, column names shown in Chinese<\/em><\/p>\n<\/blockquote>\n<pre class=\"wp-block-code\"><code>data = tejapi.get('TRAIL\/TAPRCD', \n                   coid='2603', \n                   mdate={'gte':'2020-01-01', 'lte':'2020-12-31'},\n                   opts={'columns':['mdate','close_d', 'volume']},\n                   chinese_column_name=True\n                  )<\/code><\/pre>\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.tejwin.com\/en\/wp-content\/uploads\/2026\/08\/1Ut0SR3CDN-1AaEqDV_979g.png\"\/><\/figure>\n<p class=\"wp-block-paragraph\" id=\"7b55\">Do you find there is a difference between your table and this picture? Try to add this line of code.<\/p>\n<pre class=\"wp-block-code\"><code>tejapi.ApiConfig.ignoretz = True<\/code><\/pre>\n<p class=\"wp-block-paragraph\">Finally, replace the index with the date column.<\/p>\n<pre class=\"wp-block-code\"><code>data.set_index('\u5e74\u6708\u65e5', inplace=True)<\/code><\/pre>\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.tejwin.com\/en\/wp-content\/uploads\/2026\/08\/14VmP0dVo6nJ3lAcqPURTLg.png\"\/><\/figure>\n<h2 class=\"wp-block-heading\" id=\"e787\"><strong>Conclusion<\/strong><\/h2>\n<p class=\"wp-block-paragraph\" id=\"2d06\">Today, we display how to use the TEJ API trial database. There is still a lot of data waiting for us to dig. With this data, we can do more advanced analysis, such as formulating trading strategy, evaluating investment risks, etc. You can see other applications in the extended reading at the bottom of this article. If you want to use longer-term data or other professional financial data, it is recommended to use\u00a0<a href=\"https:\/\/eshop.tej.com.tw\/E-Shop\/Edata_caseIntro\/2\" rel=\"noreferrer noopener\" target=\"_blank\"><strong>advanced schemes<\/strong><\/a>, which will be more perfect for formulating our strategy!<\/p>\n<h2 class=\"wp-block-heading\" id=\"0e12\"><strong>Related Link<\/strong><\/h2>\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/api.tej.com.tw\/index.html\" rel=\"noreferrer noopener\" target=\"_blank\">TEJ API<\/a><\/li>\n<li><a href=\"https:\/\/eshop.tej.com.tw\/E-Shop\/Edata_intro\" rel=\"noreferrer noopener\" target=\"_blank\">TEJ E-Shop<\/a><a href=\"https:\/\/medium.com\/tag\/python?source=post_page-----223e0cb5c341---------------python-----------------\" rel=\"noopener\" target=\"_blank\"><\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>The application and usage of TEJ API trial database Preface With the increase of the calculation power of chips, Big Data has become more and more important, especially in the field of the financial markets. How to analyze a specific industry or company precisely? It always comes bias if we analyze by our intuition. Therefore, [\u2026]<\/p>\n","protected":false},"featured_media":2726,"template":"","tags":[70,65],"insight_category":[16],"class_list":["post-2737","insight","type-insight","status-publish","has-post-thumbnail","hentry","tag-tej-api","tag-python","insight_category-quant-data-science"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/insight\/2737","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/insight"}],"about":[{"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/types\/insight"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/media\/2726"}],"wp:attachment":[{"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/media?parent=2737"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/tags?post=2737"},{"taxonomy":"insight_category","embeddable":true,"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/insight_category?post=2737"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}