API/Bitfinex/ファンディング情報を取得する(API v1)(PowerShell)
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
]
開始行:
#navi(../)
* Bitfinexのファンディング情報を取得する(API v1)(PowerShe...
PowerShellでBitfinexのファンディング情報(lendbook)を取得...
Bitfinexでは、レンディングではなくファンディングと呼んで...
Fundingbook APIのページを見ると ''lend''bookとなっていま...
#contents
#htmlinsert(cc-top.html)
* 参考資料 [#v30735ca]
Bitfinexのファンディング情報(lendbook)を取得するAPIドキュ...
Fundingbook API仕様は、以下のURLで確認してください。~
https://bitfinex.readme.io/v1/reference#rest-public-fundi...
* 関連記事 [#db3f03b2]
-[[Bitfinexの通貨シンボル一覧の取得(API v1)(PowerShell)>A...
-[[BitfinexのTickerの取得(API v1)(PowerShell)>API/Bitfine...
-[[Bitfinexで指定した通貨ペアの取引量を取得する(API v1)(P...
-[[Bitfinexのファンディング情報を取得する(API v1)(PowerSh...
-[[Bitfinexの板情報(注文一覧)を取得する(API v1)(PowerShel...
* ブラウザでアクセスしてみる [#da3f2cc7]
以下、URLでBTCのファンディング(レンディング)情報が取得で...
https://api.bitfinex.com/v1/lendbook/BTC
|''JSON''|
|&ref(01.png);|
|''生データ''|
|&ref(02.png);|
* PowerShellによるアクセス [#se9db58e]
PowerShellの''Invoke-RestMethod''コマンドレットと、''Invo...
指定した通貨のファンディング(レンディング)情報を取得して...
** ''Invoke-RestMethod''コマンドレット [#ae9027e0]
''Invoke-RestMethod''コマンドレットを使用して、指定した通...
PS C:\> $v1_lendbook_api = "https://api.bitfinex.com/v1/...
PS C:\> $currency = "BTC"
PS C:\> $lendbook = Invoke-RestMethod -UseBasicParsing (...
PS C:\> $lendbook
bids
----
{@{rate=5.548; amount=85.02918116; period=30; timestamp=...
bits, asksの情報はデフォルトでは、最大50件となっていたの...
PS C:\> $lendbook.bids.Count
50
PS C:\> $lendbook.asks.Count
50
パラメータとして、limit_bids, limit_asks があります。~
これは、bids, asks の最大取得件数を指定するパラメータにな...
bids, asksともに2件と指定し、取得してみます。
PS C:\> $currency = "ETH"
PS C:\> $limit_bids = 2
PS C:\> $limit_asks = 2
PS C:\> $lendbook = Invoke-RestMethod -UseBasicParsing (...
PS C:\> $lendbook
bids ...
---- ...
{@{rate=3.285; amount=677.4577947; period=30; timestamp=...
PS C:\> $lendbook.bids.Count
2
PS C:\> $lendbook.asks.Count
2
PS C:\> $lendbook.bids
rate : 3.285
amount : 677.4577947
period : 30
timestamp : 1531314687.0
frr : No
rate : 2.993
amount : 1840.63028393
period : 30
timestamp : 1530807405.0
frr : No
PS C:\> $lendbook.asks
rate : 1.8826
amount : 0.6076321
period : 2
timestamp : 1531409769.0
frr : No
rate : 1.8826
amount : 0.420347
period : 2
timestamp : 1531409848.0
frr : No
bids, asksともに指定した件数が取得されているのが確認でき...
上記の例では、currencyにBTCとETHを指定しました。
** ''Invoke-WebRequest''+''ConvertFrom-Json''コマンドレッ...
''Invoke-WebRequest''使うことにより、HTTPステータスや、Co...
取得したContent部分を''ConvertFrom-Json''コマンドレットを...
JSON形式でアクセスすることができます。
+ Invoke-WebRequestでFundingbook APIをアクセス
PS C:\> $v1_lendbook_api = "https://api.bitfinex.com/v1/...
PS C:\> $currency = "XRP"
PS C:\> $limit_bids = 1
PS C:\> $limit_asks = 1
PS C:\> $response = Invoke-WebRequest -UseBasicParsing (...
+ 取得したレスポンスを表示します。
PS C:\> $response
StatusCode : 200
StatusDescription : OK
Content : {"bids":[{"rate":"0.0219","amount":"...
0","frr":"...
RawContent : HTTP/1.1 200 OK
Connection: keep-alive
X-Frame-Options: SAMEORIGIN,SAMEORIGIN
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
X-Request-Id: a13c409a-6ba4-4134-92f...
X...
Forms :
Headers : {[Connection, keep-alive], [X-Frame-...
Images : {}
InputFields : {}
Links : {}
ParsedHtml :
RawContentLength : 206
+HTTPステータスコード、ヘッダー、Content-Typeなどにアクセ...
PS C:\> $response.StatusCode
200
PS C:\> $response.Headers
Key Value
--- -----
Connection keep-alive
X-Frame-Options SAMEORIGIN,SAMEORIGIN
X-XSS-Protection 1; mode=block
X-Content-Type-Options nosniff
X-Request-Id a13c409a-6ba4-4134-92fc-831a67...
X-Runtime 0.111515
Strict-Transport-Security max-age=31536000
Expect-CT max-age=604800, report-uri="ht...
CF-RAY 4394ac61ce696ef9-NRT
Content-Length 206
Cache-Control max-age=0, private, must-reval...
Content-Type application/json; charset=utf-8
Date Thu, 12 Jul 2018 15:51:49 GMT
ETag W/"2307dfec05c81f6dec04bca6736...
Set-Cookie __cfduid=d8e96e5fad527ff5c6808...
Server cloudflare
PS C:\> $response.Headers.'Content-Type'
application/json; charset=utf-8
+ConvertFrom-Jsonコマンドレットを使うことにより、JSON形式...
PS C:\> $json = ConvertFrom-Json $response.Content
PS C:\> $json
bids ...
---- ...
{@{rate=0.0219; amount=12183.20629104; period=30; timest...
* Webの応答を読み取っています。(Waiting for response)を非...
上記のコマンドレットを実行すると、APIサーバとのやり取りの...
#ref(51.png)
これを非表示にしたい場合は、以下のようにしてください。
非表示にするには、$ProgressPreferenceにSilentlyContinueを...
変更前は以下のように Continue が設定されています。
PS C:\> $ProgressPreference
Continue
非表示にするには、以下のように変更します。
PS C:\> $ProgressPreference = "SilentlyContinue"
以上、PowerShellを使って、BitfinexのFundingbook APIを呼び...
#htmlinsert(cc-btm.html)
終了行:
#navi(../)
* Bitfinexのファンディング情報を取得する(API v1)(PowerShe...
PowerShellでBitfinexのファンディング情報(lendbook)を取得...
Bitfinexでは、レンディングではなくファンディングと呼んで...
Fundingbook APIのページを見ると ''lend''bookとなっていま...
#contents
#htmlinsert(cc-top.html)
* 参考資料 [#v30735ca]
Bitfinexのファンディング情報(lendbook)を取得するAPIドキュ...
Fundingbook API仕様は、以下のURLで確認してください。~
https://bitfinex.readme.io/v1/reference#rest-public-fundi...
* 関連記事 [#db3f03b2]
-[[Bitfinexの通貨シンボル一覧の取得(API v1)(PowerShell)>A...
-[[BitfinexのTickerの取得(API v1)(PowerShell)>API/Bitfine...
-[[Bitfinexで指定した通貨ペアの取引量を取得する(API v1)(P...
-[[Bitfinexのファンディング情報を取得する(API v1)(PowerSh...
-[[Bitfinexの板情報(注文一覧)を取得する(API v1)(PowerShel...
* ブラウザでアクセスしてみる [#da3f2cc7]
以下、URLでBTCのファンディング(レンディング)情報が取得で...
https://api.bitfinex.com/v1/lendbook/BTC
|''JSON''|
|&ref(01.png);|
|''生データ''|
|&ref(02.png);|
* PowerShellによるアクセス [#se9db58e]
PowerShellの''Invoke-RestMethod''コマンドレットと、''Invo...
指定した通貨のファンディング(レンディング)情報を取得して...
** ''Invoke-RestMethod''コマンドレット [#ae9027e0]
''Invoke-RestMethod''コマンドレットを使用して、指定した通...
PS C:\> $v1_lendbook_api = "https://api.bitfinex.com/v1/...
PS C:\> $currency = "BTC"
PS C:\> $lendbook = Invoke-RestMethod -UseBasicParsing (...
PS C:\> $lendbook
bids
----
{@{rate=5.548; amount=85.02918116; period=30; timestamp=...
bits, asksの情報はデフォルトでは、最大50件となっていたの...
PS C:\> $lendbook.bids.Count
50
PS C:\> $lendbook.asks.Count
50
パラメータとして、limit_bids, limit_asks があります。~
これは、bids, asks の最大取得件数を指定するパラメータにな...
bids, asksともに2件と指定し、取得してみます。
PS C:\> $currency = "ETH"
PS C:\> $limit_bids = 2
PS C:\> $limit_asks = 2
PS C:\> $lendbook = Invoke-RestMethod -UseBasicParsing (...
PS C:\> $lendbook
bids ...
---- ...
{@{rate=3.285; amount=677.4577947; period=30; timestamp=...
PS C:\> $lendbook.bids.Count
2
PS C:\> $lendbook.asks.Count
2
PS C:\> $lendbook.bids
rate : 3.285
amount : 677.4577947
period : 30
timestamp : 1531314687.0
frr : No
rate : 2.993
amount : 1840.63028393
period : 30
timestamp : 1530807405.0
frr : No
PS C:\> $lendbook.asks
rate : 1.8826
amount : 0.6076321
period : 2
timestamp : 1531409769.0
frr : No
rate : 1.8826
amount : 0.420347
period : 2
timestamp : 1531409848.0
frr : No
bids, asksともに指定した件数が取得されているのが確認でき...
上記の例では、currencyにBTCとETHを指定しました。
** ''Invoke-WebRequest''+''ConvertFrom-Json''コマンドレッ...
''Invoke-WebRequest''使うことにより、HTTPステータスや、Co...
取得したContent部分を''ConvertFrom-Json''コマンドレットを...
JSON形式でアクセスすることができます。
+ Invoke-WebRequestでFundingbook APIをアクセス
PS C:\> $v1_lendbook_api = "https://api.bitfinex.com/v1/...
PS C:\> $currency = "XRP"
PS C:\> $limit_bids = 1
PS C:\> $limit_asks = 1
PS C:\> $response = Invoke-WebRequest -UseBasicParsing (...
+ 取得したレスポンスを表示します。
PS C:\> $response
StatusCode : 200
StatusDescription : OK
Content : {"bids":[{"rate":"0.0219","amount":"...
0","frr":"...
RawContent : HTTP/1.1 200 OK
Connection: keep-alive
X-Frame-Options: SAMEORIGIN,SAMEORIGIN
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
X-Request-Id: a13c409a-6ba4-4134-92f...
X...
Forms :
Headers : {[Connection, keep-alive], [X-Frame-...
Images : {}
InputFields : {}
Links : {}
ParsedHtml :
RawContentLength : 206
+HTTPステータスコード、ヘッダー、Content-Typeなどにアクセ...
PS C:\> $response.StatusCode
200
PS C:\> $response.Headers
Key Value
--- -----
Connection keep-alive
X-Frame-Options SAMEORIGIN,SAMEORIGIN
X-XSS-Protection 1; mode=block
X-Content-Type-Options nosniff
X-Request-Id a13c409a-6ba4-4134-92fc-831a67...
X-Runtime 0.111515
Strict-Transport-Security max-age=31536000
Expect-CT max-age=604800, report-uri="ht...
CF-RAY 4394ac61ce696ef9-NRT
Content-Length 206
Cache-Control max-age=0, private, must-reval...
Content-Type application/json; charset=utf-8
Date Thu, 12 Jul 2018 15:51:49 GMT
ETag W/"2307dfec05c81f6dec04bca6736...
Set-Cookie __cfduid=d8e96e5fad527ff5c6808...
Server cloudflare
PS C:\> $response.Headers.'Content-Type'
application/json; charset=utf-8
+ConvertFrom-Jsonコマンドレットを使うことにより、JSON形式...
PS C:\> $json = ConvertFrom-Json $response.Content
PS C:\> $json
bids ...
---- ...
{@{rate=0.0219; amount=12183.20629104; period=30; timest...
* Webの応答を読み取っています。(Waiting for response)を非...
上記のコマンドレットを実行すると、APIサーバとのやり取りの...
#ref(51.png)
これを非表示にしたい場合は、以下のようにしてください。
非表示にするには、$ProgressPreferenceにSilentlyContinueを...
変更前は以下のように Continue が設定されています。
PS C:\> $ProgressPreference
Continue
非表示にするには、以下のように変更します。
PS C:\> $ProgressPreference = "SilentlyContinue"
以上、PowerShellを使って、BitfinexのFundingbook APIを呼び...
#htmlinsert(cc-btm.html)
ページ名: