def insert_stock_trading_record(data: dict, stock_account: object):
    """Inserts a stock trading (i.e., buying or selling stocks) records."""
    from finance.models import Asset, deposit
    if data['category1'].startswith('장내'):
        code_suffix = '.KS'
    elif data['category1'].startswith('코스닥'):
        code_suffix = '.KQ'
    else:
        code_suffix = ''
        raise ValueError(
            "code_suffix could not be determined with the category '{}'".
            format(data['category1']))
    code = data['code'] + code_suffix
    asset = Asset.get_by_symbol(code)
    if asset is None:
        raise ValueError("Asset object could not be retrived with code '{}'"
            .format(code))
    return deposit(stock_account, asset, data['quantity'], data['date'])
