import { IndicativePriceApiParams , IndicativePriceApiResult , PriceApiParams , PriceApiResult , NotifyOrderResult , Quoter , } from './types' ; import { sendRequest } from '../_request' ; import { DealOrder , ExceptionOrder } from '../../types' ; export class HTTPQuoter implements Quoter { endpoint : string ; constructor ( endpoint ) { this . endpoint = endpoint ; } async getPairs ( ) { return sendRequest ( { method : 'get' , url : `${ this . endpoint }/pairs` , } ) . then ( ( res ) => { return res . pairs ; } ) ; } async getIndicativePrice ( data ) { return sendRequest ( { method : 'get' , url : `${ this . endpoint }/indicativePrice` , params : data , } ) ; } async getPrice ( data ) { return sendRequest ( { method : 'get' , url : `${ this . endpoint }/price` , params : data , } ) ; } async dealOrder ( data ) { return sendRequest ( { method : 'post' , url : `${ this . endpoint }/deal` , data , header : { 'Content-Type' : 'application/json' , } , } ) ; } async exceptionOrder ( data ) { return sendRequest ( { method : 'post' , url : `${ this . endpoint }/exception` , data , header : { 'Content-Type' : 'application/json' , } , } ) ; } }