Skip to content

Commit 645b4fe

Browse files
Merge pull request #102 from koiizuka/feat/abu
feat: circuit break info
2 parents 33fc8ee + c79344d commit 645b4fe

File tree

7 files changed

+432
-62
lines changed

7 files changed

+432
-62
lines changed

CHANGELOG.md

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,35 @@
1-
# CHANGELOG for Bitbank's API (2023-11-08)
1+
# CHANGELOG for Bitbank's API (2023-11-17)
22

3+
## 2023-11-17
4+
5+
* Add new endpoint, room `circuit_break_info`
6+
* `public-api.md`
7+
* `public-api_JP.md`
8+
* `public-stream.md`
9+
* `public-stream_JP.md`
10+
* Cross buy/sell condition can occur
11+
* `public-api.md`
12+
* `public-api_JP.md`
13+
* `public-stream.md`
14+
* `public-stream_JP.md`
15+
* Market order and post only option are restricted in `CIRCUIT_BREAK` mode
16+
* `rest-api.md`
17+
* `rest-api_JP.md`
18+
* Add over/under responses to depth API
19+
* `public-api.md`
20+
* `public-api_JP.md`
21+
* `public-stream.md`
22+
* `public-stream_JP.md`
23+
24+
---
325
## 2023-11-08
426
* Added new docs
527
* `networks.md`
628
* Added network fields to
729
* `rest-api.md`.
830
* `rest-api_JP.md`.
931

32+
---
1033
## 2023-10-23
1134
* Added new pairs to
1235
* `pairs.md`
@@ -24,7 +47,6 @@
2447
* `rest-api_JP.md`
2548

2649
---
27-
2850
## 2023-09-07
2951
* Added new pairs to
3052
* `pairs.md`

public-api.md

Lines changed: 84 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
55
**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
66

