什么是智能合约?
智能合约是对协议的翻译,区块链开发者用JAVA、C++和其他编程语言编写脚本,不会引起歧义或误解。这段代码翻译了一组自动执行和验证的规则。
双方的合同代码被上传到区块链,以检查合同的有效性并启用所需的步骤。从初始化开始,智能合约将自动执行。
区块链是一个链接数据的结构,它包含数据和指向以前数据的散列指针。
int32_t WtHftStraDemo::totalAlphasValue(TicksUPtr&ticksUPtr){
int32_t maAlphaValue=MaAlpha::alphaValue(ticksUPtr,20);
/*int32_t macdAlphaValue=MacdAlpha::alphaValue(ticksUPtr,9,12,26);
int32_t diffAlphaValue=DiffAlpha::alphaValue(ticksUPtr,20);
int32_t lastTradedQuantityAlphaValue=LastTradedQuantityAlpha::alphaValue(ticksUPtr,20);
int32_t bookAlphaValue=BookAlpha::alphaValue(ticksUPtr,20);*/
/*
///output all values to terminal for test...
//std::cout<<"maAlphaValue:"<<maAlphaValue<<std::endl;
std::cout<<"macdAlphaValue:"<<macdAlphaValue<<std::endl;
//std::cout<<"diffAlphaValue:"<<diffAlphaValue<<std::endl;
std::cout<<"lastTradedQuantityAlphaValue:"<<lastTradedQuantityAlphaValue<<std::endl;
//std::cout<<"bookAlphaValue:"<<bookAlphaValue<<std::endl;
*/
//return(maAlphaValue+macdAlphaValue+diffAlphaValue+lastTradedQuantityAlphaValue+bookAlphaValue);
return maAlphaValue;
}
uint32_t WtHftStraDemo::getLongOffsetValue(){
int32_t totalAlphasValue=this->totalAlphasValue(this->_ticks_uptr);
return(totalAlphasValue<0)?this->_long_order_offset:(this->_long_order_offset+totalAlphasValue);
}
uint32_t WtHftStraDemo::getShortOffsetValue(){
int32_t totalAlphasValue=this->totalAlphasValue(this->_ticks_uptr);
return(totalAlphasValue<0)?this->_short_order_offset:(this->_short_order_offset+totalAlphasValue);
}
bool WtHftStraDemo::updateTicks(WTSTickData tickData){
if(this->_ticks_uptr->size()==ALPHA_TICK_COUNTS)