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

説明

指定された日付の全約定履歴を取得します。

構文

bitbankapiInstance.Transactions(string currencyPair,string YYYYMMDD)

引数

クラス名前説明
stringcurrencyPair通貨ペア。
stringYYYYMMDD日付文字列。

返り値

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

サンプルコード

1:

bitbankapi bitbankapiIns = new bitbankapi();

2:

bitbankres bitbankresIns = bitbankapiIns.Transactions("btc_jpy",""); // 当日

3:

string jsonStr = bitbankresIns.Result;

4:

bitbankresIns = bitbankapiIns.Transactions("btc_jpy","20200220"); // 2020/02/20

5:

jsonStr = bitbankresIns.Result;

JSON-text 例

当日データ
{"success":1,"data":{"transactions":[{"transaction_id":1005509689,"side":"buy","price":"0.03923545","amount":"0.0001","executed_at":1582335100699},{"transaction_id":1005509620,"side":"buy","price":"0.03911941","amount":"0.0001","executed_at":1582334992363},{"transaction_id":1005508705,"side":"buy","price":"0.03920289","amount":"2.0000","executed_at":1582331540345},{"transaction_id":1005508470,"side":"buy","price":"0.03927823","amount":"0.0001","executed_at":1582331034333},{"transaction_id":1005508464,"side":"buy","price":"0.03917660","amount":"0.0001","executed_at":1582331025604},{"transaction_id":1005508463,"side":"buy","price":"0.03916755","amount":"0.0001","executed_at":1582331016852},{"transaction_id":1005508370,"side":"buy","price":"0.03923479","amount":"0.0001","executed_at":1582330828297},{"transaction_id":1005508213,"side":"buy","price":"0.03903776","amount":"0.0001","executed_at":1582330630852},{"transaction_id":1005508196,"side":"sell","price":"0.03900613","amount":"4.0472","executed_at":1582330609995},{"transaction_id":1005508105,"side":"sell","price":"0.03890673","amount":"5.0149","executed_at":1582330185141},{"transaction_id":1005508056,"side":"sell","price":"0.03903393","amount":"0.0001","executed_at":1582330058428},{"transaction_id":1005507903,"side":"sell","price":"0.03895498","amount":"5.0149","executed_at":1582329755236},{"transaction_id":1005507256,"side":"buy","price":"0.03922041","amount":"0.0003","executed_at":1582327875699},{"transaction_id":1005506813,"side":"buy","price":"0.03908283","amount":"0.0013","executed_at":1582326978162},{"transaction_id":1005506534,"side":"buy","price":"0.03899969","amount":"0.0001","executed_at":1582326445419},{"transaction_id":1005505950,"side":"sell","price":"0.03888839","amount":"0.0013","executed_at":1582323959917},{"transaction_id":1005505945,"side":"sell","price":"0.03889000","amount":"0.4013","executed_at":1582323950221},{"transaction_id":1005505934,"side":"sell","price":"0.03890986","amount":"0.0003","executed_at":1582323935161},{"transaction_id":1005505754,"side":"sell","price":"0.03900000","amount":"0.0710","executed_at":1582323635303},{"transaction_id":1005505291,"side":"sell","price":"0.03907148","amount":"0.0002","executed_at":1582321564529},{"transaction_id":1005504830,"side":"sell","price":"0.03925598","amount":"0.0001","executed_at":1582319206740},{"transaction_id":1005504602,"side":"buy","price":"0.03923161","amount":"0.0001","executed_at":1582318181083},{"transaction_id":1005504242,"side":"buy","price":"0.03914979","amount":"0.0001","executed_at":1582317071381},{"transaction_id":1005504177,"side":"buy","price":"0.03911809","amount":"0.0001","executed_at":1582316840477},{"transaction_id":1005504170,"side":"buy","price":"0.03909418","amount":"0.0001","executed_at":1582316816506},{"transaction_id":1005503750,"side":"sell","price":"0.03908964","amount":"1.2820","executed_at":1582315528857},{"transaction_id":1005503688,"side":"sell","price":"0.03893013","amount":"0.5000","executed_at":1582315412621},{"transaction_id":1005503592,"side":"sell","price":"0.03908381","amount":"0.0013","executed_at":1582315348900},{"transaction_id":1005503439,"side":"sell","price":"0.03914924","amount":"0.1011","executed_at":1582315336221},{"transaction_id":1005503270,"side":"sell","price":"0.03928021","amount":"0.0013","executed_at":1582315323640},{"transaction_id":1005503141,"side":"sell","price":"0.03947760","amount":"0.0013","executed_at":1582314878226},{"transaction_id":1005503132,"side":"sell","price":"0.03950000","amount":"0.4195","executed_at":1582314821740},{"transaction_id":1005503084,"side":"buy","price":"0.03950961","amount":"0.0001","executed_at":1582314627090},{"transaction_id":1005503019,"side":"sell","price":"0.03950000","amount":"0.5000","executed_at":1582314193397},{"transaction_id":1005502998,"side":"sell","price":"0.03950000","amount":"0.5000","executed_at":1582314108505},{"transaction_id":1005502462,"side":"sell","price":"0.03952965","amount":"0.0195","executed_at":1582311509459},{"transaction_id":1005502451,"side":"sell","price":"0.03952024","amount":"0.0225","executed_at":1582311276825},{"transaction_id":1005502431,"side":"sell","price":"0.03952236","amount":"0.0195","executed_at":1582311044384},{"transaction_id":1005502332,"side":"sell","price":"0.03954002","amount":"0.0285","executed_at":1582310579884},{"transaction_id":1005502316,"side":"sell","price":"0.03959131","amount":"0.0208","executed_at":1582310347337},{"transaction_id":1005502315,"side":"sell","price":"0.03960611","amount":"0.0001","executed_at":1582310347337},{"transaction_id":1005502287,"side":"sell","price":"0.03955303","amount":"0.0285","executed_at":1582310114593},{"transaction_id":1005502170,"side":"sell","price":"0.03956270","amount":"0.0195","executed_at":1582309882144},{"transaction_id":1005502134,"side":"sell","price":"0.03956043","amount":"0.0240","executed_at":1582309649767},{"transaction_id":1005502106,"side":"sell","price":"0.03951996","amount":"0.0285","executed_at":1582309417135},{"transaction_id":1005502047,"side":"sell","price":"0.03953946","amount":"0.0209","executed_at":1582309184743},{"transaction_id":1005502002,"side":"sell","price":"0.03964826","amount":"0.0180","executed_at":1582308952332},{"transaction_id":1005501977,"side":"sell","price":"0.03956627","amount":"0.0270","executed_at":1582308719910},{"transaction_id":1005501952,"side":"sell","price":"0.03947897","amount":"0.0254","executed_at":1582308487457},{"transaction_id":1005501901,"side":"sell","price":"0.03950909","amount":"0.0254","executed_at":1582308254968},{"transaction_id":1005501855,"side":"sell","price":"0.03951041","amount":"0.0165","executed_at":1582308022571},{"transaction_id":1005501597,"side":"sell","price":"0.03952396","amount":"0.0962","executed_at":1582307165512},{"transaction_id":1005501596,"side":"sell","price":"0.03952396","amount":"0.0287","executed_at":1582307154010},{"transaction_id":1005501559,"side":"sell","price":"0.03966502","amount":"0.0001","executed_at":1582306988096},{"transaction_id":1005501376,"side":"sell","price":"0.03975429","amount":"0.0254","executed_at":1582306397279},{"transaction_id":1005501367,"side":"buy","price":"0.03981328","amount":"3.7042","executed_at":1582306374986},{"transaction_id":1005501333,"side":"sell","price":"0.03984384","amount":"0.3000","executed_at":1582306278484},{"transaction_id":1005501332,"side":"sell","price":"0.03984384","amount":"0.1786","executed_at":1582306278484},{"transaction_id":1005501298,"side":"sell","price":"0.03984384","amount":"0.5000","executed_at":1582306185563},{"transaction_id":1005501293,"side":"sell","price":"0.03984384","amount":"0.0165","executed_at":1582306164998}]}}
指定日データ
{"success":1,"data":{"transactions":[{"transaction_id":1005395758,"side":"sell","price":"0.03956031","amount":"0.0080","executed_at":1582156848346},{"transaction_id":1005395759,"side":"sell","price":"0.03956030","amount":"0.1008","executed_at":1582156848346},{"transaction_id":1005402800,"side":"buy","price":"0.03998915","amount":"0.5416","executed_at":1582162968800},{"transaction_id":1005402802,"side":"buy","price":"0.03998915","amount":"1.0649","executed_at":1582162968850},...

注意

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

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

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

第二引数に空文字列を指定した場合、その通貨ペアの当日分の約定情報が返ります。

第二引数に日付文字列を指定した場合、その通貨ペアの指定日分の約定情報が返ります。ただし、当日の日付文字列を指定した場合はエラーとなります。

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

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

当日分の JSON-text の transactions は先頭が最新のデータです。つまり、transaction_id/executed_at(unixtimestamp)が降順で並んでいます。

指定日分の JSON-text の transactions は末尾が最新のデータです。つまり、transaction_id/executed_at(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.