7-
- [Public REST API for Bitbank (2023-04-27)](#public-rest-api-for-bitbank-2023-04-27)
7+
- [Public REST API for Bitbank (2023-11-17)](#public-rest-api-for-bitbank-2023-11-17)
88
- [General API Information](#general-api-information)
99
- [General endpoints](#general-endpoints)
1010
- [Ticker](#ticker)
@@ -13,10 +13,11 @@
1313
- [Depth](#depth)
1414
- [Transactions](#transactions)
1515
- [Candlestick](#candlestick)
16+
- [Circuit Break Info](#circuit-break-info)
1617

1718
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
1819

19-
# Public REST API for Bitbank (2023-04-27)
20+
# Public REST API for Bitbank (2023-11-17)
2021

2122
## General API Information
2223

@@ -39,6 +40,8 @@
3940

4041
Get Ticker information
4142

43+
Except for circuit_break_info.mode is `NONE`, sell and buy price possibly cross.
44+
4245
```txt
4346
GET /{pair}/ticker
4447
```
@@ -84,6 +87,8 @@ response format:
8487

8588
Get All Tickers information
8689

90+
Except for circuit_break_info.mode is `NONE`, sell and buy price possibly cross.
91+
8792
```txt
8893
GET /tickers
8994
```
@@ -129,6 +134,8 @@ response format:
129134

130135
Get All JPY Pair Tickers information
131136

137+
Except for circuit_break_info.mode is `NONE`, sell and buy price possibly cross.
138+
132139
```txt
133140
GET /tickers_jpy
134141
```
@@ -174,6 +181,17 @@ response format:
174181

175182
Get Depth information.
176183

184+
#### In circuit_break_info.mode is `NONE` or estimated price is null
185+
186+
- Asks and bids data is restricted to 200 entries each from best bid offer.
187+
- Asks and bids price never cross.
188+
189+
#### In circuit_break_info.mode is not `NONE` and estimated price is not null
190+
191+
- Asks and bids data is restricted to 200 entries each around the estimated price. (Max 400 entries)
192+
- Asks and bids price possibly cross.
193+
- asks_under, bids_over possibly includes the quantity of orders which price is out of range.
194+
177195
```txt
178196
GET /{pair}/depth
179197
```
@@ -190,6 +208,12 @@ Name | Type | Description
190208
------------ | ------------ | ------------
191209
asks | [string, string][] | array of [price, amount]
192210
bids | [string, string][] | array of [price, amount]
211+
asks_over | string | the quantity of asks over the highest price of asks orders.
212+
bids_under | string | the quantity of bids under the lowest price of bids orders.
213+
asks_under | string | the quantity of asks under the lowest price of asks orders.
214+
bids_over | string | the quantity of bids over the highest price of bids orders.
215+
timestamp | number | published at timestamp
216+
sequenceId | number | sequence id, increased monotonically but not always consecutive
193217

194218
response format:
195219

@@ -206,7 +230,13 @@ response format:
206230
[
207231
"string", "string"
208232
]
209-
]
233+
],
234+
"asks_over": "string",
235+
"bids_under": "string",
236+
"asks_under": "string",
237+
"bids_over": "string",
238+
"timestamp": 0,
239+
"sequenceId": "string"
210240
}
211241
}
212242
```
@@ -306,3 +336,54 @@ response format:
306336
}
307337
}
308338
```
339+
340+
### Circuit Break Info
341+
342+
Get circuit break informations.
343+
344+
```txt
345+
GET /{pair}/circuit_break_info
346+
```
347+
348+
**Parameters:**
349+
350+
Name | Type | Mandatory | Description
351+
------------ | ------------ | ------------ | ------------
352+
pair | string | YES | pair enum: [pair list](pairs.md)
353+
354+
**Response:**
355+
356+
Name | Type | Description
357+
------------ | ------------ | ------------
358+
mode | string | enum: `NONE`, `CIRCUIT_BREAK`, `FULL_RANGE_CIRCUIT_BREAK`, `RESUMPTION`, `LISTING`
359+
estimated_itayose_price | string \| null | estimated price. Null if mode is `NONE` or when there is no estimated price.
360+
estimated_itayose_amount | string \| null | estimated amount. Null if mode is `NONE`.
361+
itayose_upper_price | string \| null | itayose price range upper limit. Null if mode is in `NONE`, `FULL_RANGE_CIRCUIT_BREAK` or `LISTING`.
362+
itayose_lower_price | string \| null | itayose price range lower limit. Null if mode is in `NONE`, `FULL_RANGE_CIRCUIT_BREAK` or `LISTING`.
363+
upper_trigger_price | string \| null | upper trigger price. Null if mode is not `NONE`.
364+
lower_trigger_price | string \| null | lower trigger price. Null if mode is not `NONE`.
365+
fee_type | string | enum: `NORMAL`, `SELL_MAKER`, `BUY_MAKER`, `DYNAMIC`
366+
reopen_timestamp | number \| null | reopen timestamp(milliseconds). Null if mode is `NONE`, or reopen timestamp is undetermined yet.
367+
timestamp | number | ticked at unix timestamp (milliseconds)
368+
369+
For details on `mode` and `fee_type`, please check the [Circuit breaker system](https://bitbank.cc/docs/circuit-breaker-mode/) page.
370+
371+
response format:
372+
373+
```json
374+
{
375+
"success": 1,
376+
"data": {
377+
"mode": "string",
378+
"estimated_itayose_price": "string",
379+
"estimated_itayose_amount": "string",
380+
"itayose_upper_price": "string",
381+
"itayose_lower_price": "string",
382+
"upper_trigger_price": "string",
383+
"lower_trigger_price": "string",
384+
"fee_type": "string",
385+
"reopen_timestamp": 0,
386+
"timestamp": 0
387+
}
388+
}
389+
```

public-api_JP.md

Lines changed: 84 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
55
**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
66

7-
- [Public API一覧 (2023-04-27)](#public-api%E4%B8%80%E8%A6%A7-2023-04-27)
7+
- [Public API一覧 (2023-11-17)](#public-api%E4%B8%80%E8%A6%A7-2023-11-17)
88
- [API 概要](#api-%E6%A6%82%E8%A6%81)
99
- [エンドポイント一覧](#%E3%82%A8%E3%83%B3%E3%83%89%E3%83%9D%E3%82%A4%E3%83%B3%E3%83%88%E4%B8%80%E8%A6%A7)
1010
- [Ticker](#ticker)
@@ -13,10 +13,11 @@
1313
- [Depth](#depth)
1414
- [Transactions](#transactions)
1515
- [Candlestick](#candlestick)
16+
- [Circuit Break Info](#circuit-break-info)
1617

1718
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
1819

19-
# Public API一覧 (2023-04-27)
20+
# Public API一覧 (2023-11-17)
2021

2122
## API 概要
2223

@@ -39,6 +40,8 @@
3940

4041
[Public API] ティッカー情報を取得。
4142

43+
circuit_break_info.mode が `NONE` 以外の場合、sellとbuyが反転する場合があります。
44+
4245
```txt
4346
GET /{pair}/ticker
4447
```
@@ -84,6 +87,8 @@ timestamp | number | 日時(UnixTimeのミリ秒)
8487

8588
[Public API] 全ペアのティッカー情報を取得。
8689

90+
circuit_break_info.mode が `NONE` 以外の場合、sellとbuyが反転する場合があります。
91+
8792
```txt
8893
GET /tickers
8994
```
@@ -129,6 +134,8 @@ timestamp | number | 日時(UnixTimeのミリ秒)
129134

130135
[Public API] JPYペアのティッカー情報を取得。
131136

137+
circuit_break_info.mode が `NONE` 以外の場合、sellとbuyが反転する場合があります。
138+
132139
```txt
133140
GET /tickers_jpy
134141
```
@@ -174,6 +181,17 @@ timestamp | number | 日時(UnixTimeのミリ秒)
174181

175182
[Public API] 板情報を取得。
176183

184+
#### circuit_break_info.modeが `NONE` もしくは 見積価格がNull の場合
185+
186+
- asks, bidsで配信されるデータは、Best Bid Offerから200件ずつです。
187+
- したがって、asks, bidsのBBO(Best Bid Offer)は必ず `最も安いAsk > 最も高いBid` となります。
188+
189+
#### circuit_break_info.modeが `NONE` 以外 かつ 見積価格が存在する 場合
190+
191+
- asks, bidsで配信されるデータは、見積価格から上下200件ずつです。(最大400件)
192+
- したがって、通常時とは異なり、 `最も安いAsk < 最も高いBid` となる場合があります。
193+
- また、配信データの価格範囲よりも安い売り注文は `asks_under` に、高い買い注文は `bids_over` に加算されます。
194+
177195
```txt
178196
GET /{pair}/depth
179197
```
@@ -190,6 +208,12 @@ Name | Type | Description
190208
------------ | ------------ | ------------
191209
asks | [string, string][] | 売り板 [価格, 数量]
192210
bids | [string, string][] | 買い板 [価格, 数量]
211+
asks_over | string | asksの最高値よりも高いasksの数量
212+
bids_under | string | bidsの最安値よりも安いbidsの数量
213+
asks_under | string | bidsの最安値よりも安いasksの数量。通常モードの場合は `0`
214+
bids_over | string | asksの最高値よりも高いbidsの数量。通常モードの場合は `0`
215+
timestamp | number | timestamp
216+
sequenceId | string | シーケンスID、単調増加しますが連続しているとは限りません
193217

194218
レスポンスのフォーマット:
195219

@@ -206,7 +230,13 @@ bids | [string, string][] | 買い板 [価格, 数量]
206230
[
207231
"string", "string"
208232
]
209-
]
233+
],
234+
"asks_over": "string",
235+
"bids_under": "string",
236+
"asks_under": "string",
237+
"bids_over": "string",
238+
"timestamp": 0,
239+
"sequenceId": "string"
210240
}
211241
}
212242
```
@@ -306,3 +336,54 @@ ohlcv | [string, string, string, string, string, number][] | [始値, 高値,
306336
}
307337
}
308338
```
339+
340+
### Circuit Break Info
341+
342+
[Public API] サーキットブレイク情報を取得。
343+
344+
```txt
345+
GET /{pair}/circuit_break_info
346+
```
347+
348+
**Parameters:**
349+
350+
Name | Type | Mandatory | Description
351+
------------ | ------------ | ------------ | ------------
352+
pair | string | YES | 通貨ペア: [ペア一覧](pairs.md)
353+
354+
**Response:**
355+
356+
Name | Type | Description
357+
------------ | ------------ | ------------
358+
mode | string | `NONE` または `CIRCUIT_BREAK` または `FULL_RANGE_CIRCUIT_BREAK` または `RESUMPTION` または `LISTING`
359+
estimated_itayose_price | string \| null | 見積価格。ザラ場または見積価格が無い場合はnull
360+
estimated_itayose_amount | string \| null | 見積数量。ザラ場であればnull
361+
itayose_upper_price | string \| null | 参照価格レンジ上限。ザラ場、無期限、上場準備時はnull
362+
itayose_lower_price | string \| null | 参照価格レンジ下限。ザラ場、無期限、上場準備時はnull
363+
upper_trigger_price | string \| null | CB突入判定価格上限。CB中はnull
364+
lower_trigger_price | string \| null | CB突入判定価格下限。CB中はnull
365+
fee_type | string | `NORMAL` または `SELL_MAKER` または `BUY_MAKER` または `DYNAMIC`
366+
reopen_timestamp | number \| null | サーキットブレイク終了予定時刻(UnixTimeのミリ秒)。ザラ場、またはCB終了予定時刻がない場合はnull
367+
timestamp | number | 日時(UnixTimeのミリ秒)
368+
369+
`mode` および `fee_type` の詳細は[サーキットブレーカー制度](https://bitbank.cc/docs/circuit-breaker-mode/)のページをご確認ください。
370+
371+
response format:
372+
373+
```json
374+
{
375+
"success": 1,
376+
"data": {
377+
"mode": "string",
378+
"estimated_itayose_price": "string",
379+
"estimated_itayose_amount": "string",
380+
"itayose_upper_price": "string",
381+
"itayose_lower_price": "string",
382+
"upper_trigger_price": "string",
383+
"lower_trigger_price": "string",
384+
"fee_type": "string",
385+
"reopen_timestamp": 0,
386+
"timestamp": 0
387+
}
388+
}
389+
```

0 commit comments

Comments
 (0)