@bitgen/sdk 1.0.8 → 1.1.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/CHANGELOG.md +13 -0
- package/README.md +3 -1
- package/dist/cjs/client.d.ts +4 -0
- package/dist/cjs/client.d.ts.map +1 -1
- package/dist/cjs/client.js +6 -0
- package/dist/cjs/client.js.map +1 -1
- package/dist/cjs/constants.d.ts +118 -0
- package/dist/cjs/constants.d.ts.map +1 -1
- package/dist/cjs/constants.js +93 -1
- package/dist/cjs/constants.js.map +1 -1
- package/dist/cjs/index.d.ts +2 -2
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +14 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/resources/autotrading.d.ts +44 -0
- package/dist/cjs/resources/autotrading.d.ts.map +1 -0
- package/dist/cjs/resources/autotrading.js +116 -0
- package/dist/cjs/resources/autotrading.js.map +1 -0
- package/dist/cjs/resources/bot.d.ts +31 -0
- package/dist/cjs/resources/bot.d.ts.map +1 -0
- package/dist/cjs/resources/bot.js +54 -0
- package/dist/cjs/resources/bot.js.map +1 -0
- package/dist/cjs/types/autotrading.d.ts +196 -0
- package/dist/cjs/types/autotrading.d.ts.map +1 -0
- package/dist/cjs/types/autotrading.js +3 -0
- package/dist/cjs/types/autotrading.js.map +1 -0
- package/dist/cjs/types/bot.d.ts +45 -0
- package/dist/cjs/types/bot.d.ts.map +1 -0
- package/dist/cjs/types/bot.js +3 -0
- package/dist/cjs/types/bot.js.map +1 -0
- package/dist/cjs/types/index.d.ts +13 -3
- package/dist/cjs/types/index.d.ts.map +1 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/client.d.ts +4 -0
- package/dist/esm/client.d.ts.map +1 -1
- package/dist/esm/client.js +6 -0
- package/dist/esm/client.js.map +1 -1
- package/dist/esm/constants.d.ts +118 -0
- package/dist/esm/constants.d.ts.map +1 -1
- package/dist/esm/constants.js +92 -0
- package/dist/esm/constants.js.map +1 -1
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/resources/autotrading.d.ts +44 -0
- package/dist/esm/resources/autotrading.d.ts.map +1 -0
- package/dist/esm/resources/autotrading.js +112 -0
- package/dist/esm/resources/autotrading.js.map +1 -0
- package/dist/esm/resources/bot.d.ts +31 -0
- package/dist/esm/resources/bot.d.ts.map +1 -0
- package/dist/esm/resources/bot.js +50 -0
- package/dist/esm/resources/bot.js.map +1 -0
- package/dist/esm/types/autotrading.d.ts +196 -0
- package/dist/esm/types/autotrading.d.ts.map +1 -0
- package/dist/esm/types/autotrading.js +2 -0
- package/dist/esm/types/autotrading.js.map +1 -0
- package/dist/esm/types/bot.d.ts +45 -0
- package/dist/esm/types/bot.d.ts.map +1 -0
- package/dist/esm/types/bot.js +2 -0
- package/dist/esm/types/bot.js.map +1 -0
- package/dist/esm/types/index.d.ts +13 -3
- package/dist/esm/types/index.d.ts.map +1 -1
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/package.json +1 -1
- package/readme/concepts.md +3 -3
- package/readme/errors.md +1 -1
- package/readme/resource/autotrading.md +304 -0
- package/readme/resource/bot.md +207 -0
- package/readme/resource/customer.md +1 -1
- package/readme/resource/transaction.md +1 -1
- package/readme/resource/webhooks.md +2 -0
- package/src/client.ts +6 -0
- package/src/constants.ts +131 -0
- package/src/index.ts +28 -0
- package/src/resources/autotrading.ts +132 -0
- package/src/resources/bot.ts +58 -0
- package/src/types/autotrading.ts +218 -0
- package/src/types/bot.ts +48 -0
- package/src/types/index.ts +45 -3
- package/src/version.ts +1 -1
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AutotradingResource = void 0;
|
|
4
|
+
const utils_js_1 = require("../utils.js");
|
|
5
|
+
/**
|
|
6
|
+
* The automated-trading module: the organization sets a frame — a strategy — and the engine decides on
|
|
7
|
+
* its own when to buy and when to sell. The decision itself stays closed: no signal and no rationale is
|
|
8
|
+
* exposed. The bot assigned to the module holds the funds, its EUR account pays for the purchases
|
|
9
|
+
* (`client.bot`, `client.bank`).
|
|
10
|
+
*
|
|
11
|
+
* `create` and `update` need the module installed, enabled and served by a bot; the reads and
|
|
12
|
+
* `pause` / `resume` / `close` answer whatever the state of the module, so a strategy can always be read
|
|
13
|
+
* and closed.
|
|
14
|
+
*
|
|
15
|
+
* **Every EUR amount of this resource is a string**, in and out — `capital`, `installment`, the guard
|
|
16
|
+
* rail values, `value`, `engaged`, `unrealised`, `realisedGains`, the `amount` and `cash` of a journal
|
|
17
|
+
* line. The numbers are the points of a curve, `performance`, `benchmark`, `percent`, `trades`,
|
|
18
|
+
* `losingStreak` and `strategies`.
|
|
19
|
+
*/
|
|
20
|
+
class AutotradingResource {
|
|
21
|
+
http;
|
|
22
|
+
constructor(http) {
|
|
23
|
+
this.http = http;
|
|
24
|
+
}
|
|
25
|
+
/** Creates a `RUNNING` strategy, due for its first pass straight away */
|
|
26
|
+
async create(params) {
|
|
27
|
+
return await this.http.post('/extension/autotrading/strategy', strategyBody(params));
|
|
28
|
+
}
|
|
29
|
+
/** Strategies of the organization, the most recent first — closed ones with `includeClosed` */
|
|
30
|
+
async list(params = {}) {
|
|
31
|
+
return await this.http.get('/extension/autotrading/strategies', { ...params });
|
|
32
|
+
}
|
|
33
|
+
/** One strategy by uuid, or by model */
|
|
34
|
+
async get(strategy) {
|
|
35
|
+
return await this.http.get(`/extension/autotrading/strategy/${this.segment(strategy)}`);
|
|
36
|
+
}
|
|
37
|
+
/** Replaces the frame of the strategy, field for field: send the whole frame every time */
|
|
38
|
+
async update(strategy, params) {
|
|
39
|
+
await this.http.put(`/extension/autotrading/strategy/${this.segment(strategy)}`, strategyBody(params));
|
|
40
|
+
}
|
|
41
|
+
/** Stops the passes and leaves the positions as they are — the state it already has is a no-op */
|
|
42
|
+
async pause(strategy) {
|
|
43
|
+
await this.transition(strategy, 'PAUSE');
|
|
44
|
+
}
|
|
45
|
+
/** Starts the passes again and clears what had paused the strategy: its losing run and its mark of the day */
|
|
46
|
+
async resume(strategy) {
|
|
47
|
+
await this.transition(strategy, 'RESUME');
|
|
48
|
+
}
|
|
49
|
+
/** Closes the strategy: it settles position by position, following `closing`, then reaches `CLOSED` on its own */
|
|
50
|
+
async close(strategy) {
|
|
51
|
+
await this.transition(strategy, 'CLOSE');
|
|
52
|
+
}
|
|
53
|
+
/** Curve of the strategy, its performance, the same window on BTC, and the figures of the moment */
|
|
54
|
+
async history(strategy) {
|
|
55
|
+
return await this.http.get(`/extension/autotrading/strategy/${this.segment(strategy)}/history`);
|
|
56
|
+
}
|
|
57
|
+
/** What the strategy did, the most recent first — paginated inside a window of ten thousand lines */
|
|
58
|
+
async journal(strategy, params = {}) {
|
|
59
|
+
return await this.http.get(`/extension/autotrading/strategy/${this.segment(strategy)}/journal`, { ...params });
|
|
60
|
+
}
|
|
61
|
+
/** Every strategy of the organization that is not `CLOSED`, as one position: the same curves, and the totals */
|
|
62
|
+
async portfolio() {
|
|
63
|
+
return await this.http.get('/extension/autotrading/portfolio');
|
|
64
|
+
}
|
|
65
|
+
async transition(strategy, action) {
|
|
66
|
+
await this.http.patch(`/extension/autotrading/strategy/${this.segment(strategy)}`, { action });
|
|
67
|
+
}
|
|
68
|
+
segment(strategy) {
|
|
69
|
+
return (0, utils_js_1.pathSegment)((0, utils_js_1.idOf)(strategy, 'strategy'), 'strategy');
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
exports.AutotradingResource = AutotradingResource;
|
|
73
|
+
/** The frame as the API reads it: amounts and percentages as strings, assets as uuid or ISO code */
|
|
74
|
+
function strategyBody(params) {
|
|
75
|
+
const body = {
|
|
76
|
+
name: params.name,
|
|
77
|
+
capital: (0, utils_js_1.amount)(params.capital),
|
|
78
|
+
risk: params.risk,
|
|
79
|
+
frequency: params.frequency,
|
|
80
|
+
};
|
|
81
|
+
if (params.assets !== undefined) {
|
|
82
|
+
// A string is iterable too: without this guard `assets: 'BTC'` would reach the API as one asset per letter
|
|
83
|
+
if (!Array.isArray(params.assets)) {
|
|
84
|
+
throw new TypeError('assets must be an array of assets, each a uuid or an ISO code, or a model');
|
|
85
|
+
}
|
|
86
|
+
body.assets = params.assets.map((asset) => (0, utils_js_1.assetId)(asset));
|
|
87
|
+
}
|
|
88
|
+
if (params.endDate !== undefined)
|
|
89
|
+
body.endDate = params.endDate;
|
|
90
|
+
if (params.allocation !== undefined)
|
|
91
|
+
body.allocation = params.allocation;
|
|
92
|
+
if (params.reinvest !== undefined)
|
|
93
|
+
body.reinvest = params.reinvest;
|
|
94
|
+
if (params.closing !== undefined)
|
|
95
|
+
body.closing = params.closing;
|
|
96
|
+
if (params.notifyMode !== undefined)
|
|
97
|
+
body.notifyMode = params.notifyMode;
|
|
98
|
+
for (const [key, value] of [
|
|
99
|
+
['stopLoss', params.stopLoss], ['takeProfit', params.takeProfit], ['trailingStop', params.trailingStop],
|
|
100
|
+
['orderLimits', params.orderLimits], ['autoPause', params.autoPause],
|
|
101
|
+
]) {
|
|
102
|
+
if (value !== undefined)
|
|
103
|
+
body[key] = value;
|
|
104
|
+
}
|
|
105
|
+
for (const [key, value] of [
|
|
106
|
+
['installment', params.installment], ['stopLossPercent', params.stopLossPercent],
|
|
107
|
+
['takeProfitPercent', params.takeProfitPercent], ['trailingStopPercent', params.trailingStopPercent],
|
|
108
|
+
['maxOrderPercent', params.maxOrderPercent], ['minOrderAmount', params.minOrderAmount],
|
|
109
|
+
['autoPauseLoss', params.autoPauseLoss], ['autoPauseStreak', params.autoPauseStreak],
|
|
110
|
+
]) {
|
|
111
|
+
if (value !== undefined)
|
|
112
|
+
body[key] = (0, utils_js_1.amount)(value);
|
|
113
|
+
}
|
|
114
|
+
return body;
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL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,CAAC;QACX,IAAI,KAAK,KAAK,SAAS;YAAE,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;IAC5C,CAAC;IAED,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI;QACzB,CAAC,aAAa,EAAE,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,iBAAiB,EAAE,MAAM,CAAC,eAAe,CAAC;QAChF,CAAC,mBAAmB,EAAE,MAAM,CAAC,iBAAiB,CAAC,EAAE,CAAC,qBAAqB,EAAE,MAAM,CAAC,mBAAmB,CAAC;QACpG,CAAC,iBAAiB,EAAE,MAAM,CAAC,eAAe,CAAC,EAAE,CAAC,gBAAgB,EAAE,MAAM,CAAC,cAAc,CAAC;QACtF,CAAC,eAAe,EAAE,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC,iBAAiB,EAAE,MAAM,CAAC,eAAe,CAAC;KAC5E,EAAE,CAAC;QACX,IAAI,KAAK,KAAK,SAAS;YAAE,IAAI,CAAC,GAAG,CAAC,GAAG,IAAA,iBAAM,EAAC,KAAK,CAAC,CAAA;IACpD,CAAC;IAED,OAAO,IAAI,CAAA;AACb,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { HttpClient } from '../http.js';
|
|
2
|
+
import type { Bot, BotApplication, BotListParams, BotModuleRef, BotRef, Created, Page } from '../types/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* The technical customers the organization runs for its own account, and the modules they serve.
|
|
5
|
+
* A bot is left out of the assets under management and of the customer count, it does not appear
|
|
6
|
+
* among the customers or in the journal of transactions, and it cannot sign in.
|
|
7
|
+
*
|
|
8
|
+
* `list` and `get` answer the identity of a bot and its modules, and nothing more: the details of the
|
|
9
|
+
* account behind it are read through `client.customer`.
|
|
10
|
+
*/
|
|
11
|
+
export declare class BotResource {
|
|
12
|
+
private readonly http;
|
|
13
|
+
constructor(http: HttpClient);
|
|
14
|
+
/** Creates a bot in the organization — takes nothing: the platform writes the login, the name and a validated identity */
|
|
15
|
+
create(): Promise<Created>;
|
|
16
|
+
/** Bots of the organization, each with the modules it serves — closed ones with `includeClosed` */
|
|
17
|
+
list(params?: BotListParams): Promise<Page<Bot>>;
|
|
18
|
+
/** One bot by uuid, or by model — a closed bot stays readable; the same fields as `list` */
|
|
19
|
+
get(bot: BotRef): Promise<Bot>;
|
|
20
|
+
/** Attaches the bot to a module. A module is served by one bot at most; the same bot again is a no-op */
|
|
21
|
+
assign(bot: BotRef, module: BotModuleRef): Promise<void>;
|
|
22
|
+
/** Detaches the bot from a module — a module it does not serve is a no-op */
|
|
23
|
+
detach(bot: BotRef, module: BotModuleRef): Promise<void>;
|
|
24
|
+
/** The modules this bot serves — not paginated: `count` is the length of the list */
|
|
25
|
+
modules(bot: BotRef): Promise<Page<BotApplication>>;
|
|
26
|
+
/** Closes the bot. It must serve no module and hold no open position */
|
|
27
|
+
close(bot: BotRef): Promise<void>;
|
|
28
|
+
private segment;
|
|
29
|
+
private moduleSegment;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=bot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bot.d.ts","sourceRoot":"","sources":["../../../src/resources/bot.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAC5C,OAAO,KAAK,EAAE,GAAG,EAAE,cAAc,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AAGhH;;;;;;;GAOG;AACH,qBAAa,WAAW;IACV,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAE7C,0HAA0H;IACpH,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC;IAIhC,mGAAmG;IAC7F,IAAI,CAAC,MAAM,GAAE,aAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAI1D,4FAA4F;IACtF,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAIpC,yGAAyG;IACnG,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAI9D,6EAA6E;IACvE,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAI9D,qFAAqF;IAC/E,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAIzD,wEAAwE;IAClE,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIvC,OAAO,CAAC,OAAO;IAIf,OAAO,CAAC,aAAa;CAGtB"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BotResource = void 0;
|
|
4
|
+
const utils_js_1 = require("../utils.js");
|
|
5
|
+
/**
|
|
6
|
+
* The technical customers the organization runs for its own account, and the modules they serve.
|
|
7
|
+
* A bot is left out of the assets under management and of the customer count, it does not appear
|
|
8
|
+
* among the customers or in the journal of transactions, and it cannot sign in.
|
|
9
|
+
*
|
|
10
|
+
* `list` and `get` answer the identity of a bot and its modules, and nothing more: the details of the
|
|
11
|
+
* account behind it are read through `client.customer`.
|
|
12
|
+
*/
|
|
13
|
+
class BotResource {
|
|
14
|
+
http;
|
|
15
|
+
constructor(http) {
|
|
16
|
+
this.http = http;
|
|
17
|
+
}
|
|
18
|
+
/** Creates a bot in the organization — takes nothing: the platform writes the login, the name and a validated identity */
|
|
19
|
+
async create() {
|
|
20
|
+
return await this.http.post('/bot');
|
|
21
|
+
}
|
|
22
|
+
/** Bots of the organization, each with the modules it serves — closed ones with `includeClosed` */
|
|
23
|
+
async list(params = {}) {
|
|
24
|
+
return await this.http.get('/bot', { ...params });
|
|
25
|
+
}
|
|
26
|
+
/** One bot by uuid, or by model — a closed bot stays readable; the same fields as `list` */
|
|
27
|
+
async get(bot) {
|
|
28
|
+
return await this.http.get(`/bot/${this.segment(bot)}`);
|
|
29
|
+
}
|
|
30
|
+
/** Attaches the bot to a module. A module is served by one bot at most; the same bot again is a no-op */
|
|
31
|
+
async assign(bot, module) {
|
|
32
|
+
await this.http.patch(`/bot/${this.segment(bot)}/assign/${this.moduleSegment(module)}`);
|
|
33
|
+
}
|
|
34
|
+
/** Detaches the bot from a module — a module it does not serve is a no-op */
|
|
35
|
+
async detach(bot, module) {
|
|
36
|
+
await this.http.delete(`/bot/${this.segment(bot)}/assign/${this.moduleSegment(module)}`);
|
|
37
|
+
}
|
|
38
|
+
/** The modules this bot serves — not paginated: `count` is the length of the list */
|
|
39
|
+
async modules(bot) {
|
|
40
|
+
return await this.http.get(`/bot/${this.segment(bot)}/assign`);
|
|
41
|
+
}
|
|
42
|
+
/** Closes the bot. It must serve no module and hold no open position */
|
|
43
|
+
async close(bot) {
|
|
44
|
+
await this.http.delete(`/bot/${this.segment(bot)}`);
|
|
45
|
+
}
|
|
46
|
+
segment(bot) {
|
|
47
|
+
return (0, utils_js_1.pathSegment)((0, utils_js_1.idOf)(bot, 'bot'), 'bot');
|
|
48
|
+
}
|
|
49
|
+
moduleSegment(module) {
|
|
50
|
+
return (0, utils_js_1.pathSegment)((0, utils_js_1.idOf)(module, 'module'), 'module');
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.BotResource = BotResource;
|
|
54
|
+
//# sourceMappingURL=bot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bot.js","sourceRoot":"","sources":["../../../src/resources/bot.ts"],"names":[],"mappings":";;;AAEA,0CAA+C;AAE/C;;;;;;;GAOG;AACH,MAAa,WAAW;IACO;IAA7B,YAA6B,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;IAAG,CAAC;IAEjD,0H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CAAC,EAAE,CAAC,CAAA;IACrD,CAAC;IAEO,OAAO,CAAC,GAAW;QACzB,OAAO,IAAA,sBAAW,EAAC,IAAA,eAAI,EAAC,GAAG,EAAE,KAAK,CAAC,EAAE,KAAK,CAAC,CAAA;IAC7C,CAAC;IAEO,aAAa,CAAC,MAAoB;QACxC,OAAO,IAAA,sBAAW,EAAC,IAAA,eAAI,EAAC,MAAM,EAAE,QAAQ,CAAC,EAAE,QAAQ,CAAC,CAAA;IACtD,CAAC;CACF;AA7CD,kCA6CC"}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
export type { StrategyState, StrategyRisk, StrategyFrequency, StrategyAllocation, StrategyClosing, StrategyNotifyMode, StrategyJournalEvent, StrategyExitReason, StrategyIdleReason, } from '../constants.js';
|
|
2
|
+
import type { StrategyState, StrategyRisk, StrategyFrequency, StrategyAllocation, StrategyClosing, StrategyNotifyMode, StrategyJournalEvent, StrategyIdleReason } from '../constants.js';
|
|
3
|
+
import type { Amount, AssetInput, History, OrganizationSummary, UserSummary } from './index.js';
|
|
4
|
+
/** The guard rails of a strategy, switch by switch, with the value each one uses — percentages and EUR amounts as strings */
|
|
5
|
+
export interface StrategyGuards {
|
|
6
|
+
stopLoss: boolean;
|
|
7
|
+
/** Fall from the cost that sells, as a percentage */
|
|
8
|
+
stopLossPercent: string;
|
|
9
|
+
takeProfit: boolean;
|
|
10
|
+
/** Gain over the cost that sells, as a percentage */
|
|
11
|
+
takeProfitPercent: string;
|
|
12
|
+
trailingStop: boolean;
|
|
13
|
+
/** Fall under the highest point that sells, as a percentage */
|
|
14
|
+
trailingStopPercent: string;
|
|
15
|
+
/** Bounds the purchases — a sale is bounded by the sale minimum of the platform */
|
|
16
|
+
orderLimits: boolean;
|
|
17
|
+
/** Largest purchase, as a percentage of `capital` */
|
|
18
|
+
maxOrderPercent: string;
|
|
19
|
+
/** Floor of a purchase, in EUR */
|
|
20
|
+
minOrderAmount: string;
|
|
21
|
+
autoPause: boolean;
|
|
22
|
+
/** Daily loss that pauses, as a percentage of `capital` */
|
|
23
|
+
autoPauseLoss: string;
|
|
24
|
+
/** Losing sales in a row that pauses */
|
|
25
|
+
autoPauseStreak: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* A strategy: the frame the organization sets, the state it is in, and its figures of the moment.
|
|
29
|
+
*
|
|
30
|
+
* Every EUR amount of this resource is a **string** — `capital`, `installment`, the guard rail values,
|
|
31
|
+
* `engaged`. The numbers are `trades` and `losingStreak`.
|
|
32
|
+
*/
|
|
33
|
+
export interface Strategy {
|
|
34
|
+
uuid: string;
|
|
35
|
+
/** When the frame last changed (epoch seconds) — a change of `state` leaves it as it is */
|
|
36
|
+
updatedAt: number;
|
|
37
|
+
createdAt: number;
|
|
38
|
+
state: StrategyState;
|
|
39
|
+
organization: OrganizationSummary;
|
|
40
|
+
/** The bot that holds the funds */
|
|
41
|
+
bot: UserSummary;
|
|
42
|
+
name: string;
|
|
43
|
+
/** The universe, as ISO codes — empty when the engine picks in the whole catalogue */
|
|
44
|
+
assets: string[];
|
|
45
|
+
/** Ceiling of the strategy, in EUR: never gone past, whatever the balance of the bot */
|
|
46
|
+
capital: string;
|
|
47
|
+
/** Amount of one due date, in EUR — `null` outside `DCA` */
|
|
48
|
+
installment: string | null;
|
|
49
|
+
allocation: StrategyAllocation;
|
|
50
|
+
/** Weights of the universe — an empty list while the bot spreads the capital itself */
|
|
51
|
+
allocations: Record<string, string> | [];
|
|
52
|
+
/** Whether the gains go back to work */
|
|
53
|
+
reinvest: boolean;
|
|
54
|
+
risk: StrategyRisk;
|
|
55
|
+
frequency: StrategyFrequency;
|
|
56
|
+
/** Last day of the strategy (epoch seconds) — `null` when it has none */
|
|
57
|
+
endDate: number | null;
|
|
58
|
+
closing: StrategyClosing;
|
|
59
|
+
guards: StrategyGuards;
|
|
60
|
+
notifyMode: StrategyNotifyMode;
|
|
61
|
+
/** When the strategy was closed (epoch seconds) — `null` while it is open */
|
|
62
|
+
closedAt: number | null;
|
|
63
|
+
/** When its next pass is due (epoch seconds) */
|
|
64
|
+
nextRunAt: number | null;
|
|
65
|
+
/** Why the strategy is resting — `null` when it runs normally */
|
|
66
|
+
idleReason: StrategyIdleReason | null;
|
|
67
|
+
/** Losing sales in a row, reset by a winning sale and by a resume */
|
|
68
|
+
losingStreak: number;
|
|
69
|
+
/** Gains of the sales already settled, in EUR, losses included: negative when the strategy is behind */
|
|
70
|
+
realisedGains: string;
|
|
71
|
+
/** Orders settled since the strategy started */
|
|
72
|
+
trades: number;
|
|
73
|
+
/** Cost of the positions it holds, in EUR: this is what compares to `capital` */
|
|
74
|
+
engaged: string;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* The frame of a strategy. `update` **replaces** it field for field: a call without `assets` puts the
|
|
78
|
+
* strategy back on the whole catalogue, one without `stopLoss` switches the stop loss off — send the
|
|
79
|
+
* whole frame every time. The booleans command and the values follow: `stopLossPercent` is read when
|
|
80
|
+
* `stopLoss` is `true`.
|
|
81
|
+
*/
|
|
82
|
+
export interface StrategyInput {
|
|
83
|
+
/** 120 characters at most */
|
|
84
|
+
name: string;
|
|
85
|
+
/** Ceiling of the strategy, in EUR */
|
|
86
|
+
capital: Amount;
|
|
87
|
+
risk: StrategyRisk;
|
|
88
|
+
/** A `DCA` takes a dated pace, so `AUTO` is refused for it */
|
|
89
|
+
frequency: StrategyFrequency;
|
|
90
|
+
/** The universe, 15 at most, each asset by uuid or ISO code — absent or empty, the engine picks in the whole catalogue */
|
|
91
|
+
assets?: AssetInput[];
|
|
92
|
+
/** Amount of one due date, in EUR — required for `DCA`, ignored for the other profiles */
|
|
93
|
+
installment?: Amount;
|
|
94
|
+
/** Last day of the strategy, `YYYY-MM-DD` — read for `DCA` only */
|
|
95
|
+
endDate?: string;
|
|
96
|
+
/** Only `AUTO` is accepted: the bot alone spreads the capital over the universe */
|
|
97
|
+
allocation?: Extract<StrategyAllocation, 'AUTO'>;
|
|
98
|
+
/** `true` by default: the gains go back to work */
|
|
99
|
+
reinvest?: boolean;
|
|
100
|
+
/** `SELL_ALL` by default */
|
|
101
|
+
closing?: StrategyClosing;
|
|
102
|
+
/** `THRESHOLDS` by default */
|
|
103
|
+
notifyMode?: StrategyNotifyMode;
|
|
104
|
+
stopLoss?: boolean;
|
|
105
|
+
/** Percentage above zero and up to 100 */
|
|
106
|
+
stopLossPercent?: Amount;
|
|
107
|
+
takeProfit?: boolean;
|
|
108
|
+
/** Percentage, same shape */
|
|
109
|
+
takeProfitPercent?: Amount;
|
|
110
|
+
trailingStop?: boolean;
|
|
111
|
+
/** Percentage, same shape */
|
|
112
|
+
trailingStopPercent?: Amount;
|
|
113
|
+
/** Bounds the purchases of the strategy */
|
|
114
|
+
orderLimits?: boolean;
|
|
115
|
+
/** Largest purchase, as a percentage of `capital` */
|
|
116
|
+
maxOrderPercent?: Amount;
|
|
117
|
+
/** Floor of a purchase, in EUR */
|
|
118
|
+
minOrderAmount?: Amount;
|
|
119
|
+
autoPause?: boolean;
|
|
120
|
+
/** Daily loss that pauses, as a percentage of `capital` */
|
|
121
|
+
autoPauseLoss?: Amount;
|
|
122
|
+
/** Losing sales in a row that pauses, a whole number from one */
|
|
123
|
+
autoPauseStreak?: Amount;
|
|
124
|
+
}
|
|
125
|
+
export interface StrategyListParams {
|
|
126
|
+
offset?: number;
|
|
127
|
+
limit?: number;
|
|
128
|
+
/** Also returns the `CLOSED` strategies — default `false` */
|
|
129
|
+
includeClosed?: boolean;
|
|
130
|
+
}
|
|
131
|
+
/** One percentage per window, `null` when the window has no base to compute on */
|
|
132
|
+
export type StrategyRatios = Record<'d' | 'w' | 'm' | 'y' | 'all', number | null>;
|
|
133
|
+
/** The curve of a strategy, its performance, the same window on BTC to compare against, and the figures of the moment */
|
|
134
|
+
export interface StrategyHistory {
|
|
135
|
+
/** Value of the positions over time — each curve starts when the strategy was created */
|
|
136
|
+
history: History;
|
|
137
|
+
/** Return over each window: it accounts for what went in and out, so a purchase does not read as a gain */
|
|
138
|
+
performance: StrategyRatios;
|
|
139
|
+
/** Move of BTC over the same windows */
|
|
140
|
+
benchmark: StrategyRatios;
|
|
141
|
+
/** What the positions are worth now, in EUR: an asset with no price of its own is left out */
|
|
142
|
+
value: string;
|
|
143
|
+
/** Cost of the positions, in EUR */
|
|
144
|
+
engaged: string;
|
|
145
|
+
/** `value` less the cost of the priced positions */
|
|
146
|
+
unrealised: string;
|
|
147
|
+
realisedGains: string;
|
|
148
|
+
trades: number;
|
|
149
|
+
/** Weight of each asset of the universe, the largest first — an asset with nothing in it comes last at zero,
|
|
150
|
+
* and the shares add up to 100 as soon as a position is worth something, and are all zero when the strategy holds nothing */
|
|
151
|
+
distribution: {
|
|
152
|
+
asset: string;
|
|
153
|
+
amount: string;
|
|
154
|
+
percent: number;
|
|
155
|
+
}[];
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* One line of what a strategy did. Every line about an asset carries the position held **after** the
|
|
159
|
+
* operation; the lines that only say what the strategy became carry no quantity.
|
|
160
|
+
*/
|
|
161
|
+
export interface StrategyJournalEntry {
|
|
162
|
+
/** When the line was written (epoch seconds) */
|
|
163
|
+
date: number | null;
|
|
164
|
+
event: StrategyJournalEvent | null;
|
|
165
|
+
/**
|
|
166
|
+
* What the line is about, when it has one — `stop_loss`, `take_profit` or `trailing_stop` on a `guard`
|
|
167
|
+
* (see `StrategyExitReason`); `daily_loss` or `losing_streak` on a `paused`; `end_date` or
|
|
168
|
+
* `capital_consumed` on a `closing`; `SELL_ALL` or `KEEP` on a `closed`; an idle reason on an `idle`;
|
|
169
|
+
* `order_refused`, `sale_not_executed`, `insufficient_funds` or `daily_buy_limit_exceeded` on a `failed`
|
|
170
|
+
*/
|
|
171
|
+
reason: string | null;
|
|
172
|
+
/** ISO code of the asset of the line */
|
|
173
|
+
asset: string | null;
|
|
174
|
+
/** EUR for a `buy`, asset units for a `sell`, as a string */
|
|
175
|
+
amount: string | null;
|
|
176
|
+
/** Position held in that asset after the operation, as a string */
|
|
177
|
+
quantity: string | null;
|
|
178
|
+
/** Money of the settlement, in EUR: what a purchase cost, what a sale brought in */
|
|
179
|
+
cash: string | null;
|
|
180
|
+
/** The order behind the line — `null` on a line that has no order */
|
|
181
|
+
order: string | null;
|
|
182
|
+
}
|
|
183
|
+
/** Every strategy of the organization that is not `CLOSED`, as one position */
|
|
184
|
+
export interface AutotradingPortfolio {
|
|
185
|
+
history: History;
|
|
186
|
+
performance: StrategyRatios;
|
|
187
|
+
benchmark: StrategyRatios;
|
|
188
|
+
/** How many strategies the totals cover */
|
|
189
|
+
strategies: number;
|
|
190
|
+
/** Sum of the values of the strategies, in EUR */
|
|
191
|
+
value: string;
|
|
192
|
+
engaged: string;
|
|
193
|
+
unrealised: string;
|
|
194
|
+
realisedGains: string;
|
|
195
|
+
}
|
|
196
|
+
//# sourceMappingURL=autotrading.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autotrading.d.ts","sourceRoot":"","sources":["../../../src/types/autotrading.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,aAAa,EACb,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,iBAAiB,CAAA;AACxB,OAAO,KAAK,EACV,aAAa,EACb,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EACnB,MAAM,iBAAiB,CAAA;AACxB,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAE/F,6HAA6H;AAC7H,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,OAAO,CAAA;IACjB,qDAAqD;IACrD,eAAe,EAAE,MAAM,CAAA;IACvB,UAAU,EAAE,OAAO,CAAA;IACnB,qDAAqD;IACrD,iBAAiB,EAAE,MAAM,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,IAAI,CAAA;IACrB,wCAAwC;IACxC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,6DAA6D;IAC7D,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,mEAAmE;IACnE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,oFAAoF;IACpF,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,qEAAqE;IACrE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;CACrB;AAED,+EAA+E;AAC/E,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,OAAO,CAAA;IAChB,WAAW,EAAE,cAAc,CAAA;IAC3B,SAAS,EAAE,cAAc,CAAA;IACzB,2CAA2C;IAC3C,UAAU,EAAE,MAAM,CAAA;IAClB,kDAAkD;IAClD,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;IACf,UAAU,EAAE,MAAM,CAAA;IAClB,aAAa,EAAE,MAAM,CAAA;CACtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autotrading.js","sourceRoot":"","sources":["../../../src/types/autotrading.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export type { BotState, BotApplicationState, ExtensionState, ExtensionCategory } from '../constants.js';
|
|
2
|
+
import type { BotState, BotApplicationState, ExtensionState, ExtensionCategory } from '../constants.js';
|
|
3
|
+
/** The extension a module runs — `label` is the display name by language (`{ fr, en }`) */
|
|
4
|
+
export interface BotExtension {
|
|
5
|
+
uuid: string;
|
|
6
|
+
state: ExtensionState;
|
|
7
|
+
/** Technical name, e.g. `auto-trading` */
|
|
8
|
+
name: string;
|
|
9
|
+
category: ExtensionCategory;
|
|
10
|
+
label: Record<string, string>;
|
|
11
|
+
}
|
|
12
|
+
/** A module the bot serves: an installed application of the organization and the extension it runs */
|
|
13
|
+
export interface BotApplication {
|
|
14
|
+
uuid: string;
|
|
15
|
+
/** When the module was installed (epoch seconds) */
|
|
16
|
+
createdAt: number;
|
|
17
|
+
state: BotApplicationState;
|
|
18
|
+
extension: BotExtension;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* A technical customer the organization runs for its own account: an account like any other, flagged `bot`,
|
|
22
|
+
* left out of the assets under management and of the customer count, absent from the customers and from the
|
|
23
|
+
* journal of transactions, and unable to sign in.
|
|
24
|
+
*
|
|
25
|
+
* `bot.list` and `bot.get` answer the identity of the bot and its modules, and nothing more — the details of
|
|
26
|
+
* the account behind it (contact details, identity file, settings) are read through `client.customer`.
|
|
27
|
+
*/
|
|
28
|
+
export interface Bot {
|
|
29
|
+
uuid: string;
|
|
30
|
+
createdAt: number;
|
|
31
|
+
state: BotState;
|
|
32
|
+
/** `false` once the bot is closed */
|
|
33
|
+
isAvailable: boolean;
|
|
34
|
+
/** `bot_<id>@<uuid of the organization>` — rewritten when the bot is closed */
|
|
35
|
+
login: string;
|
|
36
|
+
/** The modules this bot serves, empty when it serves none */
|
|
37
|
+
applications: BotApplication[];
|
|
38
|
+
}
|
|
39
|
+
export interface BotListParams {
|
|
40
|
+
offset?: number;
|
|
41
|
+
limit?: number;
|
|
42
|
+
/** Also returns the closed bots — default `false` */
|
|
43
|
+
includeClosed?: boolean;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=bot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bot.d.ts","sourceRoot":"","sources":["../../../src/types/bot.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,QAAQ,EAAE,mBAAmB,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AACvG,OAAO,KAAK,EAAE,QAAQ,EAAE,mBAAmB,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAEvG,2FAA2F;AAC3F,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,cAAc,CAAA;IACrB,0CAA0C;IAC1C,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC9B;AAED,sGAAsG;AACtG,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAA;IACZ,oDAAoD;IACpD,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,mBAAmB,CAAA;IAC1B,SAAS,EAAE,YAAY,CAAA;CACxB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,GAAG;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,QAAQ,CAAA;IACf,qCAAqC;IACrC,WAAW,EAAE,OAAO,CAAA;IACpB,+EAA+E;IAC/E,KAAK,EAAE,MAAM,CAAA;IACb,6DAA6D;IAC7D,YAAY,EAAE,cAAc,EAAE,CAAA;CAC/B;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,qDAAqD;IACrD,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bot.js","sourceRoot":"","sources":["../../../src/types/bot.ts"],"names":[],"mappings":""}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { Env } from '../constants.js';
|
|
2
2
|
import type { Asset as AssetModel } from './asset.js';
|
|
3
|
+
import type { Bot, BotApplication } from './bot.js';
|
|
4
|
+
import type { Strategy } from './autotrading.js';
|
|
3
5
|
import type { Account, Customer } from './customer.js';
|
|
4
6
|
import type { OrderUser } from './trading.js';
|
|
5
7
|
/** `'production' | 'sandbox' | 'staging' | 'localhost'` — the values of `Env` */
|
|
@@ -14,7 +16,7 @@ export interface BitgenConfig {
|
|
|
14
16
|
/** Request timeout in seconds — default 30, `0` = no timeout. Expiry → `BitgenError { status: 0, code: 'request_timeout' }` */
|
|
15
17
|
timeout?: number;
|
|
16
18
|
}
|
|
17
|
-
/** `{ uuid }` — what a creation answers (`customer.create`, `bank.credit`, `staking.stake`, `webhooks.subscribe`); carries a customer's uuid where it is one */
|
|
19
|
+
/** `{ uuid }` — what a creation answers (`customer.create`, `bank.credit`, `staking.stake`, `webhooks.subscribe`, `bot.create`, `autotrading.create`); carries a customer's uuid where it is one */
|
|
18
20
|
export interface Created {
|
|
19
21
|
uuid: string;
|
|
20
22
|
}
|
|
@@ -27,7 +29,7 @@ export interface AssetRef {
|
|
|
27
29
|
/** An asset as accepted by every method expecting one: its uuid or ISO code (`Asset.ETH`), or an `Asset` / `AssetRef` returned by the SDK — its uuid is then sent */
|
|
28
30
|
export type AssetInput = string | AssetModel | AssetRef;
|
|
29
31
|
/**
|
|
30
|
-
* A user as a transaction
|
|
32
|
+
* A user as a transaction, a staking movement or a strategy references them — `{ uuid, state, login, account: { firstname, lastname, fin } }`:
|
|
31
33
|
* the customer (`owner`) or the compliance officer in charge (`assignee`). An `owner` carries the customer's uuid.
|
|
32
34
|
*/
|
|
33
35
|
export interface UserSummary {
|
|
@@ -46,7 +48,7 @@ export interface OrganizationHub {
|
|
|
46
48
|
uuid: string;
|
|
47
49
|
name: string;
|
|
48
50
|
}
|
|
49
|
-
/** An organization as a transaction
|
|
51
|
+
/** An organization as a transaction, a staking movement or a strategy references it — `hub` is only given on a transaction */
|
|
50
52
|
export interface OrganizationSummary {
|
|
51
53
|
uuid: string;
|
|
52
54
|
state: string;
|
|
@@ -59,6 +61,12 @@ export interface OrganizationSummary {
|
|
|
59
61
|
* the `user` of an `Order`, the `owner` of a `Transaction` or of a `StakingMovement`. The SDK sends the uuid.
|
|
60
62
|
*/
|
|
61
63
|
export type UserRef = string | Created | Customer | Account | UserSummary | OrderUser;
|
|
64
|
+
/** A bot as accepted by every method expecting one: its uuid, or one of the models that carry it — the `Created` of `bot.create`, or a `Bot` */
|
|
65
|
+
export type BotRef = string | Created | Bot;
|
|
66
|
+
/** A module as accepted by every method expecting one: its uuid, or a `BotApplication` returned by the SDK */
|
|
67
|
+
export type BotModuleRef = string | BotApplication;
|
|
68
|
+
/** A strategy as accepted by every method expecting one: its uuid, or one of the models that carry it — the `Created` of `autotrading.create`, or a `Strategy` */
|
|
69
|
+
export type StrategyRef = string | Created | Strategy;
|
|
62
70
|
/** An amount as accepted by the SDK — always sent to the API as a string; prefer strings, a `number` only keeps ~15 significant digits */
|
|
63
71
|
export type Amount = string | number;
|
|
64
72
|
/** Pagination query — `limit` default 10, max 50 (100 on `/transaction`) */
|
|
@@ -94,4 +102,6 @@ export type { CoreType, CoreState, CoreConfigField, Core, CoreListParams, } from
|
|
|
94
102
|
export type { StakingMovementState, StakingMovementKind, StakingPositionState, CoreRef, StakingPosition, StakingMovement, StakingOperation, StakingPortfolio, StakeParams, StakingListParams, StakingAmountParams, } from './staking.js';
|
|
95
103
|
export type { WebhookEventName, SubscriberState, WebhookType, Subscriber, WebhookSubscriptions, DeliveryLog, WebhookEvent, VerifyInput, } from './webhooks.js';
|
|
96
104
|
export type { ApikeyState, Apikey, ApikeyLog, ApikeyListParams, } from './apikeys.js';
|
|
105
|
+
export type { BotState, BotApplicationState, ExtensionState, ExtensionCategory, BotExtension, BotApplication, Bot, BotListParams, } from './bot.js';
|
|
106
|
+
export type { StrategyState, StrategyRisk, StrategyFrequency, StrategyAllocation, StrategyClosing, StrategyNotifyMode, StrategyJournalEvent, StrategyExitReason, StrategyIdleReason, StrategyGuards, Strategy, StrategyInput, StrategyListParams, StrategyRatios, StrategyHistory, StrategyJournalEntry, AutotradingPortfolio, } from './autotrading.js';
|
|
97
107
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAA;AAC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AkB,EAClB,cAAc,EACd,eAAe,EACf,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,kBAAkB,CAAA"}
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "1.0
|
|
1
|
+
export declare const VERSION = "1.1.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/cjs/version.js
CHANGED
package/dist/esm/client.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { HttpClient } from './http.js';
|
|
2
2
|
import { ApikeysResource } from './resources/apikeys.js';
|
|
3
3
|
import { AssetResource } from './resources/asset.js';
|
|
4
|
+
import { AutotradingResource } from './resources/autotrading.js';
|
|
4
5
|
import { BankResource } from './resources/bank.js';
|
|
6
|
+
import { BotResource } from './resources/bot.js';
|
|
5
7
|
import { CoreResource } from './resources/core.js';
|
|
6
8
|
import { CustodyResource } from './resources/custody.js';
|
|
7
9
|
import { CustomerResource } from './resources/customer.js';
|
|
@@ -26,6 +28,8 @@ export declare class BitgenClient {
|
|
|
26
28
|
readonly staking: StakingResource;
|
|
27
29
|
readonly webhooks: WebhooksResource;
|
|
28
30
|
readonly apikeys: ApikeysResource;
|
|
31
|
+
readonly bot: BotResource;
|
|
32
|
+
readonly autotrading: AutotradingResource;
|
|
29
33
|
constructor(config: BitgenConfig);
|
|
30
34
|
}
|
|
31
35
|
//# sourceMappingURL=client.d.ts.map
|
package/dist/esm/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAA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
|
import { HttpClient } from './http.js';
|
|
2
2
|
import { ApikeysResource } from './resources/apikeys.js';
|
|
3
3
|
import { AssetResource } from './resources/asset.js';
|
|
4
|
+
import { AutotradingResource } from './resources/autotrading.js';
|
|
4
5
|
import { BankResource } from './resources/bank.js';
|
|
6
|
+
import { BotResource } from './resources/bot.js';
|
|
5
7
|
import { CoreResource } from './resources/core.js';
|
|
6
8
|
import { CustodyResource } from './resources/custody.js';
|
|
7
9
|
import { CustomerResource } from './resources/customer.js';
|
|
@@ -25,6 +27,8 @@ export class BitgenClient {
|
|
|
25
27
|
staking;
|
|
26
28
|
webhooks;
|
|
27
29
|
apikeys;
|
|
30
|
+
bot;
|
|
31
|
+
autotrading;
|
|
28
32
|
constructor(config) {
|
|
29
33
|
this.http = new HttpClient(config);
|
|
30
34
|
this.asset = new AssetResource(this.http);
|
|
@@ -37,6 +41,8 @@ export class BitgenClient {
|
|
|
37
41
|
this.staking = new StakingResource(this.http, this.core);
|
|
38
42
|
this.webhooks = new WebhooksResource(this.http);
|
|
39
43
|
this.apikeys = new ApikeysResource(this.http);
|
|
44
|
+
this.bot = new BotResource(this.http);
|
|
45
|
+
this.autotrading = new AutotradingResource(this.http);
|
|
40
46
|
}
|
|
41
47
|
}
|
|
42
48
|
//# sourceMappingURL=client.js.map
|