Poloniex api sell/buy immediatelly

1.3k views Asked by At

how to buy or sell immediatelly with poloniex api . i am using nickelbot and its always put for order

function api_buy()
{
    global $Adapters;

    $exchange = isset( $_GET['exchange'] ) ? $_GET['exchange'] : "error";
    if( $exchange == "error" ) return array( "error" => "exchange required" );
    $price = isset( $_GET['price'] ) ? $_GET['price'] : "error";
    if( $price == "error" ) return array( "error" => "price required" );
    $amount = isset( $_GET['amount'] ) ? $_GET['amount'] : "error";
    if( $amount == "error" ) return array( "error" => "amount required" );
    $market = isset( $_GET['market'] ) ? $_GET['market'] : "error";
    if( $market == "error" ) return array( "error" => "market required" );

    //let's not open up the trade api to the public:


    return array( get_class( $Adapters[$exchange] ) => $Adapters[$exchange]->buy( $market, $amount, $price ) );
}
2

There are 2 answers

0
A. STEFANI On

What do you mean by immediatelly ?

Websocket are not implemented to send buy or sell order, so you have to use API request.

You may use

Trading API Methods : buy and sell (Required POST parameters are "currencyPair", "rate", and "amount")

Take a look at Poloniex API support

0
exvion On

You may optionally set "immediateOrCancel" to 1. An immediate-or-cancel order can be partially or completely filled, but any portion of the order that cannot be filled immediately will be canceled rather than left on the order book.