@riocrypto/common-server 1.0.521 → 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,11 +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 = yield exchange.fetchTradingFees();
101
- console.log("exchangeFee", exchangeFee);
100
+ const exchangeFee = exchange.id === "bitstamp" ? 0.002 : 0.002;
102
101
  return {
103
- price: ticker.vwap,
104
- amountCrypto: amount / ticker.vwap,
102
+ price: ticker.vwap * (1 + exchangeFee),
103
+ amountCrypto: amount / (ticker.vwap * (1 + exchangeFee)),
105
104
  amountFiat: amount,
106
105
  crypto,
107
106
  fiat,
@@ -165,10 +164,11 @@ class CCXTClient {
165
164
  let ticker = yield exchange.fetchTicker(`${crypto}/${fiat}`);
166
165
  if (!ticker.vwap)
167
166
  throw new Error("Unable to get ticker vwap");
167
+ const exchangeFee = exchange.id === "bitstamp" ? 0.002 : 0.002;
168
168
  return {
169
- price: ticker.vwap,
169
+ price: ticker.vwap * (1 - exchangeFee),
170
170
  amountCrypto: amount,
171
- amountFiat: amount * ticker.vwap,
171
+ amountFiat: amount * (ticker.vwap * (1 - exchangeFee)),
172
172
  crypto,
173
173
  fiat,
174
174
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common-server",
3
- "version": "1.0.521",
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",