2

I am using this class https://github.com/ricog/coinbase-exchange-php/blob/master/lib/CoinbaseExchange/CoinbaseExchange.php

When I call it using

$listOrders = $exchange->listOrders();
print_r($listOrders);

This is my output:

[
    {
        "id": "d50ec984-77a8-460a-b958-66f114b0de9b",
        "size": "3.0",
        "price": "100.23",
        "product_id": "BTC-USD",
        "status": "open",
        "filled_size": "1.23",
        "fill_fees": "0.001",
        "settled": false,
        "side": "buy",
        "created_at": "2014-11-14 06:39:55.189376+00"
    }
]

By default all the pending or open orders are called. The documentation states "To specify multiple statuses, use the status query argument multiple times: /orders?status=done&status=pending." How can I call the above class where the status is 'done' instead of 'open', without showing any pending transactions.

I tried this $listOrders = $exchange->listOrders('status'=>'done');

It didn't work.

Source: https://docs.exchange.coinbase.com/?php#list-orders

2
  • I doesn't seem to be possible to call it with any parameters, not to mention calling it twice with same parameter. Method listOrders is not taking any parameters according to source. Commented Aug 25, 2015 at 9:56
  • You could just extend class CoinbaseExchange and add custom method listOrders that will create request with uri like this /orders?status=done&status=pending. Commented Aug 25, 2015 at 9:58

1 Answer 1

1

the class that you are using is not ment for sending multiple params (kind of stupidly written if you ask me). What you can do is to extend that class:

class MyExchange extends CoinbaseExchange {
    public function request($endpoint, $params = array()){
        return $response = parent::request($endpoint, $params);
    }
}

And then use it like this:

$exchange = new MyExchange();
// any other methods required for authentikation and settings like $exchange->auth(...)
$listOrders = $exchange->request('orders', array('status'=>'done', 'status'=>'pending');
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.