package com.jxy.marketall.controller;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.jxy.common.core.annotation.RateLimiter;
import com.jxy.common.core.enums.LimitType;
import com.jxy.common.core.utils.StringUtils;
import com.jxy.common.core.web.Result.AjaxResult;
import com.jxy.common.log.annotation.Log;
import com.jxy.common.security.annotation.RequiresLogin;

import com.jxy.marketall.dto.HolderBalanceDto;
import com.jxy.marketall.service.*;
import com.jxy.marketall.vo.*;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Description btc查询
 * @Date 2022/6/20 17:26
 * @Author 杜懿
 */
@RestController
@RequestMapping(value = {"/btc","/BTC"})
@Api(tags = "btc查询接口")
@SentinelResource
public class BTCController {

    @Autowired
    private Arh99Service arh99Service;

    @Autowired
    private BTCService btcService;

    @Autowired
    private BTCV2Service btcv2Service;


    @Autowired
    private Arh99DayService arh99DayService;

    @Autowired
    private Jzr60Service Jzr60Service;

    @Autowired
    private Jzr60DayService Jzr60DayService;

    @Autowired
    private BTCBigAmountVoutService btcBigAmountVoutService;


    @Autowired
    private HolderService holderService;

    @Autowired
    private UtxosService utxosService;

    @Autowired
    private BTCMongoService btcMongoService;


    @GetMapping("/arh99")
    @ApiOperation(value = "btc  arh999囤币及逃顶指标",response = List.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "start", value = "开始时间", dataType = "string", paramType = "query", required = false),
            @ApiImplicitParam(name = "end", value = "结束时间", dataType = "string", paramType = "query", required = false) })
    public AjaxResult arh99(QueryVo queryVo){
        return  arh99Service.findArh99ByTime(queryVo);
    }

    @GetMapping(value = {"/arh99day"})
    @ApiOperation(value = "btc  arh999囤币及逃顶指标",response = List.class)
    public AjaxResult arh99day(){

        return  arh99DayService.findArh99Day();
    }

    @GetMapping("/jzr60")
    @ApiOperation(value = "btc  江卓尔60日累计涨幅",response = List.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "start", value = "开始时间", dataType = "string", paramType = "query", required = false),
            @ApiImplicitParam(name = "end", value = "结束时间", dataType = "string", paramType = "query", required = false) })
    public AjaxResult jzr60(QueryVo queryVo){
        return  Jzr60Service.findJzr60ByTime(queryVo);
    }

    @GetMapping("/jzr60day")
    @ApiOperation(value = "btc  江卓尔60日累计涨幅",response = List.class)
    public AjaxResult jzr60day(){

        return  Jzr60DayService.findJzr60Day();
    }

    @GetMapping("/ma730")
    @ApiOperation(value = "btc 2年移动平均价格乘数",response = List.class)
    @Log(title = "")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "start", value = "开始时间", dataType = "string", paramType = "query", required = false),
            @ApiImplicitParam(name = "end", value = "结束时间", dataType = "string", paramType = "query", required = false) })
    public AjaxResult ma730(QueryVo queryVo){
        return  btcService.findMa730ByTime(queryVo);
    }

    @GetMapping("/ma730day")
    @ApiOperation(value = "btc 2年移动平均价格乘数",response = List.class)
    public AjaxResult ma730day(){

        return  btcService.findMa730Day();
    }

    @GetMapping(value = {"/btcVolume","/BTCVolume"})
    @ApiOperation(value = "btc日交易统计")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "start", value = "开始时间  可以只传开始时间，表示查询大于这个时间的值", dataType = "string", paramType = "query", required = false),
            @ApiImplicitParam(name = "end", value = "结束时间 可以只传开始时间，表示查询大于这个时间的值", dataType = "string", paramType = "query", required = false) })
    public AjaxResult btcVolume(QueryVo vo){

        //return  btcService.getBTCVolumeList(vo);
        return  btcService.getVolumeList(vo);
    }

    @GetMapping(value = {"/btcFees","/BTCFees"})
    @ApiOperation(value = "btc日交易统计")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "start", value = "开始时间  可以只传开始时间，表示查询大于这个时间的值", dataType = "string", paramType = "query", required = false),
            @ApiImplicitParam(name = "end", value = "结束时间 可以只传开始时间，表示查询大于这个时间的值", dataType = "string", paramType = "query", required = false) })
    @RateLimiter(time = 10000, count = 4,limitType = LimitType.IP)
    public AjaxResult btcFees(QueryVo vo){

        //return  btcService.getBTCFeesList(vo);
        return  btcService.getFeesList(vo);
    }

    @GetMapping(value = {"/eaVolume"})
    @ApiOperation(value = "交易量(找零消除) Transaction Volume (Entity-adjusted)")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "start", value = "开始时间", dataType = "string", paramType = "query", required = false),
            @ApiImplicitParam(name = "end", value = "结束时间", dataType = "string", paramType = "query", required = false) })
    public AjaxResult eaVolume(QueryVo vo){

        return  btcService.geteaVolumeList(vo);
    }


    @GetMapping("/bigamountvout")
    @ApiOperation(value = "btc 条件查询大额交易",response = List.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "amount", value = "最大交易额", dataType = "double", paramType = "query", required = false),
            @ApiImplicitParam(name = "vout", value = "", dataType = "string", paramType = "query", required = false),
            @ApiImplicitParam(name = "total", value = "模糊查询 值可以是amount、vout、txId", dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "txId", value = "交易id", dataType = "string", paramType = "query", required = false)
            })
    public AjaxResult bigamountvout(BTCVo btcVo){
        return btcBigAmountVoutService.findBTCBigAmountVoutByBTCVo(btcVo);
    }

    @GetMapping(value={"/btcbigtxcount","/BTCbigtxcount","/BTCBigTxCount","/btcBigTxCount","/BtcBigTxCount"})
    @ApiOperation(value = "btc 大额交易数量查询",response = List.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "start", value = "开始时间  可以只传开始时间，表示查询大于这个时间的值", dataType = "string", paramType = "query", required = false),
            @ApiImplicitParam(name = "end", value = "结束时间 可以只传开始时间，表示查询大于这个时间的值", dataType = "string", paramType = "query", required = false) })
    public AjaxResult btcbigtxcount(BTCBigTxCountVo vo){

        AjaxResult btcBigAmountVoutByTime = btcBigAmountVoutService.findBTCBigAmountVoutByTime(vo);

        return btcBigAmountVoutByTime ;

    }

    @GetMapping(value = {"/address"})
    @ApiOperation(value = "btc 地址统计")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "start", value = "开始时间  可以只传开始时间，表示查询大于这个时间的值", dataType = "string", paramType = "query", required = false),
            @ApiImplicitParam(name = "end", value = "结束时间 可以只传开始时间，表示查询大于这个时间的值", dataType = "string", paramType = "query", required = false) })
    public AjaxResult address(QueryVo queryVo){

        return  btcService.getAddressList(queryVo);
    }



    //@GetMapping(value = {"/dailyBuySell"})
    //@ApiOperation(value = "btc 日交易详情")
    //@ApiImplicitParams({
    //        @ApiImplicitParam(name = "start", value = "开始时间  可以只传开始时间，表示查询大于这个时间的值", dataType = "string", paramType = "query", required = false),
    //        @ApiImplicitParam(name = "end", value = "结束时间 可以只传开始时间，表示查询大于这个时间的值", dataType = "string", paramType = "query", required = false) })
    ////@RequiresLogin
    //public AjaxResult dailyBuySell(PageQueryVo queryVo){
    //
    //    return  dailyBuySellService.getDailyBuySellList(queryVo);
    //}

    //@GetMapping(value = {"/bigSell"})
    //@ApiOperation(value = "btc 大额出售详情")
    //@ApiImplicitParams({
    //        @ApiImplicitParam(name = "amount", value = "出售价格", dataType = "double", paramType = "query", required = false),
    //        @ApiImplicitParam(name = "profit", value = "收益", dataType = "double", paramType = "query", required = false),
    //        @ApiImplicitParam(name = "address", value = "交易地址", dataType = "string", paramType = "query", required = false),
    //        @ApiImplicitParam(name = "txId", value = "交易id", dataType = "string", paramType = "query", required = false),
    //        @ApiImplicitParam(name = "start", value = "开始时间  可以只传开始时间，表示查询大于这个时间的值", dataType = "string", paramType = "query", required = false),
    //        @ApiImplicitParam(name = "end", value = "结束时间 可以只传开始时间，表示查询大于这个时间的值", dataType = "string", paramType = "query", required = false) })
    ////@RequiresLogin
    //public AjaxResult bigSell(BigSellVo bigSellVo){
    //
    //    return  bigSellService.getBigSellListByCond(bigSellVo);
    //}

    @GetMapping(value = {"/holder"})
    @ApiOperation(value = "btc 持有者地址数分布( 按持有时间分段)")
    //@RequiresLogin
    public AjaxResult holder(QueryVo vo){
        return  holderService.getNewHolder(vo);
    }

    @GetMapping(value = {"/holderBalance"})
    @ApiOperation(value = "btc 持有者币数量分布( 按持有时间分段)")
    //@RequiresLogin
    public AjaxResult holderBalance(QueryVo vo){
        return  holderService.getNewHolderBalance(vo);
    }

    @GetMapping(value = {"/utxos"})
    @ApiOperation(value = "btc 持有者地址数分布(按余额分段)")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "start", value = "开始时间  可以只传开始时间，表示查询大于这个时间的值", dataType = "string", paramType = "query", required = false),
            @ApiImplicitParam(name = "end", value = "结束时间 可以只传开始时间，表示查询大于这个时间的值", dataType = "string", paramType = "query", required = false) })
    //@RequiresLogin
    public AjaxResult utxos(QueryVo vo){
        return  utxosService.getUtxosByTime(vo);
    }

    @GetMapping(value = {"/utxos2nd"})
    @ApiOperation(value = "btc 持有者币数量分布(按余额分段)")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "start", value = "开始时间  可以只传开始时间，表示查询大于这个时间的值", dataType = "string", paramType = "query", required = false),
            @ApiImplicitParam(name = "end", value = "结束时间 可以只传开始时间，表示查询大于这个时间的值", dataType = "string", paramType = "query", required = false) })
    //@RequiresLogin
    public AjaxResult utxos2nd(QueryVo vo){
        return  utxosService.getUtxos2ndByTime(vo);
    }

    @GetMapping(value = {"/getBuyData"})
    @ApiOperation(value = "btc 持有者地址数分布( 按买入价格分段)")
    //@RequiresLogin
    public AjaxResult getBuyData(QueryVo vo){
        return  btcMongoService.getBuyData(vo);
    }

    @GetMapping(value = {"/getBuyAmountData"})
    @ApiOperation(value = "btc 持有者币数量分布( 按买入价格分段)")
    //@RequiresLogin
    public AjaxResult getBuyAmountData(QueryVo vo){
        return  btcMongoService.getBuyAmountData(vo);
    }

    @GetMapping(value = {"/getDiffData"})
    @ApiOperation(value = "btc 持有者地址数分布(盈亏)")
    //@RequiresLogin
    public AjaxResult getDiffData(QueryVo vo){
        return  btcMongoService.getDiffData(vo);
    }

    @GetMapping(value = {"/getDiffAmountData"})
    @ApiOperation(value = "btc 改为 持有者币数量分布(盈亏)")
    //@RequiresLogin
    public AjaxResult getDiffAmountData(QueryVo vo){
        return  btcMongoService.getDiffAmountData(vo);
    }

    @GetMapping(value = {"/getProfitData"})
    @ApiOperation(value = "btc  持有者地址数分布(利润率)")
    //@RequiresLogin
    public AjaxResult getProfitData(QueryVo vo){
        return  btcMongoService.getProfitData(vo);
    }

    @GetMapping(value = {"/getProfitAmountData"})
    @ApiOperation(value = "btc 持有者币数量分布(利润率)")
    //@RequiresLogin
    public AjaxResult getProfitAmountData(QueryVo vo){
        return  btcMongoService.getProfitAmountData(vo);
    }

    @GetMapping(value = {"/getTopList"})
    @ApiOperation(value = "btc 巨鲸地址列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "page", value = "页数 从1开始 默认为第一页", dataType = "int", paramType = "query", required = false),
            @ApiImplicitParam(name = "address", value = "按地址查询", dataType = "string", paramType = "query", required = false),
            @ApiImplicitParam(name = "value", value = "查询范围 大于该值", dataType = "int", paramType = "query", required = false) })
    //@RequiresLogin
    public AjaxResult getTopList(TopVo topVo){
        //btcMongoService.getDayBalanceData()
        return  btcMongoService.getTopList(topVo);
    }

    @GetMapping(value = {"/getDayBalanceData/{value}"})
    @ApiOperation(value = "btc 指定范围内持有者币龄地址数分布数据")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "start", value = "开始时间  可以只传开始时间，表示查询大于这个时间的值", dataType = "string", paramType = "query", required = false),
            @ApiImplicitParam(name = "end", value = "结束时间 可以只传开始时间，表示查询大于这个时间的值", dataType = "string", paramType = "query", required = false),
            @ApiImplicitParam(name = "value", value = "查询范围 大于该值", dataType = "String", paramType = "path", required = false) })
    //@RequiresLogin
    public AjaxResult getDayBalanceData(QueryVo queryVo,@PathVariable("value") String value){
        return  btcMongoService.getDayBalanceData(queryVo,value,"balance_");
    }

    @GetMapping(value = {"/getDayBalanceAmountData/{value}"})
    @ApiOperation(value = "btc 指定范围内持有者币数量 币龄分布数据")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "start", value = "开始时间  可以只传开始时间，表示查询大于这个时间的值", dataType = "string", paramType = "query", required = false),
            @ApiImplicitParam(name = "end", value = "结束时间 可以只传开始时间，表示查询大于这个时间的值", dataType = "string", paramType = "query", required = false),
            @ApiImplicitParam(name = "value", value = "查询范围 大于该值", dataType = "String", paramType = "path", required = false) })
    //@RequiresLogin
    public AjaxResult getDayBalanceAmountData(QueryVo queryVo,@PathVariable("value") String value){
        return  btcMongoService.getDayBalanceData(queryVo,value,"balance_amount_");
    }

    @GetMapping(value = {"/getTopListWatch"})
    @ApiOperation(value = "btc 巨鲸交易监控")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "start", value = "开始时间  可以只传开始时间，表示查询大于这个时间的值", dataType = "string", paramType = "query", required = false),
            @ApiImplicitParam(name = "end", value = "结束时间 可以只传开始时间，表示查询大于这个时间的值", dataType = "string", paramType = "query", required = false),
            @ApiImplicitParam(name = "address", value = "按地址查询", dataType = "string", paramType = "query", required = false),
            @ApiImplicitParam(name = "value", value = "查询范围 大于该值", dataType = "int", paramType = "query", required = false) })
    //@RequiresLogin
    public AjaxResult getTopListWatch(TopListWatchVo vo){
        return  btcMongoService.getTopListWatch(vo);
    }


    @GetMapping(value = {"/capReal"})
    @ApiOperation(value = "capReal  放在每日币价K线中")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "start", value = "开始时间  可以只传开始时间，表示查询大于这个时间的值", dataType = "string", paramType = "query", required = false),
            @ApiImplicitParam(name = "end", value = "结束时间 可以只传开始时间，表示查询大于这个时间的值", dataType = "string", paramType = "query", required = false) })
    //@RequiresLogin
    public AjaxResult capReal(CoinVo vo){

        return  utxosService.getCapReal(vo);
    }

    @GetMapping(value = {"/CDD"})
    @ApiOperation(value = "Coin Days Destroyed 币天销毁量" )
    @ApiImplicitParams({
            @ApiImplicitParam(name = "start", value = "开始时间", dataType = "string", paramType = "query", required = false),
            @ApiImplicitParam(name = "end", value = "结束时间", dataType = "string", paramType = "query", required = false) })
    //@RequiresLogin
    public AjaxResult cDD(QueryVo vo){

        return  btcService.getCDDList(vo);
    }


    @GetMapping(value = {"/profitRate"})
    @ApiOperation(value = "已实现盈利交易占比 Percent UTXOs in Profit")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "start", value = "开始时间", dataType = "string", paramType = "query", required = false),
            @ApiImplicitParam(name = "end", value = "结束时间", dataType = "string", paramType = "query", required = false) })
    //@RequiresLogin
    public AjaxResult profitRate(QueryVo vo){

        return  btcService.getProfitRateList(vo);
    }


    @GetMapping(value = {"/sopr"})
    @ApiOperation(value = "已花费输出盈利比  Spent Output Profit Ratio")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "start", value = "开始时间", dataType = "string", paramType = "query", required = false),
            @ApiImplicitParam(name = "end", value = "结束时间", dataType = "string", paramType = "query", required = false) })
    //@RequiresLogin
    public AjaxResult sopr(QueryVo vo){

        return  btcService.getSoprList(vo);
    }

    @GetMapping(value = {"/asol"})
    @ApiOperation(value = "已花费输出平均寿命  Average Spent Output Lifespan")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "start", value = "开始时间", dataType = "string", paramType = "query", required = false),
            @ApiImplicitParam(name = "end", value = "结束时间", dataType = "string", paramType = "query", required = false) })
    //@RequiresLogin
    public AjaxResult asol(QueryVo vo){

        return  btcService.getAsolList(vo);
    }

    @GetMapping(value = {"/dormancy"})
    @ApiOperation(value = "已花费输出休眠平均天数 Average Coin Dormancy")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "start", value = "开始时间", dataType = "string", paramType = "query", required = false),
            @ApiImplicitParam(name = "end", value = "结束时间", dataType = "string", paramType = "query", required = false) })
    //@RequiresLogin
    public AjaxResult dormancy(QueryVo vo){

        return  btcService.getDormancyList(vo);
    }

    @GetMapping(value = {"/soag"})
    @ApiOperation(value = "币天销毁量年龄分布 Spent Output Age Bands")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "start", value = "开始时间", dataType = "string", paramType = "query", required = false),
            @ApiImplicitParam(name = "end", value = "结束时间", dataType = "string", paramType = "query", required = false) })
    //@RequiresLogin
    public AjaxResult soag(QueryVo vo){

        return  btcService.getSoagList(vo);
    }

    @GetMapping(value = {"/csupply"})
    @ApiOperation(value = "流通供应量 Circulating Supply")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "start", value = "开始时间", dataType = "string", paramType = "query", required = false),
            @ApiImplicitParam(name = "end", value = "结束时间", dataType = "string", paramType = "query", required = false) })
    public AjaxResult csupply(QueryVo vo){

        return  btcService.getCSupplyList(vo);
    }


    @GetMapping(value = {"/sumcsupply"})
    @ApiOperation(value = "累计币天销毁量（流通供应量） Cumulative Circulating Supply")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "start", value = "开始时间", dataType = "string", paramType = "query", required = false),
            @ApiImplicitParam(name = "end", value = "结束时间", dataType = "string", paramType = "query", required = false) })
    //@RequiresLogin
    public AjaxResult sumcsupply(QueryVo vo){

        return  btcService.getSumCSupplyList(vo);
    }

    @GetMapping(value = {"/sumcdd"})
    @ApiOperation(value = "累计币天销毁量 Cumulative Coin Days Destroyed")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "start", value = "开始时间", dataType = "string", paramType = "query", required = false),
            @ApiImplicitParam(name = "end", value = "结束时间", dataType = "string", paramType = "query", required = false) })
    //@RequiresLogin
    public AjaxResult sumcdd(QueryVo vo){

        return  btcService.getSumCddList(vo);
    }

    @GetMapping(value = {"/sumeacdd"})
    @ApiOperation(value = "累计币天销毁量(找零消除) Entity-adjusted Cumulative Coin Days Destroyed")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "start", value = "开始时间", dataType = "string", paramType = "query", required = false),
            @ApiImplicitParam(name = "end", value = "结束时间", dataType = "string", paramType = "query", required = false) })
    //@RequiresLogin
    public AjaxResult sumeacdd(QueryVo vo){

        return  btcService.getSumCddList(vo);
    }

    @GetMapping(value = {"/liveliness"})
    @ApiOperation(value = "活跃度 Liveliness")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "start", value = "开始时间", dataType = "string", paramType = "query", required = false),
            @ApiImplicitParam(name = "end", value = "结束时间", dataType = "string", paramType = "query", required = false) })
    //@RequiresLogin
    public AjaxResult liveliness(QueryVo vo){

        return  btcService.getLiveLinessList(vo);
    }

    @GetMapping(value = {"/rprofit"})
    @ApiOperation(value = "已实现盈利量 Realized Profit")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "start", value = "开始时间", dataType = "string", paramType = "query", required = false),
            @ApiImplicitParam(name = "end", value = "结束时间", dataType = "string", paramType = "query", required = false) })
    //@RequiresLogin
    public AjaxResult rprofit(QueryVo vo){

        return  btcService.getRealizedProfitList(vo);
    }

    @GetMapping(value = {"/rloss"})
    @ApiOperation(value = "已实现亏损量 Realized Loss")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "start", value = "开始时间", dataType = "string", paramType = "query", required = false),
            @ApiImplicitParam(name = "end", value = "结束时间", dataType = "string", paramType = "query", required = false) })
    //@RequiresLogin
    public AjaxResult rloss(QueryVo vo){

        return  btcService.getRealizedLossList(vo);
    }

    @GetMapping(value = {"/rplRate"})
    @ApiOperation(value = "已实现净收益损失比 Realized Profit/Loss")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "start", value = "开始时间", dataType = "string", paramType = "query", required = false),
            @ApiImplicitParam(name = "end", value = "结束时间", dataType = "string", paramType = "query", required = false) })
    //@RequiresLogin
    public AjaxResult rplRate(QueryVo vo){

        return  btcService.getRplRateList(vo);
    }

    @GetMapping(value = {"/marketcap"})
    @ApiOperation(value = "流通市值 market capitalization")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "start", value = "开始时间", dataType = "string", paramType = "query", required = false),
            @ApiImplicitParam(name = "end", value = "结束时间", dataType = "string", paramType = "query", required = false) })
    public AjaxResult marketcap(QueryVo vo){

        return  btcService.getMarketCapList(vo);
    }

    @PostMapping(value = {"/rcap"})
    @ApiOperation(value = "已实现流通市值 Realized capitalization")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "start", value = "开始时间", dataType = "string", paramType = "query", required = false),
            @ApiImplicitParam(name = "end", value = "结束时间", dataType = "string", paramType = "query", required = false) })
    public AjaxResult rcap(@RequestBody(required = false) QueryVo vo){
        if(StringUtils.isNull(vo)){vo = new QueryVo();}
        return  btcService.getRealizedCapList(vo);
    }

    @PostMapping(value = {"/earcap"})
    @ApiOperation(value = "已实现流通市值(找零消除) Entity-adjusted Realized capitalization")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "start", value = "开始时间", dataType = "string", paramType = "query", required = false),
            @ApiImplicitParam(name = "end", value = "结束时间", dataType = "string", paramType = "query", required = false) })
    public AjaxResult earcap(@RequestBody(required = false)  QueryVo vo){
        if(StringUtils.isNull(vo)){vo = new QueryVo();}
        return  btcService.getEntityAdjustedRealizedCapList(vo);
    }


    @GetMapping(value = {"/mvrv"})
    @ApiOperation(value = "流通市值-已实现流通市值比 market-value-to-realized-value")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "start", value = "开始时间", dataType = "string", paramType = "query", required = false),
            @ApiImplicitParam(name = "end", value = "结束时间", dataType = "string", paramType = "query", required = false) })
    public AjaxResult mvrv(QueryVo vo){

        return  btcService.getMVRVList(vo);
    }

    @PostMapping(value = {"/mvrvz"})
    @ApiOperation(value = "MVRV Z-Score")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "start", value = "开始时间", dataType = "string", paramType = "query", required = false),
            @ApiImplicitParam(name = "end", value = "结束时间", dataType = "string", paramType = "query", required = false) })
    public AjaxResult mvrvz(@RequestBody(required = false) QueryVo vo){
        if(StringUtils.isNull(vo)){vo = new QueryVo();}

        return  btcService.getMVRVZList(vo);
    }

    @GetMapping(value = {"/lthmvrv"})
    @ApiOperation(value = "长持者流通市值-已实现流通市值比 Long Term Holder MVRV")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "start", value = "开始时间", dataType = "string", paramType = "query", required = false),
            @ApiImplicitParam(name = "end", value = "结束时间", dataType = "string", paramType = "query", required = false) })
    //@RequiresLogin
    public AjaxResult lthmvrv(QueryVo vo){

        return  btcService.getLthMVRVList(vo);
    }

    @GetMapping(value = {"/sthmvrv"})
    @ApiOperation(value = "短持者流通市值-已实现流通市值比 Short Term Holder MVRV")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "start", value = "开始时间", dataType = "string", paramType = "query", required = false),
            @ApiImplicitParam(name = "end", value = "结束时间", dataType = "string", paramType = "query", required = false) })
    //@RequiresLogin
    public AjaxResult sthmvrv(QueryVo vo){

        return  btcService.getSthMVRVList(vo);
    }

    @GetMapping(value = {"/nupl"})
    @ApiOperation(value = "未实现的净收益损失比 Net Unrealized Profit/Loss")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "start", value = "开始时间", dataType = "string", paramType = "query", required = false),
            @ApiImplicitParam(name = "end", value = "结束时间", dataType = "string", paramType = "query", required = false) })
    //@RequiresLogin
    public AjaxResult nupl(QueryVo vo){

        return  btcService.getNuplList(vo);
    }

    @GetMapping(value = {"/uprofit"})
    @ApiOperation(value = "未实现的净收益量 Unrealized Profit")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "start", value = "开始时间", dataType = "string", paramType = "query", required = false),
            @ApiImplicitParam(name = "end", value = "结束时间", dataType = "string", paramType = "query", required = false) })
    //@RequiresLogin
    public AjaxResult uprofit(QueryVo vo){

        return  btcService.getUnrealizedProfitList(vo);
    }

    @GetMapping(value = {"/uloss"})
    @ApiOperation(value = "未实现的净损失量 Unrealized Loss")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "start", value = "开始时间", dataType = "string", paramType = "query", required = false),
            @ApiImplicitParam(name = "end", value = "结束时间", dataType = "string", paramType = "query", required = false) })
    //@RequiresLogin
    public AjaxResult uloss(QueryVo vo){

        return  btcService.getUnrealizedLossList(vo);
    }

    @GetMapping(value = {"/lthnupl"})
    @ApiOperation(value = "长持者未实现的净收益损失比 Long Term Holder NUPL")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "start", value = "开始时间", dataType = "string", paramType = "query", required = false),
            @ApiImplicitParam(name = "end", value = "结束时间", dataType = "string", paramType = "query", required = false) })
    //@RequiresLogin
    public AjaxResult lthnupl(QueryVo vo){

        return  btcService.getLthNuplList(vo);
    }

    @GetMapping(value = {"/sthnupl"})
    @ApiOperation(value = "短持者未实现的净收益损失比 Short Term Holder NUPL")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "start", value = "开始时间", dataType = "string", paramType = "query", required = false),
            @ApiImplicitParam(name = "end", value = "结束时间", dataType = "string", paramType = "query", required = false) })
    //@RequiresLogin
    public AjaxResult sthnupl(QueryVo vo){

        return  btcService.getSthNuplList(vo);
    }

    @GetMapping(value = {"/mintusd"})
    @ApiOperation(value = "发行价值Daily Coin Issuance (in USD)")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "start", value = "开始时间", dataType = "string", paramType = "query", required = false),
            @ApiImplicitParam(name = "end", value = "结束时间", dataType = "string", paramType = "query", required = false) })
    public AjaxResult mintusd(QueryVo vo){

        return  btcService.getMintusd(vo);
    }

    @GetMapping(value = {"/minerAddress"})
    @ApiOperation(value = "矿工地址数 Number of Miner Address")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "start", value = "开始时间", dataType = "string", paramType = "query", required = false),
            @ApiImplicitParam(name = "end", value = "结束时间", dataType = "string", paramType = "query", required = false) })
    public AjaxResult minerAddress(QueryVo vo){

        return  btcService.getMinerAddress(vo);
    }

    @GetMapping(value = {"/minerBalance"})
    @ApiOperation(value = " 矿工地址余额  Balance of Miner Address")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "start", value = "开始时间", dataType = "string", paramType = "query", required = false),
            @ApiImplicitParam(name = "end", value = "结束时间", dataType = "string", paramType = "query", required = false) })
    public AjaxResult minerBalance(QueryVo vo){

        return  btcService.getMinerBalance(vo);
    }

    @PostMapping(value = {"/nvtSign"})
    @ApiOperation(value = "NVT信号 Network Value to Transactions Signal")
    //@RequiresLogin
    public AjaxResult NVTSignal(@RequestBody(required = false) SmaVo vo){

        if(StringUtils.isNull(vo)){vo = new SmaVo();}

        return  btcv2Service.getNVTSignalList(vo.getSma());
    }

    @PostMapping(value = {"/vdd"})
    @ApiOperation(value = "vdd指标")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "start", value = "开始时间", dataType = "string", paramType = "query", required = false),
            @ApiImplicitParam(name = "end", value = "结束时间", dataType = "string", paramType = "query", required = false) })
    //@RequiresLogin
    public AjaxResult vdd(@RequestBody(required = false) QueryVo vo){

        if(StringUtils.isNull(vo)){vo = new QueryVo();}

        return  btcService.getVDDList(vo);
    }

    @GetMapping(value = {"/sma/{day}"})
    @ApiOperation(value = "币价SMA")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "start", value = "开始时间", dataType = "string", paramType = "query", required = false),
            @ApiImplicitParam(name = "end", value = "结束时间", dataType = "string", paramType = "query", required = false) })
    //@RequiresLogin
    public AjaxResult sma(QueryVo vo,@PathVariable("day") int day){

        vo.setSma(day);
        return  btcService.getPrice(vo);
    }

    @PostMapping(value = {"/test"})
    @ApiOperation(value = "NVT信号 Network Value to Transactions Signal")
    //@RequiresLogin
    public AjaxResult test(){

        return  AjaxResult.success();
    }

    @PostMapping(value = {"/test2"})
    @ApiOperation(value = "NVT信号 Network Value to Transactions Signal")
    //@RequiresLogin
    public AjaxResult test2(){

        HolderBalanceDto dto = new HolderBalanceDto();
        return  AjaxResult.success(dto);
    }

    @PostMapping(value = {"/test3"})
    @ApiOperation(value = "NVT信号 Network Value to Transactions Signal")
    //@RequiresLogin
    public AjaxResult test3(){

        HolderBalanceDto dto = new HolderBalanceDto();
        dto = null;
        return  AjaxResult.success(dto);
    }


}
