atlaas 0.3.0 → 0.4.0
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 +473 -429
- package/dist/index.d.ts +108 -28
- package/dist/index.js +66 -19
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1197,12 +1197,12 @@ interface SubscribedMessage {
|
|
|
1197
1197
|
feed: MarketFeedState;
|
|
1198
1198
|
ts: number;
|
|
1199
1199
|
}
|
|
1200
|
-
/** `subscribe_failed` WS reply: the account is inactive
|
|
1201
|
-
*
|
|
1200
|
+
/** `subscribe_failed` WS reply: the account is inactive or suspended (or
|
|
1201
|
+
* could not be checked), so the subscribe changed nothing. What
|
|
1202
1202
|
* the socket already subscribed to keeps streaming. */
|
|
1203
1203
|
interface SubscribeFailedMessage {
|
|
1204
1204
|
type: "subscribe_failed";
|
|
1205
|
-
/** E.g. `Account is inactive`, `Account is suspended
|
|
1205
|
+
/** E.g. `Account is inactive`, `Account is suspended`. */
|
|
1206
1206
|
reason: string;
|
|
1207
1207
|
ts: number;
|
|
1208
1208
|
}
|
|
@@ -2175,20 +2175,32 @@ interface BacktestEstimateQuery {
|
|
|
2175
2175
|
/** Runs in a batch, noise test or matrix (1..12), default 1. */
|
|
2176
2176
|
runs?: number;
|
|
2177
2177
|
}
|
|
2178
|
+
/** An amount of money in the account's usage-balance currency. */
|
|
2179
|
+
interface Money {
|
|
2180
|
+
amount: number;
|
|
2181
|
+
currency: "USD" | "INR";
|
|
2182
|
+
}
|
|
2178
2183
|
interface BacktestEstimate {
|
|
2179
2184
|
estimatedSeconds: number;
|
|
2180
2185
|
queueWaitSeconds: number;
|
|
2181
2186
|
estimatedFinishAt: string;
|
|
2182
|
-
|
|
2187
|
+
/** What one run (a whole walk-forward with `folds`) costs from the usage balance. */
|
|
2188
|
+
costPerRun: Money;
|
|
2183
2189
|
runs: number;
|
|
2184
|
-
|
|
2190
|
+
/** `costPerRun` x `runs`: what the usage balance must cover. */
|
|
2191
|
+
cost: Money;
|
|
2185
2192
|
/** With `folds`. */
|
|
2186
2193
|
walkForward?: {
|
|
2187
2194
|
optimizationSeconds: number;
|
|
2188
2195
|
oosSeconds: number;
|
|
2189
2196
|
holdoutSeconds: number;
|
|
2190
2197
|
totalSeconds: number;
|
|
2191
|
-
|
|
2198
|
+
estimatedCost: Money;
|
|
2199
|
+
};
|
|
2200
|
+
/** A native estimate: what one run replays (M1 bars, or ticks for REAL_TICKS). */
|
|
2201
|
+
replay?: {
|
|
2202
|
+
kind: "m1" | "ticks";
|
|
2203
|
+
count: number;
|
|
2192
2204
|
};
|
|
2193
2205
|
}
|
|
2194
2206
|
interface PortfolioBody {
|
|
@@ -2692,7 +2704,7 @@ declare class HttpTransport {
|
|
|
2692
2704
|
* MT5 strategy tester runs (`/api/external/backtests`). A backtest is a group
|
|
2693
2705
|
* of one or more runs: a single test, an optimization, or a walk-forward.
|
|
2694
2706
|
*
|
|
2695
|
-
* Creating one queues real work
|
|
2707
|
+
* Creating one queues real work charged to the usage balance, and the server does not
|
|
2696
2708
|
* de-duplicate these writes, so the SDK never sends one twice: after a
|
|
2697
2709
|
* timeout, `list()` before you create again.
|
|
2698
2710
|
*/
|
|
@@ -2704,9 +2716,9 @@ declare class BacktestsResource {
|
|
|
2704
2716
|
/** Your backtests, newest first. Page with `nextCursor`. */
|
|
2705
2717
|
list(query?: ListBacktestsQuery): Promise<ListBacktestsResult>;
|
|
2706
2718
|
/** Queue a backtest: a single run, an optimization (`optimization`) or a
|
|
2707
|
-
* walk-forward (`optimization` + `walkForward`). 402 when
|
|
2719
|
+
* walk-forward (`optimization` + `walkForward`). 402 when the usage balance is short. */
|
|
2708
2720
|
create(body: CreateBacktestBody): Promise<CreateBacktestResult>;
|
|
2709
|
-
/** Time and
|
|
2721
|
+
/** Time and cost (from the usage balance, in its currency) a backtest would take. Queues nothing. */
|
|
2710
2722
|
estimate(query: BacktestEstimateQuery): Promise<BacktestEstimate>;
|
|
2711
2723
|
/** A group with its runs and their tester logs. */
|
|
2712
2724
|
get(groupId: string): Promise<BacktestGroup>;
|
|
@@ -2781,34 +2793,63 @@ declare class BrokerSubscriptionsResource {
|
|
|
2781
2793
|
/** @internal */ readonly http: HttpTransport;
|
|
2782
2794
|
/** @internal */ readonly basePath: string;
|
|
2783
2795
|
constructor(http: HttpTransport, basePath: string);
|
|
2796
|
+
/** @deprecated Subscribe NSE, BSE and MCX keys on the `market.ticks` WebSocket channel instead (it needs India access). */
|
|
2784
2797
|
subscribe(body: BrokerSubscribeBody): Promise<unknown>;
|
|
2798
|
+
/** @deprecated Unsubscribe from the `market.ticks` WebSocket channel instead. */
|
|
2785
2799
|
unsubscribe(body: BrokerUnsubscribeBody): Promise<unknown>;
|
|
2800
|
+
/** @deprecated The `subscribed` reply on the `market.ticks` WebSocket channel lists what streams. */
|
|
2786
2801
|
list(): Promise<unknown>;
|
|
2787
2802
|
}
|
|
2788
|
-
/**
|
|
2803
|
+
/**
|
|
2804
|
+
* One broker connection's own API, in the broker's own field names
|
|
2805
|
+
* (`/api/external/brokers/:broker/connections/:id`). Every method is
|
|
2806
|
+
* deprecated in favour of `atlas.v2.connections(id)` and `atlas.v2.market`,
|
|
2807
|
+
* which speak one shape for every broker; the routes keep working.
|
|
2808
|
+
* @internal
|
|
2809
|
+
*/
|
|
2789
2810
|
declare class BrokerConnectionResource {
|
|
2790
2811
|
readonly subscriptions: BrokerSubscriptionsResource;
|
|
2791
2812
|
/** @internal */ readonly basePath: string;
|
|
2792
2813
|
/** @internal */ readonly http: HttpTransport;
|
|
2793
2814
|
constructor(http: HttpTransport, brokerName: string, connectionId: string);
|
|
2794
|
-
/**
|
|
2795
|
-
*
|
|
2815
|
+
/**
|
|
2816
|
+
* Place an order in the broker's own fields. Runs at most once per
|
|
2817
|
+
* Idempotency-Key, so a retry never places twice.
|
|
2818
|
+
* @deprecated Use `atlas.v2.connections(id).placeOrder()` (`POST /api/v2/connections/{id}/orders`).
|
|
2819
|
+
*/
|
|
2796
2820
|
placeOrder(order: BrokerOrder | BrokerOrderBody, options?: WriteOptions): Promise<unknown>;
|
|
2821
|
+
/** @deprecated Use `atlas.v2.connections(id).orders()` (`GET /api/v2/connections/{id}/orders`). */
|
|
2797
2822
|
getOrders(): Promise<unknown>;
|
|
2823
|
+
/** @deprecated Use `atlas.v2.connections(id).order(orderId)` (`GET /api/v2/connections/{id}/orders/{orderId}`). */
|
|
2798
2824
|
getOrder(orderId: string): Promise<unknown>;
|
|
2799
|
-
/**
|
|
2825
|
+
/**
|
|
2826
|
+
* Change a working order, in the broker's own fields.
|
|
2827
|
+
* @deprecated Use `atlas.v2.connections(id).modifyOrder()` (`PUT /api/v2/connections/{id}/orders/{orderId}`).
|
|
2828
|
+
*/
|
|
2800
2829
|
modifyOrder(orderId: string, changes: BrokerOrder | BrokerModifyOrderBody, options?: WriteOptions): Promise<unknown>;
|
|
2830
|
+
/** @deprecated Use `atlas.v2.connections(id).cancelOrder(orderId)` (`DELETE /api/v2/connections/{id}/orders/{orderId}`). */
|
|
2801
2831
|
cancelOrder(orderId: string, body?: BrokerCancelOrderBody, options?: WriteOptions): Promise<unknown>;
|
|
2802
|
-
/**
|
|
2803
|
-
*
|
|
2832
|
+
/**
|
|
2833
|
+
* Trade book (fills). Currently served by Motilal Oswal; brokers whose
|
|
2834
|
+
* runner adapter doesn't implement it return an "unsupported command" error.
|
|
2835
|
+
* @deprecated Use `atlas.v2.connections(id).trades()` (`GET /api/v2/connections/{id}/trades`).
|
|
2836
|
+
*/
|
|
2804
2837
|
getTrades(): Promise<unknown>;
|
|
2838
|
+
/** @deprecated Use `atlas.v2.connections(id).positions()` (`GET /api/v2/connections/{id}/positions`). */
|
|
2805
2839
|
getPositions(): Promise<unknown>;
|
|
2840
|
+
/** @deprecated Use `atlas.v2.connections(id).holdings()` (`GET /api/v2/connections/{id}/holdings`). */
|
|
2806
2841
|
getHoldings(): Promise<unknown>;
|
|
2842
|
+
/** @deprecated Use `atlas.v2.market.candles()` (`GET /api/v2/market/candles`), served from the Atlaas market data feed. */
|
|
2807
2843
|
getCandles(query: BrokerCandlesQuery): Promise<unknown>;
|
|
2808
|
-
/**
|
|
2844
|
+
/**
|
|
2845
|
+
* Option expiries for an underlying, through this Dhan connection.
|
|
2846
|
+
* @deprecated Use `atlas.v2.market.expiries(underlyingKey)` (`GET /api/v2/market/expiries`).
|
|
2847
|
+
*/
|
|
2809
2848
|
getOptionExpiries(underlying: DhanUnderlying): Promise<string[]>;
|
|
2810
|
-
/**
|
|
2811
|
-
*
|
|
2849
|
+
/**
|
|
2850
|
+
* Dhan's option chain for one expiry (YYYY-MM-DD), through this Dhan connection.
|
|
2851
|
+
* @deprecated Use `atlas.v2.market.optionChain(underlyingKey, expiry)` (`GET /api/v2/market/option-chain`), which serves the same data without a connection.
|
|
2852
|
+
*/
|
|
2812
2853
|
getOptionChain(underlying: DhanUnderlying, expiry: string): Promise<DhanOptionChain>;
|
|
2813
2854
|
}
|
|
2814
2855
|
|
|
@@ -2869,8 +2910,14 @@ declare class ConnectionsV2 {
|
|
|
2869
2910
|
capabilities(): Promise<CapabilitiesResult>;
|
|
2870
2911
|
/** Every read in one call; each section reports ok or error on its own. Positions are `NET`. */
|
|
2871
2912
|
snapshot(params?: IncludeRawParams): Promise<V2Snapshot>;
|
|
2913
|
+
placeOrder(body: PlaceOrderV2Body, options?: V2WriteOptions): Promise<PlaceOrderResult>;
|
|
2914
|
+
modifyOrder(orderId: string, body: ModifyOrderV2Body, options?: V2WriteOptions): Promise<ModifyOrderResult>;
|
|
2915
|
+
cancelOrder(orderId: string, options?: V2WriteOptions): Promise<CancelOrderResult>;
|
|
2916
|
+
/** @deprecated Renamed to {@link ConnectionsV2.placeOrder}, which takes the same arguments. */
|
|
2872
2917
|
place(body: PlaceOrderV2Body, options?: V2WriteOptions): Promise<PlaceOrderResult>;
|
|
2918
|
+
/** @deprecated Renamed to {@link ConnectionsV2.modifyOrder}, which takes the same arguments. */
|
|
2873
2919
|
modify(orderId: string, body: ModifyOrderV2Body, options?: V2WriteOptions): Promise<ModifyOrderResult>;
|
|
2920
|
+
/** @deprecated Renamed to {@link ConnectionsV2.cancelOrder}, which takes the same arguments. */
|
|
2874
2921
|
cancel(orderId: string, options?: V2WriteOptions): Promise<CancelOrderResult>;
|
|
2875
2922
|
closePosition(body: ClosePositionV2Body, options?: V2WriteOptions): Promise<ClosePositionResult>;
|
|
2876
2923
|
/** SL / TP on a live position (MT5). An omitted side keeps its level; 0 clears it. */
|
|
@@ -3063,8 +3110,9 @@ declare class MarketV2 {
|
|
|
3063
3110
|
|
|
3064
3111
|
/**
|
|
3065
3112
|
* MT5 terminals by login (`/api/external/instances`): deploy, start, stop and
|
|
3066
|
-
* remove them. Trade on one with `atlas.
|
|
3067
|
-
* de-duplicated by the server, so the SDK never sends one
|
|
3113
|
+
* remove them. Trade on one with `atlas.v2.connections(instance.id)`. None
|
|
3114
|
+
* of these writes is de-duplicated by the server, so the SDK never sends one
|
|
3115
|
+
* twice.
|
|
3068
3116
|
*/
|
|
3069
3117
|
declare class Mt5Resource {
|
|
3070
3118
|
private readonly http;
|
|
@@ -3075,7 +3123,7 @@ declare class Mt5Resource {
|
|
|
3075
3123
|
/** Deploy a terminal. It starts as PENDING and the account is charged the provisioning fee. */
|
|
3076
3124
|
create(body: CreateInstanceBody): Promise<Instance>;
|
|
3077
3125
|
get(accountId: string): Promise<Instance>;
|
|
3078
|
-
/** Remove the terminal.
|
|
3126
|
+
/** Remove the terminal. Nothing is refunded. */
|
|
3079
3127
|
delete(accountId: string): Promise<void>;
|
|
3080
3128
|
/** Enable the terminal and queue it to deploy again. */
|
|
3081
3129
|
start(accountId: string): Promise<Instance>;
|
|
@@ -3132,6 +3180,12 @@ declare class SubscriptionsResource {
|
|
|
3132
3180
|
/**
|
|
3133
3181
|
* MT5 trading on one terminal, named by its MT5 login: `/api/external/instances/:accountId`.
|
|
3134
3182
|
*
|
|
3183
|
+
* Most of it is deprecated in favour of `atlas.v2.connections(id)` and
|
|
3184
|
+
* `atlas.v2.market`, which work the same on MT5 and every broker; each
|
|
3185
|
+
* deprecated method names its replacement. The routes keep working, and
|
|
3186
|
+
* `getPosition`, `getClosedPositions` and `calculateMargin` have no v2
|
|
3187
|
+
* equivalent yet.
|
|
3188
|
+
*
|
|
3135
3189
|
* The reads that come from the terminal can return their freshness too: pass
|
|
3136
3190
|
* `{ withFreshness: true }` to get `{ data, dataAsOf, lastHeartbeatAt }`. A
|
|
3137
3191
|
* terminal Atlaas cannot see answers 503 with `code: "TERMINAL_UNAVAILABLE"`
|
|
@@ -3144,30 +3198,52 @@ declare class TradingResource {
|
|
|
3144
3198
|
private read;
|
|
3145
3199
|
/** An order write: it runs at most once per Idempotency-Key. */
|
|
3146
3200
|
private write;
|
|
3201
|
+
/** @deprecated Use `atlas.v2.connections(id).placeOrder()` (`POST /api/v2/connections/{id}/orders`). */
|
|
3147
3202
|
placeOrder(accountId: string, body: PlaceOrderBody, options?: WriteOptions): Promise<Order>;
|
|
3203
|
+
/** @deprecated Use `atlas.v2.connections(id).orders()` (`GET /api/v2/connections/{id}/orders`). */
|
|
3148
3204
|
getOrders(accountId: string): Promise<Order[]>;
|
|
3205
|
+
/** @deprecated Use `atlas.v2.connections(id).orders()` (`GET /api/v2/connections/{id}/orders`). */
|
|
3149
3206
|
getOrders(accountId: string, options: FreshnessOption): Promise<Fresh<Order[]>>;
|
|
3207
|
+
/** @deprecated Use `atlas.v2.connections(id).cancelOrder(ticket)` (`DELETE /api/v2/connections/{id}/orders/{ticket}`). */
|
|
3150
3208
|
cancelOrder(accountId: string, ticket: number, options?: WriteOptions): Promise<void>;
|
|
3151
|
-
/**
|
|
3209
|
+
/**
|
|
3210
|
+
* Open positions, as the EA last pushed them (held for a few seconds).
|
|
3211
|
+
* @deprecated Use `atlas.v2.connections(id).positions()` (`GET /api/v2/connections/{id}/positions`).
|
|
3212
|
+
*/
|
|
3152
3213
|
getPositions(accountId: string): Promise<Position[]>;
|
|
3214
|
+
/** @deprecated Use `atlas.v2.connections(id).positions()` (`GET /api/v2/connections/{id}/positions`). */
|
|
3153
3215
|
getPositions(accountId: string, options: FreshnessOption): Promise<Fresh<Position[]>>;
|
|
3154
3216
|
/** One position by ticket. A ticket no longer open is read from the terminal's history as `status: "CLOSED"`. */
|
|
3155
3217
|
getPosition(accountId: string, ticket: number): Promise<PositionDetail>;
|
|
3156
3218
|
getPosition(accountId: string, ticket: number, options: FreshnessOption): Promise<Fresh<PositionDetail>>;
|
|
3157
3219
|
/** Fully closed positions from the terminal's deal history, oldest first. Page with `since` = the last `closeTimeMs`. */
|
|
3158
3220
|
getClosedPositions(accountId: string, query: ClosedPositionsQuery): Promise<ClosedPositionsResult>;
|
|
3221
|
+
/** @deprecated Use `atlas.v2.connections(id).modifyPosition(ticket, { stopLoss, takeProfit })` (`PUT /api/v2/connections/{id}/positions/{ticket}`). */
|
|
3159
3222
|
modifyPosition(accountId: string, ticket: number, body: ModifyPositionBody, options?: WriteOptions): Promise<ModifyMt5PositionResult>;
|
|
3223
|
+
/** @deprecated Use `atlas.v2.connections(id).closePosition({ instrumentKey, positionId: ticket })` (`POST /api/v2/connections/{id}/positions/close`). */
|
|
3160
3224
|
closePosition(accountId: string, ticket: number, body?: ClosePositionBody, options?: WriteOptions): Promise<CloseMt5PositionResult>;
|
|
3225
|
+
/** @deprecated Use `atlas.v2.connections(id).closePosition({ instrumentKey })` (`POST /api/v2/connections/{id}/positions/close`). */
|
|
3161
3226
|
closeBySymbol(accountId: string, body: CloseBySymbolBody, options?: WriteOptions): Promise<CloseBySymbolResult>;
|
|
3227
|
+
/** @deprecated Use `atlas.v2.market.quote("FX:<SYMBOL>")` (`GET /api/v2/market/quote`). */
|
|
3162
3228
|
getPrice(accountId: string, symbol: string): Promise<Price>;
|
|
3229
|
+
/** @deprecated Use `atlas.v2.market.quote("FX:<SYMBOL>")` (`GET /api/v2/market/quote`). */
|
|
3163
3230
|
getPrice(accountId: string, symbol: string, options: FreshnessOption): Promise<Fresh<Price>>;
|
|
3231
|
+
/** @deprecated Use `atlas.v2.connections(id).symbols()` (`GET /api/v2/connections/{id}/symbols`). */
|
|
3164
3232
|
getSymbols(accountId: string): Promise<string[]>;
|
|
3233
|
+
/** @deprecated Use `atlas.v2.connections(id).symbols()` (`GET /api/v2/connections/{id}/symbols`). */
|
|
3165
3234
|
getSymbols(accountId: string, options: FreshnessOption): Promise<Fresh<string[]>>;
|
|
3166
|
-
/**
|
|
3235
|
+
/**
|
|
3236
|
+
* Contract specs for every symbol on the terminal's server, raw from the terminal.
|
|
3237
|
+
* @deprecated Use `atlas.v2.connections(id).symbols()` (`GET /api/v2/connections/{id}/symbols`), which carries each symbol's contract spec.
|
|
3238
|
+
*/
|
|
3167
3239
|
getSymbolSpecs(accountId: string): Promise<Mt5SymbolSpec[]>;
|
|
3240
|
+
/** @deprecated Use `atlas.v2.connections(id).symbols()` (`GET /api/v2/connections/{id}/symbols`), which carries each symbol's contract spec. */
|
|
3168
3241
|
getSymbolSpecs(accountId: string, options: FreshnessOption): Promise<Fresh<Mt5SymbolSpec[]>>;
|
|
3242
|
+
/** @deprecated Use `atlas.v2.connections(id).funds()` (`GET /api/v2/connections/{id}/funds`). */
|
|
3169
3243
|
getAccountInfo(accountId: string): Promise<AccountInfo>;
|
|
3244
|
+
/** @deprecated Use `atlas.v2.connections(id).funds()` (`GET /api/v2/connections/{id}/funds`). */
|
|
3170
3245
|
getAccountInfo(accountId: string, options: FreshnessOption): Promise<Fresh<AccountInfo>>;
|
|
3246
|
+
/** @deprecated Use `atlas.v2.market.candles({ instrumentKey, interval, from, to, connectionId })` (`GET /api/v2/market/candles`). */
|
|
3171
3247
|
getCandles(accountId: string, query: GetCandlesQuery): Promise<Candle[]>;
|
|
3172
3248
|
/** A calculation, not a write: it changes nothing on the terminal. */
|
|
3173
3249
|
calculateMargin(accountId: string, body: CalculateMarginBody): Promise<MarginResult>;
|
|
@@ -3181,16 +3257,17 @@ interface AtlasClientOptions {
|
|
|
3181
3257
|
logger?: AtlasLogger;
|
|
3182
3258
|
}
|
|
3183
3259
|
declare class AtlasClient {
|
|
3184
|
-
/**
|
|
3260
|
+
/** MT5 platform (v1): instances and broker connections on `/api/atlas/instances`. */
|
|
3185
3261
|
readonly instances: InstancesResource;
|
|
3186
|
-
/** MT5 terminals by login
|
|
3262
|
+
/** MT5 platform (v1): terminals by login, deploy, start, stop, remove. */
|
|
3187
3263
|
readonly mt5: Mt5Resource;
|
|
3188
3264
|
readonly eas: EasResource;
|
|
3189
3265
|
readonly backtests: BacktestsResource;
|
|
3190
|
-
/** MT5 trading on one terminal, by login. */
|
|
3266
|
+
/** MT5 trading on one terminal, by login. Mostly deprecated: use `v2.connections(id)` and `v2.market`, which work on every market. */
|
|
3191
3267
|
readonly trading: TradingResource;
|
|
3192
3268
|
readonly subscriptions: SubscriptionsResource;
|
|
3193
3269
|
readonly serviceKeys: ServiceKeysResource;
|
|
3270
|
+
/** The market-neutral API (`/api/v2`): trading on every connection, instruments, market data and the scanner. */
|
|
3194
3271
|
readonly v2: {
|
|
3195
3272
|
instruments: InstrumentsV2;
|
|
3196
3273
|
market: MarketV2;
|
|
@@ -3200,7 +3277,10 @@ declare class AtlasClient {
|
|
|
3200
3277
|
private readonly http;
|
|
3201
3278
|
private readonly brokersResource;
|
|
3202
3279
|
constructor(options: AtlasClientOptions);
|
|
3203
|
-
/**
|
|
3280
|
+
/**
|
|
3281
|
+
* A broker connection's own API, by broker name and the connection's `externalRef`.
|
|
3282
|
+
* @deprecated Use `v2.connections(connectionId)`, which takes the same `externalRef` and speaks one shape for every broker.
|
|
3283
|
+
*/
|
|
3204
3284
|
broker(brokerName: string, connectionId: string): BrokerConnectionResource;
|
|
3205
3285
|
}
|
|
3206
3286
|
|
|
@@ -3268,4 +3348,4 @@ declare class AtlasWebSocket extends EventEmitter {
|
|
|
3268
3348
|
emit<K extends keyof WSEventMap>(event: K, ...args: WSEventMap[K]): boolean;
|
|
3269
3349
|
}
|
|
3270
3350
|
|
|
3271
|
-
export { type AccountInfo, type ApiEnvelope, AtlasAuthError, AtlasClient, type AtlasClientOptions, AtlasError, type AtlasErrorCode, type AtlasErrorDetails, type AtlasInstance, type AtlasLogger, AtlasNetworkError, AtlasRateLimitError, AtlasValidationError, AtlasWebSocket, type AtlasWebSocketOptions, type BacktestAiSummary, type BacktestAnalytics, type BacktestBatchKind, type BacktestBatchReport, type BacktestEstimate, type BacktestEstimateQuery, type BacktestExecutor, type BacktestExitReason, type BacktestGroup, type BacktestGroupKind, type BacktestPassesQuery, type BacktestPassesResult, type BacktestPeerContext, type BacktestRedFlag, type BacktestResultUrls, type BacktestRun, type BacktestRunMode, type BacktestRunStats, type BacktestSourceDiff, type BacktestStats, type BacktestStatus, type BacktestTickMode, type BacktestTrade, type BacktestTradeAggregate, type BacktestTradeAggregateRow, type BacktestTradeSort, type BacktestTradesQuery, type BacktestTradesResult, type BacktestWindow, BacktestsResource, type BrokerCancelOrderBody, type BrokerCandlesQuery, type BrokerCapabilities, BrokerConnectionResource, type BrokerInstrumentRef, type BrokerModifyOrderBody, type BrokerOrder, type BrokerOrderBody, type BrokerOrderUpdate, type BrokerSubscribeBody, BrokerSubscriptionsResource, type BrokerTick, type BrokerUnsubscribeBody, type CalculateMarginBody, type CancelBacktestRunResult, type CancelOrderResult, type Candle, type CandleSubscription, type CandleSubscriptions, type CapabilitiesResult, type ChainSelector, type CloseBySymbolBody, type CloseBySymbolResult, type CloseMt5PositionResult, type ClosePositionBody, type ClosePositionResult, type ClosePositionV2Body, type ClosedPosition, type ClosedPositionDetail, type ClosedPositionsQuery, type ClosedPositionsResult, ConnectionsV2, type CreateAtlasInstanceBody, type CreateAtlasInstanceResult, type CreateBacktestBatchBody, type CreateBacktestBatchResult, type CreateBacktestBody, type CreateBacktestResult, type CreateDeploymentBody, type CreateEaBody, type CreateEaPresetBody, type CreateInstanceBody, type CreateNoiseTestBody, type CreateNoiseTestResult, type CreateServiceKeyBody, type CreateWalkForwardMatrixBody, type CreateWalkForwardMatrixResult, type DeployRegion, type DeployServer, type Deployment, type DeploymentState, type DhanOptionChain, type DhanOptionLeg, type DhanSegment, type DhanUnderlying, type DroppedMt5Row, type DroppedRow, type Ea, type EaCompileFailure, type EaCompileStatus, type EaInputManifest, type EaInputParam, type EaInputType, type EaPreset, type EaSourceType, type EaTimeframe, type EaVersion, type EaVersionSource, type EaVersionStatus, EasResource, type ExpirationType, type FillingMode, type Fresh, type FreshnessOption, type GetCandlesQuery, type HoldingsListResult, type IncludeRawParams, type Instance, type InstanceState, type InstanceType, InstancesResource, type InstrumentListParams, type InstrumentListResult, InstrumentsV2, type ListBacktestsQuery, type ListBacktestsResult, type ListDeploymentsQuery, type ListDeploymentsResult, type ListEaVersionsQuery, type ListEaVersionsResult, type ListInstancesQuery, type LiveComparison, type LiveComparisonMatch, type LiveComparisonSummary, type MT5Candle, type MT5Heartbeat, type MT5LivePosition, type MT5PositionUpdate, type MT5Tick, type MT5TradeEvent, type MarginOrderType, type MarginResult, type MarketCandleMessage, type MarketCandlesParams, type MarketCandlesResult, type MarketChainMessage, type MarketFeedState, type MarketQuotesResult, type MarketScannerMessage, type MarketTickMessage, MarketV2, type ModifyMt5PositionResult, type ModifyOrderResult, type ModifyOrderV2Body, type ModifyPositionBody, type ModifyPositionResult, type ModifyPositionV2Body, type MonitorStatus, type MonitorVerdict, Mt5Resource, type Mt5SymbolSpec, type NoiseTestConfig, type OpenPositionDetail, type OptimizationAlgorithm, type OptimizationConfig, type OptimizationConfigInput, type OptimizationCriterion, type OptimizationPass, type OptimizationRange, type Order, type OrderDirection, type OrderType, type OrdersListParams, type OrdersListResult, type PlaceOrderBody, type PlaceOrderResult, type PlaceOrderV2Body, type PortfolioBody, type PortfolioReport, type Position, type PositionDetail, type PositionsListParams, type PositionsListResult, type PresignEaVersionBody, type PresignEaVersionResult, type Price, type RefusedInstrumentKeyReason, type RegisterEaVersionBody, type RegisteredEaVersion, type ResolveInstrumentParams, type RetiredWSChannel, type RevealOosResult, type RunLiveComparisonBody, type SaveEaSourceBody, type ScannerBoard, type ScannerBoardParams, type ScannerRow, type ScannerSession, type ScannerSessionState, ScannerV2, type ScannerZones, type ServiceKey, type ServiceKeyWithRaw, ServiceKeysResource, type SetMonitorBody, type SpreadCalibration, type SubscribeCandleBody, type SubscribeFailedMessage, type SubscribeTickBody, type SubscribedMessage, SubscriptionsResource, type SwapArbRow, type SwapArbitrageReport, type SymbolSpecsResult, type TickSubscriptions, type Timeframe, type TradesListResult, type TradingOrderMessage, TradingResource, type UnifiedCandle, type UnifiedError, type UnifiedErrorCode, type UnifiedFunds, type UnifiedHolding, type UnifiedInstrument, type UnifiedInterval, type UnifiedOptionChain, type UnifiedOptionExpiries, type UnifiedOptionLeg, type UnifiedOrder, type UnifiedPosition, type UnifiedProfile, type UnifiedSymbolSpec, type UnifiedTick, type UnifiedTrade, type UnsubscribeCandleBody, type UnsubscribeTickBody, type UnsubscribedMessage, type UpdateAtlasInstanceBody, type UpdateDeploymentBody, type UpdateEaBody, type UpdateServiceKeyBody, type V2Snapshot, type V2WriteOptions, type ValidateBrokerCredentialsBody, type ValidateBrokerCredentialsResult, type WSChannel, type WSEventMap, type WSSubscribeOptions, type WSUnsubscribeOptions, type WalkForwardConfig, type WalkForwardReport, type WriteOptions };
|
|
3351
|
+
export { type AccountInfo, type ApiEnvelope, AtlasAuthError, AtlasClient, type AtlasClientOptions, AtlasError, type AtlasErrorCode, type AtlasErrorDetails, type AtlasInstance, type AtlasLogger, AtlasNetworkError, AtlasRateLimitError, AtlasValidationError, AtlasWebSocket, type AtlasWebSocketOptions, type BacktestAiSummary, type BacktestAnalytics, type BacktestBatchKind, type BacktestBatchReport, type BacktestEstimate, type BacktestEstimateQuery, type BacktestExecutor, type BacktestExitReason, type BacktestGroup, type BacktestGroupKind, type BacktestPassesQuery, type BacktestPassesResult, type BacktestPeerContext, type BacktestRedFlag, type BacktestResultUrls, type BacktestRun, type BacktestRunMode, type BacktestRunStats, type BacktestSourceDiff, type BacktestStats, type BacktestStatus, type BacktestTickMode, type BacktestTrade, type BacktestTradeAggregate, type BacktestTradeAggregateRow, type BacktestTradeSort, type BacktestTradesQuery, type BacktestTradesResult, type BacktestWindow, BacktestsResource, type BrokerCancelOrderBody, type BrokerCandlesQuery, type BrokerCapabilities, BrokerConnectionResource, type BrokerInstrumentRef, type BrokerModifyOrderBody, type BrokerOrder, type BrokerOrderBody, type BrokerOrderUpdate, type BrokerSubscribeBody, BrokerSubscriptionsResource, type BrokerTick, type BrokerUnsubscribeBody, type CalculateMarginBody, type CancelBacktestRunResult, type CancelOrderResult, type Candle, type CandleSubscription, type CandleSubscriptions, type CapabilitiesResult, type ChainSelector, type CloseBySymbolBody, type CloseBySymbolResult, type CloseMt5PositionResult, type ClosePositionBody, type ClosePositionResult, type ClosePositionV2Body, type ClosedPosition, type ClosedPositionDetail, type ClosedPositionsQuery, type ClosedPositionsResult, ConnectionsV2, type CreateAtlasInstanceBody, type CreateAtlasInstanceResult, type CreateBacktestBatchBody, type CreateBacktestBatchResult, type CreateBacktestBody, type CreateBacktestResult, type CreateDeploymentBody, type CreateEaBody, type CreateEaPresetBody, type CreateInstanceBody, type CreateNoiseTestBody, type CreateNoiseTestResult, type CreateServiceKeyBody, type CreateWalkForwardMatrixBody, type CreateWalkForwardMatrixResult, type DeployRegion, type DeployServer, type Deployment, type DeploymentState, type DhanOptionChain, type DhanOptionLeg, type DhanSegment, type DhanUnderlying, type DroppedMt5Row, type DroppedRow, type Ea, type EaCompileFailure, type EaCompileStatus, type EaInputManifest, type EaInputParam, type EaInputType, type EaPreset, type EaSourceType, type EaTimeframe, type EaVersion, type EaVersionSource, type EaVersionStatus, EasResource, type ExpirationType, type FillingMode, type Fresh, type FreshnessOption, type GetCandlesQuery, type HoldingsListResult, type IncludeRawParams, type Instance, type InstanceState, type InstanceType, InstancesResource, type InstrumentListParams, type InstrumentListResult, InstrumentsV2, type ListBacktestsQuery, type ListBacktestsResult, type ListDeploymentsQuery, type ListDeploymentsResult, type ListEaVersionsQuery, type ListEaVersionsResult, type ListInstancesQuery, type LiveComparison, type LiveComparisonMatch, type LiveComparisonSummary, type MT5Candle, type MT5Heartbeat, type MT5LivePosition, type MT5PositionUpdate, type MT5Tick, type MT5TradeEvent, type MarginOrderType, type MarginResult, type MarketCandleMessage, type MarketCandlesParams, type MarketCandlesResult, type MarketChainMessage, type MarketFeedState, type MarketQuotesResult, type MarketScannerMessage, type MarketTickMessage, MarketV2, type ModifyMt5PositionResult, type ModifyOrderResult, type ModifyOrderV2Body, type ModifyPositionBody, type ModifyPositionResult, type ModifyPositionV2Body, type Money, type MonitorStatus, type MonitorVerdict, Mt5Resource, type Mt5SymbolSpec, type NoiseTestConfig, type OpenPositionDetail, type OptimizationAlgorithm, type OptimizationConfig, type OptimizationConfigInput, type OptimizationCriterion, type OptimizationPass, type OptimizationRange, type Order, type OrderDirection, type OrderType, type OrdersListParams, type OrdersListResult, type PlaceOrderBody, type PlaceOrderResult, type PlaceOrderV2Body, type PortfolioBody, type PortfolioReport, type Position, type PositionDetail, type PositionsListParams, type PositionsListResult, type PresignEaVersionBody, type PresignEaVersionResult, type Price, type RefusedInstrumentKeyReason, type RegisterEaVersionBody, type RegisteredEaVersion, type ResolveInstrumentParams, type RetiredWSChannel, type RevealOosResult, type RunLiveComparisonBody, type SaveEaSourceBody, type ScannerBoard, type ScannerBoardParams, type ScannerRow, type ScannerSession, type ScannerSessionState, ScannerV2, type ScannerZones, type ServiceKey, type ServiceKeyWithRaw, ServiceKeysResource, type SetMonitorBody, type SpreadCalibration, type SubscribeCandleBody, type SubscribeFailedMessage, type SubscribeTickBody, type SubscribedMessage, SubscriptionsResource, type SwapArbRow, type SwapArbitrageReport, type SymbolSpecsResult, type TickSubscriptions, type Timeframe, type TradesListResult, type TradingOrderMessage, TradingResource, type UnifiedCandle, type UnifiedError, type UnifiedErrorCode, type UnifiedFunds, type UnifiedHolding, type UnifiedInstrument, type UnifiedInterval, type UnifiedOptionChain, type UnifiedOptionExpiries, type UnifiedOptionLeg, type UnifiedOrder, type UnifiedPosition, type UnifiedProfile, type UnifiedSymbolSpec, type UnifiedTick, type UnifiedTrade, type UnsubscribeCandleBody, type UnsubscribeTickBody, type UnsubscribedMessage, type UpdateAtlasInstanceBody, type UpdateDeploymentBody, type UpdateEaBody, type UpdateServiceKeyBody, type V2Snapshot, type V2WriteOptions, type ValidateBrokerCredentialsBody, type ValidateBrokerCredentialsResult, type WSChannel, type WSEventMap, type WSSubscribeOptions, type WSUnsubscribeOptions, type WalkForwardConfig, type WalkForwardReport, type WriteOptions };
|
package/dist/index.js
CHANGED
|
@@ -221,11 +221,11 @@ var BacktestsResource = class {
|
|
|
221
221
|
return this.http.request({ method: "GET", path: "/api/external/backtests", query: { limit: query?.limit, cursor: query?.cursor } });
|
|
222
222
|
}
|
|
223
223
|
/** Queue a backtest: a single run, an optimization (`optimization`) or a
|
|
224
|
-
* walk-forward (`optimization` + `walkForward`). 402 when
|
|
224
|
+
* walk-forward (`optimization` + `walkForward`). 402 when the usage balance is short. */
|
|
225
225
|
async create(body) {
|
|
226
226
|
return this.http.request({ method: "POST", path: "/api/external/backtests", body });
|
|
227
227
|
}
|
|
228
|
-
/** Time and
|
|
228
|
+
/** Time and cost (from the usage balance, in its currency) a backtest would take. Queues nothing. */
|
|
229
229
|
async estimate(query) {
|
|
230
230
|
return this.http.request({
|
|
231
231
|
method: "GET",
|
|
@@ -376,6 +376,7 @@ var BrokerSubscriptionsResource = class {
|
|
|
376
376
|
this.http = http;
|
|
377
377
|
this.basePath = basePath;
|
|
378
378
|
}
|
|
379
|
+
/** @deprecated Subscribe NSE, BSE and MCX keys on the `market.ticks` WebSocket channel instead (it needs India access). */
|
|
379
380
|
async subscribe(body) {
|
|
380
381
|
return this.http.request({
|
|
381
382
|
method: "POST",
|
|
@@ -383,6 +384,7 @@ var BrokerSubscriptionsResource = class {
|
|
|
383
384
|
body
|
|
384
385
|
});
|
|
385
386
|
}
|
|
387
|
+
/** @deprecated Unsubscribe from the `market.ticks` WebSocket channel instead. */
|
|
386
388
|
async unsubscribe(body) {
|
|
387
389
|
return this.http.request({
|
|
388
390
|
method: "DELETE",
|
|
@@ -390,6 +392,7 @@ var BrokerSubscriptionsResource = class {
|
|
|
390
392
|
body
|
|
391
393
|
});
|
|
392
394
|
}
|
|
395
|
+
/** @deprecated The `subscribed` reply on the `market.ticks` WebSocket channel lists what streams. */
|
|
393
396
|
async list() {
|
|
394
397
|
return this.http.request({
|
|
395
398
|
method: "GET",
|
|
@@ -409,8 +412,11 @@ var BrokerConnectionResource = class {
|
|
|
409
412
|
this.subscriptions = new BrokerSubscriptionsResource(http, this.basePath);
|
|
410
413
|
}
|
|
411
414
|
// Orders
|
|
412
|
-
/**
|
|
413
|
-
*
|
|
415
|
+
/**
|
|
416
|
+
* Place an order in the broker's own fields. Runs at most once per
|
|
417
|
+
* Idempotency-Key, so a retry never places twice.
|
|
418
|
+
* @deprecated Use `atlas.v2.connections(id).placeOrder()` (`POST /api/v2/connections/{id}/orders`).
|
|
419
|
+
*/
|
|
414
420
|
async placeOrder(order, options) {
|
|
415
421
|
return this.http.request({
|
|
416
422
|
method: "POST",
|
|
@@ -421,19 +427,24 @@ var BrokerConnectionResource = class {
|
|
|
421
427
|
idempotent: true
|
|
422
428
|
});
|
|
423
429
|
}
|
|
430
|
+
/** @deprecated Use `atlas.v2.connections(id).orders()` (`GET /api/v2/connections/{id}/orders`). */
|
|
424
431
|
async getOrders() {
|
|
425
432
|
return this.http.request({
|
|
426
433
|
method: "GET",
|
|
427
434
|
path: `${this.basePath}/orders`
|
|
428
435
|
});
|
|
429
436
|
}
|
|
437
|
+
/** @deprecated Use `atlas.v2.connections(id).order(orderId)` (`GET /api/v2/connections/{id}/orders/{orderId}`). */
|
|
430
438
|
async getOrder(orderId) {
|
|
431
439
|
return this.http.request({
|
|
432
440
|
method: "GET",
|
|
433
441
|
path: `${this.basePath}/orders/${encodeURIComponent(orderId)}`
|
|
434
442
|
});
|
|
435
443
|
}
|
|
436
|
-
/**
|
|
444
|
+
/**
|
|
445
|
+
* Change a working order, in the broker's own fields.
|
|
446
|
+
* @deprecated Use `atlas.v2.connections(id).modifyOrder()` (`PUT /api/v2/connections/{id}/orders/{orderId}`).
|
|
447
|
+
*/
|
|
437
448
|
async modifyOrder(orderId, changes, options) {
|
|
438
449
|
return this.http.request({
|
|
439
450
|
method: "PUT",
|
|
@@ -444,6 +455,7 @@ var BrokerConnectionResource = class {
|
|
|
444
455
|
idempotent: true
|
|
445
456
|
});
|
|
446
457
|
}
|
|
458
|
+
/** @deprecated Use `atlas.v2.connections(id).cancelOrder(orderId)` (`DELETE /api/v2/connections/{id}/orders/{orderId}`). */
|
|
447
459
|
async cancelOrder(orderId, body, options) {
|
|
448
460
|
return this.http.request({
|
|
449
461
|
method: "DELETE",
|
|
@@ -455,8 +467,11 @@ var BrokerConnectionResource = class {
|
|
|
455
467
|
});
|
|
456
468
|
}
|
|
457
469
|
// Trades
|
|
458
|
-
/**
|
|
459
|
-
*
|
|
470
|
+
/**
|
|
471
|
+
* Trade book (fills). Currently served by Motilal Oswal; brokers whose
|
|
472
|
+
* runner adapter doesn't implement it return an "unsupported command" error.
|
|
473
|
+
* @deprecated Use `atlas.v2.connections(id).trades()` (`GET /api/v2/connections/{id}/trades`).
|
|
474
|
+
*/
|
|
460
475
|
async getTrades() {
|
|
461
476
|
return this.http.request({
|
|
462
477
|
method: "GET",
|
|
@@ -464,12 +479,14 @@ var BrokerConnectionResource = class {
|
|
|
464
479
|
});
|
|
465
480
|
}
|
|
466
481
|
// Positions & Holdings
|
|
482
|
+
/** @deprecated Use `atlas.v2.connections(id).positions()` (`GET /api/v2/connections/{id}/positions`). */
|
|
467
483
|
async getPositions() {
|
|
468
484
|
return this.http.request({
|
|
469
485
|
method: "GET",
|
|
470
486
|
path: `${this.basePath}/positions`
|
|
471
487
|
});
|
|
472
488
|
}
|
|
489
|
+
/** @deprecated Use `atlas.v2.connections(id).holdings()` (`GET /api/v2/connections/{id}/holdings`). */
|
|
473
490
|
async getHoldings() {
|
|
474
491
|
return this.http.request({
|
|
475
492
|
method: "GET",
|
|
@@ -477,6 +494,7 @@ var BrokerConnectionResource = class {
|
|
|
477
494
|
});
|
|
478
495
|
}
|
|
479
496
|
// Candles
|
|
497
|
+
/** @deprecated Use `atlas.v2.market.candles()` (`GET /api/v2/market/candles`), served from the Atlaas market data feed. */
|
|
480
498
|
async getCandles(query) {
|
|
481
499
|
return this.http.request({
|
|
482
500
|
method: "GET",
|
|
@@ -485,7 +503,10 @@ var BrokerConnectionResource = class {
|
|
|
485
503
|
});
|
|
486
504
|
}
|
|
487
505
|
// Options (Dhan only)
|
|
488
|
-
/**
|
|
506
|
+
/**
|
|
507
|
+
* Option expiries for an underlying, through this Dhan connection.
|
|
508
|
+
* @deprecated Use `atlas.v2.market.expiries(underlyingKey)` (`GET /api/v2/market/expiries`).
|
|
509
|
+
*/
|
|
489
510
|
async getOptionExpiries(underlying) {
|
|
490
511
|
return this.http.request({
|
|
491
512
|
method: "GET",
|
|
@@ -493,8 +514,10 @@ var BrokerConnectionResource = class {
|
|
|
493
514
|
query: underlyingQuery(underlying)
|
|
494
515
|
});
|
|
495
516
|
}
|
|
496
|
-
/**
|
|
497
|
-
*
|
|
517
|
+
/**
|
|
518
|
+
* Dhan's option chain for one expiry (YYYY-MM-DD), through this Dhan connection.
|
|
519
|
+
* @deprecated Use `atlas.v2.market.optionChain(underlyingKey, expiry)` (`GET /api/v2/market/option-chain`), which serves the same data without a connection.
|
|
520
|
+
*/
|
|
498
521
|
async getOptionChain(underlying, expiry) {
|
|
499
522
|
return this.http.request({
|
|
500
523
|
method: "GET",
|
|
@@ -581,15 +604,29 @@ var ConnectionsV2 = class {
|
|
|
581
604
|
}
|
|
582
605
|
// ── Writes ───────────────────────────────────────────────────────────
|
|
583
606
|
// Each runs at most once per Idempotency-Key, so a retry never acts twice.
|
|
584
|
-
|
|
607
|
+
// Named like the v1 and raw broker writes (placeOrder, modifyOrder,
|
|
608
|
+
// cancelOrder, closePosition, modifyPosition).
|
|
609
|
+
async placeOrder(body, options) {
|
|
585
610
|
return this.write("POST", "/orders", body, options);
|
|
586
611
|
}
|
|
587
|
-
async
|
|
612
|
+
async modifyOrder(orderId, body, options) {
|
|
588
613
|
return this.write("PUT", `/orders/${encodeURIComponent(orderId)}`, body, options);
|
|
589
614
|
}
|
|
590
|
-
async
|
|
615
|
+
async cancelOrder(orderId, options) {
|
|
591
616
|
return this.write("DELETE", `/orders/${encodeURIComponent(orderId)}`, void 0, options);
|
|
592
617
|
}
|
|
618
|
+
/** @deprecated Renamed to {@link ConnectionsV2.placeOrder}, which takes the same arguments. */
|
|
619
|
+
async place(body, options) {
|
|
620
|
+
return this.placeOrder(body, options);
|
|
621
|
+
}
|
|
622
|
+
/** @deprecated Renamed to {@link ConnectionsV2.modifyOrder}, which takes the same arguments. */
|
|
623
|
+
async modify(orderId, body, options) {
|
|
624
|
+
return this.modifyOrder(orderId, body, options);
|
|
625
|
+
}
|
|
626
|
+
/** @deprecated Renamed to {@link ConnectionsV2.cancelOrder}, which takes the same arguments. */
|
|
627
|
+
async cancel(orderId, options) {
|
|
628
|
+
return this.cancelOrder(orderId, options);
|
|
629
|
+
}
|
|
593
630
|
async closePosition(body, options) {
|
|
594
631
|
return this.write("POST", "/positions/close", body, options);
|
|
595
632
|
}
|
|
@@ -960,7 +997,7 @@ var Mt5Resource = class {
|
|
|
960
997
|
async get(accountId) {
|
|
961
998
|
return this.http.request({ method: "GET", path: this.path(accountId) });
|
|
962
999
|
}
|
|
963
|
-
/** Remove the terminal.
|
|
1000
|
+
/** Remove the terminal. Nothing is refunded. */
|
|
964
1001
|
async delete(accountId) {
|
|
965
1002
|
await this.http.request({ method: "DELETE", path: this.path(accountId) });
|
|
966
1003
|
}
|
|
@@ -1112,12 +1149,14 @@ var TradingResource = class {
|
|
|
1112
1149
|
return this.http.request({ method, path: this.path(accountId, suffix), body, idempotencyKey: options?.idempotencyKey, signal: options?.signal, idempotent: true });
|
|
1113
1150
|
}
|
|
1114
1151
|
// Orders
|
|
1152
|
+
/** @deprecated Use `atlas.v2.connections(id).placeOrder()` (`POST /api/v2/connections/{id}/orders`). */
|
|
1115
1153
|
async placeOrder(accountId, body, options) {
|
|
1116
1154
|
return this.write("POST", accountId, "/orders", body, options);
|
|
1117
1155
|
}
|
|
1118
1156
|
async getOrders(accountId, options) {
|
|
1119
1157
|
return this.read(accountId, "/orders", options);
|
|
1120
1158
|
}
|
|
1159
|
+
/** @deprecated Use `atlas.v2.connections(id).cancelOrder(ticket)` (`DELETE /api/v2/connections/{id}/orders/{ticket}`). */
|
|
1121
1160
|
async cancelOrder(accountId, ticket, options) {
|
|
1122
1161
|
await this.write("DELETE", accountId, `/orders/${ticket}`, void 0, options);
|
|
1123
1162
|
}
|
|
@@ -1135,12 +1174,15 @@ var TradingResource = class {
|
|
|
1135
1174
|
query: { since: query.since, until: query.until, limit: query.limit }
|
|
1136
1175
|
});
|
|
1137
1176
|
}
|
|
1177
|
+
/** @deprecated Use `atlas.v2.connections(id).modifyPosition(ticket, { stopLoss, takeProfit })` (`PUT /api/v2/connections/{id}/positions/{ticket}`). */
|
|
1138
1178
|
async modifyPosition(accountId, ticket, body, options) {
|
|
1139
1179
|
return this.write("PATCH", accountId, `/positions/${ticket}`, body, options);
|
|
1140
1180
|
}
|
|
1181
|
+
/** @deprecated Use `atlas.v2.connections(id).closePosition({ instrumentKey, positionId: ticket })` (`POST /api/v2/connections/{id}/positions/close`). */
|
|
1141
1182
|
async closePosition(accountId, ticket, body, options) {
|
|
1142
1183
|
return this.write("POST", accountId, `/positions/${ticket}/close`, body, options);
|
|
1143
1184
|
}
|
|
1185
|
+
/** @deprecated Use `atlas.v2.connections(id).closePosition({ instrumentKey })` (`POST /api/v2/connections/{id}/positions/close`). */
|
|
1144
1186
|
async closeBySymbol(accountId, body, options) {
|
|
1145
1187
|
return this.write("POST", accountId, "/positions/close-by-symbol", body, options);
|
|
1146
1188
|
}
|
|
@@ -1157,6 +1199,7 @@ var TradingResource = class {
|
|
|
1157
1199
|
return this.read(accountId, "/account", options);
|
|
1158
1200
|
}
|
|
1159
1201
|
// Historical data
|
|
1202
|
+
/** @deprecated Use `atlas.v2.market.candles({ instrumentKey, interval, from, to, connectionId })` (`GET /api/v2/market/candles`). */
|
|
1160
1203
|
async getCandles(accountId, query) {
|
|
1161
1204
|
return this.http.request({
|
|
1162
1205
|
method: "GET",
|
|
@@ -1178,16 +1221,17 @@ var TradingResource = class {
|
|
|
1178
1221
|
|
|
1179
1222
|
// src/client.ts
|
|
1180
1223
|
var AtlasClient = class {
|
|
1181
|
-
/**
|
|
1224
|
+
/** MT5 platform (v1): instances and broker connections on `/api/atlas/instances`. */
|
|
1182
1225
|
instances;
|
|
1183
|
-
/** MT5 terminals by login
|
|
1226
|
+
/** MT5 platform (v1): terminals by login, deploy, start, stop, remove. */
|
|
1184
1227
|
mt5;
|
|
1185
1228
|
eas;
|
|
1186
1229
|
backtests;
|
|
1187
|
-
/** MT5 trading on one terminal, by login. */
|
|
1230
|
+
/** MT5 trading on one terminal, by login. Mostly deprecated: use `v2.connections(id)` and `v2.market`, which work on every market. */
|
|
1188
1231
|
trading;
|
|
1189
1232
|
subscriptions;
|
|
1190
1233
|
serviceKeys;
|
|
1234
|
+
/** The market-neutral API (`/api/v2`): trading on every connection, instruments, market data and the scanner. */
|
|
1191
1235
|
v2;
|
|
1192
1236
|
http;
|
|
1193
1237
|
brokersResource;
|
|
@@ -1214,7 +1258,10 @@ var AtlasClient = class {
|
|
|
1214
1258
|
connections: (connectionId) => new ConnectionsV2(this.http, connectionId)
|
|
1215
1259
|
};
|
|
1216
1260
|
}
|
|
1217
|
-
/**
|
|
1261
|
+
/**
|
|
1262
|
+
* A broker connection's own API, by broker name and the connection's `externalRef`.
|
|
1263
|
+
* @deprecated Use `v2.connections(connectionId)`, which takes the same `externalRef` and speaks one shape for every broker.
|
|
1264
|
+
*/
|
|
1218
1265
|
broker(brokerName, connectionId) {
|
|
1219
1266
|
return this.brokersResource.connection(brokerName, connectionId);
|
|
1220
1267
|
}
|
|
@@ -1371,7 +1418,7 @@ var AtlasWebSocket = class extends EventEmitter {
|
|
|
1371
1418
|
this.emit("connected");
|
|
1372
1419
|
break;
|
|
1373
1420
|
// Bad key, IP not allowed, rate limited, insufficient scope, or an
|
|
1374
|
-
// inactive
|
|
1421
|
+
// inactive or suspended account.
|
|
1375
1422
|
case "service_auth_failed":
|
|
1376
1423
|
onAuthFailure(new AtlasAuthError(msg.reason ?? "Authentication failed"));
|
|
1377
1424
|
break;
|