soapClient = new SoapClient($wsdlAddress); } function obj2array($obj) { $out = array(); foreach ($obj as $key => $val) { switch (true) { case is_object($val): $out[$key] = $this->obj2array($val); break; case is_array($val): $out[$key] = $this->obj2array($val); break; default: $out[$key] = $val; } } return $out; } /* * get indices based on market code. */ function getIndice($code) { $in = array( "code" => $code ); $indici = $this->soapClient->__soapCall('Indices', array( 'parameters' => $in ), null, null); $result = $this->obj2array($indici); $result = $result['IndicesResult']; $result = $result['TypeIndices']; $indice = new Indice(); $indice->setCode($code); $indice->setLastUpdateTime($result['LastUpdateTime']); $indice->setOpenValue($result['OpenValue']); $indice->setCurrentValue($result['CurrentValue']); $indice->setLowValue($result['LowValue']); $indice->setHighValue($result['HighValue']); $indice->setNetChange($result['NetChange']); $indice->setPrcChange($result['PrcChange']); return $indice; } /** * get symbol based on market. */ function getSymbol($symbol, $market) { $in = array( "symbol" => $symbol, "market" => $market ); $level1 = $this->soapClient->__soapCall('Level1', array( 'parameters' => $in ), null, null); $level1Result = $this->obj2array($level1); $level1Result = $level1Result['Level1Result']; $symbol = new Symbol(); $symbol->setMarketCode($level1Result['Marketcode']); $symbol->setSymbolCode($level1Result['Symbolcode']); $symbol->setLastTradeTime($level1Result['LastTradeTime']); $symbol->setOpenPrice($level1Result['Openprice']); $symbol->setClosePrice($level1Result['Closeprice']); $symbol->setValue($level1Result['Value']); $symbol->setVolume($level1Result['Volume']); $symbol->setTrades($level1Result['Trades']); $symbol->setLowPriceCurrent($level1Result['Lowpricecurrent']); $symbol->setHighPriceCurrent($level1Result['Highpricecurrent']); $symbol->setAvgprice($level1Result['Avgprice']); $symbol->setNetChgFromOfficialPrice($level1Result['NetChgFromOfficialPrice']); $symbol->setPrcChgFromOfficialPrice($level1Result['PrcChgFromOfficialPrice']); $symbol->setReferencePrice($level1Result['ReferencePrice']); $symbol->setPotentialOpenVol($level1Result['PotentialOpenVol']); $symbol->setPotentialOpenPrice($level1Result['PotentialOpenPrice']); $symbol->setSymbolStatus($level1Result['SymbolStatus']); $symbol->setLastBestTime($level1Result['LastBestTime']); $symbol->setBestBidVol($level1Result['BestBidVol']); $symbol->setBestBidPrice($level1Result['BestBidPricev']); $symbol->setBestAskVol($level1Result['BestAskVol']); $symbol->setBestAskPrice($level1Result['BestAskPrice']); return $symbol; } /** * get structured symbol based on market. */ function getSymbolPeNivele($symbol, $market) { $in = array( "symbol" => $symbol, "market" => $market ); $level2 = $this->soapClient->__soapCall('Level2', array( 'parameters' => $in ), null, null); $level2Result = $this->obj2array($level2); $level2Result = $level2Result['Level2Result']; $symbol = new Symbol(); $symbol->setMarketCode($level2Result['Marketcode']); $symbol->setSymbolCode($level2Result['Symbolcode']); $symbol->setLastTradeTime($level2Result['LastTradeTime']); $symbol->setOpenPrice($level2Result['Openprice']); $symbol->setClosePrice($level2Result['Closeprice']); $symbol->setValue($level2Result['Value']); $symbol->setVolume($level2Result['Volume']); $symbol->setTrades($level2Result['Trades']); $symbol->setLowPriceCurrent($level2Result['Lowpricecurrent']); $symbol->setHighPriceCurrent($level2Result['Highpricecurrent']); $symbol->setAvgprice($level2Result['Avgprice']); $symbol->setNetChgFromOfficialPrice($level2Result['NetChgFromOfficialPrice']); $symbol->setPrcChgFromOfficialPrice($level2Result['PrcChgFromOfficialPrice']); $symbol->setReferencePrice($level2Result['ReferencePrice']); $symbol->setPotentialOpenVol($level2Result['PotentialOpenVol']); $symbol->setPotentialOpenPrice($level2Result['PotentialOpenPrice']); $symbol->setSymbolStatus($level2Result['SymbolStatus']); $symbol->setLastTopTime($level2Result['LastTopTime']); $symbol->setNivel1($level2Result['A1Price'], $level2Result['B1Price'], $level2Result['A1Vol'], $level2Result['B1Vol']); $symbol->setNivel2($level2Result['A2Price'], $level2Result['B2Price'], $level2Result['A2Vol'], $level2Result['B2Vol']); $symbol->setNivel3($level2Result['A3Price'], $level2Result['B3Price'], $level2Result['A3Vol'], $level2Result['B3Vol']); $symbol->setNivel4($level2Result['A4Price'], $level2Result['B4Price'], $level2Result['A4Vol'], $level2Result['B4Vol']); $symbol->setNivel5($level2Result['A5Price'], $level2Result['B5Price'], $level2Result['A5Vol'], $level2Result['B5Vol']); return $symbol; } }