Open Thie1e opened 3 years ago
verbose() connection printouts below show that the start_time
and end_time
encoding into url is identical in successful (ftx_trades
) and unsuccessful (ftx_my_spot_borrow_history
) case.
ftx_my_spot_borrow_history
with start_time
and end_time
fails while without them succeeds.
It seems that the issue is in FTX side that does not implement/api/spot_margin/borrow_history
with start_time
and end_time
correctly.
GET request with start_time
and end_time
to /api/markets/[market]/trades
endpoint
evrything fine:
> ftx_trades(key, secret, "SOL/USD", start_time = now()-1000, end_time = now())
-> GET /api/markets/SOL/USD/trades?start_time=1635886011&end_time=1635887011 HTTP/1.1
-> Host: ftx.com
-> User-Agent: libcurl/7.64.1 r-curl/4.3.2 httr/1.4.2
-> Accept-Encoding: deflate, gzip
-> Accept: application/json, text/xml, application/xml, */*
-> FTX-KEY: 9YTEX4BePPk7yhd2jTZPEuFjYa_ROiVAKVvIElhE
-> FTX-SIGN: b0f1b9fc3be30e8e3217ba8c7a9b517cbd1db1dc8d716ec9c45bde7737fe411b
-> FTX-TS: 1635887010000
->
<- HTTP/1.1 200 OK
<- Date: Tue, 02 Nov 2021 21:03:29 GMT
<- Content-Type: application/json
<- Transfer-Encoding: chunked
<- Connection: keep-alive
<- Vary: Accept-Encoding
<- Vary: Accept-Encoding
<- Cache-Control: public, max-age=0
<- ETag: W/"0ca97b7b932f36ee309107637f406703"
<- Vary: Origin
<- Content-Encoding: gzip
<- X-Cache-Status: MISS
<- CF-Cache-Status: MISS
<- Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
<- Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
<- X-Content-Type-Options: nosniff
<- Server: cloudflare
<- CF-RAY: 6a804f4e7ee0b633-TLL
<- alt-svc: h3=":443"; ma=86400, h3-29=":443"; ma=86400, h3-28=":443"; ma=86400, h3-27=":443"; ma=86400
GET request without start_time
and end_time
to /api/spot_margin/borrow_history
endpoint
evrything fine:
> ftx_my_spot_borrow_history(key, secret)
-> GET /api/spot_margin/borrow_history HTTP/1.1
-> Host: ftx.com
-> User-Agent: libcurl/7.64.1 r-curl/4.3.2 httr/1.4.2
-> Accept-Encoding: deflate, gzip
-> Accept: application/json, text/xml, application/xml, */*
-> FTX-KEY: 9YTEX4BePPk7yhd2jTZPEuFjYa_ROiVAKVvIElhE
-> FTX-SIGN: a6c676eae16289cccdf6bcdbd7873f7dcbdd229b19f106c4c7d56a5fc4742baf
-> FTX-TS: 1635887748000
->
<- HTTP/1.1 200 OK
<- Date: Tue, 02 Nov 2021 21:15:47 GMT
<- Content-Type: application/json
<- Transfer-Encoding: chunked
<- Connection: keep-alive
<- Vary: Accept-Encoding
<- Vary: Accept-Encoding
<- Cache-Control: private, max-age=0, no-cache
<- account-id: 20707144
<- ETag: W/"0d0cd173ded83cacc333a804eb9917c8"
<- Vary: Origin
<- Content-Encoding: gzip
<- X-Cache-Status: MISS
<- CF-Cache-Status: MISS
<- Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
<- Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
<- X-Content-Type-Options: nosniff
<- Server: cloudflare
<- CF-RAY: 6a8061532929b633-TLL
<- alt-svc: h3=":443"; ma=86400, h3-29=":443"; ma=86400, h3-28=":443"; ma=86400, h3-27=":443"; ma=86400
GET request with start_time
and end_time
to /api/spot_margin/borrow_history
endpoint
fails: 401 UNAUTHORIZED:
> ftx_my_spot_borrow_history(key, secret, start_time = now() - days(200))
-> GET /api/spot_margin/borrow_history?start_time=1618603265&end_time=1635886865 HTTP/1.1
-> Host: ftx.com
-> User-Agent: libcurl/7.64.1 r-curl/4.3.2 httr/1.4.2
-> Accept-Encoding: deflate, gzip
-> Accept: application/json, text/xml, application/xml, */*
-> FTX-KEY: 9YTEX4BePPk7yhd2jTZPEuFjYa_ROiVAKVvIElhE
-> FTX-SIGN: 148e87ef48cc591e5273e814ce47476d6099b500498dcc4129bcfbfd8057d37a
-> FTX-TS: 1635886865000
->
<- HTTP/1.1 401 UNAUTHORIZED
<- Date: Tue, 02 Nov 2021 21:01:04 GMT
<- Content-Type: application/json
<- Content-Length: 42
<- Connection: keep-alive
<- Cache-Control: private, max-age=0, no-cache
<- account-id: None
<- Vary: Origin, Accept-Encoding
<- CF-Cache-Status: MISS
<- Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
<- Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
<- X-Content-Type-Options: nosniff
<- Server: cloudflare
<- CF-RAY: 6a804bc25866b633-TLL
<- alt-svc: h3=":443"; ma=86400, h3-29=":443"; ma=86400, h3-28=":443"; ma=86400, h3-27=":443"; ma=86400
Thanks, looks like it. I don't know much about working with APIs and the appropriate requests, but I just unsuccessfully fiddled around with this GET request for nearly an hour and also could not get it to work.
It's probably not the most important functionality anyway.
Hi,
first of all, thanks a lot for this package! I think this is going to be very useful.
I tried out some functions, mainly for getting my lending history, which worked, but I can not set an
end_time
there. Theend_time
parameter works inftx_spot_lending_history
, for example, but not inftx_my_spot_borrow_history
.Created on 2021-11-02 by the reprex package (v2.0.1)