@bizjaya/finclient 0.2.0 → 0.2.2
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 +10 -4
- package/dist/index.cjs +7 -5
- package/dist/index.d.cts +726 -697
- package/dist/index.d.ts +726 -697
- package/dist/index.js +7 -5
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# @bizjaya/finclient
|
|
2
2
|
|
|
3
|
-
The official TypeScript SDK for FinCopy's public API, `https://api.fincopy.
|
|
4
|
-
paths under `/v1/fxs
|
|
3
|
+
The official TypeScript SDK for FinCopy's public API, `https://api.fincopy.io`. Since version 0.2.0 it uses numeric ACNO
|
|
4
|
+
account paths under `/v1/fxs`, which changed the 0.1 API; see the changelog before upgrading.
|
|
5
5
|
|
|
6
6
|
```sh
|
|
7
7
|
npm install @bizjaya/finclient
|
|
@@ -18,7 +18,7 @@ for (const account of accounts.items) console.log(account.Fleet?.Account?.ACNO,
|
|
|
18
18
|
// await fin.copy.orders.make(52014125, { SYM: "EURUSD", ACT: "NEW", OTY: "OP_BUY", LOT: 0.01 });
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
The client defaults to `https://api.fincopy.
|
|
21
|
+
The client defaults to `https://api.fincopy.io`. Account-scoped methods take the numeric ACNO, and paged list methods
|
|
22
22
|
return `{ items, paging, ... }`. DTO fields keep the API's PascalCase names.
|
|
23
23
|
|
|
24
24
|
- `copy.accounts`: settings and lifecycle, pairs, symbols, quotes, orders, history, DCA, performance, activity, strategy
|
|
@@ -43,7 +43,13 @@ const account = await fin.copy.accounts.get(52014125);
|
|
|
43
43
|
```
|
|
44
44
|
|
|
45
45
|
The API accepts browser requests only from FinCopy's own sites. Session trade writes pass the member's trade-PIN gate on
|
|
46
|
-
the server. The main entry uses no Node.js built-ins, so it runs in browsers, Node.js
|
|
46
|
+
the server. The main entry uses no Node.js built-ins, so it runs in browsers, Node.js 20+, Deno and Bun.
|
|
47
|
+
|
|
48
|
+
`copy.accounts.remove(acno, { TrPin }, options)` disconnects the hosted terminal, forgets its broker password and frees its seat.
|
|
49
|
+
Customer account settings and trade history remain so the login can be restored later; a free demo's account and terminal records
|
|
50
|
+
are deleted. Open orders stay at the broker, and virtual TP, SL and TS stop working while no terminal runs. Include the member's
|
|
51
|
+
trading PIN for a session account when its PIN is enabled; API-key requests do not use a session PIN. Pass an `idempotencyKey`
|
|
52
|
+
in `options` so retries receive the same operation.
|
|
47
53
|
|
|
48
54
|
## Results, errors and the stream
|
|
49
55
|
|
package/dist/index.cjs
CHANGED
|
@@ -120,7 +120,7 @@ var FinHttpTransport = class {
|
|
|
120
120
|
constructor(options) {
|
|
121
121
|
this.apiKey = options.apiKey?.trim() ?? "";
|
|
122
122
|
if (!this.apiKey && !options.fetch) throw new TypeError("apiKey is required unless a custom fetch authenticates the member session.");
|
|
123
|
-
this.baseUrl = (options.baseUrl ?? "https://api.fincopy.
|
|
123
|
+
this.baseUrl = (options.baseUrl ?? "https://api.fincopy.io").replace(/\/+$/, "");
|
|
124
124
|
const base = new URL(this.baseUrl);
|
|
125
125
|
if (!/^https?:$/.test(base.protocol) || base.search || base.hash) {
|
|
126
126
|
throw new TypeError("baseUrl must be an absolute HTTP or HTTPS URL without a query or fragment.");
|
|
@@ -527,9 +527,11 @@ var AccountsResource = class {
|
|
|
527
527
|
restart(acno, options = {}) {
|
|
528
528
|
return this.operation(acno, "restart", options);
|
|
529
529
|
}
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
530
|
+
remove(acno, commandOrOptions = {}, options = {}) {
|
|
531
|
+
const hasCommand = Object.prototype.hasOwnProperty.call(commandOrOptions, "TrPin");
|
|
532
|
+
const command = hasCommand ? commandOrOptions : { TrPin: null };
|
|
533
|
+
const requestOptions = hasCommand ? options : commandOrOptions;
|
|
534
|
+
return this.http.request("DELETE", accountPath(acno), command, requestOptions);
|
|
533
535
|
}
|
|
534
536
|
operation(acno, action, options) {
|
|
535
537
|
return this.http.request("POST", `${accountPath(acno)}/${action}`, void 0, options);
|
|
@@ -643,7 +645,7 @@ var FxResource = class {
|
|
|
643
645
|
}
|
|
644
646
|
/** Searches broker servers available when adding an account. */
|
|
645
647
|
brokers(query, platform, demosOnly, options = {}) {
|
|
646
|
-
return this.http.request("GET", queryPath("v1/brokers", void 0, {
|
|
648
|
+
return this.http.request("GET", queryPath("v1/brokers", void 0, { query, Platform: platform, DemosOnly: demosOnly }), void 0, options);
|
|
647
649
|
}
|
|
648
650
|
};
|
|
649
651
|
var ChangesResource = class {
|