标签: gdax-api

如何从GDAX websocket Feed获得实时出价/询价/价格

API doc不鼓励在/ticker端点上进行轮询,并建议使用websocket流来监听匹配消息

但匹配响应仅提供a price和a side(卖/买)

如何从websocket Feed重新创建股票代码数据(价格,要价和出价)?

{
  “price”: “333.99”,
  “size”: “0.193”,
  “bid”: “333.98”,
  “ask”: “333.99”,
  “volume”: “5957.11914015”,
  “time”: “2015-11-14T20:46:03.511254Z”
}
Run Code Online (Sandbox Code Playgroud)

ticker端点和WebSocket的饲料都返回一个"价格",但我想这是不一样的.是priceticker端点某种平均随着时间的推移?

我怎样才能计算Bid价值,Ask价值?

coinbase-api gdax-api

18
推荐指数
1
解决办法
7970
查看次数

如何使用Python将FIX登录消息发送到GDAX/Coinbase

我正在尝试为fix.gdax.com建立一个FIX 4.2会话(docs:https://docs.gdax.com/#fix-api 或https://docs.prime.coinbase.com/?python#logon -a)使用Python 3.5和stunnel.除了我的登录消息之外,一切都正在工作,该消息被拒绝,服务器关闭会话而没有响应,因此很难调试出错的地方.我的Python代码如下:

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("127.0.0.1", 4197)) # address and port specified in stunnel config file

# generate a signature according to the gdax protocol for signing a message:
timestamp = str(time.time())
message   = [timestamp, "A", "0", "f3e85389ffb809650c367d42b37e0a80", "Coinbase", "password-goes-here"] # these are the components of the pre-hash string as specified in the docs for a logon message
message   = bytes("|".join(message), 'utf-8') # add the field separator

hmac_key  = base64.b64decode(r"api-secret-goes-here")
signature = …
Run Code Online (Sandbox Code Playgroud)

python fix-protocol coinbase-api gdax-api

6
推荐指数
1
解决办法
2338
查看次数

可用的GDAX订单状态和含义

GDAX API文档不做枚举的订单可以有可用的状态了伟大的工作.我看到至少open,pending,active,done,也许settled[^ 1].有没有人确定一份全面的清单,以及每种状况的含义?

我也尝试过查看一些可用的库,但官方客户端都是弱类型的(Node,Ruby),在非官方客户端中,Java客户端使用字符串,Rust客户端使用字符串,Haskell客户端 执行枚举类型,但它们也没有记录.

[^ 1]:settled实际上可能是它自己的领域.

gdax-api

6
推荐指数
1
解决办法
665
查看次数

GDAX/Coinbase API身份验证过程:必须在散列之前对Unicode对象进行编码

我有很多编码经验,但Python对我来说是新的领域.

我正在使用CoinbaseExchangeAuth类来访问GDAX API的专用端点.我写了一些简单的代码......

api_url = 'https://public.sandbox.gdax.com/'
auth = CoinbaseExchangeAuth(API_KEY, API_SECRET, API_PASS)
Run Code Online (Sandbox Code Playgroud)

(注意我已经准确地定义了api密钥,秘密并在这些代码行之前正确传递 - 对于沙箱)

然后我写道:

r = requests.get(api_url + 'accounts', auth=auth)
Run Code Online (Sandbox Code Playgroud)

运行代码并得到此错误:

文件"a:\ PythonCryptoBot\Bot1.0\CoinbaseExhangeAuth.py",第16行,在call signature = hmac.new(hmackey,message,hashlib.sha256)文件"C:\ Users\Dylan\AppData\Local\Programs\Python\Python35-32\lib\hmac.py",第144行,在新的返回HMAC(key,msg,digestmod)文件"C:\ Users\Dylan\AppData\Local\Programs\Python\Python35-32\lib\hmac.py",第84行,在__init_ self.update(msg)文件"C:\ Users\Dylan\AppData\Local\Programs\Python\Python35-32\lib\hmac.py",第93行,更新自我.inner.update(msg)TypeError:必须在散列之前对Unicode对象进行编码

另请注意,我尝试过API_KEY.encode('utf-8')和其他人一样. - 似乎没有做任何事情.

python api unicode coinbase-api gdax-api

5
推荐指数
1
解决办法
1136
查看次数

GDAX API:购买时状态为“已拒绝”(reject_reason:仅发布)

我有一个Python脚本,该脚本使用以下参数调用/ orders方法:

{
    "size": "0.01",
    "price": "<last price>",
    "side": "buy",
    "product_id": "BTC-USD",
    "type": "limit",
    "post_only": true
}
Run Code Online (Sandbox Code Playgroud)

有时它可以工作,但是大多数时候我都会收到此错误:

{
    "status": "rejected",
    "reject_reason": "post only"
}
Run Code Online (Sandbox Code Playgroud)

阅读交易规则后,它表示:

1.8A Limit Order with ‘post-only’ selected will only be posted to the Order Book if it would not be posted at the same price as an existing Order on the Order Book.

So I attempted to make the purchase with + $0.01, + $0.02, ..., + $0.99 (just to make sure that …

coinbase-api gdax-api

2
推荐指数
1
解决办法
1576
查看次数

如何将二进制密钥传递给 openssl

我很难将关键参数传递给openssl dgst. 我正在尝试连接到 GDAX 交易平台,并且每个请求都必须由 HMAC 签名。他们明确地说

“首先对字母数字秘密字符串(产生 64 个字节)进行 base64 解码,然后将其用作 HMAC 的密钥。”

这将产生一个 64 字节的二进制字符串。但是 openssl 命令行程序只是说-hmac key意味着您在命令行上提供密钥作为参数,如果它是简单的 ASCII 就可以了。但是我看不到提供二进制字节串作为键的方法。有没有办法做到这一点?

(也curl欢迎任何有关指导 GDAX 的一般建议)

openssl hmac gdax-api

1
推荐指数
1
解决办法
1275
查看次数

标签 统计

gdax-api ×6

coinbase-api ×4

python ×2

api ×1

fix-protocol ×1

hmac ×1

openssl ×1

unicode ×1