diff --git a/README.md b/README.md index 09921c3..7e5f361 100644 --- a/README.md +++ b/README.md @@ -91,6 +91,14 @@ const params: GetCandleStickRequest = { const res = await publicApi.getCandlestick(params); ``` +##### getCircuitBreakInfo +```typescript +const params: GetCircuitBreakInfoRequest = { + pair: 'btc_jpy', // required +}; +const res = await publicApi.getCircuitBreakInfo(params); +``` + ### PrivateAPI PrivateAPIの初期化にはPrivateApiConfigが必要になります。 @@ -145,7 +153,7 @@ const params: OrderRequest = { price: 1000, // optional side: 'buy', // required type: 'market', // required - post_only: false, // optional + post_only: false, // optional. Except for circuit_break_info.mode is NONE, this parm is ignored. }; const res = await privateApi.postOrder(params); ``` diff --git a/package.json b/package.json index 6ac07e0..34ad20b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "node-bitbankcc", - "version": "3.1.0", + "version": "3.2.0", "description": "node-bitbankcc", "repository": { "type": "git", diff --git a/src/lib/public-api.test.ts b/src/lib/public-api.test.ts index 51e6762..08717b3 100644 --- a/src/lib/public-api.test.ts +++ b/src/lib/public-api.test.ts @@ -1,6 +1,12 @@ import * as assert from 'power-assert'; import { PublicApi } from './public-api'; -import { GetCandleStickRequest, GetDepthRequest, GetTickerRequest, GetTransactionsRequest } from './requestType'; +import { + GetCandleStickRequest, + GetCircuitBreakInfoRequest, + GetDepthRequest, + GetTickerRequest, + GetTransactionsRequest, +} from './requestType'; function getYesterdayYYYYMMDD(): string { const date = new Date(); @@ -60,10 +66,20 @@ const getCandlestickTest = async () => { assert.equal(res.success, 1); }; +const getCircuitBreakInfoTest = async () => { + const publicApi = new PublicApi(config.publicApi); + const params: GetCircuitBreakInfoRequest = { + pair: 'btc_jpy', + }; + const res = await publicApi.getCircuitBreakInfo(params); + assert.equal(res.success, 1); +}; + describe('PublicAPI Test', () => { it('GET /{pair}/ticker', getTickerTest); it('GET /{pair}/depth', getDepthTest); it('GET /{pair}/transactions', getTransactionsTest); it('GET /{pair}/transactions/{YYYYMMDD}', getDailyTransactionsTest); it('GET /{pair}/candlestick/{candle-type}/{YYYYMMDD}', getCandlestickTest); + it('GET /{pair}/circuit_break_info', getCircuitBreakInfoTest); }); diff --git a/src/lib/public-api.ts b/src/lib/public-api.ts index 5e5fc0d..9915870 100644 --- a/src/lib/public-api.ts +++ b/src/lib/public-api.ts @@ -1,6 +1,19 @@ import { Api } from './api'; -import { GetCandleStickRequest, GetDepthRequest, GetTickerRequest, GetTransactionsRequest } from './requestType'; -import { CandlestickResponse, DepthResponse, Response, TickerResponse, TransactionsResponse } from './responseType'; +import { + GetCandleStickRequest, + GetCircuitBreakInfoRequest, + GetDepthRequest, + GetTickerRequest, + GetTransactionsRequest, +} from './requestType'; +import { + CandlestickResponse, + CircuitBreakInfoResponse, + DepthResponse, + Response, + TickerResponse, + TransactionsResponse, +} from './responseType'; export class PublicApi extends Api { public getTicker(params: GetTickerRequest): Promise> { @@ -25,4 +38,9 @@ export class PublicApi extends Api { const path: string = '/'.concat(params.pair, '/candlestick/', params.candleType, '/', params.yyyymmdd); return this.get(path); } + + public getCircuitBreakInfo(params: GetCircuitBreakInfoRequest): Promise> { + const path: string = '/'.concat(params.pair, '/circuit_break_info'); + return this.get(path); + } } diff --git a/src/lib/requestType.ts b/src/lib/requestType.ts index e1bfb4b..b827bce 100644 --- a/src/lib/requestType.ts +++ b/src/lib/requestType.ts @@ -100,3 +100,8 @@ export interface WithdrawalRequest { otp_token?: string; sms_token?: string; } + +// Circuit Break Info +export interface GetCircuitBreakInfoRequest { + pair: string; +} diff --git a/src/lib/responseType.ts b/src/lib/responseType.ts index 249ab34..80c938b 100644 --- a/src/lib/responseType.ts +++ b/src/lib/responseType.ts @@ -20,6 +20,12 @@ export interface TickerResponse { export interface DepthResponse { asks: [string, string][]; bids: [string, string][]; + asks_over: string; + bids_under: string; + asks_under: string; + bids_over: string; + timestamp: number; + sequenceId: string; } // Transactions @@ -190,3 +196,16 @@ export interface WithdrawalResponse { export interface WithdrawalHistoryResponse { withdrawals: WithdrawalResponse[]; } + +// Circuit Break Info +export interface CircuitBreakInfoResponse { + mode: 'NONE' | 'CIRCUIT_BREAK' | 'FULL_RANGE_CIRCUIT_BREAK' | 'RESUMPTION' | 'LISTING'; + upper_trigger_price: string | null; + lower_trigger_price: string | null; + fee_type: 'NORMAL' | 'SELL_MAKER' | 'BUY_MAKER' | 'DYNAMIC'; + estimated_itayose_price: string | null; + itayose_upper_price: string | null; + itayose_lower_price: string | null; + reopen_timestamp: number | null; + timestamp: number; +}