<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jxy.marketall.mapper.BTCV2Mapper">

	<select id="getProfitAddressList" resultType="com.jxy.marketall.dto.DateBigDecimalDto">
		SELECT distinct
		unixdt as date,
		profit_addresses as value
		FROM
		   utxosv4
		ORDER BY
		unixdt
	</select>

	<select id="getLossAddressList" resultType="com.jxy.marketall.dto.DateBigDecimalDto">
		SELECT distinct
		unixdt as date,
		loss_addresses as value
		FROM
		   utxosv4
		ORDER BY
		unixdt
	</select>

	<select id="getProfitRatioList" resultType="com.jxy.marketall.dto.DateBigDecimalDto">
		SELECT distinct
		unixdt as date,
		profit_ratio as value
		FROM
		   utxosv4
		ORDER BY
		unixdt
	</select>

	<select id="getLthSupplyList" resultType="com.jxy.marketall.dto.DateBigDecimalDto">
		SELECT distinct
		unixdt as date,
		lth_supply as value
		FROM
		   utxosv4
		ORDER BY
		unixdt
	</select>

	<select id="getSthSupplyList" resultType="com.jxy.marketall.dto.DateBigDecimalDto">
		SELECT distinct
		unixdt as date,
		sth_supply as value
		FROM
		   utxosv4
		ORDER BY
		unixdt
	</select>

	<select id="getRealizedPriceList" resultType="com.jxy.marketall.dto.DateBigDecimalDto">
		SELECT distinct
		unixdt as date,
		realized_price as value
		FROM
		   utxosv4
		ORDER BY
		unixdt
	</select>


	<select id="getLthProfitSupplyList" resultType="com.jxy.marketall.dto.DateBigDecimalDto">
		SELECT distinct
		unixdt as date,
		lth_profit_supply as value
		FROM
		   utxosv4
		ORDER BY
		unixdt
	</select>

	<select id="getSthProfitSupplyList" resultType="com.jxy.marketall.dto.DateBigDecimalDto">
		SELECT distinct
		unixdt as date,
		sth_profit_supply as value
		FROM
		   utxosv4
		ORDER BY
		unixdt
	</select>

	<select id="getLthLossSupplyList" resultType="com.jxy.marketall.dto.DateBigDecimalDto">
		SELECT distinct
		unixdt as date,
		lth_loss_supply as value
		FROM
		   utxosv4
		ORDER BY
		unixdt
	</select>

	<select id="getSthLossSupplyList" resultType="com.jxy.marketall.dto.DateBigDecimalDto">
		SELECT distinct
		unixdt as date,
		sth_loss_supply as value
		FROM
		   utxosv4
		ORDER BY
		unixdt
	</select>

	<select id="getSthProfitRatioList" resultType="com.jxy.marketall.dto.DateBigDecimalDto">
		SELECT distinct
		unixdt as date,
		sth_profit_ratio as value
		FROM
		   utxosv4
		ORDER BY
		unixdt
	</select>

	<select id="getLthProfitRatioList" resultType="com.jxy.marketall.dto.DateBigDecimalDto">
		SELECT distinct
		unixdt as date,
		lth_profit_ratio as value
		FROM
		   utxosv4
		ORDER BY
		unixdt
	</select>

	<select id="getSLRVRatioList" resultType="com.jxy.marketall.dto.DateBigDecimalDto">
		SELECT distinct
		unixdt as date,
		slrv_ratio as value
		FROM
		   utxosv4
		ORDER BY
		unixdt
	</select>

	<select id="getLthVolumeList" resultType="com.jxy.marketall.dto.DateBigDecimalDto">
		SELECT distinct
		unixdt as date,
		lth_volume as value
		FROM
		   dailyindsv3e2
		ORDER BY
		unixdt
	</select>

	<select id="getFeeRatioMultipleList" resultType="com.jxy.marketall.dto.DateBigDecimalDto">
		SELECT distinct
		unixdt as date,
		frm as value
		FROM
		   dailyindsv3e2
		ORDER BY
		unixdt
	</select>

	<select id="getCVDDList" resultType="com.jxy.marketall.dto.DateBigDecimalDto">
		SELECT distinct
		unixdt as date,
		cvdd as value
		FROM
		   dailyindsv3e2
		ORDER BY
		unixdt
	</select>

	<select id="getBalancedPriceList" resultType="com.jxy.marketall.dto.DateBigDecimalDto">
		SELECT distinct
		unixdt as date,
		balanced_price as value
		FROM
		   dailyindsv3e2
		ORDER BY
		unixdt
	</select>

	<select id="getNVTRatioList" resultType="com.jxy.marketall.dto.DateBigDecimalDto">
		SELECT distinct
		unixdt as date,
		nvt_ratio as value
		FROM
		   dailyindsv3e2
		ORDER BY
		unixdt
	</select>

	<select id="getVelocityList" resultType="com.jxy.marketall.dto.DateBigDecimalDto">
		SELECT distinct
		unixdt as date,
		velocity as value
		FROM
		   dailyindsv3e2
		ORDER BY
		unixdt
	</select>

	<select id="getListByTableAndField" resultType="com.jxy.marketall.dto.DateBigDecimalDto" statementType="STATEMENT">
		SELECT distinct
		unixdt as date,
		${field} as value
		FROM
		   ${table}
		ORDER BY
		unixdt
	</select>

	<select id="getMempoolTransation" resultType="com.jxy.marketall.dto.MempoolTransactionDto">
		SELECT distinct
		unixdt as `date`,
		mempool_size as mempoolSize,
		mempool_fees as mempoolFees
		FROM
		   realtimeindsv3
		where unixdt &gt;= '2024-01-02'
		ORDER BY
		unixdt desc limit 30
	</select>

    <select id="getLthSthSupplyDistributionList" resultType="com.jxy.marketall.dto.RelativeSupplyDto">
		SELECT
			unixdt as date,
			lth_profit_supply as lthProfitSupply,
			lth_loss_supply as lthLossSupply,
			sth_profit_supply as sthProfitSupply,
			sth_loss_supply as sthLossSupply
		FROM
		   utxosv4
		ORDER BY
		unixdt
	</select>

	<select id="getRelativeSupplyList" resultType="com.jxy.marketall.dto.DateBigDecimalDto">
		SELECT
			unixdt as `date`,
			relative_lth_sth as `value`
		FROM
		   utxosv4
		ORDER BY
		unixdt
	</select>

	<select id="getProfitAndLoss" resultType="com.jxy.marketall.dto.DateBigDecimalsDto">
		SELECT distinct
			unixdt as `date`,
			profit_addresses as `value1`,
			loss_addresses as `value2`
		FROM
		   utxosv4
		ORDER BY
		unixdt
	</select>

	<select id="getNVTRatioAndVolume" resultType="com.jxy.marketall.dto.DateBigDecimalsDto">
		SELECT distinct
			e2.unixdt as `date`,
			e2.nvt_ratio as `value1`,
			e1.volume as `value2`
		FROM
		   dailyindsv3e2 e2 left join dailyindsv3e1 e1 on e2.unixdt = e1.unixdt
		ORDER BY
			e2.unixdt
	</select>


</mapper>
