How to place buy/sell order for Ethereum?
Hi,
I was wondering how to place a buy/sell order for Ether. The docs say I can use this:
use Coinbase\Wallet\Resource\Buy;
$buy = new Buy([
'bitcoinAmount' => 1
]);
$client->createAccountBuy($account, $buy);
What are the parameters I should put into the Buy object to buy Ether? And how can I pass more arguments into the call like in the API docs? https://developers.coinbase.com/api/v2?python#place-buy-order
Hope someone can help me out! :)
I think something like that
$buy = new Buy();
$buy->setAmount(new Money(0.05, 'ETH'));
$buy->setPaymentMethod($paymentMethod);
bitcoinAmount is just a shorthand for
public function setBitcoinAmount($amount)
{
$this->amount = new Money($amount, CurrencyCode::BTC);
}
Then to place the buy: should we still use :
$client->createAccountBuy($account, $buy); ?
I'm not certain which account needs to be used here, getPrimaryAccount or one of getAccounts?
In any case: createAccountBuy is returning null in my code... :/
Support for new currencies was added in version 2.6.0. Ensure you're running that version or newer, and if you're still seeing issues feel free to open a new issue. Thanks!