如何使用Coinbase API进行付款?获得无效的签名,但获得价格

时间:2019-05-29 19:30:36

标签: cryptocurrency

我可以通过获取当前价格

 client = Coinbase::Wallet::Client.new(api_key: ENV["CB_API_KEY"], api_secret: ENV["CB_API_SECRET"])
 buy_price = client.buy_price(currency_pair: 'LTC-USD')["amount"].to_f

我怎么卖?

我正在尝试:

client = Coinbase::Wallet::Client.new(api_key: ENV["CB_API_KEY"], api_secret: ENV["CB_API_SECRET"], api_version: '2019-05-29')
account = client.primary_account  #  <-- error
payment_method = client.get_payment_methods()[0]
p "account = #{payment_method}"
p "payment method = #{payment_method}"
sleep
account.sell(amount = @sell_amount, currency = 'LTC', payment_method = payment_method.id)

但我明白了

无效签名(Coinbase :: Wallet :: AuthenticationError)

位于https://developers.coinbase.com/docs/wallet/guides/buy-sell

的示例

有线...

from coinbase.wallet.client import Client
client = Client(<api_key>,
                <api_secret>,
                api_version='YYYY-MM-DD')

payment_methods = client.get_payment_methods()

但是我认为from不是Ruby。不确定使用或采取哪种正确格式

我的设置似乎还可以:

enter image description here

0 个答案:

没有答案