随着信息技术和通信技术的不断进步,我们已经步入了智能工业时代。在这个时代,各种智能技术的应用正在推动着工业的升级和转型,人工智能技术、5G技术和工业互联网技术等新一代信息技术正在不断推进着时代进步和发展。
void WtHftStraDemo::__tqz_cancelOrder(const std::string code,const uint32_t orderId){
if(this->_ctx->tqz_getCancelCounts(code.c_str())>(this->_cancel_limit_counts+15)){
this->_ctx->stra_log_text("[WtHftStraDemo::__tqz_cancelOrder]out of cancel limit counts when cancel order,code:%s,orderId:%d,
return;
}开发需求I35功能7O98设计O7I8
this->_ctx->stra_cancel(orderId);
}关于区块链项目技术开发唯:MrsFu123,代币发行、dapp智能合约开发、链游开发、多链钱包开发
交易所开发、量化合约开发、互助游戏开发、Nft数字藏品开发、众筹互助开发、元宇宙开发、swap开发、
链上合约开发、ido开发、商城开发等,开发过各种各样的系统模式,更有多种模式、制度、案例、后台等,成熟技术团队,欢迎实体参考。
void WtHftStraDemo::__tqz_cancelOrders(const std::string code,const IDSet orderIds){
for(auto&localid:orderIds)
this->__tqz_cancelOrder(code,localid);
}
void WtHftStraDemo::__tqz_cancelAllOrders(){
this->__tqz_cancelOrders(this->_code,this->_code_buy_orders);
this->__tqz_cancelOrders(this->_code,this->_code_sell_orders);
this->__tqz_cancelOrders(this->_code,this->_code_short_orders);
this->__tqz_cancelOrders(this->_code,this->_code_cover_orders);
}
TQZOrderType WtHftStraDemo::__tqz_getOrderType(const uint32_t orderId){
TQZOrderType orderType=DEFAULT_ORDER_TYPE;
if(this->_code_buy_orders.find(orderId)!=std::end(this->_code_buy_orders)){
orderType=BUY_TYPE;
}else if(this->_code_sell_orders.find(orderId)!=std::end(this->_code_sell_orders)){
orderType=SELL_TYPE;
}else if(this->_code_short_orders.find(orderId)!=std::end(this->_code_short_orders)){
orderType=SHORT_TYPE;
}else if(this->_code_cover_orders.find(orderId)!=std::end(this->_code_cover_orders)){
orderType=COVER_TYPE;
}else{
orderType=NO_TYPE;
}
return orderType;
}
double WtHftStraDemo::__tqz_getAskPrice(const std::string code){
return this->_ctx->stra_get_last_tick(code.c_str())->askprice(0);
}
double WtHftStraDemo::__tqz_getBidPrice(const std::string code){
return this->_ctx->stra_get_last_tick(code.c_str())->bidprice(0);
}
double WtHftStraDemo::__tqz_getCurrentMidPrice(const std::string code){
return(this->__tqz_getAskPrice(code)+this->__tqz_getBidPrice(code))*0.5;
}
bool WtHftStraDemo::__midPriceIsChange(int offsetTicks){
double currentMidPrice=this->__tqz_getCurrentMidPrice(this->_code);
double minPriceTick=this->_ctx->stra_get_comminfo(this->_code.c_str())->getPriceTick();
double midPriceOffset=abs(currentMidPrice-this->_last_mid_price);
bool midPriceIsChange=(midPriceOffset>=(minPriceTick*offsetTicks));
if(midPriceIsChange)
this->_last_mid_price=currentMidPrice;
return midPriceIsChange;
}
double WtHftStraDemo::__tqz_getLowerlimitPrice(const std::string code){
return this->_ctx->stra_get_last_tick(code.c_str())->lowerlimit();
}
double WtHftStraDemo::__tqz_getUpperlimitPrice(const std::string code){
return this->_ctx->stra_get_last_tick(code.c_str())->upperlimit();
}
double WtHftStraDemo::__tqz_getMarketMakingLongPrice(const std::string code,const double currentMidPrice,const int offsetTicks){
double minPriceTick=this->_ctx->stra_get_comminfo(code.c_str())->getPriceTick();
double marketMakerLongOrderPrice=currentMidPrice-minPriceTick*offsetTicks;
int longOrderPriceTicks=static_cast<int>(floor(marketMakerLongOrderPrice/minPriceTick));
return longOrderPriceTicks*minPriceTick;
}
double WtHftStraDemo::__tqz_getMarketMakingShortPrice(const std::string code,const double currentMidPrice,const int offsetTicks){
double minPriceTick=this->_ctx->stra_get_comminfo(code.c_str())->getPriceTick();
double marketMakerShortOrderPrice=currentMidPrice+minPriceTick*offsetTicks;
int shortOrderPriceTicks=static_cast<int>(ceil(marketMakerShortOrderPrice/minPriceTick));
return shortOrderPriceTicks*minPriceTick;
}
bool WtHftStraDemo::__isBeyondUpperlimitOrLowerlimit(const string code,const int longOrderOffsetTicks,const int shortOrderOffsetTicks){
if(this->__tqz_getLongPrice(code,longOrderOffsetTicks)>=this->__tqz_getUpperlimitPrice(code))
return true;
if(this->__tqz_getShortPrice(code,shortOrderOffsetTicks)<=this->__tqz_getLowerlimitPrice(code))
return true;
return false;
}
double WtHftStraDemo::__tqz_getLongPrice(const std::string code,const int offsetTicks=0){
WTSCommodityInfo*codeInfo=this->_ctx->stra_get_comminfo(code.c_str());
double longPrice=this->__tqz_getAskPrice(code.c_str())+codeInfo->getPriceTick()*offsetTicks;
if(longPrice>=this->__tqz_getUpperlimitPrice(code))
longPrice=this->__tqz_getUpperlimitPrice(code);
if(longPrice<=this->__tqz_getLowerlimitPrice(code))
longPrice=this->__tqz_getLowerlimitPrice(code);
return longPrice;
}