@gainsnetwork/sdk 0.2.0-rc1 → 0.2.0-rc3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/contracts/utils/openTrades.js +1 -1
- package/lib/trade/types.d.ts +23 -1
- package/lib/trade/types.js +16 -1
- package/package.json +1 -1
|
@@ -368,7 +368,7 @@ const _prepareTradeContainer = (trade, tradeInfo, tradeInitialAccFees, collatera
|
|
|
368
368
|
createdBlock: parseInt(tradeInfo.createdBlock.toString()),
|
|
369
369
|
tpLastUpdatedBlock: parseInt(tradeInfo.tpLastUpdatedBlock.toString()),
|
|
370
370
|
slLastUpdatedBlock: parseInt(tradeInfo.slLastUpdatedBlock.toString()),
|
|
371
|
-
maxSlippageP: parseFloat(tradeInfo.maxSlippageP.toString()) /
|
|
371
|
+
maxSlippageP: parseFloat(tradeInfo.maxSlippageP.toString()) / 1e3,
|
|
372
372
|
lastOiUpdateTs: parseFloat(tradeInfo.lastOiUpdateTs),
|
|
373
373
|
collateralPriceUsd: parseFloat(tradeInfo.collateralPriceUsd.toString()) / 1e8,
|
|
374
374
|
},
|
package/lib/trade/types.d.ts
CHANGED
|
@@ -64,7 +64,7 @@ export type Pair = {
|
|
|
64
64
|
export type TradeHistoryRecord = {
|
|
65
65
|
action: string;
|
|
66
66
|
address: string;
|
|
67
|
-
|
|
67
|
+
long: number;
|
|
68
68
|
collateralPriceUsd: number;
|
|
69
69
|
collateralIndex: number;
|
|
70
70
|
date: string;
|
|
@@ -153,6 +153,19 @@ export type TraderFeeTiers = {
|
|
|
153
153
|
lastDayUpdatedPoints: number;
|
|
154
154
|
expiredPoints: number[];
|
|
155
155
|
};
|
|
156
|
+
export declare enum PendingOrderType {
|
|
157
|
+
MARKET_OPEN = 0,
|
|
158
|
+
MARKET_CLOSE = 1,
|
|
159
|
+
LIMIT_OPEN = 2,
|
|
160
|
+
STOP_OPEN = 3,
|
|
161
|
+
TP_CLOSE = 4,
|
|
162
|
+
SL_CLOSE = 5,
|
|
163
|
+
LIQ_CLOSE = 6
|
|
164
|
+
}
|
|
165
|
+
export declare enum CounterType {
|
|
166
|
+
TRADE = 0,
|
|
167
|
+
PENDING_ORDER = 1
|
|
168
|
+
}
|
|
156
169
|
export declare enum TradeType {
|
|
157
170
|
TRADE = 0,
|
|
158
171
|
LIMIT = 1,
|
|
@@ -163,6 +176,15 @@ export type OpenInterest = {
|
|
|
163
176
|
short: number;
|
|
164
177
|
max: number;
|
|
165
178
|
};
|
|
179
|
+
export type PendingOrder = {
|
|
180
|
+
trade: Trade;
|
|
181
|
+
user: string;
|
|
182
|
+
index: string;
|
|
183
|
+
isOpen: boolean;
|
|
184
|
+
orderType: PendingOrderType;
|
|
185
|
+
createdBlock: string;
|
|
186
|
+
maxSlippageP: string;
|
|
187
|
+
};
|
|
166
188
|
export type TradeInitialAccFees = BorrowingFee.InitialAccFees;
|
|
167
189
|
export declare enum PairIndex {
|
|
168
190
|
BTCUSD = 0,
|
package/lib/trade/types.js
CHANGED
|
@@ -1,11 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PairIndex = exports.TradeType = exports.PositionType = void 0;
|
|
3
|
+
exports.PairIndex = exports.TradeType = exports.CounterType = exports.PendingOrderType = exports.PositionType = void 0;
|
|
4
4
|
var PositionType;
|
|
5
5
|
(function (PositionType) {
|
|
6
6
|
PositionType["LONG"] = "LONG";
|
|
7
7
|
PositionType["SHORT"] = "SHORT";
|
|
8
8
|
})(PositionType = exports.PositionType || (exports.PositionType = {}));
|
|
9
|
+
var PendingOrderType;
|
|
10
|
+
(function (PendingOrderType) {
|
|
11
|
+
PendingOrderType[PendingOrderType["MARKET_OPEN"] = 0] = "MARKET_OPEN";
|
|
12
|
+
PendingOrderType[PendingOrderType["MARKET_CLOSE"] = 1] = "MARKET_CLOSE";
|
|
13
|
+
PendingOrderType[PendingOrderType["LIMIT_OPEN"] = 2] = "LIMIT_OPEN";
|
|
14
|
+
PendingOrderType[PendingOrderType["STOP_OPEN"] = 3] = "STOP_OPEN";
|
|
15
|
+
PendingOrderType[PendingOrderType["TP_CLOSE"] = 4] = "TP_CLOSE";
|
|
16
|
+
PendingOrderType[PendingOrderType["SL_CLOSE"] = 5] = "SL_CLOSE";
|
|
17
|
+
PendingOrderType[PendingOrderType["LIQ_CLOSE"] = 6] = "LIQ_CLOSE";
|
|
18
|
+
})(PendingOrderType = exports.PendingOrderType || (exports.PendingOrderType = {}));
|
|
19
|
+
var CounterType;
|
|
20
|
+
(function (CounterType) {
|
|
21
|
+
CounterType[CounterType["TRADE"] = 0] = "TRADE";
|
|
22
|
+
CounterType[CounterType["PENDING_ORDER"] = 1] = "PENDING_ORDER";
|
|
23
|
+
})(CounterType = exports.CounterType || (exports.CounterType = {}));
|
|
9
24
|
var TradeType;
|
|
10
25
|
(function (TradeType) {
|
|
11
26
|
TradeType[TradeType["TRADE"] = 0] = "TRADE";
|