package rediskey

// 量化
const (
	IPPositionCache     = "_IPPositionCache"        // IP 归属地缓存
	AppLoginUserToken   = "_AppLoginUserToken_%d"   // App登录用户的Token {uid}
	AgentLoginUserToken = "_AgentLoginUserToken_%d" // PC端代理商登录用户的Token
	AgentEmailCode      = "_AgentEmailCode_%d"
	AdminLoginUserToken = "_AdminLoginUserToken_%d"   // 后台登录用户的Token {uid}
	PCLoginUserToken    = "_PCLoginUserToken_%d"      // PC端登录token
	UserLoginPwdErrFre  = "_UserLoginPwdErrFre_%d"    // 用户登录密码错误次数 {uid}
	UserCaptchaSendFre  = "_UserCaptchaSendFre_%v_%d" // 用户验证码发送频次 {uid|ip}_{business}
	UserLoginWsClient   = "_UserLoginWsClient"        // websocket连接的客户端
	ScanLoginSecret     = "_ScanLoginSecret_%v"       // 扫码登录秘钥
	StatusCodeLanguage  = "_StatusCodeLanguage_%v"    // 状态码语言包_en
	PCRegisterEmail     = "_PCRegister_%v"            // 用户注册时邮箱key
	PCResetPwdEmail     = "_PCResetPwdEmail_%v"       // 用户重置密码时邮箱key

	PCRegisterMobile = "_PCRegisterMobile_%v" // 用户注册时手机key
	PCResetPwdMobile = "_PCResetPwdMobile_%v" // 用户重置密码时手机key

	// SpotSymbolTicker   = "_SpotSymbolTicker_"    // 现货交易对行情
	// FutSymbolTicker    = "_FutSymbolTicker_"     // 合约交易对行情
	PreOrderScriptList = "_ProOrderScriptList_" // 脚本执行list
	// 待触发的现货订单集合{交易所类型 exchange_type}
	PreSpotOrderList = "_PreSpotOrderList_:%s"
	// 待触发的订单集合 {交易所类型 exchange_type}
	PreFutOrderList = "_PreFutOrderList_:%s"

	//策略现货订单集合 {交易所类型 exchange_type}
	StrategySpotOrderList = "strategy_spot_order_list:%s"
	//策略合约订单集合 {交易所类型 exchange_type}
	StrategyFutOrderList = "strategy_fut_order_list:%s"

	API_USER      = "api_user:%v"    // api用户
	SystemSetting = "system_setting" //系统设置
	ApiGroup      = "api_group:%v"   //api用户组 {id}
	ApiGroupAll   = "api_group:"

	ApiUserActiveList = "api_user_active_list" //已启用待连接websocket的api
	ApiUserDeleteList = "api_user_delete_list" //已删除待删除的api

	FutStopTrigger  = "fut_trigger_stop_lock:%v_%s"  //合约止损触发锁
	SpotStopTrigger = "spot_trigger_stop_lock:%v_%s" //现货止损触发锁

	SpotAddPositionTrigger = "spot_addposition_trigger:%v_%s" //现货加仓触发 {apiuserid|symbol}
	FutAddPositionTrigger  = "fut_addposition_trigger:%v_%s"  //合约加仓触发 {apiuserid|symbol}
	SpotTrigger            = "spot_trigger_lock:%v_%s"        //现货触发 {apiuserid|symbol}
	FutTrigger             = "fut_trigger_lock:%v_%s"         //合约触发 {apiuserid|symbol}

	//波段现货触发{apiuserid|symbol}
	StrategySpotTriggerLock = "strategy_spot_trigger_l:%v_%s"
	//波段合约触发{apiuserid|symbol}
	StrategyFutTriggerLock = "strategy_fut_trigger_l:%v_%s"

	//减仓波段合约触发 {apiuserid|symbol}
	ReduceStrategyFutTriggerLock = "reduce_strategy_fut_trigger_l:%v_%s"
	//减仓波段现货触发 {apiuserid|symbol}
	ReduceStrategySpotTriggerLock = "reduce_strategy_spot_trigger_l:%v_%s"

	SpotCallBack = "spot_callback:%s" //现货回调 {ordersn}
	FutCallBack  = "fut_callback:%s"  //合约回调 {ordersn}

	FutReducecCallback = "fut_reduce_callback:%v_%s"  //合约减仓回调 {apiid,symbol}
	SpotReduceCallback = "spot_reduce_callback:%v_%s" //现货减仓回调 {apiid,symbol}

	//需要清理键值---------BEGIN---------------

	//现货止损待触发列表 {交易所类型code}
	SpotStopLossList = "spot_stoploss_list:%s"
	//现货止盈待触发列表 {交易所类型code}
	SpotTakeList = "spot_takelist:%s"
	//现货减仓待触发 {交易所类型code}
	SpotReduceList = "spot_reduce_list:%s"
	//合约止损待触发列表 {交易所类型code}
	FuturesStopLossList = "futures_stoploss_list:%s"
	//合约止盈待触发列表 {交易所类型code}
	FuturesTakeList = "futures_takelist:%s"
	//合约减仓待触发 {交易所类型code}
	FuturesReduceList = "futures_reduce_list:%s"
	//现货加仓待触发 {交易所code}
	SpotAddPositionList = "spot_add_position_list:%s"
	//合约加仓待触发 {交易所code}
	FuturesAddPositionList = "futures_add_position_list:%s"
	//现货持仓 {exchangeType,apiuserid,symbol,side}
	SpotPosition = "spot_position:%s:%v:%s_%s"
	//合约持仓 {exchangeType,apiuserid,symbol,side}
	FuturePosition = "future_position:%s:%v:%s_%s"

	//现货减仓单减仓策略 {exchangeType}
	SpotOrderReduceStrategyList = "spot_reduce_strategy_list:%s"
	//合约减仓单减仓策略 {exchangeType}
	FutOrderReduceStrategyList = "fut_reduce_strategy_list:%s"
	//需要清理键值---------END-----------------

	//定时取消限价并下市价锁
	JobReOrderTrigger = "job_re_order_trigger"
	//现货持仓修改锁{apiId,symbol,side}
	SpotPositionLock = "spot_position_lock:%v:%s:%s"
	//合约持仓修改锁{apiId,symbol,side}
	FuturePositionLock = "future_position_lock:%v:%s:%s"

	ListenAveLastSymbol = "listen_ave_last_symbol" // 监听最新交易对
	AveRequestToken     = "ave_request_token"      // AVE请求token
)

const (
	//现货最后成交价 sort set {exchangeType,symbol}
	SpotTickerLastPrice = "spot_ticker_last_price:%s:%s"
	//合约最后成交价 sort set {exchangeType,symbol}
	FutureTickerLastPrice = "fut_ticker_last_price:%s:%s"

	//允许缓存交易对价格的交易对 list
	CacheSymbolLastPrice = "cache_symbol_price"

	//减仓策略缓存 {id}
	ReduceStrategy = "reduce_stragy:%d"
)

// 用户下单
const (
	MemberShipPre = "member_ship_pre:%v" //用户开通会员预下单 单价缓存{payable_amount}
	MemberHash    = "member_hash:%s"     //用户开通会员hash缓存 {hash}
	OrderAmount   = "order_amount:%v"    //用户下单金额缓存 {amount}

	OrderCallBackLock = "order_callback_lock:%v" //订单回调锁 {amount}
)
