diff --git a/frontend/src/lib/apis/earningRate.ts b/frontend/src/lib/apis/earningRate.ts index 60d0f9e..46d0758 100644 --- a/frontend/src/lib/apis/earningRate.ts +++ b/frontend/src/lib/apis/earningRate.ts @@ -1,8 +1,11 @@ /* eslint-disable import/prefer-default-export */ + +import { EarningRate } from '../types/earningRate'; + import api from '.'; export const getEarningRate = async () => { - const response = await api({ + const response = await api({ url: '/v1/earning_rate', method: 'POST', }); diff --git a/frontend/src/lib/apis/index.ts b/frontend/src/lib/apis/index.ts index c61995b..b13d224 100644 --- a/frontend/src/lib/apis/index.ts +++ b/frontend/src/lib/apis/index.ts @@ -1,6 +1,6 @@ import qs from 'qs'; -import { FetchRequest } from '@/types/api'; +import { FetchRequest } from '../types/api'; export class FetchError extends Error { constructor( diff --git a/frontend/src/lib/apis/scenario.ts b/frontend/src/lib/apis/scenario.ts index 54cd738..0b64e3c 100644 --- a/frontend/src/lib/apis/scenario.ts +++ b/frontend/src/lib/apis/scenario.ts @@ -1,9 +1,12 @@ +import { ScenariosTickerResponse, ScenarioTickerRequest } from '../types/scenario'; + import api from '.'; -export const getTicker = async () => { - const response = await api({ +export const getTicker = async (params: ScenarioTickerRequest) => { + const response = await api({ url: '/v1/scenario/{ticker}', method: 'POST', + params, }); return response; diff --git a/frontend/src/types/api.ts b/frontend/src/lib/types/api.ts similarity index 100% rename from frontend/src/types/api.ts rename to frontend/src/lib/types/api.ts diff --git a/frontend/src/lib/types/earningRate.ts b/frontend/src/lib/types/earningRate.ts new file mode 100644 index 0000000..c0c0fa8 --- /dev/null +++ b/frontend/src/lib/types/earningRate.ts @@ -0,0 +1,5 @@ +export interface EarningRate { + asset: number; + result: number; + rate: string; +} diff --git a/frontend/src/lib/types/scenario.ts b/frontend/src/lib/types/scenario.ts new file mode 100644 index 0000000..70369e6 --- /dev/null +++ b/frontend/src/lib/types/scenario.ts @@ -0,0 +1,27 @@ +export type ScenarioTickerRequest = { + start_time: number; + end_time: number; +}; + +export type ScenariosTickerResponse = ScenariosTicker[]; + +export interface ScenariosTicker { + code: 'BTC/KRW'; + high: number; + open: number; + close: number; + low: number; + buySignal: number; // 주문 + buyInfo: BuyInfo[]; // 채결 + sellSignal: number; + sellInfo: SellInfo[]; + currentTime: number; + hasMore: boolean; +} + +export type BuyInfo = { + price: number; + amount: number; +}; + +export type SellInfo = BuyInfo;