ccxt-ir 4.19.0 → 4.20.1

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/js/ccxt.js CHANGED
@@ -38,7 +38,7 @@ import * as errors from './src/base/errors.js';
38
38
  import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, ManualInteractionNeeded, RestrictedLocation, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError } from './src/base/errors.js';
39
39
  //-----------------------------------------------------------------------------
40
40
  // this is updated by vss.js when building
41
- const version = '4.19.0';
41
+ const version = '4.20.1';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import abantether from './src/abantether.js';
@@ -126,6 +126,7 @@ import foxbit from './src/foxbit.js';
126
126
  import gate from './src/gate.js';
127
127
  import gateio from './src/gateio.js';
128
128
  import gemini from './src/gemini.js';
129
+ import gerami from './src/gerami.js';
129
130
  import goldika from './src/goldika.js';
130
131
  import goldis from './src/goldis.js';
131
132
  import hamrahgold from './src/hamrahgold.js';
@@ -372,6 +373,7 @@ const exchanges = {
372
373
  'gate': gate,
373
374
  'gateio': gateio,
374
375
  'gemini': gemini,
376
+ 'gerami': gerami,
375
377
  'goldika': goldika,
376
378
  'goldis': goldis,
377
379
  'hamrahgold': hamrahgold,
@@ -546,6 +548,6 @@ pro.exchanges = Object.keys(pro);
546
548
  pro['Exchange'] = Exchange; // now the same for rest and ts
547
549
  //-----------------------------------------------------------------------------
548
550
  const ccxt = Object.assign({ version, Exchange, Precise, 'exchanges': Object.keys(exchanges), 'pro': pro }, exchanges, functions, errors);
549
- export { version, Exchange, exchanges, pro, Precise, functions, errors, BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, ManualInteractionNeeded, RestrictedLocation, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError, abantether, afratether, alpaca, apex, arzinja, arzplus, asacoine, ascendex, asretether, baazar, bequant, bidarz, bigone, binance, binancecoinm, binanceus, binanceusdm, bingx, bit24, bit2c, bitbank, bitbarg, bitbns, bitfinex, bitflyer, bitget, bithumb, bitimen, bitir, bitmart, bitmex, bitopro, bitpin, bitrue, bitso, bitstamp, bitteam, bittrade, bitunix, bitvavo, bitwana, blockchaincom, blofin, btcalpha, btcbox, btcmarkets, btcturk, bybit, bydfi, cafearz, cex, changefa, coinbase, coinbaseadvanced, coinbaseexchange, coinbaseinternational, coincatch, coincheck, coinex, coinmate, coinmetro, coinone, coinsph, coinspot, cryptocom, cryptomus, daric, defx, delta, deribit, derive, digifinex, digikalagold, ellipx, eterex, excoino, exir, exmo, exnovin, farhadexchange, fmfwio, foxbit, gate, gateio, gemini, goldika, goldis, hamrahgold, hamtapay, hashkey, hibachi, hitbtc, hitobit, hollaex, htx, huobi, hyperliquid, independentreserve, indodax, iranexchange, jibitex, kcex, kifpoolme, kraken, krakenfutures, kucoin, kucoinfutures, latoken, lbank, luno, mazdax, melligold, mercado, mexc, milligold, modetrade, myokx, ndax, nobitex, novadax, oceanex, okcoin, okexchange, okx, okxus, ompfinex, onetrading, ourbit, oxfun, p2b, paradex, paymium, phemex, pingi, poloniex, pooleno, probit, raastin, ramzinex, saraf, sarmayex, sarrafex, tabdeal, talaavan, talapp, talasea, technogold, tehran_exchange, tetherland, timex, tokocrypto, toobit, tradeogre, twox, ubitex, upbit, vertex, wallex, wallgold, wavesexchange, whitebit, woo, woofipro, xt, yobit, zaif, zarafza, zarminex, zarniv, zarpin, zonda, };
551
+ export { version, Exchange, exchanges, pro, Precise, functions, errors, BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, ManualInteractionNeeded, RestrictedLocation, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError, abantether, afratether, alpaca, apex, arzinja, arzplus, asacoine, ascendex, asretether, baazar, bequant, bidarz, bigone, binance, binancecoinm, binanceus, binanceusdm, bingx, bit24, bit2c, bitbank, bitbarg, bitbns, bitfinex, bitflyer, bitget, bithumb, bitimen, bitir, bitmart, bitmex, bitopro, bitpin, bitrue, bitso, bitstamp, bitteam, bittrade, bitunix, bitvavo, bitwana, blockchaincom, blofin, btcalpha, btcbox, btcmarkets, btcturk, bybit, bydfi, cafearz, cex, changefa, coinbase, coinbaseadvanced, coinbaseexchange, coinbaseinternational, coincatch, coincheck, coinex, coinmate, coinmetro, coinone, coinsph, coinspot, cryptocom, cryptomus, daric, defx, delta, deribit, derive, digifinex, digikalagold, ellipx, eterex, excoino, exir, exmo, exnovin, farhadexchange, fmfwio, foxbit, gate, gateio, gemini, gerami, goldika, goldis, hamrahgold, hamtapay, hashkey, hibachi, hitbtc, hitobit, hollaex, htx, huobi, hyperliquid, independentreserve, indodax, iranexchange, jibitex, kcex, kifpoolme, kraken, krakenfutures, kucoin, kucoinfutures, latoken, lbank, luno, mazdax, melligold, mercado, mexc, milligold, modetrade, myokx, ndax, nobitex, novadax, oceanex, okcoin, okexchange, okx, okxus, ompfinex, onetrading, ourbit, oxfun, p2b, paradex, paymium, phemex, pingi, poloniex, pooleno, probit, raastin, ramzinex, saraf, sarmayex, sarrafex, tabdeal, talaavan, talapp, talasea, technogold, tehran_exchange, tetherland, timex, tokocrypto, toobit, tradeogre, twox, ubitex, upbit, vertex, wallex, wallgold, wavesexchange, whitebit, woo, woofipro, xt, yobit, zaif, zarafza, zarminex, zarniv, zarpin, zonda, };
550
552
  export default ccxt;
551
553
  //-----------------------------------------------------------------------------
@@ -0,0 +1,8 @@
1
+ import { implicitReturnType } from '../base/types.js';
2
+ import { Exchange as _Exchange } from '../base/Exchange.js';
3
+ interface Exchange {
4
+ publicGetPairsPair(params?: {}): Promise<implicitReturnType>;
5
+ }
6
+ declare abstract class Exchange extends _Exchange {
7
+ }
8
+ export default Exchange;
@@ -0,0 +1,11 @@
1
+ // ----------------------------------------------------------------------------
2
+
3
+ // PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
4
+ // https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
5
+ // EDIT THE CORRESPONDENT .ts FILE INSTEAD
6
+
7
+ // -------------------------------------------------------------------------------
8
+ import { Exchange as _Exchange } from '../base/Exchange.js';
9
+ class Exchange extends _Exchange {
10
+ }
11
+ export default Exchange;
package/js/src/baazar.js CHANGED
@@ -116,14 +116,18 @@ export default class baazar extends Exchange {
116
116
  }
117
117
  parseTicker(response, market = undefined) {
118
118
  const data = this.safeDict(response, 'data', {});
119
- let bid = this.safeNumber(data, 'sellPrice');
120
- let ask = this.safeNumber(data, 'buyPrice');
119
+ let bid = this.safeNumber(data, 'buyPrice');
120
+ let ask = this.safeNumber(data, 'sellPrice');
121
121
  if (bid !== undefined) {
122
122
  bid = bid / 10;
123
123
  }
124
124
  if (ask !== undefined) {
125
125
  ask = ask / 10;
126
126
  }
127
+ let last = bid;
128
+ if (ask !== undefined && (last === undefined || ask > last)) {
129
+ last = ask;
130
+ }
127
131
  return this.safeTicker({
128
132
  'symbol': market['symbol'],
129
133
  'timestamp': this.safeInteger(data, 'currentTime'),
@@ -136,8 +140,8 @@ export default class baazar extends Exchange {
136
140
  'askVolume': undefined,
137
141
  'vwap': undefined,
138
142
  'open': undefined,
139
- 'close': ask,
140
- 'last': ask,
143
+ 'close': last,
144
+ 'last': last,
141
145
  'previousClose': undefined,
142
146
  'change': undefined,
143
147
  'percentage': undefined,
package/js/src/daric.js CHANGED
@@ -145,20 +145,26 @@ export default class daric extends Exchange {
145
145
  markets = response;
146
146
  }
147
147
  const ticker = this.filterBy(markets, 'destinationCoinSymbol', market['baseId'])[0];
148
+ const bid = this.safeNumber(ticker, 'bestSell');
149
+ const ask = this.safeNumber(ticker, 'bestBuy');
150
+ let last = bid;
151
+ if (ask !== undefined && (last === undefined || ask > last)) {
152
+ last = ask;
153
+ }
148
154
  return this.safeTicker({
149
155
  'symbol': market['symbol'],
150
156
  'timestamp': undefined,
151
157
  'datetime': undefined,
152
158
  'high': this.safeNumber(ticker, 'highestRecentOrder'),
153
159
  'low': this.safeNumber(ticker, 'lowestRecentOrder'),
154
- 'bid': this.safeNumber(ticker, 'bestBuy'),
160
+ 'bid': bid,
155
161
  'bidVolume': undefined,
156
- 'ask': this.safeNumber(ticker, 'bestSell'),
162
+ 'ask': ask,
157
163
  'askVolume': undefined,
158
164
  'vwap': undefined,
159
165
  'open': undefined,
160
- 'close': this.safeNumber(ticker, 'lastOrderPrice'),
161
- 'last': this.safeNumber(ticker, 'lastOrderPrice'),
166
+ 'close': last,
167
+ 'last': last,
162
168
  'previousClose': undefined,
163
169
  'change': undefined,
164
170
  'percentage': this.safeNumber(ticker, 'change'),
@@ -0,0 +1,20 @@
1
+ import Exchange from './base/Exchange.js';
2
+ import { Market, Strings, Ticker, Tickers } from './base/types.js';
3
+ /**
4
+ * @class gerami
5
+ * @augments Exchange
6
+ */
7
+ export default class gerami extends Exchange {
8
+ describe(): any;
9
+ fetchMarkets(params?: {}): Promise<Market[]>;
10
+ parseMarket(response: any): Market;
11
+ fetchTicker(symbol: string, params?: {}): Promise<Ticker>;
12
+ fetchTickers(symbols?: Strings, params?: {}): Promise<Tickers>;
13
+ parseTicker(response: any, market?: Market): Ticker;
14
+ sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
15
+ url: string;
16
+ method: string;
17
+ body: any;
18
+ headers: any;
19
+ };
20
+ }
@@ -0,0 +1,182 @@
1
+ // ----------------------------------------------------------------------------
2
+
3
+ // PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
4
+ // https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
5
+ // EDIT THE CORRESPONDENT .ts FILE INSTEAD
6
+
7
+ // ---------------------------------------------------------------------------
8
+ import Exchange from './base/Exchange.js';
9
+ // ---------------------------------------------------------------------------
10
+ /**
11
+ * @class gerami
12
+ * @augments Exchange
13
+ */
14
+ export default class gerami extends Exchange {
15
+ describe() {
16
+ return this.deepExtend(super.describe(), {
17
+ 'id': 'gerami',
18
+ 'name': 'Gerami',
19
+ 'countries': ['IR'],
20
+ 'rateLimit': 1000,
21
+ 'certified': false,
22
+ 'pro': false,
23
+ 'has': {
24
+ 'CORS': undefined,
25
+ 'spot': false,
26
+ 'margin': false,
27
+ 'swap': false,
28
+ 'future': false,
29
+ 'option': false,
30
+ 'fetchMarkets': true,
31
+ 'fetchTicker': true,
32
+ 'fetchTickers': true,
33
+ 'otc': true,
34
+ },
35
+ 'options': {
36
+ 'defaultType': 'otc',
37
+ },
38
+ 'urls': {
39
+ 'api': {
40
+ 'public': 'https://api.gerami.com/api/v1',
41
+ },
42
+ 'www': 'https://gerami.com',
43
+ 'doc': 'https://api.gerami.com/api/v1/pairs/XAU750g_IRT',
44
+ },
45
+ 'api': {
46
+ 'public': {
47
+ 'get': {
48
+ 'pairs/{pair}': 1,
49
+ },
50
+ },
51
+ },
52
+ });
53
+ }
54
+ async fetchMarkets(params = {}) {
55
+ const marketIds = ['XAU750g_IRT', 'XAG999g_IRT', 'XCU9999g_IRT'];
56
+ const result = [];
57
+ for (let i = 0; i < marketIds.length; i++) {
58
+ const response = await this.publicGetPairsPair(this.extend({
59
+ 'pair': marketIds[i],
60
+ }, params));
61
+ result.push(this.parseMarket(response));
62
+ }
63
+ return result;
64
+ }
65
+ parseMarket(response) {
66
+ const data = this.safeDict(response, 'data', {});
67
+ const baseId = this.safeString(data, 'base_symbol');
68
+ const quoteId = this.safeString(data, 'quote_symbol');
69
+ let base = 'XAG-1G';
70
+ if (baseId === 'XAU750g') {
71
+ base = 'XAU18';
72
+ }
73
+ if (baseId === 'XCU9999g') {
74
+ base = 'XCU-1G';
75
+ }
76
+ return {
77
+ 'id': this.safeString(data, 'market'),
78
+ 'symbol': base + '/' + quoteId,
79
+ 'base': base,
80
+ 'quote': quoteId,
81
+ 'settle': undefined,
82
+ 'baseId': baseId,
83
+ 'quoteId': quoteId,
84
+ 'settleId': undefined,
85
+ 'type': 'otc',
86
+ 'spot': false,
87
+ 'margin': false,
88
+ 'swap': false,
89
+ 'future': false,
90
+ 'option': false,
91
+ 'active': this.safeBool(data, 'buy_is_active') && this.safeBool(data, 'sell_is_active'),
92
+ 'contract': false,
93
+ 'linear': undefined,
94
+ 'inverse': undefined,
95
+ 'contractSize': undefined,
96
+ 'expiry': undefined,
97
+ 'expiryDatetime': undefined,
98
+ 'strike': undefined,
99
+ 'optionType': undefined,
100
+ 'precision': {
101
+ 'amount': this.safeNumber(data, 'amount_precision'),
102
+ 'price': this.safeNumber(data, 'price_precision'),
103
+ },
104
+ 'limits': {
105
+ 'leverage': { 'min': undefined, 'max': undefined },
106
+ 'amount': {
107
+ 'min': this.safeNumber(data, 'buy_min_amount'),
108
+ 'max': this.safeNumber(data, 'buy_max_amount'),
109
+ },
110
+ 'price': { 'min': undefined, 'max': undefined },
111
+ 'cost': { 'min': undefined, 'max': undefined },
112
+ },
113
+ 'created': undefined,
114
+ 'info': data,
115
+ };
116
+ }
117
+ async fetchTicker(symbol, params = {}) {
118
+ await this.loadMarkets();
119
+ const market = this.market(symbol);
120
+ const response = await this.publicGetPairsPair(this.extend({
121
+ 'pair': market['id'],
122
+ }, params));
123
+ return this.parseTicker(response, market);
124
+ }
125
+ async fetchTickers(symbols = undefined, params = {}) {
126
+ await this.loadMarkets();
127
+ if (symbols !== undefined) {
128
+ symbols = this.marketSymbols(symbols);
129
+ }
130
+ const marketSymbols = ['XAU18/IRT', 'XAG-1G/IRT', 'XCU-1G/IRT'];
131
+ const result = {};
132
+ for (let i = 0; i < marketSymbols.length; i++) {
133
+ const market = this.market(marketSymbols[i]);
134
+ const response = await this.publicGetPairsPair(this.extend({
135
+ 'pair': market['id'],
136
+ }, params));
137
+ const ticker = this.parseTicker(response, market);
138
+ result[ticker['symbol']] = ticker;
139
+ }
140
+ return this.filterByArrayTickers(result, 'symbol', symbols);
141
+ }
142
+ parseTicker(response, market = undefined) {
143
+ const data = this.safeDict(response, 'data', {});
144
+ const bid = this.safeNumber(data, 'buy_price');
145
+ const ask = this.safeNumber(data, 'sell_price');
146
+ let last = bid;
147
+ if (ask !== undefined && (last === undefined || ask > last)) {
148
+ last = ask;
149
+ }
150
+ return this.safeTicker({
151
+ 'symbol': market['symbol'],
152
+ 'timestamp': undefined,
153
+ 'datetime': undefined,
154
+ 'high': undefined,
155
+ 'low': undefined,
156
+ 'bid': bid,
157
+ 'bidVolume': undefined,
158
+ 'ask': ask,
159
+ 'askVolume': undefined,
160
+ 'vwap': undefined,
161
+ 'open': undefined,
162
+ 'close': last,
163
+ 'last': last,
164
+ 'previousClose': undefined,
165
+ 'change': this.safeNumber(data, 'daily_price_change_amount'),
166
+ 'percentage': this.safeNumber(data, 'daily_price_change_percentage'),
167
+ 'average': undefined,
168
+ 'baseVolume': undefined,
169
+ 'quoteVolume': undefined,
170
+ 'info': data,
171
+ }, market);
172
+ }
173
+ sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
174
+ let url = this.urls['api'][api] + '/' + this.implodeParams(path, params);
175
+ const query = this.omit(params, this.extractParams(path));
176
+ if (Object.keys(query).length) {
177
+ url += '?' + this.urlencode(query);
178
+ }
179
+ headers = { 'Accept': 'application/json' };
180
+ return { 'url': url, 'method': method, 'body': body, 'headers': headers };
181
+ }
182
+ }
package/js/src/goldika.js CHANGED
@@ -127,6 +127,10 @@ export default class goldika extends Exchange {
127
127
  if (ask !== undefined) {
128
128
  ask = ask / 10;
129
129
  }
130
+ let last = bid;
131
+ if (ask !== undefined && (last === undefined || ask > last)) {
132
+ last = ask;
133
+ }
130
134
  return this.safeTicker({
131
135
  'symbol': market['symbol'],
132
136
  'timestamp': timestamp,
@@ -139,8 +143,8 @@ export default class goldika extends Exchange {
139
143
  'askVolume': undefined,
140
144
  'vwap': undefined,
141
145
  'open': undefined,
142
- 'close': ask,
143
- 'last': ask,
146
+ 'close': last,
147
+ 'last': last,
144
148
  'previousClose': undefined,
145
149
  'change': undefined,
146
150
  'percentage': this.safeNumber(data, 'daily_change_percent'),
@@ -123,8 +123,8 @@ export default class hamrahgold extends Exchange {
123
123
  const sell = this.safeDict(sellResponse, 'data', {});
124
124
  const changes = this.safeDict(sell, 'changes', {});
125
125
  const dailyChange = this.safeDict(changes, '1d', {});
126
- let bid = this.safeNumber(buy, 'current');
127
- let ask = this.safeNumber(sell, 'current');
126
+ let bid = this.safeNumber(sell, 'current');
127
+ let ask = this.safeNumber(buy, 'current');
128
128
  let previousClose = this.safeNumber(dailyChange, 'price');
129
129
  if (bid !== undefined) {
130
130
  bid = bid / 10;
@@ -135,6 +135,10 @@ export default class hamrahgold extends Exchange {
135
135
  if (previousClose !== undefined) {
136
136
  previousClose = previousClose / 10;
137
137
  }
138
+ let last = bid;
139
+ if (ask !== undefined && (last === undefined || ask > last)) {
140
+ last = ask;
141
+ }
138
142
  return this.safeTicker({
139
143
  'symbol': market['symbol'],
140
144
  'timestamp': undefined,
@@ -147,8 +151,8 @@ export default class hamrahgold extends Exchange {
147
151
  'askVolume': undefined,
148
152
  'vwap': undefined,
149
153
  'open': undefined,
150
- 'close': ask,
151
- 'last': ask,
154
+ 'close': last,
155
+ 'last': last,
152
156
  'previousClose': previousClose,
153
157
  'change': undefined,
154
158
  'percentage': this.safeNumber(dailyChange, 'percent'),
@@ -56,7 +56,7 @@ export default class melligold extends Exchange {
56
56
  });
57
57
  }
58
58
  async fetchMarkets(params = {}) {
59
- const symbols = ['XAU18', 'XAG'];
59
+ const symbols = ['XAU18', 'XAG', 'XCU'];
60
60
  const result = [];
61
61
  for (let i = 0; i < symbols.length; i++) {
62
62
  const response = await this.requestWithCookie(this.extend({
@@ -108,6 +108,9 @@ export default class melligold extends Exchange {
108
108
  if (base === 'XAG') {
109
109
  base = 'XAG-1G';
110
110
  }
111
+ if (base === 'XCU') {
112
+ base = 'XCU-1G';
113
+ }
111
114
  const quote = 'IRT';
112
115
  return {
113
116
  'id': base + quote,
@@ -165,7 +168,7 @@ export default class melligold extends Exchange {
165
168
  symbols = this.marketSymbols(symbols);
166
169
  }
167
170
  const result = {};
168
- const marketSymbols = ['XAU18/IRT', 'XAG-1G/IRT'];
171
+ const marketSymbols = ['XAU18/IRT', 'XAG-1G/IRT', 'XCU-1G/IRT'];
169
172
  for (let i = 0; i < marketSymbols.length; i++) {
170
173
  const market = this.market(marketSymbols[i]);
171
174
  const response = await this.requestWithCookie(this.extend({
@@ -181,6 +184,10 @@ export default class melligold extends Exchange {
181
184
  const data = this.safeDict(response, 'data', {});
182
185
  const buy = this.safeNumber(data, 'price_buy');
183
186
  const sell = this.safeNumber(data, 'price_sell');
187
+ let last = buy;
188
+ if (sell !== undefined && (last === undefined || sell > last)) {
189
+ last = sell;
190
+ }
184
191
  return this.safeTicker({
185
192
  'symbol': market['symbol'],
186
193
  'timestamp': this.safeTimestamp(data, 'timestamp'),
@@ -193,8 +200,8 @@ export default class melligold extends Exchange {
193
200
  'askVolume': undefined,
194
201
  'vwap': undefined,
195
202
  'open': undefined,
196
- 'close': buy,
197
- 'last': buy,
203
+ 'close': last,
204
+ 'last': last,
198
205
  'previousClose': undefined,
199
206
  'change': undefined,
200
207
  'percentage': undefined,
@@ -361,7 +361,6 @@ export default class ramzinex extends Exchange {
361
361
  let open = this.safeFloat(tickerinfo, 'open');
362
362
  let close = this.safeFloat(tickerinfo, 'close');
363
363
  const change = this.safeFloat(tickerinfo, 'change_percent');
364
- let last = this.safeFloat(ticker, 'buy');
365
364
  let quoteVolume = this.safeFloat(tickerinfo, 'quote_volume');
366
365
  const baseVolume = this.safeFloat(tickerinfo, 'base_volume');
367
366
  if (marketinfo['quote'] === 'IRT') {
@@ -371,9 +370,13 @@ export default class ramzinex extends Exchange {
371
370
  ask = ask ? ask / 10 : 0;
372
371
  open = open ? open / 10 : 0;
373
372
  close = close ? close / 10 : 0;
374
- last = last ? last / 10 : 0;
375
373
  quoteVolume = quoteVolume ? quoteVolume / 10 : 0;
376
374
  }
375
+ let last = bid;
376
+ if (ask !== undefined && (last === undefined || ask > last)) {
377
+ last = ask;
378
+ }
379
+ close = last;
377
380
  return this.safeTicker({
378
381
  'symbol': symbol,
379
382
  'timestamp': undefined,
package/js/src/talapp.js CHANGED
@@ -120,20 +120,26 @@ export default class talapp extends Exchange {
120
120
  if (fetchedAt !== undefined) {
121
121
  timestamp = this.parse8601(fetchedAt.replace(' ', 'T') + '+03:30');
122
122
  }
123
+ const bid = this.safeNumber(response, 'buy_gold');
124
+ const ask = this.safeNumber(response, 'sell_gold');
125
+ let last = bid;
126
+ if (ask !== undefined && (last === undefined || ask > last)) {
127
+ last = ask;
128
+ }
123
129
  return this.safeTicker({
124
130
  'symbol': market['symbol'],
125
131
  'timestamp': timestamp,
126
132
  'datetime': undefined,
127
133
  'high': undefined,
128
134
  'low': undefined,
129
- 'bid': this.safeNumber(response, 'buy_gold'),
135
+ 'bid': bid,
130
136
  'bidVolume': undefined,
131
- 'ask': this.safeNumber(response, 'sell_gold'),
137
+ 'ask': ask,
132
138
  'askVolume': undefined,
133
139
  'vwap': undefined,
134
140
  'open': undefined,
135
- 'close': this.safeNumber(response, 'sell_gold'),
136
- 'last': this.safeNumber(response, 'sell_gold'),
141
+ 'close': last,
142
+ 'last': last,
137
143
  'previousClose': undefined,
138
144
  'change': undefined,
139
145
  'percentage': this.safeNumber(response, 'sell_diff'),
@@ -117,20 +117,24 @@ export default class technogold extends Exchange {
117
117
  const prices = this.safeDict(response, 'results', {});
118
118
  const buy = this.safeNumber(prices, 'buy_price');
119
119
  const sell = this.safeNumber(prices, 'sell_price');
120
+ let last = buy;
121
+ if (sell !== undefined && (last === undefined || sell > last)) {
122
+ last = sell;
123
+ }
120
124
  return this.safeTicker({
121
125
  'symbol': market['symbol'],
122
126
  'timestamp': undefined,
123
127
  'datetime': undefined,
124
128
  'high': undefined,
125
129
  'low': undefined,
126
- 'bid': sell,
130
+ 'bid': buy,
127
131
  'bidVolume': undefined,
128
- 'ask': buy,
132
+ 'ask': sell,
129
133
  'askVolume': undefined,
130
134
  'vwap': undefined,
131
135
  'open': undefined,
132
- 'close': buy,
133
- 'last': buy,
136
+ 'close': last,
137
+ 'last': last,
134
138
  'previousClose': undefined,
135
139
  'change': undefined,
136
140
  'percentage': undefined,
@@ -126,6 +126,10 @@ export default class wallgold extends Exchange {
126
126
  const sellResult = this.safeDict(sellResponse, 'result', buyResult);
127
127
  const bid = this.safeNumber(buyResult, 'price');
128
128
  const ask = this.safeNumber(sellResult, 'price');
129
+ let last = bid;
130
+ if (ask !== undefined && (last === undefined || ask > last)) {
131
+ last = ask;
132
+ }
129
133
  const currentTime = this.safeString(buyResult, 'currentTime');
130
134
  const timestamp = currentTime ? this.parse8601(currentTime) : undefined;
131
135
  return this.safeTicker({
@@ -140,8 +144,8 @@ export default class wallgold extends Exchange {
140
144
  'askVolume': undefined,
141
145
  'vwap': undefined,
142
146
  'open': undefined,
143
- 'close': ask,
144
- 'last': ask,
147
+ 'close': last,
148
+ 'last': last,
145
149
  'previousClose': undefined,
146
150
  'change': undefined,
147
151
  'percentage': undefined,
package/js/src/zarafza.js CHANGED
@@ -121,8 +121,12 @@ export default class zarafza extends Exchange {
121
121
  const gold = this.safeDict(data, 'G18', {});
122
122
  const buy = this.safeDict(gold, 'buy', {});
123
123
  const sell = this.safeDict(gold, 'sell', {});
124
- const bid = this.safeNumber(buy, 'price');
125
- const ask = this.safeNumber(sell, 'price');
124
+ const bid = this.safeNumber(sell, 'price');
125
+ const ask = this.safeNumber(buy, 'price');
126
+ let last = bid;
127
+ if (ask !== undefined && (last === undefined || ask > last)) {
128
+ last = ask;
129
+ }
126
130
  return this.safeTicker({
127
131
  'symbol': market['symbol'],
128
132
  'timestamp': undefined,
@@ -135,8 +139,8 @@ export default class zarafza extends Exchange {
135
139
  'askVolume': undefined,
136
140
  'vwap': undefined,
137
141
  'open': undefined,
138
- 'close': ask,
139
- 'last': ask,
142
+ 'close': last,
143
+ 'last': last,
140
144
  'previousClose': undefined,
141
145
  'change': undefined,
142
146
  'percentage': this.safeNumber(sell, 'change'),
@@ -114,17 +114,17 @@ export default class zarminex extends Exchange {
114
114
  return this.filterByArrayTickers(result, 'symbol', symbols);
115
115
  }
116
116
  parseTicker(response, market = undefined) {
117
- let bid = this.safeNumber(response, 'sell');
118
- let ask = this.safeNumber(response, 'buy');
119
- let last = this.safeNumber(response, 'cached_price');
117
+ let bid = this.safeNumber(response, 'buy');
118
+ let ask = this.safeNumber(response, 'sell');
120
119
  if (bid !== undefined) {
121
120
  bid = bid / 10;
122
121
  }
123
122
  if (ask !== undefined) {
124
123
  ask = ask / 10;
125
124
  }
126
- if (last !== undefined) {
127
- last = last / 10;
125
+ let last = bid;
126
+ if (ask !== undefined && (last === undefined || ask > last)) {
127
+ last = ask;
128
128
  }
129
129
  return this.safeTicker({
130
130
  'symbol': market['symbol'],
package/js/src/zarniv.js CHANGED
@@ -139,9 +139,12 @@ export default class zarniv extends Exchange {
139
139
  if (serverTime !== undefined) {
140
140
  timestamp = this.parse8601(serverTime + '+03:30');
141
141
  }
142
- const bid = this.safeNumber(response, 'sell_price_per_gram');
143
- const ask = this.safeNumber(response, 'buy_price_per_gram');
144
- const last = this.safeNumber(response, 'base_price_per_gram');
142
+ const bid = this.safeNumber(response, 'buy_price_per_gram');
143
+ const ask = this.safeNumber(response, 'sell_price_per_gram');
144
+ let last = bid;
145
+ if (ask !== undefined && (last === undefined || ask > last)) {
146
+ last = ask;
147
+ }
145
148
  return this.safeTicker({
146
149
  'symbol': market['symbol'],
147
150
  'timestamp': timestamp,