<?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.BTC2Mapper">

	<select id="getProfitRateList" parameterType="com.jxy.marketall.vo.QueryVo" resultType="com.jxy.marketall.dto.DateBigDecimalDto">
		SELECT
			unixdt as date,
			profitrate as value
		FROM
			dailyindsv3e1
			<where>

				<if test="vo.start != null and vo.start != ''">
					and unixdt &gt;= "${vo.start}"
				</if>
				<if test="vo.end != null and vo.end != ''">
					and unixdt &lt;= "${vo.end}"
				</if>
			</where>
		ORDER BY
			unixdt
	</select>

	<select id="getFeesList" parameterType="com.jxy.marketall.vo.QueryVo" resultType="com.jxy.marketall.dto.DateBigDecimalDto">
		SELECT
		unixdt as `date`,
		fees as `value`
		FROM
		dailyindsv3e1
		<where>

			<if test="vo.start != null and vo.start != ''">
				and unixdt &gt;= "${vo.start}"
			</if>
			<if test="vo.end != null and vo.end != ''">
				and unixdt &lt;= "${vo.end}"
			</if>
		</where>
		ORDER BY
		unixdt
	</select>

	<select id="getAddressList" parameterType="com.jxy.marketall.vo.QueryVo" resultType="com.jxy.marketall.dto.AddressDto">
		SELECT
			unixdt as `date`,
			new_address as newAddress,
			new_address_volume as newAddressVolume,
			active_address as activeAddress,
			send_address as sendAddress,
			total_address as totalAddress,
			receive_address as receiveAddress
		FROM
		dailyindsv3e1
		<where>

			<if test="vo.start != null and vo.start != ''">
				and unixdt &gt;= "${vo.start}"
			</if>
			<if test="vo.end != null and vo.end != ''">
				and unixdt &lt;= "${vo.end}"
			</if>
		</where>
		ORDER BY
		unixdt
	</select>

	<select id="getVolumeList" parameterType="com.jxy.marketall.vo.QueryVo" resultType="com.jxy.marketall.dto.DateBigDecimalDto">
		SELECT
		unixdt as `date`,
		volume as `value`
		FROM
		dailyindsv3e1
		<where>

			<if test="vo.start != null and vo.start != ''">
				and unixdt &gt;= "${vo.start}"
			</if>
			<if test="vo.end != null and vo.end != ''">
				and unixdt &lt;= "${vo.end}"
			</if>
		</where>
		ORDER BY
		unixdt
	</select>

	<select id="geteaVolumeList" parameterType="com.jxy.marketall.vo.QueryVo" resultType="com.jxy.marketall.dto.DateBigDecimalDto">
		SELECT
		unixdt as `date`,
		eavolume as `value`
		FROM
		dailyindsv3e1
		<where>

			<if test="vo.start != null and vo.start != ''">
				and unixdt &gt;= "${vo.start}"
			</if>
			<if test="vo.end != null and vo.end != ''">
				and unixdt &lt;= "${vo.end}"
			</if>
		</where>
		ORDER BY
		unixdt
	</select>

	<select id="getSoprList" parameterType="com.jxy.marketall.vo.QueryVo" resultType="com.jxy.marketall.dto.SoprDto">
		SELECT
			unixdt as `date`,
			sopr,
			asopr,
			easopr,
			lthsopr,
			sthsopr
		FROM
		dailyindsv3e1
		<where>

			<if test="vo.start != null and vo.start != ''">
				and unixdt &gt;= "${vo.start}"
			</if>
			<if test="vo.end != null and vo.end != ''">
				and unixdt &lt;= "${vo.end}"
			</if>
		</where>
		ORDER BY
		unixdt
	</select>

	<select id="getCDDList" parameterType="com.jxy.marketall.vo.QueryVo" resultType="com.jxy.marketall.dto.CoinDayDesDto">
		SELECT
		unixdt as `date`,
		cdd,
		sacdd,
		eacdd
		FROM
		dailyindsv3e1
		<where>

			<if test="vo.start != null and vo.start != ''">
				and unixdt &gt;= "${vo.start}"
			</if>
			<if test="vo.end != null and vo.end != ''">
				and unixdt &lt;= "${vo.end}"
			</if>
		</where>
		ORDER BY
		unixdt
	</select>

	<select id="getAsolList" parameterType="com.jxy.marketall.vo.QueryVo" resultType="com.jxy.marketall.dto.ASOLDto">
		SELECT
		unixdt as `date`,
		asol,
		eaasol
		FROM
		dailyindsv3e1
		<where>

			<if test="vo.start != null and vo.start != ''">
				and unixdt &gt;= "${vo.start}"
			</if>
			<if test="vo.end != null and vo.end != ''">
				and unixdt &lt;= "${vo.end}"
			</if>
		</where>
		ORDER BY
		unixdt
	</select>

	<select id="getDormancyList" parameterType="com.jxy.marketall.vo.QueryVo" resultType="com.jxy.marketall.dto.DormancyDto">
		SELECT
		unixdt as `date`,
		dormancy,
		adormancy as sadormancy,
		eadormancy
		FROM
		dailyindsv3e1
		<where>

			<if test="vo.start != null and vo.start != ''">
				and unixdt &gt;= "${vo.start}"
			</if>
			<if test="vo.end != null and vo.end != ''">
				and unixdt &lt;= "${vo.end}"
			</if>
		</where>
		ORDER BY
		unixdt
	</select>

	<select id="getSoagList" parameterType="com.jxy.marketall.vo.QueryVo" resultType="com.jxy.marketall.dto.SOAGDto">
		SELECT
		unixdt as `date`,
		day1,
		day7,
		day30,
		day60,
		day90,
		day180,
		day365,
		day730
		FROM
		dailyindsv3e1
		<where>

			<if test="vo.start != null and vo.start != ''">
				and unixdt &gt;= "${vo.start}"
			</if>
			<if test="vo.end != null and vo.end != ''">
				and unixdt &lt;= "${vo.end}"
			</if>
		</where>
		ORDER BY
		unixdt
	</select>

	<select id="getCsupplyList" parameterType="com.jxy.marketall.vo.QueryVo" resultType="com.jxy.marketall.dto.DateBigDecimalDto">
		SELECT
		unixdt as `date`,
		csupply as `value`
		FROM
		dailyindsv3e1
		<where>

			<if test="vo.start != null and vo.start != ''">
				and unixdt &gt;= "${vo.start}"
			</if>
			<if test="vo.end != null and vo.end != ''">
				and unixdt &lt;= "${vo.end}"
			</if>
		</where>
		ORDER BY
		unixdt
	</select>

	<select id="getSumCsupplyList" parameterType="com.jxy.marketall.vo.QueryVo" resultType="com.jxy.marketall.dto.DateBigDecimalDto">
		SELECT
		unixdt as `date`,
		sumcsupply as `value`
		FROM
		dailyindsv3e1
		<where>

			<if test="vo.start != null and vo.start != ''">
				and unixdt &gt;= "${vo.start}"
			</if>
			<if test="vo.end != null and vo.end != ''">
				and unixdt &lt;= "${vo.end}"
			</if>
		</where>
		ORDER BY
		unixdt
	</select>

	<select id="getSumCddList" parameterType="com.jxy.marketall.vo.QueryVo" resultType="com.jxy.marketall.dto.DateBigDecimalDto">
		SELECT
		unixdt as `date`,
		sumcdd `value`
		FROM
		dailyindsv3e1
		<where>

		</where>
		ORDER BY
		unixdt
	</select>

	<select id="getSumEaCddList" resultType="com.jxy.marketall.dto.DateBigDecimalDto">
		SELECT
		unixdt as `date`,
		sumeacdd `value`
		FROM
		dailyindsv3e1
		<where>

		</where>
		ORDER BY
		unixdt
	</select>

	<select id="getLiveLinessList" parameterType="com.jxy.marketall.vo.QueryVo" resultType="com.jxy.marketall.dto.LiveLinessDto">
		SELECT
		unixdt as `date`,
		liveliness,
		ealiveliness
		FROM
		dailyindsv3e1
		<where>

			<if test="vo.start != null and vo.start != ''">
				and unixdt &gt;= "${vo.start}"
			</if>
			<if test="vo.end != null and vo.end != ''">
				and unixdt &lt;= "${vo.end}"
			</if>
		</where>
		ORDER BY
		unixdt
	</select>

	<select id="getRealizedProfitList" parameterType="com.jxy.marketall.vo.QueryVo" resultType="com.jxy.marketall.dto.DateBigDecimalDto">
		SELECT
		unixdt as `date`,
		rprofit as `value`
		FROM
		dailyindsv3e1
		<where>

			<if test="vo.start != null and vo.start != ''">
				and unixdt &gt;= "${vo.start}"
			</if>
			<if test="vo.end != null and vo.end != ''">
				and unixdt &lt;= "${vo.end}"
			</if>
		</where>
		ORDER BY
		unixdt
	</select>

	<select id="getRealizedLossList" parameterType="com.jxy.marketall.vo.QueryVo" resultType="com.jxy.marketall.dto.DateBigDecimalDto">
		SELECT
		unixdt as `date`,
		rloss as `value`
		FROM
		dailyindsv3e1
		<where>

			<if test="vo.start != null and vo.start != ''">
				and unixdt &gt;= "${vo.start}"
			</if>
			<if test="vo.end != null and vo.end != ''">
				and unixdt &lt;= "${vo.end}"
			</if>
		</where>
		ORDER BY
		unixdt
	</select>

	<select id="getRplRateList" parameterType="com.jxy.marketall.vo.QueryVo" resultType="com.jxy.marketall.dto.DateBigDecimalDto">
		SELECT
		unixdt as `date`,
		rplrate as `value`
		FROM
		dailyindsv3e1
		<where>

			<if test="vo.start != null and vo.start != ''">
				and unixdt &gt;= "${vo.start}"
			</if>
			<if test="vo.end != null and vo.end != ''">
				and unixdt &lt;= "${vo.end}"
			</if>
		</where>
		ORDER BY
		unixdt
	</select>

	<select id="getMarketCapList" parameterType="com.jxy.marketall.vo.QueryVo" resultType="com.jxy.marketall.dto.DateBigDecimalDto">
		SELECT
		unixdt as `date`,
		marketcap as `value`
		FROM
		dailyindsv3e1
		<where>

			<if test="vo.start != null and vo.start != ''">
				and unixdt &gt;= "${vo.start}"
			</if>
			<if test="vo.end != null and vo.end != ''">
				and unixdt &lt;= "${vo.end}"
			</if>
		</where>
		ORDER BY
		unixdt
	</select>

	<select id="getRealizedCapList" parameterType="com.jxy.marketall.vo.QueryVo" resultType="com.jxy.marketall.dto.RealizedCapDto">
		SELECT
		unixdt as `date`,
		rcap,
		earcap
		FROM
		dailyindsv3e1
		<where>

			<if test="vo.start != null and vo.start != ''">
				and unixdt &gt;= "${vo.start}"
			</if>
			<if test="vo.end != null and vo.end != ''">
				and unixdt &lt;= "${vo.end}"
			</if>
		</where>
		ORDER BY
		unixdt
	</select>

	<select id="getRealizedCapAndMarketCapList" parameterType="com.jxy.marketall.vo.QueryVo" resultType="com.jxy.marketall.dto.RCapAndMCapDto">
		SELECT
		unixdt as `date`,
		rcap,
		marketcap
		FROM
		dailyindsv3e1
		<where>

			<if test="vo.start != null and vo.start != ''">
				and unixdt &gt;= "${vo.start}"
			</if>
			<if test="vo.end != null and vo.end != ''">
				and unixdt &lt;= "${vo.end}"
			</if>
		</where>
		ORDER BY
		unixdt
	</select>

	<select id="getMVRVList" parameterType="com.jxy.marketall.vo.QueryVo" resultType="com.jxy.marketall.dto.DataDto">
		SELECT
		unixdt as `time`,
		mvrv as `value`
		FROM
		dailyindsv3e1
		<where>

			<if test="vo.start != null and vo.start != ''">
				and unixdt &gt;= "${vo.start}"
			</if>
			<if test="vo.end != null and vo.end != ''">
				and unixdt &lt;= "${vo.end}"
			</if>
		</where>
		ORDER BY
		unixdt
	</select>

	<select id="getLthMVRVList" parameterType="com.jxy.marketall.vo.QueryVo" resultType="com.jxy.marketall.dto.TermHoldermvrvDto">
		SELECT
		unixdt as `date`,
		lthmvrv as mvrv,
		lthmarketcap as marketcap,
		lthrcap as rcap
		FROM
		utxosv3
		<where>
			<if test="vo.start != null and vo.start != ''">
				and unixdt &gt;= "${vo.start}"
			</if>
			<if test="vo.end != null and vo.end != ''">
				and unixdt &lt;= "${vo.end}"
			</if>
		</where>
		ORDER BY
		unixdt
	</select>

	<select id="getSthMVRVList" parameterType="com.jxy.marketall.vo.QueryVo" resultType="com.jxy.marketall.dto.TermHoldermvrvDto">
		SELECT
		unixdt as `date`,
		sthmvrv as mvrv,
		sthmarketcap as marketcap,
		sthrcap as rcap
		FROM
		utxosv3
		<where>
			<if test="vo.start != null and vo.start != ''">
				and unixdt &gt;= "${vo.start}"
			</if>
			<if test="vo.end != null and vo.end != ''">
				and unixdt &lt;= "${vo.end}"
			</if>
		</where>
		ORDER BY
		unixdt
	</select>

	<select id="getNuplList" parameterType="com.jxy.marketall.vo.QueryVo" resultType="com.jxy.marketall.dto.DateBigDecimalDto">
		SELECT
		unixdt as `date`,
		nupl as `value`
		FROM
		dailyindsv3e1
		<where>

			<if test="vo.start != null and vo.start != ''">
				and unixdt &gt;= "${vo.start}"
			</if>
			<if test="vo.end != null and vo.end != ''">
				and unixdt &lt;= "${vo.end}"
			</if>
		</where>
		ORDER BY
		unixdt
	</select>

	<select id="getMintusdYearAvg" resultType="com.jxy.marketall.dto.YearMaDto">
		select
			DATE_FORMAT(a.date,'%Y') `year`,
			AVG(a.mintusd) `value`
		FROM (SELECT   unixdt as `date`,mintusd FROM dailyindsv3e1) a
		GROUP BY year
	</select>

	<select id="getMintusdList" parameterType="com.jxy.marketall.vo.QueryVo" resultType="com.jxy.marketall.dto.DateBigDecimalDto">
		SELECT
		unixdt as `date`,
		mintusd as `value`
		FROM
		dailyindsv3e1
		<where>

			<if test="vo.start != null and vo.start != ''">
				and unixdt &gt;= "${vo.start}"
			</if>
			<if test="vo.end != null and vo.end != ''">
				and unixdt &lt;= "${vo.end}"
			</if>
		</where>
		ORDER BY
		unixdt
	</select>

	<select id="getUnrealizedProfitList" parameterType="com.jxy.marketall.vo.QueryVo" resultType="com.jxy.marketall.dto.DateBigDecimalDto">
		SELECT
		unixdt as `date`,
		uprofit as `value`
		FROM
		utxosv3
		<where>
			<if test="vo.start != null and vo.start != ''">
				and unixdt &gt;= "${vo.start}"
			</if>
			<if test="vo.end != null and vo.end != ''">
				and unixdt &lt;= "${vo.end}"
			</if>
		</where>
		ORDER BY
		unixdt
	</select>

	<select id="getUnrealizedLossList" parameterType="com.jxy.marketall.vo.QueryVo" resultType="com.jxy.marketall.dto.DateBigDecimalDto">
		SELECT
		unixdt as `date`,
		uloss as `value`
		FROM
		utxosv3
		<where>
			<if test="vo.start != null and vo.start != ''">
				and unixdt &gt;= "${vo.start}"
			</if>
			<if test="vo.end != null and vo.end != ''">
				and unixdt &lt;= "${vo.end}"
			</if>
		</where>
		ORDER BY
		unixdt
	</select>

	<select id="getLthNuplList" parameterType="com.jxy.marketall.vo.QueryVo" resultType="com.jxy.marketall.dto.DateBigDecimalsDto">
		SELECT
			unixdt as `date`,
			lthnupl as `value1`,
			lthmarketcap as value2,
			sthmarketcap as value3
		FROM
			utxosv3
		<where>
			<if test="vo.start != null and vo.start != ''">
				and unixdt &gt;= "${vo.start}"
			</if>
			<if test="vo.end != null and vo.end != ''">
				and unixdt &lt;= "${vo.end}"
			</if>
		</where>
		ORDER BY
		unixdt
	</select>

	<select id="getSthNuplList" parameterType="com.jxy.marketall.vo.QueryVo" resultType="com.jxy.marketall.dto.DateBigDecimalsDto">
		SELECT
		unixdt as `date`,
		sthnupl as `value1`,
		lthmarketcap as value2,
		sthmarketcap as value3
		FROM
		utxosv3
		<where>
			<if test="vo.start != null and vo.start != ''">
				and unixdt &gt;= "${vo.start}"
			</if>
			<if test="vo.end != null and vo.end != ''">
				and unixdt &lt;= "${vo.end}"
			</if>
		</where>
		ORDER BY
		unixdt
	</select>

	<select id="getPriceList" parameterType="com.jxy.marketall.vo.QueryVo" resultType="com.jxy.marketall.dto.PriceDataDto">
		SELECT
		(@i:= @i+1) as id,
		d.time as `time`,
		d.price as `value`
		FROM
		(select unixdt as `time` ,price from dailyindsv3e1 ) d,(select  @i:=0) as i
		<where>
			<if test="vo.start != null and vo.start != ''">
				and `time` &gt;= "${vo.start}"
			</if>
			<if test="vo.end != null and vo.end != ''">
				and `time` &lt;= "${vo.end}"
			</if>
		</where>
		ORDER BY
		`time`
	</select>

	<select id="getPriceBigDecimalList" parameterType="com.jxy.marketall.vo.QueryVo" resultType="com.jxy.marketall.dto.PriceSMADto">
		SELECT
			unixdt as `time`,
			price as `value`
		FROM
			dailyindsv3e1
		<where>

			<if test="vo.start != null and vo.start != ''">
				and unixdt &gt;= "${vo.start}"
			</if>
			<if test="vo.end != null and vo.end != ''">
				and unixdt &lt;= "${vo.end}"
			</if>
		</where>
		ORDER BY
			unixdt
	</select>

	<select id="getMinerAddressList" parameterType="com.jxy.marketall.vo.QueryVo" resultType="com.jxy.marketall.dto.DateBigDecimalDto">
		SELECT
		unixdt as `date`,
		miner_address as `value`
		FROM
		utxosv3
		<where>
			<if test="vo.start != null and vo.start != ''">
				and unixdt &gt;= "${vo.start}"
			</if>
			<if test="vo.end != null and vo.end != ''">
				and unixdt &lt;= "${vo.end}"
			</if>
		</where>
		ORDER BY
		unixdt
	</select>

	<select id="getMinerBalanceList" parameterType="com.jxy.marketall.vo.QueryVo" resultType="com.jxy.marketall.dto.DateBigDecimalDto">
		SELECT
		unixdt as `date`,
		miner_balance as `value`
		FROM
		utxosv3
		<where>
			<if test="vo.start != null and vo.start != ''">
				and unixdt &gt;= "${vo.start}"
			</if>
			<if test="vo.end != null and vo.end != ''">
				and unixdt &lt;= "${vo.end}"
			</if>
		</where>
		ORDER BY
		unixdt
	</select>

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

	<select id="getRealizedProfitAndLossList" resultType="com.jxy.marketall.dto.DateBigDecimalsDto">
		SELECT
			unixdt as `date`,
			rprofit as `value1`,
			rloss as `value2`
		FROM
			dailyindsv3e1
		ORDER BY
		unixdt
	</select>

	<select id="getVDDList" resultType="com.jxy.marketall.dto.DateBigDecimalDto">
		select distinct
			unixdt as `date`,
			vdd as `value`
		from
			dailyindsv3e1
		order by
		unixdt
	</select>

</mapper>
