bitbankapi クラス : CandleStick(string,string,string) メソッド

説明

指定された日付のロウソク足データを取得します。

構文

bitbankapiInstance.CandleStick(string currencyPair,string candletype, string date)

引数

クラス名前説明
stringcurrencyPair通貨ペア。
stringcandletypeローソク足の期間指定文字列。
stringdate日付文字列。

返り値

クラス説明
bitbankres要求に対する応答、JSON文字列を持つ。

サンプルコード

1:

bitbankapi bitbankapiIns = new bitbankapi();

2:

bitbankres bitbankresIns = bitbankapiIns.CandleStick("btc_jpy","30min", "20200220");

3:

string jsonStr = bitbankresIns.Result;

JSON-text 例

{"success":1,"data":{"candlestick":[{"type":"30min","ohlcv":[["1070000","1073587","1067670","1071376","35.4508",1582156800000],["1071376","1074000","1070001","1073003","27.9728",1582158600000],["1073003","1073802","1068776","1070050","23.3190",1582160400000],["1070049","1071728","1066000","1069367","50.4367",1582162200000],["1069367","1069584","1061500","1062660","46.0998",1582164000000],["1062668","1066819","1058000","1066819","55.1355",1582165800000],["1067038","1069022","1065249","1068353","45.7211",1582167600000],["1068509","1068695","1065443","1065801","25.9002",1582169400000],["1065800","1068015","1065800","1066241","26.7266",1582171200000],["1066240","1066556","1064010","1066050","13.4571",1582173000000],["1066251","1066556","1064010","1064259","16.3326",1582174800000],["1064276","1065962","1062653","1065520","17.9602",1582176600000],["1065520","1065990","1064251","1064471","16.2486",1582178400000],["1064471","1072294","1064470","1071683","19.5864",1582180200000],["1071987","1074463","1062000","1073647","47.5354",1582182000000],["1073773","1073999","1071998","1072928","28.1551",1582183800000],["1072798","1073479","1069999","1070534","18.1512",1582185600000],["1070004","1070424","1066572","1069008","39.1463",1582187400000],["1070680","1071912","1068964","1071000","16.3281",1582189200000],["1070540","1075901","1070540","1075729","22.7591",1582191000000],["1075729","1079734","1072676","1078446","20.7065",1582192800000],["1078818","1080000","1076921","1077991","25.1356",1582194600000],["1077989","1079992","1076466","1076892","18.5606",1582196400000],["1076896","1076926","1071200","1071780","21.7210",1582198200000],["1071785","1075360","1071785","1073000","22.9637",1582200000000],["1073001","1073800","1069796","1071315","15.6401",1582201800000],["1071315","1072321","1068000","1069999","31.7010",1582203600000],["1070000","1074625","1068878","1074396","9.4698",1582205400000],["1074300","1077805","1072261","1076992","12.8548",1582207200000],["1076992","1077925","1076992","1077466","6.1864",1582209000000],["1077467","1077467","1073466","1074986","11.5245",1582210800000],["1075315","1076463","1075053","1075680","4.6344",1582212600000],["1075680","1077899","1070600","1071404","16.4015",1582214400000],["1071403","1085000","1056913","1080106","80.2129",1582216200000],["1080106","1081402","1059999","1066398","33.9658",1582218000000],["1066391","1068052","1063480","1065783","18.4583",1582219800000],["1066150","1067963","1062002","1066940","6.1078",1582221600000],["1066940","1072463","1066940","1070158","7.4025",1582223400000],["1070069","1071952","1069560","1070001","3.2761",1582225200000],["1071549","1072963","1069162","1072122","9.6845",1582227000000],["1072698","1072963","1070189","1070507","7.7748",1582228800000],["1071009","1074463","1071008","1073700","2.2496",1582230600000],["1073700","1075000","1073699","1074999","3.1400",1582232400000],["1075000","1078085","1074999","1078085","9.4685",1582234200000],["1078187","1083492","1078148","1080974","19.6718",1582236000000],["1080915","1080915","1076003","1079240","20.0954",1582237800000],["1079444","1079518","1076461","1078222","8.4620",1582239600000],["1078334","1078662","1076670","1077250","11.9104",1582241400000]]}],"timestamp":1582243145830}}

注意

公開APIです。API キーと秘密キーを設定しなくても情報を取得できます。

有効な第一引数 : btc_jpy, xrp_jpy, ltc_btc, eth_btc, mona_jpy, mona_btc, bcc_jpy, bcc_btc

有効な第二引数 : 1min, 5min, 15min, 30min, 1hour, 4hour, 8hour, 12hour, 1day, 1week

第三引数に日付文字列を指定します。日付文字列のフォーマットは YYYY か YYYYMMDD です。

第三引数の形式は第二引数により異なります。

YYYYMMDD : 1min, 5min, 15min, 30min, 1hour

YYYY : 4hour, 8hour, 12hour, 1day, 1week

日付はUTC+0で切り替わります。例えば、日本時間はUTC+9なので午前9時に切り替わることに注意してください。

要求に対する応答として bitbankres クラスのインスタンスが返ります。このインスタンスが応答の結果の JSON-text を保持しています。

JSON-text の ohlcv は末尾が最新のデータです。unixtimestamp が昇順で並んでいます。

引数が正しくない場合、以下の様な JSON-text が返ります。

{"success": 1000,"return": { "message": "http error"}}

HTTP エラーが発生した場合、以下の様な JSON-text が返ります。

{"success": -1000,"error": { "statuscode" : 404, "message": "Not Found"}}

"statuscode" と "message" は、それぞれの HTTP エラーで異なります。

要求がタイムアウトした場合、以下の JSON-text が返ります。

{"success": -1001,"error": { "typename" : "TaskCanceledException", "message": "タスクが取り消されました。"}}

その他の例外が発生して要求が失敗した場合、以下の様な JSON-text が返ります。

{"success": -1002,"error": { "typename" : "...", "message": "..."}}

"typename" と "message" は、それぞれの例外で異なります。

参照リンク

Copyright © Cooker All rights reserved.