package com.jxy.marketall.controller;

import com.jxy.common.core.utils.StringUtils;
import com.jxy.common.core.web.Result.AjaxResult;
import com.jxy.common.security.annotation.RequiresLogin;
import com.jxy.marketall.service.*;
import com.jxy.marketall.vo.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


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

    @Autowired
    private BTCV2Service btcv2Service;


    @PostMapping(value = {"/profitAddress"})
    @ApiOperation(value = "盈利地址数 Number of Addresses in Profit")
    //@RequiresLogin
    public AjaxResult profitAddresses(@RequestBody(required = false) SmaVo vo){

        if(StringUtils.isNull(vo)){vo = new SmaVo();}
        return  btcv2Service.getProfitAddressesList(vo.getSma());
    }

    @PostMapping(value = {"/lossAddress"})
    @ApiOperation(value = "亏损地址数 Number of Addresses in Loss")
    //@RequiresLogin
    public AjaxResult lossAddress(@RequestBody(required = false) SmaVo vo){
        if(StringUtils.isNull(vo)){vo = new SmaVo();}
        return  btcv2Service.getLossAddressList(vo.getSma());
    }

    @PostMapping(value = {"/profitRatio"})
    @ApiOperation(value = "地址盈亏比 Percent of Addresses in Profit")
    //@RequiresLogin
    public AjaxResult profitRatio(@RequestBody(required = false) SmaVo vo){

        if(StringUtils.isNull(vo)){vo = new SmaVo();}
        return  btcv2Service.getProfitRatioList(vo.getSma());
    }

    @PostMapping(value = {"/lthSupply"})
    @ApiOperation(value = "长期持有者供应量 Total Supply Held by Long-Term Holders")
    //@RequiresLogin
    public AjaxResult lthSupply(@RequestBody(required = false) SmaVo vo){
        if(StringUtils.isNull(vo)){vo = new SmaVo();}

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

    @PostMapping(value = {"/sthSupply"})
    @ApiOperation(value = "短期持有者供应量 Total Supply Held by Short-Term Holders")
    //@RequiresLogin
    public AjaxResult sthSupply(@RequestBody(required = false) SmaVo vo){
        if(StringUtils.isNull(vo)){vo = new SmaVo();}
        return  btcv2Service.getSthSupplyList(vo.getSma());
    }

    @PostMapping(value = {"/realizedPrice"})
    @ApiOperation(value = "已实现价格 Realized Price")
    //@RequiresLogin
    public AjaxResult realizedPrice(@RequestBody(required = false) SmaVo vo){
        if(StringUtils.isNull(vo)){vo = new SmaVo();}

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

    @PostMapping(value = {"/relativeLthSth"})
    @ApiOperation(value = "长/短期持有者供应量盈亏比 Long- and Short-Term Holder Supply in Profit/Loss")
    //@RequiresLogin
    public AjaxResult relativeLthSth(@RequestBody(required = false) SmaVo vo){
        if(StringUtils.isNull(vo)){vo = new SmaVo();}

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

    @PostMapping(value = {"/distributionLthSth"})
    @ApiOperation(value = "长/短期持有者供应量分布 Long- and Short-Term Holder Supply Distribution")
    //@RequiresLogin
    public AjaxResult distributionLthSth(@RequestBody(required = false) SmaVo vo){
        if(StringUtils.isNull(vo)){vo = new SmaVo();}

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

    @PostMapping(value = {"/lthProfitSupply"})
    @ApiOperation(value = "长期持有者盈利总供应量 Total Supply in Profit Held by Long-Term Holders")
    //@RequiresLogin
    public AjaxResult lthProfitSupply(@RequestBody(required = false) SmaVo vo){
        if(StringUtils.isNull(vo)){vo = new SmaVo();}

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

    @PostMapping(value = {"/sthProfitSupply"})
    @ApiOperation(value = "短期持有者盈利总供应量 Total Supply in Profit Held by Short-Term Holders")
    //@RequiresLogin
    public AjaxResult sthProfitSupply(@RequestBody(required = false) SmaVo vo){

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

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

    @PostMapping(value = {"/lthLossSupply"})
    @ApiOperation(value = "长期持有者亏损总供应量 Total Supply in Loss Held by Long-Term Holders")
    //@RequiresLogin
    public AjaxResult lthLossSupply(@RequestBody(required = false) SmaVo vo){
        if(StringUtils.isNull(vo)){vo = new SmaVo();}

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

    @PostMapping(value = {"/sthLossSupply"})
    @ApiOperation(value = "短期持有者亏损总供应量 Total Supply in Loss Held by Short-Term Holders")
    //@RequiresLogin
    public AjaxResult sthLossSupply(@RequestBody(required = false) SmaVo vo){
        if(StringUtils.isNull(vo)){vo = new SmaVo();}

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

    @PostMapping(value = {"/lthProfitRatio"})
    @ApiOperation(value = "长期持有者盈亏比 Long-Term Holder (STH) Profit/Loss Ratio")
    //@RequiresLogin
    public AjaxResult lthProfitRatio(@RequestBody(required = false) SmaVo vo){
        if(StringUtils.isNull(vo)){vo = new SmaVo();}

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

    @PostMapping(value = {"/sthProfitRatio"})
    @ApiOperation(value = "短期持有者盈亏比 Short-Term Holder (STH) Profit/Loss Ratio")
    //@RequiresLogin
    public AjaxResult sthProfitRatio(@RequestBody(required = false) SmaVo vo){
        if(StringUtils.isNull(vo)){vo = new SmaVo();}

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

    @PostMapping(value = {"/SLRVRatio"})
    @ApiOperation(value = "短期到长期实现价值比率 Short to Long-Term Realized Value (SLRV) Ratio")
    //@RequiresLogin
    public AjaxResult SLRVRatio(@RequestBody(required = false) SmaVo vo){
        if(StringUtils.isNull(vo)){vo = new SmaVo();}

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

    @PostMapping(value = {"/lthVolume"})
    @ApiOperation(value = "长期持有者每日交易量 Long-Term Holder Daily Volume")
    //@RequiresLogin
    public AjaxResult lthVolume(@RequestBody(required = false) SmaVo vo){
        if(StringUtils.isNull(vo)){vo = new SmaVo();}

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

    @PostMapping(value = {"/frm"})
    @ApiOperation(value = "交易汇率乘数 Fee Ratio Multiple (FRM)")
    //@RequiresLogin
    public AjaxResult frm(@RequestBody(required = false) SmaVo vo){
        if(StringUtils.isNull(vo)){vo = new SmaVo();}

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

    @PostMapping(value = {"/cvdd"})
    @ApiOperation(value = "累积价值-销毁天数比 Cumulative Value-Days Destroyed (CVDD)")
    //@RequiresLogin
    public AjaxResult cvdd(@RequestBody(required = false) SmaVo vo){
        if(StringUtils.isNull(vo)){vo = new SmaVo();}

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

    @PostMapping(value = {"/balancedPrice"})
    @ApiOperation(value = "已平衡价格 Balanced Price")
    //@RequiresLogin
    public AjaxResult balancedPrice(@RequestBody(required = false) SmaVo vo){
        if(StringUtils.isNull(vo)){vo = new SmaVo();}

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

    @PostMapping(value = {"/nvtRatio"})
    @ApiOperation(value = "市值/交易价值比 Network Value to Transactions Ratio")
    //@RequiresLogin
    public AjaxResult nvtRatio(@RequestBody(required = false) SmaVo vo){
        if(StringUtils.isNull(vo)){vo = new SmaVo();}

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

    @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 = {"/velocity"})
    @ApiOperation(value = "流通速度 Velocity")
    //@RequiresLogin
    public AjaxResult velocity(@RequestBody(required = false) SmaVo vo){
        if(StringUtils.isNull(vo)){vo = new SmaVo();}

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

    @PostMapping(value = {"/PiCycleTopIndicator"})
    @ApiOperation(value = "PI周期顶指标 Pi Cycle Top Indicator")
    public AjaxResult piCTI(@RequestBody(required = false) QueryVo vo){
        if(StringUtils.isNull(vo)){vo = new QueryVo();}

        return  btcv2Service.getPiCycleTIList(vo);
    }

    @PostMapping(value = {"/ssr"})
    @ApiOperation(value = "稳定币供应比 Stablecoin Supply Ratio (SSR)   ")
    //@RequiresLogin
    public AjaxResult ssr(@RequestBody(required = false) SmaVo vo){
        if(StringUtils.isNull(vo)){vo = new SmaVo();}

        return  btcv2Service.getSSRList();
    }

    @PostMapping(value = {"/ssro"})
    @ApiOperation(value = "稳定币供应比振荡器 Stablecoin Supply Ratio (SSR) Oscillator")
    //@RequiresLogin
    public AjaxResult ssro(@RequestBody(required = false) SmaVo vo){
        if(StringUtils.isNull(vo)){vo = new SmaVo();}

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

    @PostMapping(value = {"/stfRatio"})
    @ApiOperation(value = "库存/新发行比 Stock-to-Flow Ratio ")
    public AjaxResult stfRatio(@RequestBody(required = false) QueryVo vo){
        if(StringUtils.isNull(vo)){vo = new QueryVo();}

        return  btcv2Service.getSTFRatioList(vo);
    }

    @PostMapping(value = {"/stfDeflection"})
    @ApiOperation(value = "库存/新发行偏差 Stock-to-Flow Deflection ")
    //@RequiresLogin
    public AjaxResult stfDeflection(@RequestBody(required = false) SmaVo vo){
        if(StringUtils.isNull(vo)){vo = new SmaVo();}

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

    @PostMapping(value = {"/goldenRatioMult"})
    @ApiOperation(value = "库存/黄金比例乘数 Golden Ratio Multiplier ")
    //@RequiresLogin
    public AjaxResult goldenRatioMult(@RequestBody(required = false) SmaVo vo){
        if(StringUtils.isNull(vo)){vo = new SmaVo();}

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

    @PostMapping(value = {"/mempool"})
    @ApiOperation(value = "待交易量")
    //@RequiresLogin
    public AjaxResult mempool(@RequestBody(required = false) QueryVo vo){
        if(StringUtils.isNull(vo)){vo = new QueryVo();}

        return  btcv2Service.getMempoolTransaction(vo);
    }


    @PostMapping(value = {"/exchanges"})
    @ApiOperation(value = "获取所有交易所名")
    //@RequiresLogin
    public AjaxResult exchanges(){

        return  btcv2Service.getExchanges();
    }

    @PostMapping(value = {"/ebalance"})
    @ApiOperation(value = "")
    //@RequiresLogin
    public AjaxResult ebalance(@RequestBody EBalanceVo vo){

        return  btcv2Service.getExchangeBalance(vo);
    }


}
