mirror of
https://github.com/discountry/ritmex-bot.git
synced 2026-09-11 09:18:08 +00:00
refactor: split types.ts into per-exchange type modules
- Extract GRVT-specific types to grvt/types.ts - Extract Aster-spot/futures types to aster/types.ts - types.ts now contains only universal/platform-agnostic types - Reduced from 632 to ~135 lines
This commit is contained in:
@@ -6,6 +6,11 @@ import type {
|
|||||||
Depth,
|
Depth,
|
||||||
Kline,
|
Kline,
|
||||||
Order,
|
Order,
|
||||||
|
Ticker,
|
||||||
|
CreateOrderParams,
|
||||||
|
PositionSide,
|
||||||
|
} from "../types";
|
||||||
|
import type {
|
||||||
AsterSpotAccount,
|
AsterSpotAccount,
|
||||||
AsterSpotAggTrade,
|
AsterSpotAggTrade,
|
||||||
AsterSpotBookTicker,
|
AsterSpotBookTicker,
|
||||||
@@ -18,18 +23,15 @@ import type {
|
|||||||
AsterSpotTicker24h,
|
AsterSpotTicker24h,
|
||||||
AsterSpotTrade,
|
AsterSpotTrade,
|
||||||
AsterSpotUserTrade,
|
AsterSpotUserTrade,
|
||||||
Ticker,
|
|
||||||
AsterFuturesExchangeInfo,
|
AsterFuturesExchangeInfo,
|
||||||
AsterFuturesSymbolInfo,
|
AsterFuturesSymbolInfo,
|
||||||
CancelSpotOrderParams,
|
CancelSpotOrderParams,
|
||||||
CreateOrderParams,
|
|
||||||
CreateSpotOrderParams,
|
CreateSpotOrderParams,
|
||||||
PositionSide,
|
|
||||||
QuerySpotOrderParams,
|
QuerySpotOrderParams,
|
||||||
SpotAllOrdersParams,
|
SpotAllOrdersParams,
|
||||||
SpotOpenOrdersParams,
|
SpotOpenOrdersParams,
|
||||||
SpotUserTradesParams,
|
SpotUserTradesParams,
|
||||||
} from "../types";
|
} from "./types";
|
||||||
import { decimalsOf } from "../../utils/math";
|
import { decimalsOf } from "../../utils/math";
|
||||||
|
|
||||||
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
|
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
|
||||||
|
|||||||
@@ -0,0 +1,248 @@
|
|||||||
|
import type { DepthLevel, OrderSide, OrderType, TimeInForce } from "../types";
|
||||||
|
|
||||||
|
export interface AsterSpotRateLimit {
|
||||||
|
rateLimitType: string;
|
||||||
|
interval: string;
|
||||||
|
intervalNum: number;
|
||||||
|
limit: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AsterSpotExchangeFilter {
|
||||||
|
filterType: string;
|
||||||
|
[key: string]: string | number | boolean | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AsterFuturesSymbolFilter {
|
||||||
|
filterType: string;
|
||||||
|
tickSize?: string;
|
||||||
|
stepSize?: string;
|
||||||
|
minPrice?: string;
|
||||||
|
maxPrice?: string;
|
||||||
|
minQty?: string;
|
||||||
|
maxQty?: string;
|
||||||
|
[key: string]: string | number | boolean | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AsterFuturesSymbolInfo {
|
||||||
|
symbol: string;
|
||||||
|
pair?: string;
|
||||||
|
contractType?: string;
|
||||||
|
pricePrecision?: number;
|
||||||
|
quantityPrecision?: number;
|
||||||
|
baseAssetPrecision?: number;
|
||||||
|
quotePrecision?: number;
|
||||||
|
underlyingType?: string;
|
||||||
|
filters?: AsterFuturesSymbolFilter[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AsterFuturesExchangeInfo {
|
||||||
|
timezone?: string;
|
||||||
|
serverTime?: number;
|
||||||
|
symbols?: AsterFuturesSymbolInfo[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AsterSpotAssetInfo {
|
||||||
|
asset: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AsterSpotSymbolInfo {
|
||||||
|
symbol: string;
|
||||||
|
status: string;
|
||||||
|
baseAsset: string;
|
||||||
|
quoteAsset: string;
|
||||||
|
baseAssetPrecision?: number;
|
||||||
|
quotePrecision?: number;
|
||||||
|
pricePrecision?: number;
|
||||||
|
quantityPrecision?: number;
|
||||||
|
orderTypes: string[];
|
||||||
|
timeInForce: string[];
|
||||||
|
ocoAllowed: boolean;
|
||||||
|
filters: AsterSpotExchangeFilter[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AsterSpotExchangeInfo {
|
||||||
|
timezone: string;
|
||||||
|
serverTime: number;
|
||||||
|
rateLimits: AsterSpotRateLimit[];
|
||||||
|
exchangeFilters: AsterSpotExchangeFilter[];
|
||||||
|
assets?: AsterSpotAssetInfo[];
|
||||||
|
symbols: AsterSpotSymbolInfo[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AsterSpotDepth {
|
||||||
|
lastUpdateId: number;
|
||||||
|
E?: number;
|
||||||
|
T?: number;
|
||||||
|
bids: DepthLevel[];
|
||||||
|
asks: DepthLevel[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AsterSpotTrade {
|
||||||
|
id: number;
|
||||||
|
price: string;
|
||||||
|
qty: string;
|
||||||
|
baseQty?: string;
|
||||||
|
quoteQty?: string;
|
||||||
|
time: number;
|
||||||
|
isBuyerMaker: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AsterSpotHistoricalTrade extends AsterSpotTrade {
|
||||||
|
isBestMatch?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AsterSpotAggTrade {
|
||||||
|
a: number;
|
||||||
|
p: string;
|
||||||
|
q: string;
|
||||||
|
f: number;
|
||||||
|
l: number;
|
||||||
|
T: number;
|
||||||
|
m: boolean;
|
||||||
|
M?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AsterSpotKline {
|
||||||
|
openTime: number;
|
||||||
|
open: string;
|
||||||
|
high: string;
|
||||||
|
low: string;
|
||||||
|
close: string;
|
||||||
|
volume: string;
|
||||||
|
closeTime: number;
|
||||||
|
quoteAssetVolume: string;
|
||||||
|
numberOfTrades: number;
|
||||||
|
takerBuyBaseAssetVolume: string;
|
||||||
|
takerBuyQuoteAssetVolume: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AsterSpotTicker24h {
|
||||||
|
symbol: string;
|
||||||
|
priceChange: string;
|
||||||
|
priceChangePercent: string;
|
||||||
|
weightedAvgPrice: string;
|
||||||
|
prevClosePrice: string;
|
||||||
|
lastPrice: string;
|
||||||
|
lastQty: string;
|
||||||
|
bidPrice: string;
|
||||||
|
bidQty: string;
|
||||||
|
askPrice: string;
|
||||||
|
askQty: string;
|
||||||
|
openPrice: string;
|
||||||
|
highPrice: string;
|
||||||
|
lowPrice: string;
|
||||||
|
volume: string;
|
||||||
|
quoteVolume: string;
|
||||||
|
openTime: number;
|
||||||
|
closeTime: number;
|
||||||
|
firstId: number;
|
||||||
|
lastId: number;
|
||||||
|
count: number;
|
||||||
|
baseAsset?: string;
|
||||||
|
quoteAsset?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AsterSpotPriceTicker {
|
||||||
|
symbol: string;
|
||||||
|
price: string;
|
||||||
|
time?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AsterSpotBookTicker {
|
||||||
|
symbol: string;
|
||||||
|
bidPrice: string;
|
||||||
|
bidQty: string;
|
||||||
|
askPrice: string;
|
||||||
|
askQty: string;
|
||||||
|
time?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AsterSpotCommissionRate {
|
||||||
|
symbol: string;
|
||||||
|
makerCommissionRate: string;
|
||||||
|
takerCommissionRate: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CreateSpotOrderParams {
|
||||||
|
symbol: string;
|
||||||
|
side: OrderSide;
|
||||||
|
type: OrderType;
|
||||||
|
timeInForce?: TimeInForce;
|
||||||
|
quantity?: number | string;
|
||||||
|
quoteOrderQty?: number | string;
|
||||||
|
price?: number | string;
|
||||||
|
newClientOrderId?: string;
|
||||||
|
stopPrice?: number | string;
|
||||||
|
recvWindow?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CancelSpotOrderParams {
|
||||||
|
symbol: string;
|
||||||
|
orderId?: number | string;
|
||||||
|
origClientOrderId?: string;
|
||||||
|
recvWindow?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface QuerySpotOrderParams extends CancelSpotOrderParams {}
|
||||||
|
|
||||||
|
export interface SpotOpenOrdersParams {
|
||||||
|
symbol?: string;
|
||||||
|
recvWindow?: number;
|
||||||
|
orderIdList?: Array<number | string>;
|
||||||
|
origClientOrderIdList?: string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface SpotAllOrdersParams {
|
||||||
|
symbol: string;
|
||||||
|
orderId?: number;
|
||||||
|
startTime?: number;
|
||||||
|
endTime?: number;
|
||||||
|
limit?: number;
|
||||||
|
recvWindow?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AsterSpotAccountBalance {
|
||||||
|
asset: string;
|
||||||
|
free: string;
|
||||||
|
locked: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AsterSpotAccount {
|
||||||
|
feeTier: number;
|
||||||
|
canTrade: boolean;
|
||||||
|
canDeposit: boolean;
|
||||||
|
canWithdraw: boolean;
|
||||||
|
canBurnAsset?: boolean;
|
||||||
|
updateTime: number;
|
||||||
|
makerCommission?: string;
|
||||||
|
takerCommission?: string;
|
||||||
|
buyerCommission?: string;
|
||||||
|
sellerCommission?: string;
|
||||||
|
balances: AsterSpotAccountBalance[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface SpotUserTradesParams {
|
||||||
|
symbol?: string;
|
||||||
|
orderId?: number;
|
||||||
|
startTime?: number;
|
||||||
|
endTime?: number;
|
||||||
|
fromId?: number;
|
||||||
|
limit?: number;
|
||||||
|
recvWindow?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AsterSpotUserTrade {
|
||||||
|
symbol: string;
|
||||||
|
id: number;
|
||||||
|
orderId: number;
|
||||||
|
side: OrderSide;
|
||||||
|
price: string;
|
||||||
|
qty: string;
|
||||||
|
quoteQty?: string;
|
||||||
|
commission: string;
|
||||||
|
commissionAsset: string;
|
||||||
|
time: number;
|
||||||
|
counterpartyId?: number;
|
||||||
|
maker: boolean;
|
||||||
|
buyer: boolean;
|
||||||
|
}
|
||||||
@@ -31,13 +31,15 @@ import type {
|
|||||||
Ticker,
|
Ticker,
|
||||||
CreateOrderParams,
|
CreateOrderParams,
|
||||||
OrderSide,
|
OrderSide,
|
||||||
|
} from "../types";
|
||||||
|
import type {
|
||||||
GrvtSignedOrder,
|
GrvtSignedOrder,
|
||||||
GrvtSignature,
|
GrvtSignature,
|
||||||
GrvtUnsignedOrder,
|
GrvtUnsignedOrder,
|
||||||
GrvtTimeInForce,
|
GrvtTimeInForce,
|
||||||
GrvtOrderMetadataInput,
|
GrvtOrderMetadataInput,
|
||||||
GrvtTriggerMetadata,
|
GrvtTriggerMetadata,
|
||||||
} from "../types";
|
} from "./types";
|
||||||
|
|
||||||
const DEFAULT_ACCOUNT_POLL_INTERVAL_MS = 5000;
|
const DEFAULT_ACCOUNT_POLL_INTERVAL_MS = 5000;
|
||||||
const DEFAULT_ORDERS_POLL_INTERVAL_MS = 2500;
|
const DEFAULT_ORDERS_POLL_INTERVAL_MS = 2500;
|
||||||
|
|||||||
@@ -0,0 +1,202 @@
|
|||||||
|
export interface GrvtOrderLeg {
|
||||||
|
instrument: string;
|
||||||
|
size: string;
|
||||||
|
limit_price?: string;
|
||||||
|
is_buying_asset?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type GrvtTimeInForce =
|
||||||
|
| "GOOD_TILL_TIME"
|
||||||
|
| "ALL_OR_NONE"
|
||||||
|
| "IMMEDIATE_OR_CANCEL"
|
||||||
|
| "FILL_OR_KILL";
|
||||||
|
|
||||||
|
export interface GrvtOrderMetadata {
|
||||||
|
client_order_id?: string;
|
||||||
|
create_time?: string;
|
||||||
|
broker?: string | null;
|
||||||
|
trigger?: GrvtTriggerMetadata;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GrvtOrderState {
|
||||||
|
status?: string;
|
||||||
|
reject_reason?: string | null;
|
||||||
|
book_size?: string[];
|
||||||
|
traded_size?: string[];
|
||||||
|
update_time?: string;
|
||||||
|
avg_fill_price?: string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GrvtOrder {
|
||||||
|
order_id: string;
|
||||||
|
client_order_id?: string;
|
||||||
|
sub_account_id?: string;
|
||||||
|
is_market?: boolean;
|
||||||
|
time_in_force?: GrvtTimeInForce;
|
||||||
|
post_only?: boolean;
|
||||||
|
reduce_only?: boolean;
|
||||||
|
legs?: GrvtOrderLeg[];
|
||||||
|
metadata?: GrvtOrderMetadata;
|
||||||
|
state?: GrvtOrderState;
|
||||||
|
instrument?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GrvtTrade {
|
||||||
|
price: string;
|
||||||
|
size: string;
|
||||||
|
taker_side: "BUY" | "SELL";
|
||||||
|
timestamp: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GrvtTradeHistoryResponse {
|
||||||
|
result?: GrvtTrade[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GrvtWebsocketMessage<T> {
|
||||||
|
stream: string;
|
||||||
|
selector: string;
|
||||||
|
sequence_number?: string;
|
||||||
|
feed: T;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GrvtOrderUpdateFeed {
|
||||||
|
order_id: string;
|
||||||
|
client_order_id?: string;
|
||||||
|
sub_account_id?: string;
|
||||||
|
state?: GrvtOrderState;
|
||||||
|
traded_size?: string[];
|
||||||
|
update_time?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GrvtPositionUpdateFeed {
|
||||||
|
instrument: string;
|
||||||
|
size: string;
|
||||||
|
entry_price?: string;
|
||||||
|
mark_price?: string;
|
||||||
|
unrealized_pnl?: string;
|
||||||
|
sub_account_id?: string;
|
||||||
|
update_time?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GrvtDepthUpdateFeed {
|
||||||
|
instrument: string;
|
||||||
|
bids: GrvtDepthLevel[];
|
||||||
|
asks: GrvtDepthLevel[];
|
||||||
|
event_time?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GrvtTickerUpdateFeed {
|
||||||
|
instrument: string;
|
||||||
|
mark_price?: string;
|
||||||
|
last_trade_price?: string;
|
||||||
|
best_bid_price?: string;
|
||||||
|
best_ask_price?: string;
|
||||||
|
volume_24h?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GrvtOpenOrdersResponse {
|
||||||
|
result?: GrvtOrder[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GrvtPositionsResponse {
|
||||||
|
result?: GrvtPosition[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GrvtPosition {
|
||||||
|
instrument: string;
|
||||||
|
size: string;
|
||||||
|
entry_price?: string;
|
||||||
|
mark_price?: string;
|
||||||
|
unrealized_pnl?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GrvtAccountSnapshot {
|
||||||
|
total_unrealized_pnl?: string;
|
||||||
|
positions: GrvtPosition[];
|
||||||
|
settle_currency?: string;
|
||||||
|
available_balance?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GrvtBalancesResponse {
|
||||||
|
result?: {
|
||||||
|
total_unrealized_pnl?: string;
|
||||||
|
positions?: GrvtPosition[];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GrvtDepthLevel {
|
||||||
|
price: string;
|
||||||
|
size: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GrvtDepth {
|
||||||
|
instrument: string;
|
||||||
|
event_time?: string;
|
||||||
|
bids: GrvtDepthLevel[];
|
||||||
|
asks: GrvtDepthLevel[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GrvtTicker {
|
||||||
|
instrument: string;
|
||||||
|
mark_price?: string;
|
||||||
|
last_trade_price?: string;
|
||||||
|
best_bid_price?: string;
|
||||||
|
best_ask_price?: string;
|
||||||
|
volume_24h?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GrvtKline {
|
||||||
|
open_time: number;
|
||||||
|
close_time: number;
|
||||||
|
open: string;
|
||||||
|
high: string;
|
||||||
|
low: string;
|
||||||
|
close: string;
|
||||||
|
volume: string;
|
||||||
|
number_of_trades?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GrvtSignature {
|
||||||
|
signer: string;
|
||||||
|
r: string;
|
||||||
|
s: string;
|
||||||
|
v: number;
|
||||||
|
expiration: string;
|
||||||
|
nonce: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GrvtUnsignedOrderLeg {
|
||||||
|
instrument: string;
|
||||||
|
size: string;
|
||||||
|
limit_price?: string;
|
||||||
|
is_buying_asset: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GrvtTriggerMetadata {
|
||||||
|
trigger_type: "UNSPECIFIED" | "TAKE_PROFIT" | "STOP_LOSS";
|
||||||
|
tpsl: {
|
||||||
|
trigger_by: "UNSPECIFIED" | "INDEX" | "LAST" | "MID" | "MARK";
|
||||||
|
trigger_price: string;
|
||||||
|
close_position: boolean;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GrvtOrderMetadataInput {
|
||||||
|
client_order_id: string;
|
||||||
|
trigger?: GrvtTriggerMetadata;
|
||||||
|
broker?: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GrvtUnsignedOrder {
|
||||||
|
sub_account_id: string;
|
||||||
|
is_market: boolean;
|
||||||
|
time_in_force: GrvtTimeInForce;
|
||||||
|
post_only: boolean;
|
||||||
|
reduce_only: boolean;
|
||||||
|
legs: GrvtUnsignedOrderLeg[];
|
||||||
|
metadata: GrvtOrderMetadataInput;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GrvtSignedOrder extends GrvtUnsignedOrder {
|
||||||
|
signature: GrvtSignature;
|
||||||
|
}
|
||||||
+2
-453
@@ -25,9 +25,8 @@ export interface CreateOrderParams {
|
|||||||
reduceOnly?: StringBoolean;
|
reduceOnly?: StringBoolean;
|
||||||
closePosition?: StringBoolean;
|
closePosition?: StringBoolean;
|
||||||
triggerType?: "UNSPECIFIED" | "TAKE_PROFIT" | "STOP_LOSS";
|
triggerType?: "UNSPECIFIED" | "TAKE_PROFIT" | "STOP_LOSS";
|
||||||
// StandX TPSL 参数
|
slPrice?: number;
|
||||||
slPrice?: number; // 止损价格
|
tpPrice?: number;
|
||||||
tpPrice?: number; // 止盈价格
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AccountPosition {
|
export interface AccountPosition {
|
||||||
@@ -51,209 +50,6 @@ export interface AccountPosition {
|
|||||||
markPrice?: string;
|
markPrice?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GrvtOrderLeg {
|
|
||||||
instrument: string;
|
|
||||||
size: string;
|
|
||||||
limit_price?: string;
|
|
||||||
is_buying_asset?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export type GrvtTimeInForce =
|
|
||||||
| "GOOD_TILL_TIME"
|
|
||||||
| "ALL_OR_NONE"
|
|
||||||
| "IMMEDIATE_OR_CANCEL"
|
|
||||||
| "FILL_OR_KILL";
|
|
||||||
|
|
||||||
export interface GrvtOrderMetadata {
|
|
||||||
client_order_id?: string;
|
|
||||||
create_time?: string;
|
|
||||||
broker?: string | null;
|
|
||||||
trigger?: GrvtTriggerMetadata;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface GrvtOrderState {
|
|
||||||
status?: string;
|
|
||||||
reject_reason?: string | null;
|
|
||||||
book_size?: string[];
|
|
||||||
traded_size?: string[];
|
|
||||||
update_time?: string;
|
|
||||||
avg_fill_price?: string[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface GrvtOrder {
|
|
||||||
order_id: string;
|
|
||||||
client_order_id?: string;
|
|
||||||
sub_account_id?: string;
|
|
||||||
is_market?: boolean;
|
|
||||||
time_in_force?: GrvtTimeInForce;
|
|
||||||
post_only?: boolean;
|
|
||||||
reduce_only?: boolean;
|
|
||||||
legs?: GrvtOrderLeg[];
|
|
||||||
metadata?: GrvtOrderMetadata;
|
|
||||||
state?: GrvtOrderState;
|
|
||||||
instrument?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface GrvtTrade {
|
|
||||||
price: string;
|
|
||||||
size: string;
|
|
||||||
taker_side: "BUY" | "SELL";
|
|
||||||
timestamp: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface GrvtTradeHistoryResponse {
|
|
||||||
result?: GrvtTrade[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface GrvtWebsocketMessage<T> {
|
|
||||||
stream: string;
|
|
||||||
selector: string;
|
|
||||||
sequence_number?: string;
|
|
||||||
feed: T;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface GrvtOrderUpdateFeed {
|
|
||||||
order_id: string;
|
|
||||||
client_order_id?: string;
|
|
||||||
sub_account_id?: string;
|
|
||||||
state?: GrvtOrderState;
|
|
||||||
traded_size?: string[];
|
|
||||||
update_time?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface GrvtPositionUpdateFeed {
|
|
||||||
instrument: string;
|
|
||||||
size: string;
|
|
||||||
entry_price?: string;
|
|
||||||
mark_price?: string;
|
|
||||||
unrealized_pnl?: string;
|
|
||||||
sub_account_id?: string;
|
|
||||||
update_time?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface GrvtDepthUpdateFeed {
|
|
||||||
instrument: string;
|
|
||||||
bids: GrvtDepthLevel[];
|
|
||||||
asks: GrvtDepthLevel[];
|
|
||||||
event_time?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface GrvtTickerUpdateFeed {
|
|
||||||
instrument: string;
|
|
||||||
mark_price?: string;
|
|
||||||
last_trade_price?: string;
|
|
||||||
best_bid_price?: string;
|
|
||||||
best_ask_price?: string;
|
|
||||||
volume_24h?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface GrvtOpenOrdersResponse {
|
|
||||||
result?: GrvtOrder[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface GrvtPositionsResponse {
|
|
||||||
result?: GrvtPosition[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface GrvtPosition {
|
|
||||||
instrument: string;
|
|
||||||
size: string;
|
|
||||||
entry_price?: string;
|
|
||||||
mark_price?: string;
|
|
||||||
unrealized_pnl?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface GrvtAccountSnapshot {
|
|
||||||
total_unrealized_pnl?: string;
|
|
||||||
positions: GrvtPosition[];
|
|
||||||
settle_currency?: string;
|
|
||||||
available_balance?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface GrvtBalancesResponse {
|
|
||||||
result?: {
|
|
||||||
total_unrealized_pnl?: string;
|
|
||||||
positions?: GrvtPosition[];
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface GrvtDepthLevel {
|
|
||||||
price: string;
|
|
||||||
size: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface GrvtDepth {
|
|
||||||
instrument: string;
|
|
||||||
event_time?: string;
|
|
||||||
bids: GrvtDepthLevel[];
|
|
||||||
asks: GrvtDepthLevel[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface GrvtTicker {
|
|
||||||
instrument: string;
|
|
||||||
mark_price?: string;
|
|
||||||
last_trade_price?: string;
|
|
||||||
best_bid_price?: string;
|
|
||||||
best_ask_price?: string;
|
|
||||||
volume_24h?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface GrvtKline {
|
|
||||||
open_time: number;
|
|
||||||
close_time: number;
|
|
||||||
open: string;
|
|
||||||
high: string;
|
|
||||||
low: string;
|
|
||||||
close: string;
|
|
||||||
volume: string;
|
|
||||||
number_of_trades?: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface GrvtSignature {
|
|
||||||
signer: string;
|
|
||||||
r: string;
|
|
||||||
s: string;
|
|
||||||
v: number;
|
|
||||||
expiration: string;
|
|
||||||
nonce: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface GrvtUnsignedOrderLeg {
|
|
||||||
instrument: string;
|
|
||||||
size: string;
|
|
||||||
limit_price?: string;
|
|
||||||
is_buying_asset: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface GrvtTriggerMetadata {
|
|
||||||
trigger_type: "UNSPECIFIED" | "TAKE_PROFIT" | "STOP_LOSS";
|
|
||||||
tpsl: {
|
|
||||||
trigger_by: "UNSPECIFIED" | "INDEX" | "LAST" | "MID" | "MARK";
|
|
||||||
trigger_price: string;
|
|
||||||
close_position: boolean;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface GrvtOrderMetadataInput {
|
|
||||||
client_order_id: string;
|
|
||||||
trigger?: GrvtTriggerMetadata;
|
|
||||||
broker?: string | null;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface GrvtUnsignedOrder {
|
|
||||||
sub_account_id: string;
|
|
||||||
is_market: boolean;
|
|
||||||
time_in_force: GrvtTimeInForce;
|
|
||||||
post_only: boolean;
|
|
||||||
reduce_only: boolean;
|
|
||||||
legs: GrvtUnsignedOrderLeg[];
|
|
||||||
metadata: GrvtOrderMetadataInput;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface GrvtSignedOrder extends GrvtUnsignedOrder {
|
|
||||||
signature: GrvtSignature;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface AccountAsset {
|
export interface AccountAsset {
|
||||||
asset: string;
|
asset: string;
|
||||||
walletBalance: string;
|
walletBalance: string;
|
||||||
@@ -336,253 +132,6 @@ export interface Ticker {
|
|||||||
count?: number;
|
count?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AsterSpotRateLimit {
|
|
||||||
rateLimitType: string;
|
|
||||||
interval: string;
|
|
||||||
intervalNum: number;
|
|
||||||
limit: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface AsterSpotExchangeFilter {
|
|
||||||
filterType: string;
|
|
||||||
[key: string]: string | number | boolean | undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface AsterFuturesSymbolFilter {
|
|
||||||
filterType: string;
|
|
||||||
tickSize?: string;
|
|
||||||
stepSize?: string;
|
|
||||||
minPrice?: string;
|
|
||||||
maxPrice?: string;
|
|
||||||
minQty?: string;
|
|
||||||
maxQty?: string;
|
|
||||||
[key: string]: string | number | boolean | undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface AsterFuturesSymbolInfo {
|
|
||||||
symbol: string;
|
|
||||||
pair?: string;
|
|
||||||
contractType?: string;
|
|
||||||
pricePrecision?: number;
|
|
||||||
quantityPrecision?: number;
|
|
||||||
baseAssetPrecision?: number;
|
|
||||||
quotePrecision?: number;
|
|
||||||
underlyingType?: string;
|
|
||||||
filters?: AsterFuturesSymbolFilter[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface AsterFuturesExchangeInfo {
|
|
||||||
timezone?: string;
|
|
||||||
serverTime?: number;
|
|
||||||
symbols?: AsterFuturesSymbolInfo[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface AsterSpotAssetInfo {
|
|
||||||
asset: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface AsterSpotSymbolInfo {
|
|
||||||
symbol: string;
|
|
||||||
status: string;
|
|
||||||
baseAsset: string;
|
|
||||||
quoteAsset: string;
|
|
||||||
baseAssetPrecision?: number;
|
|
||||||
quotePrecision?: number;
|
|
||||||
pricePrecision?: number;
|
|
||||||
quantityPrecision?: number;
|
|
||||||
orderTypes: string[];
|
|
||||||
timeInForce: string[];
|
|
||||||
ocoAllowed: boolean;
|
|
||||||
filters: AsterSpotExchangeFilter[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface AsterSpotExchangeInfo {
|
|
||||||
timezone: string;
|
|
||||||
serverTime: number;
|
|
||||||
rateLimits: AsterSpotRateLimit[];
|
|
||||||
exchangeFilters: AsterSpotExchangeFilter[];
|
|
||||||
assets?: AsterSpotAssetInfo[];
|
|
||||||
symbols: AsterSpotSymbolInfo[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface AsterSpotDepth {
|
|
||||||
lastUpdateId: number;
|
|
||||||
E?: number;
|
|
||||||
T?: number;
|
|
||||||
bids: DepthLevel[];
|
|
||||||
asks: DepthLevel[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface AsterSpotTrade {
|
|
||||||
id: number;
|
|
||||||
price: string;
|
|
||||||
qty: string;
|
|
||||||
baseQty?: string;
|
|
||||||
quoteQty?: string;
|
|
||||||
time: number;
|
|
||||||
isBuyerMaker: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface AsterSpotHistoricalTrade extends AsterSpotTrade {
|
|
||||||
isBestMatch?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface AsterSpotAggTrade {
|
|
||||||
a: number;
|
|
||||||
p: string;
|
|
||||||
q: string;
|
|
||||||
f: number;
|
|
||||||
l: number;
|
|
||||||
T: number;
|
|
||||||
m: boolean;
|
|
||||||
M?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface AsterSpotKline {
|
|
||||||
openTime: number;
|
|
||||||
open: string;
|
|
||||||
high: string;
|
|
||||||
low: string;
|
|
||||||
close: string;
|
|
||||||
volume: string;
|
|
||||||
closeTime: number;
|
|
||||||
quoteAssetVolume: string;
|
|
||||||
numberOfTrades: number;
|
|
||||||
takerBuyBaseAssetVolume: string;
|
|
||||||
takerBuyQuoteAssetVolume: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface AsterSpotTicker24h {
|
|
||||||
symbol: string;
|
|
||||||
priceChange: string;
|
|
||||||
priceChangePercent: string;
|
|
||||||
weightedAvgPrice: string;
|
|
||||||
prevClosePrice: string;
|
|
||||||
lastPrice: string;
|
|
||||||
lastQty: string;
|
|
||||||
bidPrice: string;
|
|
||||||
bidQty: string;
|
|
||||||
askPrice: string;
|
|
||||||
askQty: string;
|
|
||||||
openPrice: string;
|
|
||||||
highPrice: string;
|
|
||||||
lowPrice: string;
|
|
||||||
volume: string;
|
|
||||||
quoteVolume: string;
|
|
||||||
openTime: number;
|
|
||||||
closeTime: number;
|
|
||||||
firstId: number;
|
|
||||||
lastId: number;
|
|
||||||
count: number;
|
|
||||||
baseAsset?: string;
|
|
||||||
quoteAsset?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface AsterSpotPriceTicker {
|
|
||||||
symbol: string;
|
|
||||||
price: string;
|
|
||||||
time?: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface AsterSpotBookTicker {
|
|
||||||
symbol: string;
|
|
||||||
bidPrice: string;
|
|
||||||
bidQty: string;
|
|
||||||
askPrice: string;
|
|
||||||
askQty: string;
|
|
||||||
time?: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface AsterSpotCommissionRate {
|
|
||||||
symbol: string;
|
|
||||||
makerCommissionRate: string;
|
|
||||||
takerCommissionRate: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface CreateSpotOrderParams {
|
|
||||||
symbol: string;
|
|
||||||
side: OrderSide;
|
|
||||||
type: OrderType;
|
|
||||||
timeInForce?: TimeInForce;
|
|
||||||
quantity?: number | string;
|
|
||||||
quoteOrderQty?: number | string;
|
|
||||||
price?: number | string;
|
|
||||||
newClientOrderId?: string;
|
|
||||||
stopPrice?: number | string;
|
|
||||||
recvWindow?: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface CancelSpotOrderParams {
|
|
||||||
symbol: string;
|
|
||||||
orderId?: number | string;
|
|
||||||
origClientOrderId?: string;
|
|
||||||
recvWindow?: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface QuerySpotOrderParams extends CancelSpotOrderParams {}
|
|
||||||
|
|
||||||
export interface SpotOpenOrdersParams {
|
|
||||||
symbol?: string;
|
|
||||||
recvWindow?: number;
|
|
||||||
orderIdList?: Array<number | string>;
|
|
||||||
origClientOrderIdList?: string[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface SpotAllOrdersParams {
|
|
||||||
symbol: string;
|
|
||||||
orderId?: number;
|
|
||||||
startTime?: number;
|
|
||||||
endTime?: number;
|
|
||||||
limit?: number;
|
|
||||||
recvWindow?: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface AsterSpotAccountBalance {
|
|
||||||
asset: string;
|
|
||||||
free: string;
|
|
||||||
locked: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface AsterSpotAccount {
|
|
||||||
feeTier: number;
|
|
||||||
canTrade: boolean;
|
|
||||||
canDeposit: boolean;
|
|
||||||
canWithdraw: boolean;
|
|
||||||
canBurnAsset?: boolean;
|
|
||||||
updateTime: number;
|
|
||||||
makerCommission?: string;
|
|
||||||
takerCommission?: string;
|
|
||||||
buyerCommission?: string;
|
|
||||||
sellerCommission?: string;
|
|
||||||
balances: AsterSpotAccountBalance[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface SpotUserTradesParams {
|
|
||||||
symbol?: string;
|
|
||||||
orderId?: number;
|
|
||||||
startTime?: number;
|
|
||||||
endTime?: number;
|
|
||||||
fromId?: number;
|
|
||||||
limit?: number;
|
|
||||||
recvWindow?: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface AsterSpotUserTrade {
|
|
||||||
symbol: string;
|
|
||||||
id: number;
|
|
||||||
orderId: number;
|
|
||||||
side: OrderSide;
|
|
||||||
price: string;
|
|
||||||
qty: string;
|
|
||||||
quoteQty?: string;
|
|
||||||
commission: string;
|
|
||||||
commissionAsset: string;
|
|
||||||
time: number;
|
|
||||||
counterpartyId?: number;
|
|
||||||
maker: boolean;
|
|
||||||
buyer: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Kline {
|
export interface Kline {
|
||||||
eventType?: string;
|
eventType?: string;
|
||||||
eventTime?: number;
|
eventTime?: number;
|
||||||
|
|||||||
Reference in New Issue
Block a user