DB

Database Usage Guide for Quantit

This document is intended for internal research purposes only at Quantit and explains how to interact with various databases using our system.

Disclaimer

  • The data discussed in this document is for internal use only and should not be shared outside of authorized Quantit personnel.

  • The databases are read-only; only SELECT queries are permitted. Other types of SQL operations will not execute.

Query Constraints

  • The maximum length for SQL queries is 1,000 characters. This limit may increase in the future.

  • Complex SQL constructs like JOIN, UNION, and SUBSELECT are not currently supported, though this may change based on future requirements.

  • Basic checks are in place to prevent SQL injection. Blacklisted characters include ;, --, /*, */, and `.

  • Queries automatically include a LIMIT clause for performance reasons. If no LIMIT is specified, it defaults to 10,000. The maximum limit is 1,000,000.

Available Databases

  • fnguide

  • spglobal

  • etfg

Python Code Examples

Importing the database module

from finter.data import DB

Initializing the database object

db = DB('fnguide')

Listing the first five available tables in the database

print(db.tables()[:5])

['TA_CAPCHG_TYP', 'TC_CMP_CAPCHG', 'TC_CMP_HIST', 'TC_CMP_HIST2', 'TC_COMPANY']

Getting column names of a specific table

print(db.columns('TS_STOCK'))

['STK_CD',
 'ISIN_CD',
 'CMP_CD',
 'MKT_TYP',
 'STK_TYP',
 'ISSUE_TYP',
 'STK_NM_KOR',
 'STK_NM_ENG',
 'LIST_DT',
 'DELIST_DT',
 'LIST_YN']

Executing a query

sql = "select * from TS_STOCK limit 2"
df = db.query(sql)

Example query result

print(df)

   CMP_CD DELIST_DT       ISIN_CD  ISSUE_TYP   LIST_DT  LIST_YN  MKT_TYP  \
0  000010  20040702  KR7000010009          1  19560303        0        1   
1  000020      None  KR7000020008          1  19760324        1        1   

   STK_CD    STK_NM_ENG STK_NM_KOR  STK_TYP  
0  000010  Shinhan Bank       ????        1  
1  000020  DongwhaPharm       ????        1  

This guide provides an overview of how to access and use the databases provided for internal research at Quantit. Please adhere strictly to the guidelines and constraints specified.

Last updated