@bcswaper/apis
Version:
bcswaper apis
207 lines (206 loc) • 5.06 kB
TypeScript
import { CandleResolution, OrderSide, OrderStatus, OrderType } from "../context";
export declare const OkxConstants: {
HTTP_ENDPOINT: string;
PUBLIC_ENDPOINT: string;
PRIVATE_ENDPOINT: string;
BUSINESS_ENDPOINT: string;
DEMO_PUBLIC_ENDPOINT: string;
DEMO_PRIVATE_ENDPOINT: string;
DEMO_BUSINESS_ENDPOINT: string;
};
export declare const convertResolution: (resolution: CandleResolution) => string | null;
export declare const reverseResolution: (resolution: string) => CandleResolution | undefined;
export declare const convertOrderType: (orderType: string) => OrderType | undefined;
export declare const convertOrderSide: (orderside: string) => OrderSide | undefined;
export declare const convertOrderStatus: (state: string) => OrderStatus | undefined;
export declare enum EventType {
Login = "login",
Subscribe = "subscribe",
Unsubscribe = "unsubscribe",
Trade = "trade",
Error = "error"
}
export declare enum ChannelType {
Tickers = "tickers",
Candle = "candle",
Orders = "orders",
Fills = "fills",
Account = "account",
Positions = "positions"
}
export declare enum OpType {
Order = "order",
Cancel = "cancel-order"
}
export declare enum InstType {
SPOT = "SPOT",
MARGIN = "MARGIN",
SWAP = "SWAP",
FUTURES = "FUTURES",
OPTION = "OPTION"
}
export type InstInfo = {
instType: InstType;
instId: string;
uly: string;
instFamily: string;
baseCcy: string;
quoteCcy: string;
settleCcy: string;
ctVal: number;
ctMult: number;
ctValCcy: string;
optType: string;
stk: number;
listTime: number;
auctionEndTime: number;
expTime: number;
lever: number;
tickSz: number;
lotSz: number;
minSz: number;
ctType: string;
state: string;
ruleType: string;
maxLmtSz: number;
maxMktSz: number;
maxLmtAmt: number;
maxMktAmt: number;
maxTwapSz: number;
maxIcebergSz: number;
maxTriggerSz: number;
maxStopSz: number;
};
export type AccountChannel = {
channel: 'account';
ccy?: string;
extraParams?: string;
};
export type PositionsChannel = {
channel: 'positions';
instType: string;
instFamily?: string;
instId?: string;
extraParams?: string;
};
export type BalanceAndPositionChannel = {
channel: 'balance_and_position';
instType: string;
instFamily?: string;
instId?: string;
};
export type OrderChannel = {
channel: 'orders';
instType: string;
instFamily?: string;
instId?: string;
};
export type AlgoOrdersChannel = {
channel: 'orders-algo';
instType: string;
instFamily?: string;
instId?: string;
};
export type AdvanceAlgoOrdersChannel = {
channel: 'algo-advance';
instType: string;
instId?: string;
algoId?: string;
};
export type PositionRiskWarningChannel = {
channel: 'liquidation-warning';
instType: string;
instFamily?: string;
instId?: string;
};
export type AccountGreeksChannel = {
channel: 'account-greeks';
ccy?: string;
};
export type SpotGridAlgoOrdersChannel = {
channel: 'grid-orders-spot';
instType: string;
instId?: string;
algoId?: string;
};
export type ContractGridAlgoOrdersChannel = {
channel: 'grid-orders-contract';
instType: string;
instId?: string;
algoId?: string;
};
export type MoonGridAlgoOrdersChannel = {
channel: 'grid-orders-moon';
instType: string;
instId?: string;
algoId?: string;
};
export type GridPositionsChannel = {
channel: 'grid-positions';
algoId: string;
};
export type GridSubordersChannel = {
channel: 'grid-sub-orders';
algoId: string;
};
export type InstrumentsChannel = {
channel: 'instruments';
instType: string;
};
export type TickersChannel = {
channel: 'tickers';
instId: string;
};
export type OpenInterestChannel = {
channel: 'open-interest';
instId: string;
};
export type CandlesticksChannel = {
channel: string;
instId: string;
};
export type TradesChannel = {
channel: 'trades';
instId: string;
};
export type EstimatedPriceChannel = {
channel: 'estimated-price';
instType: string;
instFamily?: string;
instId?: string;
};
export type MarkPriceChannel = {
channel: 'mark-price';
instId: string;
};
export type MarkPriceCandlesticksChannel = {
channel: `mark-price-candle${string}`;
instId: string;
};
export type PriceLimitChannel = {
channel: 'price-limit';
instId: string;
};
export type OrderBookChannel = {
channel: 'books' | 'books5' | 'books50-l2-tbt' | 'books-l2-tbt';
instId: string;
};
export type OptionSummaryChannel = {
channel: 'opt-summary';
instFamily: string;
};
export type FundingRateChannel = {
channel: 'funding-rate';
instId: string;
};
export type IndexCandlesticksChannel = {
channel: `index-candle${string}`;
instId: string;
};
export type IndexTickersChannel = {
channel: 'index-tickers';
instId: string;
};
export type StatusChannel = {
channel: 'status';
};