예제 #1
0
void Exchange_BitCurex::secondSlot()
{
    static int sendCounter=0;
    switch(sendCounter)
    {
    case 0:
        if(!isReplayPending(103))sendToApi(103,baseValues.currentPair.currBStrLow.toLatin1()+"/ticker",false);
        break;
    case 1:
        if(!isReplayPending(202))sendToApi(202,"balance/",true,"nonce="+QByteArray::number(++privateNonce));
        break;
    case 2:
        if(!isReplayPending(109))sendToApi(109,baseValues.currentPair.currBStrLow.toLatin1()+'/'+QByteArray::number(lastTradesDate)+"/trades",false);
        break;
    case 3:
        if(!tickerOnly&&!isReplayPending(204))sendToApi(204,"offers/",true,"nonce="+QByteArray::number(++privateNonce));
        break;
    case 4:
        if(isDepthEnabled()&&(forceDepthLoad||!isReplayPending(111)))
        {
            emit depthRequested();
            sendToApi(111,baseValues.currentPair.currBStrLow.toLatin1()+"/"+baseValues.depthCountLimitStr+"/orderbook",false);
            forceDepthLoad=false;
        }
        break;
    case 5:
        if(lastHistory.isEmpty())getHistory(false);
        break;
    default: break;
    }
    if(sendCounter++>=5)sendCounter=0;

	Exchange::secondSlot();
}
예제 #2
0
void Exchange_Cryptsy::secondSlot()
{
	static int infoCounter=0;
	if(userInfoTime.elapsed()>(lastInfoReceived?10000:1000)&&!isReplayPending(202))
	{
		userInfoTime.restart();
		sendToApi(202,baseValues.currentPair.currRequestPair+"/money/info",true,baseValues.httpSplitPackets);
	}

	if(!tickerOnly&&!isReplayPending(204))sendToApi(204,baseValues.currentPair.currRequestPair+"/money/orders",true,baseValues.httpSplitPackets);

	if(depthEnabled&&(forceDepthLoad||/*infoCounter==3&&*/!isReplayPending(111)))
	{
		emit depthRequested();
		sendToApi(111,baseValues.currentPair.currRequestPair+"/money/depth/fetch",false,baseValues.httpSplitPackets);
		forceDepthLoad=false;
	}

	if(!isReplayPending(101))sendToApi(101,baseValues.currentPair.currRequestPair+"/money/order/lag",false,baseValues.httpSplitPackets);
	if((infoCounter==1)&&!isReplayPending(103))sendToApi(103,baseValues.currentPair.currRequestPair+"/money/ticker",false,baseValues.httpSplitPackets);
	if(!isReplayPending(104))sendToApi(104,baseValues.currentPair.currRequestPair+"/money/ticker_fast",false,baseValues.httpSplitPackets);

	if(!isReplayPending(109))sendToApi(109,baseValues.currentPair.currRequestPair+"/money/trades/fetch?since="+lastTradesDateCache,false,baseValues.httpSplitPackets);
	if(lastHistory.isEmpty())
		if(!isReplayPending(208))sendToApi(208,"money/wallet/history",true,baseValues.httpSplitPackets,"&currency=BTC");
	if(!baseValues.httpSplitPackets&&ShibeHttp)ShibeHttp->prepareDataSend();

	if(++infoCounter>9)
	{
		infoCounter=0;
		quint32 syncNonce=(static_cast<quint32>(time(NULL))-1371854884)*10;
		if(privateNonce<syncNonce)privateNonce=syncNonce;
	}
	Exchange::secondSlot();
}
void Exchange_BitMarket::secondSlot()
{
    static int sendCounter=0;
    switch(sendCounter)
    {
    case 0:
        if(!isReplayPending(103))sendToApi(103,"ticker.json",false,true);
        break;
    case 1:
        if(!isReplayPending(202))sendToApi(202,"info",true,true);
        break;
    case 2:
        if(!isReplayPending(109))sendToApi(109,"trades.json?since="+lastTradesTid,false,true);
        break;
    case 3:
        if(!tickerOnly&&!isReplayPending(204))sendToApi(204,"orders&market="+baseValues.currentPair.symbol.toLatin1(),true,true);
        break;
    case 4:
        if(isDepthEnabled()&&(forceDepthLoad||!isReplayPending(111)))
        {
            emit depthRequested();
            sendToApi(111,"orderbook.json",false,true);
            forceDepthLoad=false;
        }
        break;
    case 5:
        if(lastHistory.isEmpty())getHistory(false);
        break;
    default: break;
    }
    if(sendCounter++>=5)sendCounter=0;

    static int nonceCounter=0;
    if(++nonceCounter>9)
	{
        nonceCounter=0;
        quint32 syncNonce=(TimeSync::getTimeT()-1371854884)*10;
		if(privateNonce<syncNonce)privateNonce=syncNonce;
	}
	Exchange::secondSlot();
}
void Exchange_BTCChina::getHistory(bool force)
{
	if(tickerOnly)return;
	if(force)lastHistory.clear();
	if(!isReplayPending(208))
	{
		if(historyLastDate.isEmpty())
			sendToApi(208,"getTransactions",true,true,"\"all\",100");
		else
            sendToApi(208,"getTransactions",true,true,"\"all\",1000,0,"+historyLastDate);
	}
}
void Exchange_Bitfinex::secondSlot()
{
    static int sendCounter=0;
    switch(sendCounter)
    {
    case 0:
        if(!isReplayPending(103))sendToApi(103,"ticker/"+baseValues.currentPair.currRequestPair,false,true);
        break;
    case 1:
        if(!isReplayPending(202))sendToApi(202,"balances",true,true);
        break;
    case 2:
        if(!isReplayPending(109))sendToApi(109,"trades/"+baseValues.currentPair.currRequestPair+"?timestamp="+lastTradesDateCache+"&limit_trades=200"/*astTradesDateCache*/,false,true);
        break;
    case 3:
        if(!tickerOnly&&!isReplayPending(204))sendToApi(204,"orders",true,true);
        break;
    case 4:
        if(isDepthEnabled()&&(forceDepthLoad||!isReplayPending(111)))
        {
            emit depthRequested();
            sendToApi(111,"book/"+baseValues.currentPair.currRequestPair+"?limit_bids="+baseValues.depthCountLimitStr+"&limit_asks="+baseValues.depthCountLimitStr,false,true);
            forceDepthLoad=false;
        }
        break;
    case 5:
        if(lastHistory.isEmpty())
            if(!isReplayPending(208))sendToApi(208,"mytrades",true,true,", \"symbol\": \""+baseValues.currentPair.currRequestPair+"\", \"timestamp\": "+historyLastTimestamp+", \"limit_trades\": 200");
        break;
    default: break;
    }
    if(sendCounter++>=5)sendCounter=0;

	Exchange::secondSlot();
}
void Exchange_Bitstamp::secondSlot()
{
	static int infoCounter=0;
	switch(infoCounter)
	{
	case 0: if(!tickerOnly&&!isReplayPending(204))sendToApi(204,"open_orders/",true,true); break;
	case 1: if(!isReplayPending(202))sendToApi(202,"balance/",true,true); break;
	case 2: if(!isReplayPending(103))sendToApi(103,"ticker/",false,true); break;
	case 3: if(!isReplayPending(109))sendToApi(109,"transactions/",false,true); break;
	case 4: if(lastHistory.isEmpty()&&!isReplayPending(208))sendToApi(208,"user_transactions/",true,true); break;
	default: break;
	}

	if(depthEnabled)
	{
		if(forceDepthLoad||/*infoCounter==5&&*/!isReplayPending(111))
		{
			emit depthRequested();
			sendToApi(111,"order_book/",false,true);
			forceDepthLoad=false;
		}
	}

	if(++infoCounter>4)
	{
		infoCounter=0;
		quint32 syncNonce=(static_cast<quint32>(time(NULL))-1371854884)*10;
		if(privateNonce<syncNonce)privateNonce=syncNonce;
	}

	Exchange::secondSlot();
}
void Exchange_BTCChina::secondSlot()
{
	static int infoCounter=0;
	switch(infoCounter)
	{
	case 0: if(!tickerOnly&&!isReplayPending(204))sendToApi(204,"getOrders",true,true,"true,\"ALL\""); break;
	case 1: if(!isReplayPending(202))sendToApi(202,"getAccountInfo",true,true); break;
	case 2: if(lastHistory.isEmpty()&&!isReplayPending(208))
			{
				if(historyLastDate.isEmpty())
					sendToApi(208,"getTransactions",true,true,"\"all\",100");
				else
                    sendToApi(208,"getTransactions",true,true,"\"all\",1000,0,"+historyLastDate);
			}
			break;
	default: break;
	}

	if(isDepthEnabled()&&(forceDepthLoad||/*infoCounter==3&&*/!isReplayPending(111)))
	{
		if(!isReplayPending(111))
		{
			emit depthRequested();
			sendToApi(111,"getMarketDepth2",true,true,baseValues.depthCountLimitStr+",\""+baseValues.currentPair.currRequestPair+"\"");
		}
		forceDepthLoad=false;
	}

	if(!isReplayPending(103))sendToApi(103,"ticker?market="+baseValues.currentPair.currRequestPair,false,true);//

    if(infoCounter==3&&!isReplayPending(109))
	{
		if(!lastFetchTid.isEmpty())historyLastTradesRequest="historydata?market="+baseValues.currentPair.currRequestPair+"&since="+lastFetchTid;
        else historyLastTradesRequest="historydata?market="+baseValues.currentPair.currRequestPair;
        sendToApi(109,historyLastTradesRequest,false,true);
	}

	if(infoCounter++==3)
	{
		infoCounter=0;
	}

	Exchange::secondSlot();
}
예제 #8
0
void Exchange_Cryptsy::getHistory(bool force)
{
	if(tickerOnly)return;
	if(force)lastHistory.clear();
	if(!isReplayPending(208))sendToApi(208,"money/wallet/history",true,true,"&currency=BTC");
}
예제 #9
0
void Exchange_BitCurex::getHistory(bool force)
{
	if(tickerOnly)return;
	if(force)lastHistory.clear();
    if(!isReplayPending(208))sendToApi(208,"trades/"+baseValues.currentPair.currBStrLow.toLatin1()+"/"+QByteArray::number(lastHistoryId)+"/",true,"market="+baseValues.currentPair.currBStrLow.toLatin1()+"&nonce="+QByteArray::number(++privateNonce)+"&txid="+QByteArray::number(lastHistoryId));
}
void Exchange_Bitfinex::getHistory(bool force)
{
	if(tickerOnly)return;
	if(force)lastHistory.clear();
    if(!isReplayPending(208))sendToApi(208,"mytrades",true,true,", \"symbol\": \""+baseValues.currentPair.currRequestPair+"\", \"timestamp\": "+historyLastTimestamp+", \"limit_trades\": 100");
}
void Exchange_Bitstamp::getHistory(bool force)
{
	if(tickerOnly)return;
	if(force)lastHistory.clear();
	if(!isReplayPending(208))sendToApi(208,"user_transactions/",true,true);
}
void Exchange_BitMarket::getHistory(bool force)
{
	if(tickerOnly)return;
	if(force)lastHistory.clear();
    if(!isReplayPending(208))sendToApi(208,"trades&market="+baseValues.currentPair.symbol.toLatin1()+"&start="+QByteArray::number(lastHistoryId),true,true);
}