@riocrypto/common-server 1.0.520 → 1.0.522

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.
@@ -97,9 +97,10 @@ class CCXTClient {
97
97
  let ticker = yield exchange.fetchTicker(`${crypto}/${fiat}`);
98
98
  if (!ticker.vwap)
99
99
  throw new Error("Unable to get ticker vwap");
100
+ const exchangeFee = exchange.id === "bitstamp" ? 0.002 : 0.002;
100
101
  return {
101
- price: ticker.vwap,
102
- amountCrypto: amount / ticker.vwap,
102
+ price: ticker.vwap * (1 + exchangeFee),
103
+ amountCrypto: amount / (ticker.vwap * (1 + exchangeFee)),
103
104
  amountFiat: amount,
104
105
  crypto,
105
106
  fiat,
@@ -163,10 +164,11 @@ class CCXTClient {
163
164
  let ticker = yield exchange.fetchTicker(`${crypto}/${fiat}`);
164
165
  if (!ticker.vwap)
165
166
  throw new Error("Unable to get ticker vwap");
167
+ const exchangeFee = exchange.id === "bitstamp" ? 0.002 : 0.002;
166
168
  return {
167
- price: ticker.vwap,
169
+ price: ticker.vwap * (1 - exchangeFee),
168
170
  amountCrypto: amount,
169
- amountFiat: amount * ticker.vwap,
171
+ amountFiat: amount * (ticker.vwap * (1 - exchangeFee)),
170
172
  crypto,
171
173
  fiat,
172
174
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common-server",
3
- "version": "1.0.520",
3
+ "version": "1.0.522",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -22,7 +22,7 @@
22
22
  },
23
23
  "dependencies": {
24
24
  "@aws-sdk/client-s3": "^3.297.0",
25
- "@riocrypto/common": "^1.0.527",
25
+ "@riocrypto/common": "^1.0.528",
26
26
  "@types/express": "^4.17.13",
27
27
  "axios": "^0.27.2",
28
28
  "ccxt": "^3.0.30",