@danielgroen/dxtrade-api 1.0.8 → 1.0.10
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/README.md +1 -0
- package/dist/index.d.mts +87 -14
- package/dist/index.d.ts +87 -14
- package/dist/index.js +221 -104
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +220 -102
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -1
package/README.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
declare const BROKER: {
|
|
2
2
|
readonly LARKFUNDING: "https://trade.gooeytrade.com";
|
|
3
3
|
readonly EIGHTCAP: "https://trader.dx-eightcap.com";
|
|
4
|
+
readonly FTMO: "https://dxtrade.ftmo.com";
|
|
4
5
|
};
|
|
5
|
-
declare function resolveBrokerUrl(broker: string, customUrls?: Record<string, string>): string;
|
|
6
6
|
|
|
7
7
|
declare const endpoints: {
|
|
8
8
|
login: (base: string) => string;
|
|
@@ -33,8 +33,11 @@ declare enum TIF {
|
|
|
33
33
|
GTD = "GTD"
|
|
34
34
|
}
|
|
35
35
|
declare enum WS_MESSAGE {
|
|
36
|
+
ACCOUNT_METRICS = "ACCOUNT_METRICS",
|
|
36
37
|
ACCOUNTS = "ACCOUNTS",
|
|
37
38
|
AVAILABLE_WATCHLISTS = "AVAILABLE_WATCHLISTS",
|
|
39
|
+
INSTRUMENTS = "INSTRUMENTS",
|
|
40
|
+
LIMITS = "LIMITS",
|
|
38
41
|
MESSAGE = "MESSAGE",
|
|
39
42
|
ORDERS = "ORDERS",
|
|
40
43
|
POSITIONS = "POSITIONS",
|
|
@@ -141,7 +144,7 @@ declare namespace Order {
|
|
|
141
144
|
interface DxtradeConfig {
|
|
142
145
|
username: string;
|
|
143
146
|
password: string;
|
|
144
|
-
broker:
|
|
147
|
+
broker: keyof typeof BROKER;
|
|
145
148
|
accountId?: string;
|
|
146
149
|
brokerUrls?: Record<string, string>;
|
|
147
150
|
retries?: number;
|
|
@@ -162,17 +165,18 @@ interface WsPayload {
|
|
|
162
165
|
type: string;
|
|
163
166
|
}
|
|
164
167
|
|
|
165
|
-
declare namespace
|
|
166
|
-
interface
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
168
|
+
declare namespace Account {
|
|
169
|
+
interface Metrics {
|
|
170
|
+
availableFunds: number;
|
|
171
|
+
marginCallLevel: number | string;
|
|
172
|
+
riskLevel: number;
|
|
173
|
+
openPl: number;
|
|
174
|
+
cashBalance: number;
|
|
175
|
+
equity: number;
|
|
176
|
+
conversionRate: number;
|
|
177
|
+
initialMargin: number;
|
|
178
|
+
availableBalance: number;
|
|
179
|
+
reverseRiskLevel: number | string;
|
|
176
180
|
[key: string]: unknown;
|
|
177
181
|
}
|
|
178
182
|
}
|
|
@@ -190,6 +194,72 @@ declare namespace Assessments {
|
|
|
190
194
|
}
|
|
191
195
|
}
|
|
192
196
|
|
|
197
|
+
declare namespace Instrument {
|
|
198
|
+
interface Info {
|
|
199
|
+
id: number;
|
|
200
|
+
symbol: string;
|
|
201
|
+
description: string;
|
|
202
|
+
type: string;
|
|
203
|
+
subtype: string;
|
|
204
|
+
currency: string;
|
|
205
|
+
currencyPrecision: number;
|
|
206
|
+
precision: number;
|
|
207
|
+
pipsSize: number;
|
|
208
|
+
quantityIncrement: number;
|
|
209
|
+
quantityPrecision: number;
|
|
210
|
+
priceIncrement: number;
|
|
211
|
+
version: number;
|
|
212
|
+
priceIncrementsTO: {
|
|
213
|
+
priceIncrements: number[];
|
|
214
|
+
pricePrecisions: number[];
|
|
215
|
+
bondFraction: boolean;
|
|
216
|
+
};
|
|
217
|
+
lotSize: number;
|
|
218
|
+
baseCurrency: string | null;
|
|
219
|
+
lotName: string | null;
|
|
220
|
+
multiplier: number;
|
|
221
|
+
open: boolean;
|
|
222
|
+
expiration: string | null;
|
|
223
|
+
firstNoticeDate: string | null;
|
|
224
|
+
lastTradeDate: string | null;
|
|
225
|
+
underlying: string | null;
|
|
226
|
+
mmy: string | null;
|
|
227
|
+
optionParametersTO: unknown;
|
|
228
|
+
unitName: string | null;
|
|
229
|
+
additionalFields: unknown;
|
|
230
|
+
additionalObject: unknown;
|
|
231
|
+
currencyParametersTO: unknown;
|
|
232
|
+
tradingHours: string;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
declare namespace Symbol {
|
|
237
|
+
interface Suggestion {
|
|
238
|
+
id: number;
|
|
239
|
+
name: string;
|
|
240
|
+
[key: string]: unknown;
|
|
241
|
+
}
|
|
242
|
+
interface Info {
|
|
243
|
+
maxVolume: number;
|
|
244
|
+
minVolume: number;
|
|
245
|
+
volumeStep: number;
|
|
246
|
+
lotSize: number;
|
|
247
|
+
[key: string]: unknown;
|
|
248
|
+
}
|
|
249
|
+
interface Limits {
|
|
250
|
+
symbol: string;
|
|
251
|
+
instrumentId: number;
|
|
252
|
+
limitStopDistanceType: string;
|
|
253
|
+
limitStopDistance: number;
|
|
254
|
+
limitStopDistanceInPercentOfSpread: number;
|
|
255
|
+
minOrderSize: number;
|
|
256
|
+
minOrderSizeBypass: boolean;
|
|
257
|
+
maxOrderSize: number;
|
|
258
|
+
minOrderIncrement: number;
|
|
259
|
+
limitType: string;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
193
263
|
declare class DxtradeClient {
|
|
194
264
|
private _ctx;
|
|
195
265
|
constructor(config: DxtradeConfig);
|
|
@@ -199,8 +269,11 @@ declare class DxtradeClient {
|
|
|
199
269
|
connect(): Promise<void>;
|
|
200
270
|
getSymbolSuggestions(text: string): Promise<Symbol.Suggestion[]>;
|
|
201
271
|
getSymbolInfo(symbol: string): Promise<Symbol.Info>;
|
|
272
|
+
getSymbolLimits(): Promise<Symbol.Limits[]>;
|
|
202
273
|
submitOrder(params: Order.SubmitParams): Promise<Order.Update>;
|
|
274
|
+
getAccountMetrics(): Promise<Account.Metrics>;
|
|
275
|
+
getInstruments(params?: Partial<Instrument.Info>): Promise<Instrument.Info[]>;
|
|
203
276
|
getAssessments(params: Assessments.Params): Promise<Assessments.Response>;
|
|
204
277
|
}
|
|
205
278
|
|
|
206
|
-
export { ACTION, BROKER, type DxtradeCallbacks, DxtradeClient, type DxtradeConfig, DxtradeError, ORDER_TYPE, SIDE, TIF, WS_MESSAGE, type WsPayload, endpoints
|
|
279
|
+
export { ACTION, BROKER, type DxtradeCallbacks, DxtradeClient, type DxtradeConfig, DxtradeError, ORDER_TYPE, SIDE, TIF, WS_MESSAGE, type WsPayload, endpoints };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
declare const BROKER: {
|
|
2
2
|
readonly LARKFUNDING: "https://trade.gooeytrade.com";
|
|
3
3
|
readonly EIGHTCAP: "https://trader.dx-eightcap.com";
|
|
4
|
+
readonly FTMO: "https://dxtrade.ftmo.com";
|
|
4
5
|
};
|
|
5
|
-
declare function resolveBrokerUrl(broker: string, customUrls?: Record<string, string>): string;
|
|
6
6
|
|
|
7
7
|
declare const endpoints: {
|
|
8
8
|
login: (base: string) => string;
|
|
@@ -33,8 +33,11 @@ declare enum TIF {
|
|
|
33
33
|
GTD = "GTD"
|
|
34
34
|
}
|
|
35
35
|
declare enum WS_MESSAGE {
|
|
36
|
+
ACCOUNT_METRICS = "ACCOUNT_METRICS",
|
|
36
37
|
ACCOUNTS = "ACCOUNTS",
|
|
37
38
|
AVAILABLE_WATCHLISTS = "AVAILABLE_WATCHLISTS",
|
|
39
|
+
INSTRUMENTS = "INSTRUMENTS",
|
|
40
|
+
LIMITS = "LIMITS",
|
|
38
41
|
MESSAGE = "MESSAGE",
|
|
39
42
|
ORDERS = "ORDERS",
|
|
40
43
|
POSITIONS = "POSITIONS",
|
|
@@ -141,7 +144,7 @@ declare namespace Order {
|
|
|
141
144
|
interface DxtradeConfig {
|
|
142
145
|
username: string;
|
|
143
146
|
password: string;
|
|
144
|
-
broker:
|
|
147
|
+
broker: keyof typeof BROKER;
|
|
145
148
|
accountId?: string;
|
|
146
149
|
brokerUrls?: Record<string, string>;
|
|
147
150
|
retries?: number;
|
|
@@ -162,17 +165,18 @@ interface WsPayload {
|
|
|
162
165
|
type: string;
|
|
163
166
|
}
|
|
164
167
|
|
|
165
|
-
declare namespace
|
|
166
|
-
interface
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
168
|
+
declare namespace Account {
|
|
169
|
+
interface Metrics {
|
|
170
|
+
availableFunds: number;
|
|
171
|
+
marginCallLevel: number | string;
|
|
172
|
+
riskLevel: number;
|
|
173
|
+
openPl: number;
|
|
174
|
+
cashBalance: number;
|
|
175
|
+
equity: number;
|
|
176
|
+
conversionRate: number;
|
|
177
|
+
initialMargin: number;
|
|
178
|
+
availableBalance: number;
|
|
179
|
+
reverseRiskLevel: number | string;
|
|
176
180
|
[key: string]: unknown;
|
|
177
181
|
}
|
|
178
182
|
}
|
|
@@ -190,6 +194,72 @@ declare namespace Assessments {
|
|
|
190
194
|
}
|
|
191
195
|
}
|
|
192
196
|
|
|
197
|
+
declare namespace Instrument {
|
|
198
|
+
interface Info {
|
|
199
|
+
id: number;
|
|
200
|
+
symbol: string;
|
|
201
|
+
description: string;
|
|
202
|
+
type: string;
|
|
203
|
+
subtype: string;
|
|
204
|
+
currency: string;
|
|
205
|
+
currencyPrecision: number;
|
|
206
|
+
precision: number;
|
|
207
|
+
pipsSize: number;
|
|
208
|
+
quantityIncrement: number;
|
|
209
|
+
quantityPrecision: number;
|
|
210
|
+
priceIncrement: number;
|
|
211
|
+
version: number;
|
|
212
|
+
priceIncrementsTO: {
|
|
213
|
+
priceIncrements: number[];
|
|
214
|
+
pricePrecisions: number[];
|
|
215
|
+
bondFraction: boolean;
|
|
216
|
+
};
|
|
217
|
+
lotSize: number;
|
|
218
|
+
baseCurrency: string | null;
|
|
219
|
+
lotName: string | null;
|
|
220
|
+
multiplier: number;
|
|
221
|
+
open: boolean;
|
|
222
|
+
expiration: string | null;
|
|
223
|
+
firstNoticeDate: string | null;
|
|
224
|
+
lastTradeDate: string | null;
|
|
225
|
+
underlying: string | null;
|
|
226
|
+
mmy: string | null;
|
|
227
|
+
optionParametersTO: unknown;
|
|
228
|
+
unitName: string | null;
|
|
229
|
+
additionalFields: unknown;
|
|
230
|
+
additionalObject: unknown;
|
|
231
|
+
currencyParametersTO: unknown;
|
|
232
|
+
tradingHours: string;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
declare namespace Symbol {
|
|
237
|
+
interface Suggestion {
|
|
238
|
+
id: number;
|
|
239
|
+
name: string;
|
|
240
|
+
[key: string]: unknown;
|
|
241
|
+
}
|
|
242
|
+
interface Info {
|
|
243
|
+
maxVolume: number;
|
|
244
|
+
minVolume: number;
|
|
245
|
+
volumeStep: number;
|
|
246
|
+
lotSize: number;
|
|
247
|
+
[key: string]: unknown;
|
|
248
|
+
}
|
|
249
|
+
interface Limits {
|
|
250
|
+
symbol: string;
|
|
251
|
+
instrumentId: number;
|
|
252
|
+
limitStopDistanceType: string;
|
|
253
|
+
limitStopDistance: number;
|
|
254
|
+
limitStopDistanceInPercentOfSpread: number;
|
|
255
|
+
minOrderSize: number;
|
|
256
|
+
minOrderSizeBypass: boolean;
|
|
257
|
+
maxOrderSize: number;
|
|
258
|
+
minOrderIncrement: number;
|
|
259
|
+
limitType: string;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
193
263
|
declare class DxtradeClient {
|
|
194
264
|
private _ctx;
|
|
195
265
|
constructor(config: DxtradeConfig);
|
|
@@ -199,8 +269,11 @@ declare class DxtradeClient {
|
|
|
199
269
|
connect(): Promise<void>;
|
|
200
270
|
getSymbolSuggestions(text: string): Promise<Symbol.Suggestion[]>;
|
|
201
271
|
getSymbolInfo(symbol: string): Promise<Symbol.Info>;
|
|
272
|
+
getSymbolLimits(): Promise<Symbol.Limits[]>;
|
|
202
273
|
submitOrder(params: Order.SubmitParams): Promise<Order.Update>;
|
|
274
|
+
getAccountMetrics(): Promise<Account.Metrics>;
|
|
275
|
+
getInstruments(params?: Partial<Instrument.Info>): Promise<Instrument.Info[]>;
|
|
203
276
|
getAssessments(params: Assessments.Params): Promise<Assessments.Response>;
|
|
204
277
|
}
|
|
205
278
|
|
|
206
|
-
export { ACTION, BROKER, type DxtradeCallbacks, DxtradeClient, type DxtradeConfig, DxtradeError, ORDER_TYPE, SIDE, TIF, WS_MESSAGE, type WsPayload, endpoints
|
|
279
|
+
export { ACTION, BROKER, type DxtradeCallbacks, DxtradeClient, type DxtradeConfig, DxtradeError, ORDER_TYPE, SIDE, TIF, WS_MESSAGE, type WsPayload, endpoints };
|