Fundamental bittrex api query – Bitcoin Stack Alternate

0
79


My perceive of this assertion is that I exploit my 1.2 Bitcoin to purchase
1.3X1.2 Litecoin. Is that this right?

The amount parameter refers to how lots of the coin you need to purchase, and the charge parameter as to the restrict value you need to purchase/promote these cash at.

Instance, purchase 100 dogecoin at 0.00000400 BTC every.

https://bittrex.com/api/v1.1/market/buylimit?apikey=api_key&market=BTC-DOGE&amount=100&charge=0.000004&nonce=nonce

If I need to use my Litecoin to purchase Bitcoin, do I want to alter the
market from BTC-LTC to LTC-BTC??

No, the market stays the identical, simply change a part of the URI from /buylimit? to /selllimit? or vice-versa. Promoting your litecoin for bitcion is similar as shopping for bitcoin with litecoin.

You can also make it act like a market order by checking the present bid/ask and making your charge equal to the facet your buying and selling. For instance if you wish to market purchase you may question the most effective ask value after which make that the speed.

operate fetchPairPrice($pair){
    $pair = strtoupper($pair);
    $uri = "https://bittrex.com/api/v1.1/public/getticker?market=BTC-".$pair;
    $ch = curl_init($uri);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $execResult = curl_exec($ch);
    $obj = json_decode($execResult, true);
    return $obj;
}


operate bittrexbuy($apikey, $apisecret, $image, $quant, $charge){
    $nonce=time();
    $uri='https://bittrex.com/api/v1.1/market/buylimit?apikey='.$apikey.'&market=BTC-'.$image.'&amount='.$quant.'&charge=".$charge."&nonce=".$nonce;
    $signal=hash_hmac("sha512',$uri,$apisecret);
    $ch = curl_init($uri);
        curl_setopt($ch, CURLOPT_HTTPHEADER, array('apisign:'.$signal));
    $execResult = curl_exec($ch);
    $obj = json_decode($execResult, true);
    return $obj;
}

    $symbolRate = fetchPairPrice("DOGE");
    $fetchPrice = $symbolRate["result"]["Ask"];
    $amountToBuy = 100;
    bittrexbuy($apikey, $apisecret, $image, $amountToBuy, $fetchPrice);

    //response
    //{"success":true,"message":"","consequence":{"uuid":"b5f891ab-a7b4-44aa-9488-94986d1d9551"}}

LEAVE A REPLY

Please enter your comment!
Please enter your name here